using MyCode.Project.Domain.Config; using MyCode.Project.Domain.Dtos.Request.Act; using MyCode.Project.Domain.Message.Request.DouYin; using MyCode.Project.Domain.Message.Request.Report40; using MyCode.Project.Domain.Message.Request.User; using MyCode.Project.Domain.Message.Response.DouYin; using MyCode.Project.Domain.Message.Response.Message; using MyCode.Project.Domain.Message.Response.Report40; using MyCode.Project.Domain.Message.Response.User; using MyCode.Project.Domain.Message.Response.Wechat; using MyCode.Project.Infrastructure.Cache; using MyCode.Project.Infrastructure.Common; using MyCode.Project.Infrastructure.Constant; using MyCode.Project.Infrastructure.Exceptions; using MyCode.Project.Infrastructure.PayModels; using MyCode.Project.Infrastructure.WebPost; using MyCode.Project.OutSideService; using MyCode.Project.Services; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Senparc.Weixin.TenPay; using Senparc.Weixin.TenPay.V3; using System; using System.Collections.Generic; using System.Threading; using System.Web.Http; namespace MyCode.Project.WebApi.Controllers { /// /// 测试接口 /// public class TestController : BaseAPIController { #region private readonly IWorkProcessService _workProcessService; private readonly IMyCodeCacheService _myCodeCacheService; private readonly IDingDingService _dingDingService; private readonly IMiNiProService _miNiProService; private ISalesSheetPayService _salesSheetPayService; private IMemberService _memberService; private IRedisService _redisService; private ICourseTopicsService _courseTopicsService; private IMemberMiniService _memberMiniService; private IBillKeepingService _billKeepingService; private IUserService _userService; private IMemberServiceInvService _memberServiceInvService; private IHuLiHuShao40Service _huLiHuShao40Service; private ICouponMemberHistoryService _couponMemberHistoryService; private IActivityService _activityService; private ICouponActivityService _couponActivityService; private IMaterialWarehouseService _materialWarehouseService; private IRpShopUseAppletDataService _rpShopUseAppletDataService; private IDouYinService _douYinService; private IMemberRelationshipTaskService _memberRelationshipTaskService; private IReport2301Service _report2301Service; private IReport2303Service _report2303Service; //private ITempUrlLogService _targetSetService; private IWeChatPublicService _weChatPublicService; private IMemberComplimentaryAccountService _memberComplimentaryAccountService; private IWorkProcessAsyncService _workProcessAsyncService; public TestController(IWorkProcessService workProcessService, IMyCodeCacheService myCodeCacheService, IDingDingService dingDingService, IMiNiProService miNiProService, IBillKeepingService billKeepingService, IUserService userService, ISalesSheetPayService salesSheetPayService, IMemberServiceInvService memberServiceInvService, IMemberMiniService memberMiniService, IRedisService redisService, IHuLiHuShao40Service huLiHuShao40Service , ICouponMemberHistoryService couponMemberHistoryService , IActivityService activityService , ICouponActivityService couponActivityService , IMemberService memberService , ICourseTopicsService courseTopicsService , IMaterialWarehouseService materialWarehouseService , IWeChatPublicService weChatPublicService , IRpShopUseAppletDataService rpShopUseAppletDataService , IDouYinService douYinService , IMemberRelationshipTaskService memberRelationshipTaskService , IReport2301Service report2301Service , IReport2303Service report2303Service , IMemberComplimentaryAccountService memberComplimentaryAccountService , IWorkProcessAsyncService workProcessAsyncService //, ITempUrlLogService targetSetService ) { _workProcessAsyncService = workProcessAsyncService; _memberComplimentaryAccountService = memberComplimentaryAccountService; _report2303Service = report2303Service; _report2301Service = report2301Service; _memberRelationshipTaskService = memberRelationshipTaskService; _douYinService = douYinService; _rpShopUseAppletDataService = rpShopUseAppletDataService; _weChatPublicService = weChatPublicService; _materialWarehouseService = materialWarehouseService; _courseTopicsService = courseTopicsService; _memberService = memberService; _couponMemberHistoryService = couponMemberHistoryService; _huLiHuShao40Service = huLiHuShao40Service; _redisService = redisService; _memberMiniService = memberMiniService; _salesSheetPayService = salesSheetPayService; _workProcessService = workProcessService; _myCodeCacheService = myCodeCacheService; _dingDingService = dingDingService; _miNiProService = miNiProService; _billKeepingService = billKeepingService; _userService = userService; _memberServiceInvService = memberServiceInvService; _activityService = activityService; _couponActivityService = couponActivityService; //_targetSetService = targetSetService; } #endregion /// /// 订单发送短信 /// /// [HttpGet] public void SendSmsTask(string id) { _workProcessAsyncService.SendSmsTask(id); } //#region restBugDataList() ///// ///// 什么都不是 ///// ///// //[HttpGet] //public void restBugDataList() //{ // _memberComplimentaryAccountService.restBugDataList(); //} //#endregion #region RiShuJuTongBao(阿明要的每日数据通报) /// /// 阿明要的每日数据通报 /// /// [HttpGet] public void RiShuJuTongBao(DateTime days) { _memberComplimentaryAccountService.RiShuJuTongBao(days); } #endregion ///// ///// 刷业绩记录是否护肤类服务字段 ///// ///// ///// //[HttpGet] //[AllowAnonymous] //public void SetHuFu(DateTime begin, DateTime end) //{ // _billKeepingService.SetHuFu(begin, end); //} #region SetMemberComplimentaryAccountBook(设置会员赠送的金额相关业务) /// /// 设置会员赠送的金额相关业务 /// /// [HttpGet] [AllowAnonymous] public void SetMemberComplimentaryAccountBook(string json) { _memberComplimentaryAccountService.SetMemberComplimentaryAccountBook(json); } #endregion /// /// 清除指定加盟商的服务次数 /// /// /// 开卡店铺 [HttpGet] public void ClearServiceInv(Guid? customerId, Guid? shopId) { _memberServiceInvService.ClearServiceInv(customerId, shopId); } #region ClearIntegralByCustomerId(清零指定加盟商的积分) /// /// 清零指定加盟商的积分 /// /// /// 截止日期 /// 指定店铺 [HttpGet] public void ClearIntegralByCustomerId(Guid? customerId, DateTime? days = null, Guid? shopId = null) { _billKeepingService.ClearIntegralByCustomerId(customerId, days, shopId); } #endregion /// /// 清除指定加盟商的会员余额 /// /// [HttpGet] [AllowAnonymous] public void ClearMemberAccount(Guid? customerId, Guid? shopId = null) { _memberServiceInvService.ClearMemberAccount(customerId, shopId); } ///// ///// 插入初始化某个加盟商下店铺的服务流水 ///// //[HttpGet] //public void BatchChuShiHua( ) //{ // _memberRelationshipTaskService.BatchChuShiHua( ); //} #region ChangeCustomerIdForShop(店铺转加盟商) /// /// 店铺转加盟商 /// /// 新加盟商名字 /// 旧店铺编码 /// 新店铺编码 [HttpGet] public void ChangeCustomerIdForShop(string customerName, string oldShopCode, string newShopCode) { _memberRelationshipTaskService.ChangeCustomerIdForShop(customerName, oldShopCode, newShopCode); } #endregion /// /// 重新计算具体某个店铺某个月的诊断四表的数据 /// /// /// [HttpGet] public void Save2301ReportData(DateTime begin, Guid? zhiDingShopId) { if (zhiDingShopId.HasValue) _report2303Service.Save2301ReportData(begin, zhiDingShopId.Value); else _report2303Service.SaveAllShopReportData(begin); } /// /// 补记录计算一条订单的业绩 /// /// /// [HttpGet] public void BuLuMemberExpenses(DateTime begin, DateTime end, Guid? shopId) { _memberRelationshipTaskService.BuLuMemberExpenses(begin, end, shopId); } /// /// 计算订单复购还是首单 /// /// [HttpGet] [AllowAnonymous] public void TestShouDan(Guid sheetid) { _memberRelationshipTaskService.TestShouDan(sheetid); } ///// ///// 重新计算订单的商品分类业绩报表 ///// ///// ///// //[HttpGet] //public void ReSetPerformanceRecord(DateTime begin, DateTime end) //{ // _memberRelationshipTaskService.ReSetPerformanceRecord(begin, end); //} ///// ///// 修复错误的销售订单明细分摊单价 ///// //[HttpGet] //public void RepairBusSalesSheetsWrong() //{ // _memberRelationshipTaskService.RepairBusSalesSheetsWrong(); //} ///// ///// 修复错误的销售订单明细分摊单价2 ///// //[HttpGet] //public void RepairBusSalesSheetsWrong2() //{ // _memberRelationshipTaskService.RepairBusSalesSheetsWrong2(); //} ///// ///// 修复错误的预转销销售订单明细分摊单价 ///// //[HttpGet] //public void RepairBusSalesSheetsYuZhuanXiao() //{ // _memberRelationshipTaskService.RepairBusSalesSheetsYuZhuanXiao(); //} ///// ///// 修复合计数不对的业绩记录 ///// //[HttpGet] //public void RepairStaMemberExpensesRecord() //{ // _memberRelationshipTaskService.RepairStaMemberExpensesRecord(); //} ///// ///// 修复错误的预售订单明细分摊单价 ///// //[HttpGet] //public void RepairBusPresalesSheetsWrong() //{ // _memberRelationshipTaskService.RepairBusPresalesSheetsWrong(); //} ///// /////获取明明是现金订单,现金单价为与销售单价不等的销售单 ///// //[HttpGet] //public void GetBusSalesSheetsRevenuePriceCash() //{ // _memberRelationshipTaskService.GetBusSalesSheetsRevenuePriceCash(); //} //#region CalculateMemberAccount(把没有店铺ID的会员余额赋值ID) ///// ///// 把没有店铺ID的会员余额赋值ID ///// //[HttpGet] //[AllowAnonymous] //public void CalculateMemberAccount() //{ // _memberComplimentaryAccountService.CalculateMemberAccount(); //} //#endregion ///// ///// 恢复指定加盟商的被清零的会员积分 ///// ///// //[HttpGet] //[AllowAnonymous] //public void ResumeMemberIntegral(Guid? customerId, DateTime begin, DateTime end ) //{ // _billKeepingService.ResumeMemberIntegral(customerId, begin, end); //} //#region SaveReturnSheetTemp(临时的刷业绩计算结果的支付字段数值,修复BUG记录) ///// ///// 临时的刷业绩计算结果的支付字段数值,修复BUG记录 ///// ///// ///// //[HttpGet] //[AllowAnonymous] //public void SaveReturnSheetTemp(DateTime days, DateTime end) //{ // _billKeepingService.SaveReturnSheetTemp(days, end); //} //#endregion ///// ///// 恢复指定加盟商的被清零的服务次数 ///// ///// ///// ///// //[HttpGet] //[AllowAnonymous] //public void ResumeServiceInv(Guid? customerId, DateTime begin, DateTime end) //{ // _memberServiceInvService.ResumeServiceInv(customerId, begin, end); //} ///// ///// 恢复指定加盟商的被清零的会员余额 ///// ///// ///// ///// //[HttpGet] //[AllowAnonymous] //public void ResumeMemberAccount(Guid? customerId, DateTime begin, DateTime end) //{ // _memberServiceInvService.ResumeMemberAccount(customerId, begin, end); //} /// /// 每日存储会员的剩余服务次数的数据 /// /// [HttpGet] [AllowAnonymous] public void MemberServiceInvReportData(DateTime begin) { _report2301Service.MemberServiceInvReportData(begin); } ///// ///// 根据流水计算出截止某天某个加盟商的每个门店剩余服务次数 ///// ///// 截止时间 ///// 加盟商ID //[HttpGet] //[AllowAnonymous] //public void SaveCustmoerServiceInvDays( DateTime end, Guid? customerId) //{ // _report2303Service.SaveCustmoerServiceInvDays(customerId,end); //} ///// ///// 刷某天的剩余服务次数到数据库报表 ///// ///// 想刷2月2日就传2月2日 //[HttpGet] //[AllowAnonymous] //public void BatchSaveCustmoerServiceInvDays(DateTime days) //{ // _report2303Service.BatchSaveCustmoerServiceInvDays(days); //} /************************************************************************/ ///// ///// 批量刷服务剩余次数和流水的店铺ID ///// ///// ///// ///// //[HttpGet] //[AllowAnonymous] //public void BatchSetServerQtyShopId(DateTime? begin, DateTime? end, Guid? customerId) //{ // _memberRelationshipTaskService.BatchSetServerQtyShopId(begin, end, customerId); //} ///// ///// 刷预转销的订单业绩数据 ///// ///// ///// //[HttpGet] //[AllowAnonymous] //public void SetYuZhuanXiao(DateTime begin, DateTime end) //{ // _memberRelationshipTaskService.SetYuZhuanXiao(begin, end); //} /// /// 分析订单是首单还是复购或者都不是 /// /// /// [HttpGet] [AllowAnonymous] public void SetShouDanFuGou(DateTime begin, DateTime end) { _memberRelationshipTaskService.SetShouDanFuGou(begin, end); } ///// ///// 刷业绩记录是否老客活跃 ///// ///// ///// //[HttpGet] //[AllowAnonymous] //public void SetLaoKeHuoYue(DateTime begin, DateTime end) //{ // _memberRelationshipTaskService.SetLaoKeHuoYue(begin, end); //} //[HttpGet] //[AllowAnonymous] //public void ReadLog(string url, int days) //{ // _targetSetService.ReadLog(url, days); //} //[HttpGet] //[AllowAnonymous] //public string GetNewUrl(string url) //{ // return _douYinService.GetNewUrl(url, new Domain.Model.BusDouYinInfoLog()); //} ///// ///// 生成 client_token 该接口适用于抖音或头条授权 ///// ///// //[HttpGet] //[AllowAnonymous] //public string GetClientToken() //{ // return _douYinService.GetClientToken(); //} ///// ///// 验券准备--抖音团购券码的核销, 需要先调用本接口, 查询订单的券列表,选择要验的券,再调用验券接口,核销券码 ///// ///// 验券准备接口返回的加密抖音券码 ///// 返回核销券码结果数组的json字符串 //[HttpGet] //[AllowAnonymous] //public string Prepare(string encrypted_data) //{ // return _douYinService.Prepare(encrypted_data,new Domain.Model.BusDouYinInfoLog()); //} ///// ///// 券状态查询--用于查询抖音券状态。 ///// ///// ///// //[HttpGet] //[AllowAnonymous] //public DouYinChaXunResp ChaXun(string encrypted_code) //{ // return _douYinService.ChaXun(encrypted_code); //} ///// ///// 用于验券错误需要撤回验券等场景, 有时间限制,验券超过一个小时就不可再撤销。同时适用于抖音团购券码与三方券码 ///// ///// //[HttpGet] //[AllowAnonymous] //public string Cancel(string verify_id, string certificate_id) //{ // return _douYinService.Cancel(verify_id, certificate_id); //} ///// ///// 验券--用于核销券码,同时适用于抖音团购券码与三方券码 ///// ///// 一次验券的标识 (用于短时间内的幂等) ///// 验券准备接口返回的加密抖音券码 ///// 返回核销券码结果的json字符串 //[HttpPost] //[AllowAnonymous] //public string Verify(DouYinVerify act ) //{ // return _douYinService.Verify(act.verify_token, act.Encrypted_data, new Domain.Model.BusDouYinLog()); //} //[HttpPost] //[AllowAnonymous] //public string GetSign(string body) //{ // return _douYinService.GetSign(body); //} //[HttpPost] //[AllowAnonymous] //public void MemberWeChatPublicCallBack(string sEchoStr) //{ // _weChatPublicService.MemberWeChatPublicCallBack(sEchoStr); ////} //#region BacthGetShareCode(批量刷素材库的码的数据) ///// ///// 批量刷素材库的码的数据 ///// //[HttpGet] //public void BacthSuCaiGetShareCode() //{ // _materialWarehouseService.BacthGetShareCode(); //} //#endregion ///// ///// 测试埋点 ///// ///// //[HttpPost] //[AllowAnonymous] //public void MaiDian(RpShopUseAppletDataAct act) //{ // _rpShopUseAppletDataService.SelectSetData(act.ApiUrl, act.RequestDataStr, act.Token); //} //#region BacthGetShareCode(批量刷新课程码的数据) ///// ///// 批量刷新课程码的数据 ///// //[HttpGet] //public void BacthGetShareCode() //{ // _courseTopicsService.BacthGetShareCode(); //} //#endregion //#region BatchSetRegisteredUrl(刷新店员添加客户的小程序码) ///// ///// 刷新店员添加客户的小程序码 ///// //[HttpGet] //public void BatchSetRegisteredUrl() //{ // _memberService.BatchSetRegisteredUrl(); //} //#endregion ///// ///// 批量设置普通活动的高清码缓存 ///// //[HttpGet] //public void BatchSet1280MiniCode() //{ // _activityService.BatchSet1280MiniCode(); //} ///// ///// 批量设置优惠券活动的高清码 ///// //[HttpGet] //public void BatchSetCouponActity1280MiniCode() //{ // _couponActivityService.BatchSet1280MiniCode(); //} //#region BatchRemove(除了依然在开展的优惠券活动,把一年3个月前的优惠券) ///// ///// 除了依然在开展的优惠券活动,把一年3个月前的优惠券 ///// //[AllowAnonymous] //[HttpGet] //public void BatchRemove() //{ // _couponMemberHistoryService.BatchRemove(); //} //#endregion //#region SetMemberCode(重新初始化会员卡号) ///// ///// 重新初始化会员卡号 ///// ///// ///// //[AllowAnonymous] //[HttpGet] //public void SetMemberCode(string json) //{ // if(json== "4B1BD079-28A7-4B3F-AD36-A53E65699C3A") // _huLiHuShao40Service.SetMemberCode(); //} //#endregion //#region AutoSetReport(半夜自动生成月报年报) ///// ///// 半夜自动生成月报年报 ///// ///// 非1 ///// //[AllowAnonymous] //[HttpGet] //public void AutoSetReport(string json) //{ // _huLiHuShao40Service.AutoSetReport(json); //} //#endregion //#region GetClerkNianBao40(年度经营报告-店长端) ///// ///// 年度经营报告-店长端 ///// ///// 店铺ID ///// //[AllowAnonymous] //[HttpGet] //public NianDuBaoBiao40Resp GetClerkNianBao40(string json) //{ // return _huLiHuShao40Service.GetClerkNianBao40(json); //} //#endregion //#region GetClerkYueBao40(月度经营报告-店长端) ///// ///// 月度经营报告-店长端 ///// ///// 店铺ID ///// //[AllowAnonymous] //[HttpGet] //public NianDuBaoBiao40Resp GetClerkYueBao40(string json) //{ // return _huLiHuShao40Service.GetClerkYueBao40(json); //} //#endregion //#region GetCustomerNianBao40(年度经营报告-加盟商) ///// ///// 年度经营报告-加盟商 ///// ///// 店铺ID ///// //[AllowAnonymous] //[HttpGet] //public NianDuBaoBiao40Resp GetCustomerNianBao40(string json) //{ // return _huLiHuShao40Service.GetCustomerNianBao40(json); //} //#endregion //#region GetCustomerYueBao40(月度经营报告-加盟商) ///// ///// 月度经营报告-加盟商 ///// ///// 店铺ID ///// //[AllowAnonymous] //[HttpGet] //public NianDuBaoBiao40Resp GetCustomerYueBao40(string json) //{ // return _huLiHuShao40Service.GetCustomerYueBao40(json); //} //#endregion //[AllowAnonymous] //[HttpGet] //public byte GetTest() //{ // int i = 10; // byte j = (byte)i; // return j; //} //[AllowAnonymous] //[HttpGet] //public void TestSubMessage() //{ // var templateMessageData = new TemplateMessageData(); // templateMessageData["name1"] = new TemplateMessageDataValue("12312"); // templateMessageData["amount2"] = new TemplateMessageDataValue("9999元"); // templateMessageData["date4"] = new TemplateMessageDataValue("2019-12-26"); // templateMessageData["thing3"] = new TemplateMessageDataValue("邀请好友成功,共同进步"); // _miNiProService.SendSubscribeMessage("wx28f095ca78e27699", "b7fc7cc4e4cdcae60d9746002efce845", "oGpIC5R2AoE7Zb_CnXK_CFuJOTlU", "nVBGBTIUETgqKwZlKznnCt098p8KodbPo8HX_zESz_k", templateMessageData); //} //[AllowAnonymous] //[HttpGet] //public void SetTime() //{ // _myCodeCacheService.Set("TIMENOW", DateTime.Now); //} //[AllowAnonymous] //[HttpGet] //public void TestSendInfo() //{ // try // { // int i = 0; // int j = 10 / i; // } // catch (Exception ex) // { // _dingDingService.SendMsg(ex.Message.ToString() + ex.StackTrace); // } //} //[HttpGet] //[AllowAnonymous] //public string GetSysConfigConst() //{ // return SysConfigConst.CmpPayCallbackDomain; //} ///// ///// 测试方法 ///// ///// //[AllowAnonymous] //[HttpGet] //public DateTime GetTime() //{ // return DateTime.Now; //} ///// ///// 获取分享码缓存内容 ///// ///// ///// //[HttpGet] //[AllowAnonymous] //public object GetScene(string scene) //{ // var cash = _myCodeCacheService.Get(scene); // return cash; //} ///// ///// 定期执行判断是否保持会员等级 ///// ///// //[HttpGet] //[AllowAnonymous] //public decimal KeepLevel(Guid id) //{ // _userService.KeepLevel(id); // return _userService.GetConsumptionAmount(id); //} ///// ///// 临时的处理加盟商清零服务次数 ///// ///// //[HttpGet] //[AllowAnonymous] //public void tempImportService() //{ // _memberServiceInvService.tempImportService(); //} //#region ///// ///// 测试读写缓存的能力 ///// ///// //[HttpGet] //[AllowAnonymous] //public string TestRedis() //{ // string scene = "测试读写缓存的能力"; // int cash = 0; // DateTime begin = DateTime.Now; // for (int i = 0; i < 1000; i++) // { // //var dasd = _myCodeCacheService.Get(scene); // cash++; // //if (dasd == null) // //{ // //_myCodeCacheService.Set(scene, cash, new TimeSpan(1, 0, 0)); // //} // } // DateTime end = DateTime.Now; // return begin.ToString("HH:mm:ss:ffff") + "------" + end.ToString("HH:mm:ss:ffff") + " 结果:" + cash.ToString(); //} //#endregion //#region AppletOnlinePay(小程序微信在线支付) ///// ///// 小程序微信在线支付 ///// ///// //[HttpPost] //[AllowAnonymous] //public FuiouWechatPayParam AppletOnlinePay() //{ // H5WxPayOrderAct act = new H5WxPayOrderAct(); // return _salesSheetPayService.AppletOnlinePay(act); //} //#endregion //#region GetPaySign(得到小程序支付的参数) ///// ///// 得到小程序支付的参数 ///// ///// //[AllowAnonymous] //[HttpGet] //public WxPaySign GetPaySign() //{ // //oGpIC5R2AoE7Zb_CnXK_CFuJOTlU // string Openid = "oGpIC5UoPeXl96Rq6PG5Vwe7ObfM"; // var param = new WxPayParam() // { // AppId = "wx28f095ca78e27699", // MchId = "1556042761", // ServiceIpAddress = WebUtils.GetServerIp(), // Key = "zhmdzhmdzhmdzhmdzhmdzhmdzhmdzhmd", // TradeType = TradeType.JsApi, // Body = "智慧门店会员端", // Detail = "颜值+1", // OutTradeNo = DateTime.Now.ToString("yyyyMMddHHmmss"), // FeeType = "CNY", // NotifyUrl = "https://bfy-api.wxbinf.com/api/Pay/FuiouCallBack", // Openid = Openid, // TotalFee = 1.0m, // Attach = "测试数据" // }; // //LogHelper.Info("IP:"+ param.ServiceIpAddress); // var payReturn = Pay(param); // if (payReturn.ReturnCode != WxPayState.Success) { throw new BaseException($"生成preid失败,{JsonHelper.ToJson(payReturn)}"); } // return GetPaySign("wx28f095ca78e27699", "zhmdzhmdzhmdzhmdzhmdzhmdzhmdzhmd", payReturn.PrepayId); //} //#endregion //#region Pay(微信支付) ///// ///// 调用微信支付,生成预支付交易ID:prepay_id ///// ///// 微信支付参数 ///// //private WxPayReturn Pay(WxPayParam param) //{ // string nonceStr = TenPayV3Util.GetNoncestr(); // string notifyUrl = string.Format(param.Domain + param.NotifyUrl);//通知地址,接收微信支付异步通知回调地址 // int totalFee = (int)(param.TotalFee * 100); // TenPayV3Type tradeType = TenPayV3Type.JSAPI; // tradeType = TenPayV3Type.JSAPI; // //switch (param.TradeType) // //{ // // case TradeType.App: // // tradeType = TenPayV3Type.APP; // // break; // // case TradeType.JsApi: // // tradeType = TenPayV3Type.JSAPI; // // break; // // case TradeType.Native: // // tradeType = TenPayV3Type.NATIVE; // // break; // //} // DateTime timeStart = DateTime.Now; // DateTime timeExpire = DateTime.Now.AddHours(0.5); // //设置参数 // TenPayV3UnifiedorderRequestData requestData = new TenPayV3UnifiedorderRequestData( // param.AppId, // param.MchId, // param.Body, // param.OutTradeNo, // totalFee, // param.ServiceIpAddress, // notifyUrl, // tradeType, // param.Openid, // param.Key, // nonceStr, // param.DeviceInfo, // timeStart, // timeExpire, // param.Detail, // param.Attach, // param.FeeType); // var result = TenPayV3.Unifiedorder(requestData); // //LogHelper.Info(string.Format("生成预支付ID:{0}", JsonConvert.SerializeObject(result))); // if (!result.IsReturnCodeSuccess()) { throw new BaseException(result.return_msg); } // if (!result.IsResultCodeSuccess()) { throw new BaseException(result.err_code_des); } // WxPayReturn wxPayReturn = new WxPayReturn(); // wxPayReturn.ReturnCode = WxPayState.Success; // if (param.TradeType == TradeType.Native) // { // wxPayReturn.CodeUrl = result.code_url; // } // wxPayReturn.PrepayId = result.prepay_id; // wxPayReturn.DeviceInfo = result.device_info; // return wxPayReturn; //} //#endregion //#region GetPaySign(获取预支付交易ID签名) ///// ///// 获取预支付交易ID签名 ///// ///// 微信APPID ///// 微信支付——商家支付密匙 ///// 预支付ID ///// //private WxPaySign GetPaySign(string appId, string key, string prepayId) //{ // RequestHandler paysignReqHandler = new RequestHandler(null); // //设置支付参数 // string timestamp = TenPayV3Util.GetTimestamp(); // string nonceStr = TenPayV3Util.GetNoncestr(); // var wxPaySign = new WxPaySign() // { // NonceStr = nonceStr, // TimeStamp = timestamp, // Package = string.Format("prepay_id={0}", prepayId), // SignType = "MD5", // AppId = appId // }; // paysignReqHandler.SetParameter("appId", appId); // paysignReqHandler.SetParameter("timeStamp", wxPaySign.TimeStamp); // paysignReqHandler.SetParameter("nonceStr", wxPaySign.NonceStr); // paysignReqHandler.SetParameter("package", wxPaySign.Package); // paysignReqHandler.SetParameter("signType", wxPaySign.SignType); // string paySign = paysignReqHandler.CreateMd5Sign("key", key); // wxPaySign.PaySign = paySign; // return wxPaySign; //} //#endregion //#region TestMemberGetToken(测试根据小程序的code获得用户的token等信息,如果获取不到,则调到注册页面) ///// ///// 测试根据小程序的code获得用户的token等信息,如果获取不到,则调到注册页面 ///// ///// ///// //[AllowAnonymous] //[HttpPost] //public GetMemberTokenResp TestMemberGetToken(FirstGetTokenRequest request) //{ // return _memberMiniService.TestMemberGetToken(request); //} //#endregion [AllowAnonymous] [HttpGet] public MemberLoginInfo GetJwtstring(string token) { var obj = TokenHelper.GetString(token, SystemConfig.JwtKey, Const.LoginInfoKey); var loginInfo = ((JObject)obj).ToObject();// JsonHelper.ToObject(obj.ToString()); //var loginInfo = ((JObject)obj).ToObject(); return loginInfo; } //[AllowAnonymous] //[HttpGet] //public List GetAllKeys(string key) //{ // return _redisService.GetAllKeys(key); //} //[AllowAnonymous] //[HttpGet] //public void Listdsadas() //{ // _salesSheetPayService.Listdsadas(); //} [AllowAnonymous] [HttpGet] public void TestLog() { LogHelper.Debug(new { Url = "小程序URL",Token = "23232"}); LogHelper.Info("Info Testing"); LogHelper.Error("Info Error"); LogHelper.Debug("Info Debug"); } } }