| | |
| | | /*********************************************************************** |
| | | * Project: CoreCms |
| | | * ProjectName: 核心内容管理系统 |
| | | * Web: https://www.corecms.net |
| | | * Author: 大灰灰 |
| | | * Email: jianweie@163.com |
| | | * CreateTime: 2021/1/31 21:45:10 |
| | | * Project: baifenBinfa |
| | | * ProjectName: 百分兵法管理系统 |
| | | * Web: http://chuanyin.com |
| | | * Author: |
| | | * Email: |
| | | * CreateTime: 202403/02 |
| | | * Description: 暂无 |
| | | ***********************************************************************/ |
| | | |
| | |
| | | using CoreCms.Net.Caching.AutoMate.RedisCache; |
| | | using CoreCms.Net.Configuration; |
| | | using CoreCms.Net.IServices; |
| | | using CoreCms.Net.IServices.baifenbingfa; |
| | | using CoreCms.Net.Loging; |
| | | using CoreCms.Net.Model.Entities; |
| | | using CoreCms.Net.Model.Entities.Expression; |
| | |
| | | private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; |
| | | private readonly WeChatOptions _weChatOptions; |
| | | private readonly IRedisOperationRepository _redisOperationRepository; |
| | | private readonly IDistributorDeliveryServices _distributorDeliveryServices; |
| | | |
| | | /// <summary> |
| | | /// 构造函数 |
| | |
| | | , ICoreCmsSettingServices settingServices |
| | | , ICoreCmsServicesServices servicesServices |
| | | , IOptions<WeChatOptions> weChatOptions |
| | | , ICoreCmsUserServicesOrderServices userServicesOrderServices, ICoreCmsUserServicesTicketServices userServicesTicketServices, ICoreCmsStoreServices storeServices, ICoreCmsCouponServices couponServices, ICoreCmsOrderServices orderServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, IRedisOperationRepository redisOperationRepository) |
| | | , ICoreCmsUserServicesOrderServices userServicesOrderServices |
| | | , ICoreCmsUserServicesTicketServices userServicesTicketServices |
| | | , ICoreCmsStoreServices storeServices |
| | | , ICoreCmsCouponServices couponServices |
| | | , ICoreCmsOrderServices orderServices |
| | | , IWeChatApiHttpClientFactory weChatApiHttpClientFactory |
| | | , IRedisOperationRepository redisOperationRepository |
| | | , IDistributorDeliveryServices distributorDeliveryServices) |
| | | { |
| | | _user = user; |
| | | _userWeChatInfoServices = userWeChatInfoServices; |
| | |
| | | _weChatApiHttpClientFactory = weChatApiHttpClientFactory; |
| | | _redisOperationRepository = redisOperationRepository; |
| | | _weChatOptions = weChatOptions.Value; |
| | | _distributorDeliveryServices = distributorDeliveryServices; |
| | | |
| | | } |
| | | |
| | |
| | | return jm; |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 获取请求ID |
| | | /// </summary> |
| | | /// <param name="request"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public WebApiCallBack GeiIp([FromServices] IHttpContextAccessor request) |
| | | { |
| | | string clientIp = request.HttpContext.Connection.RemoteIpAddress.ToString(); |
| | | // 如果客户端通过代理访问,可能需要检查X-Forwarded-For头 |
| | | if (clientIp == "::1" || clientIp == "127.0.0.1") |
| | | { |
| | | clientIp = request.HttpContext.Request. Headers["X-Forwarded-For"].FirstOrDefault() |
| | | ?? request.HttpContext.Connection.RemoteIpAddress.ToString(); |
| | | } |
| | | return new WebApiCallBack |
| | | { |
| | | code = 0, |
| | | data = clientIp, |
| | | }; |
| | | |
| | | } |
| | | #region 微信核验数据并获取用户详细资料===================================================== |
| | | /// <summary> |
| | | /// 核验数据并获取用户详细资料 |
| | |
| | | { |
| | | user.sex = (int)GlobalEnumVars.UserSexTypes.未知; |
| | | } |
| | | //未处理订单数量 |
| | | var DeliveryCount = await _distributorDeliveryServices.GetNoAcceptedDeliveryCount(); |
| | | |
| | | var ShowDelivery = await _distributorDeliveryServices.GetShowDelivery(); |
| | | jm.data = new |
| | | { |
| | | user.id, |
| | |
| | | user.status, |
| | | user.parentId, |
| | | user.passWord, |
| | | user.IsBaifenPromotion, |
| | | gradeName = userGrade != null ? userGrade.title : "", |
| | | gradeKey= userGrade != null ? userGrade.valueKey:"", |
| | | userCouponCount, |
| | | orderCount, |
| | | footPrintCount, |
| | | collectionCount |
| | | collectionCount, |
| | | user.isplanorder, |
| | | DeliveryCount, |
| | | ShowDelivery |
| | | }; |
| | | return jm; |
| | | } |
| | |
| | | |
| | | #region 提现申请 |
| | | /// <summary> |
| | | /// 提现申请 |
| | | /// 提现申请 type 银行线下转账 = 0, 企业付款到零钱 = 1, 企商家转账到零钱 = 3 企业付款到银行卡 = 2, |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | |
| | | public async Task<WebApiCallBack> Cash([FromBody] FMIntId entity) |
| | | { |
| | | var money = entity.data.ObjectToDecimal(0); |
| | | var jm = await _userTocashServices.Tocash(_user.ID, money, entity.id); |
| | | var Paytype = entity.data.ObjectToDecimal(0); |
| | | var jm = await _userTocashServices.Tocash(_user.ID, money, entity.id,type: (GlobalEnumVars.UserTocashType)Paytype); |
| | | return jm; |
| | | } |
| | | |