public object deviceControl(Dictionary <string, object> dicParas) { string errMsg = string.Empty; string token = dicParas.ContainsKey("token") ? dicParas["token"].ToString() : string.Empty; string mcuid = dicParas.ContainsKey("mcuid") ? dicParas["mcuid"].ToString() : string.Empty; string icCardId = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty; string action = dicParas.ContainsKey("controlAction") ? dicParas["controlAction"].ToString() : string.Empty; string coins = dicParas.ContainsKey("coins") ? dicParas["coins"].ToString() : string.Empty; UDPClientItemBusiness.ClientItem item = XCCloudService.SocketService.UDP.ClientList.ClientListObj.Where <UDPClientItemBusiness.ClientItem>(p => p.gID.Equals(token)).FirstOrDefault <UDPClientItemBusiness.ClientItem>(); if (item == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "雷达token不存在")); } StoreBusiness storeBusiness = new StoreBusiness(); StoreCacheModel storeCacheModel = null; if (!storeBusiness.IsEffectiveStore(item.StoreID, ref storeCacheModel, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在")); } IMemberService memberService = BLLContainer.Resolve <IMemberService>(storeCacheModel.StoreDBName); var memberlist = memberService.GetModels(x => x.ICCardID.ToString() == icCardId).FirstOrDefault <t_member>(); if (memberlist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机号码无效")); } //判断设备状态是否为启用状态 XCCloudService.BLL.IBLL.XCGame.IDeviceService ids = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IDeviceService>(storeCacheModel.StoreDBName); var menlist = ids.GetModels(p => p.MCUID.Equals(mcuid, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.t_device>(); if (menlist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备不存在")); } if (menlist.state != "启用") { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备未启用")); } string sn = UDPSocketAnswerBusiness.GetSN(); string orderId = System.Guid.NewGuid().ToString("N"); DeviceControlRequestDataModel deviceControlModel = new DeviceControlRequestDataModel(item.StoreID, memberlist.Mobile, icCardId, item.Segment, mcuid, action, int.Parse(coins), sn, orderId, storeCacheModel.StorePassword, 0, ""); MPOrderBusiness.AddTCPAnswerOrder(orderId, memberlist.Mobile, int.Parse(coins), action, icCardId, item.StoreID); if (!DataFactory.SendDataToRadar(deviceControlModel, out errMsg)) { ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.F, "", Result_Code.T, errMsg); } var obj = new { orderId = orderId, sn = sn }; return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj)); }
/// <summary> /// 出币 /// </summary> /// <returns></returns> public static bool DeviceOutputCoin(XCGameManaDeviceStoreType deviceStoreType, DevieControlTypeEnum deviceControlType, string storeId, string mobile, int icCardId, string orderId, string segment, string mcuId, string storePassword, int foodId, int coins, string ruleId, out string errMsg) { errMsg = string.Empty; if (deviceStoreType == XCGameManaDeviceStoreType.Store || deviceStoreType == XCGameManaDeviceStoreType.Merch) { string action = ((int)(deviceControlType)).ToString(); string sn = UDPSocketAnswerBusiness.GetSN(); if (string.IsNullOrEmpty(orderId)) { orderId = System.Guid.NewGuid().ToString("N"); } DeviceControlRequestDataModel deviceControlModel = new DeviceControlRequestDataModel(storeId, mobile, icCardId.ToString(), segment, mcuId, action, coins, sn, orderId, storePassword, foodId, ruleId); MPOrderBusiness.AddTCPAnswerOrder(orderId, mobile, coins, action, "", storeId); IconOutLockBusiness.Add(mobile, coins); if (!DataFactory.SendDataToRadar(deviceControlModel, out errMsg)) { return(false); } else { return(true); } } else { errMsg = "门店类型不正确"; return(false); } }
public object coinPut() { string orderId = System.DateTime.Now.ToString("yyyyMMddHHmmss"); string storeId = "100027"; string mobile = "15618920033"; int icCardId = 10000002; string action = "6"; int coins = 5; string segment = "0001"; string mcuId = "20170518000023"; string sn = UDPSocketAnswerBusiness.GetSN(); string errMsg = string.Empty; DeviceControlRequestDataModel deviceControlModel = new DeviceControlRequestDataModel(storeId, mobile, icCardId.ToString(), segment, mcuId, action, coins, sn, orderId, "778852013146", 0, ""); MPOrderBusiness.AddTCPAnswerOrder(orderId, mobile, coins, action, "", storeId); IconOutLockBusiness.Add(mobile, coins); if (!DataFactory.SendDataToRadar(deviceControlModel, out errMsg)) { return(false); } else { return(true); } }
public WxPayData GetNotifyData() { LogHelper.SaveLog(TxtLogType.WeiXin, TxtLogContentType.Common, TxtLogFileType.Time, "GetNotifyData"); //接收从微信后台POST过来的数据 System.IO.Stream s = Request.InputStream; int count = 0; byte[] buffer = new byte[1024]; StringBuilder builder = new StringBuilder(); while ((count = s.Read(buffer, 0, 1024)) > 0) { builder.Append(Encoding.UTF8.GetString(buffer, 0, count)); } s.Flush(); s.Close(); s.Dispose(); //转换数据格式并验证签名 WxPayData data = new WxPayData(); try { data.FromXml(builder.ToString()); if (data.CheckSign()) { string result_code = data.GetValue("result_code").ToString(); if (result_code == "SUCCESS") { string out_trade_no = data.GetValue("out_trade_no").ToString(); string trade_no = data.GetValue("transaction_id").ToString(); if (MPOrderBusiness.UpdateOrderForPaySuccess(out_trade_no, trade_no)) { WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); LogHelper.SaveLog(TxtLogType.WeiXin, TxtLogContentType.Common, TxtLogFileType.Time, res.ToXml()); Response.Write(res.ToXml()); Response.End(); } LogHelper.SaveLog(TxtLogType.WeiXin, TxtLogContentType.Common, TxtLogFileType.Time, "Response.End()"); } } else { } } catch (WxPayException ex) { //若签名错误,则立即返回结果给微信支付后台 WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", ex.Message); Response.Write(res.ToXml()); Response.End(); } return(data); }
/// <summary> /// 对支付宝异步通知的关键参数进行校验 /// </summary> /// <returns></returns> private bool CheckParams(out Data_Order order) { //获得商户订单号out_trade_no string out_trade_no = Request.Form["out_trade_no"]; //判断通知数据中的out_trade_no是否为商户系统中创建的订单号 order = MPOrderBusiness.GetOrderModel(out_trade_no); if (order == null) { //PayLogHelper.WritePayLog("商户订单号校验失败"); return(false); } //获得支付总金额total_amount string total_amount = Request.Form["total_amount"]; // 判断total_amount是否确实为该订单的实际金额 if (order.Price.ToString("0.00") != total_amount) { //PayLogHelper.WritePayLog("支付金额校验失败"); return(false); } //获得卖家账号seller_id string seller_id = Request.Form["seller_id"].Trim(); // 验证通知中的seller_email(或者seller_id) 是否为out_trade_no这笔单据的对应的操作方(有的时候,一个商户可能有多个seller_id / seller_email) if (AliPayConfig.pid.Trim() != seller_id) { //PayLogHelper.WritePayLog("seller_id校验失败"); return(false); } //获得调用方的appid; //如果是非授权模式,appid是商户的appid;如果是授权模式(token调用),appid是系统商的appid string app_id = Request.Form["app_id"]; // 验证支付宝小程序app_id是否是调用方的appid if (AliPayConfig.miniAppId.Trim() != app_id) { //PayLogHelper.WritePayLog("app_id校验失败"); return(false); } //验证上述四个参数,完全吻合则返回参数校验成功 return(true); }
} //H5调起JS API参数 protected void Page_Load(object sender, EventArgs e) { MPOrderBusiness.UpdateOrderForPaySuccess("2017112323575210001000000009", "1234324"); if (!IsPostBack) { string openid = "oNWocwVUdOOajF2CpSmnyD8uN3Nw"; string total_fee = "5"; //检测是否给当前页面传递了相关参数 if (string.IsNullOrEmpty(openid) || string.IsNullOrEmpty(total_fee)) { Response.Write("<span style='color:#FF0000;font-size:20px'>" + "oNWocwVUdOOajF2CpSmnyD8uN3Nw" + "</span>"); Response.Write("<span style='color:#FF0000;font-size:20px'>" + "页面传参出错,请返回重试" + "</span>"); submit.Visible = false; return; } //若传递了相关参数,则调统一下单接口,获得后续相关接口的入口参数 JsApiPay jsApiPay = new JsApiPay(this); jsApiPay.openid = openid; jsApiPay.total_fee = int.Parse(total_fee); jsApiPay.body = "ceshi"; jsApiPay.out_trade_no = System.DateTime.Now.ToString("yyyyMMddHHmmss"); jsApiPay.device_info = "100010"; //JSAPI支付预处理 try { WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult(); wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 //在页面上显示订单信息 Response.Write("<span style='color:#00CD00;font-size:20px'>订单详情:</span><br/>"); Response.Write("<span style='color:#00CD00;font-size:20px'>" + unifiedOrderResult.ToPrintStr() + "</span>"); } catch (Exception ex) { Response.Write("<span style='color:#FF0000;font-size:20px'>" + "下单失败,请返回重试" + "</span>"); submit.Visible = false; } } }
public object saveCoins(Dictionary <string, object> dicParas) { try { string state = string.Empty; string stateName = string.Empty; string xcGameDBName = string.Empty; string errMsg = string.Empty; string storePassword = string.Empty; string terminalNo = dicParas.ContainsKey("deviceToken") ? dicParas["deviceToken"].ToString() : string.Empty; XCGameMemberTokenModel memberTokenModel = (XCGameMemberTokenModel)(dicParas[Constant.XCGameMemberTokenModel]); MobileTokenModel mobileTokenModel = (MobileTokenModel)(dicParas[Constant.MobileTokenModel]); //根据终端号查询终端号是否存在 XCCloudService.BLL.IBLL.XCGameManager.IDeviceService deviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGameManager.IDeviceService>(); var deviceModel = deviceService.GetModels(p => p.TerminalNo.Equals(terminalNo, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGameManager.t_device>(); if (deviceModel == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "终端号不存在")); } StoreBusiness store = new StoreBusiness(); if (!store.IsEffectiveStore(deviceModel.StoreId, out xcGameDBName, out storePassword, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } if (!deviceModel.StoreId.Equals(memberTokenModel.StoreId)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员令牌对应门店和设备不一致")); } //判断设备状态是否为启用状态 XCCloudService.BLL.IBLL.XCGame.IDeviceService ids = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IDeviceService>(xcGameDBName); var menlist = ids.GetModels(p => p.MCUID.Equals(deviceModel.DeviceId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.t_device>(); if (menlist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备不存在")); } if (menlist.state != "启用") { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备未启用")); } //验证缓存设备状态 if (DeviceStateBusiness.ExistDeviceState(deviceModel.StoreId, deviceModel.DeviceId)) { state = DeviceStateBusiness.GetDeviceState(deviceModel.StoreId, deviceModel.DeviceId); } if (state != "1") { stateName = DeviceStateBusiness.GetStateName(state); return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, stateName)); } //请求雷达处理存币 string action = ((int)(DevieControlTypeEnum.存币)).ToString(); string sn = UDPSocketAnswerBusiness.GetSN(); string orderId = System.Guid.NewGuid().ToString("N"); DeviceControlRequestDataModel deviceControlModel = new DeviceControlRequestDataModel(deviceModel.StoreId, mobileTokenModel.Mobile, memberTokenModel.ICCardId, menlist.segment, menlist.MCUID, action, 0, sn, orderId, storePassword, 0, ""); MPOrderBusiness.AddTCPAnswerOrder(orderId, mobileTokenModel.Mobile, 0, action, memberTokenModel.ICCardId, deviceModel.StoreId); IconOutLockBusiness.AddByNoTimeLimit(mobileTokenModel.Mobile); if (!DataFactory.SendDataToRadar(deviceControlModel, out errMsg)) { ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.F, "", Result_Code.T, errMsg); } //设置推送消息的缓存结构 string form_id = dicParas.ContainsKey("form_id") ? dicParas["form_id"].ToString() : string.Empty; SAppMessageMana.SetMemberCoinsMsgCacheData(SAppMessageType.MemberCoinsOperationNotify, orderId, form_id, mobileTokenModel.Mobile, null, out errMsg); return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "")); } catch (Exception e) { throw e; } }
public static string CreateXCGameOrderNo(string storeId, decimal price, decimal fee, int orderType, string productName, string mobile, string buyType, int coins) { string orderNo = MPOrderBusiness.GetOrderNo(storeId, price, fee, orderType, productName, mobile, buyType, coins); return(orderNo); }
public static void RadarNotify(string requestDataJson, UDPClientItemBusiness.ClientItem item) { object outModel = null; object requestModel = null; DataFactory.CreateResponseProtocolData(TransmiteEnum.雷达通知指令, requestDataJson, ref requestModel, ref outModel); RadarNotifyRequestModel rnrModel = Utils.DataContractJsonDeserializer <RadarNotifyRequestModel>(requestDataJson); RadarNotifyOutParamsModel responseOutModel = (RadarNotifyOutParamsModel)outModel; XCGameRadarDeviceTokenModel radarTokenModel = XCGameRadarDeviceTokenBusiness.GetRadarDeviceTokenModel(rnrModel.Token); Send(((IPEndPoint)item.remotePoint).Address.ToString(), ((IPEndPoint)item.remotePoint).Port, ((RadarNotifyOutParamsModel)outModel).ResponsePackages); RadarNotifyRequestModel requestDataModel = (RadarNotifyRequestModel)requestModel; //验证相应模式 bool bCoinSuccess = false; if (responseOutModel.ResponseModel.GetType().Name.Equals("ComonErrorResponseModel")) { ComonErrorResponseModel model = (ComonErrorResponseModel)(responseOutModel.ResponseModel); bCoinSuccess = model.Result_Code == "1" ? true : false; } else if (responseOutModel.ResponseModel.GetType().Name.Equals("ComonSuccessResponseModel")) { ComonSuccessResponseModel model = (ComonSuccessResponseModel)(responseOutModel.ResponseModel); bCoinSuccess = model.Result_Code == "1" ? true : false; } //记录日志 string logTxt = "[接收:" + requestDataJson + "]" + "[响应:" + responseOutModel.ResponseJson + "]" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); UDPLogHelper.SaveUDPRadarNotifyLog(requestDataModel.StoreId, requestDataModel.OrderId, requestDataModel.Token, requestDataModel.SN, int.Parse(requestDataModel.Coins), int.Parse(requestDataModel.Action), requestDataModel.Result, ((IPEndPoint)item.remotePoint).Address.ToString(), ((IPEndPoint)item.remotePoint).Port, requestDataJson, responseOutModel.ResponseJson, bCoinSuccess, logTxt); string message = "[接收:" + requestDataJson + "]" + "[响应:" + responseOutModel.ResponseJson + "]"; SignalrServerToClient.BroadcastMessage(Convert.ToInt32(TransmiteEnum.雷达通知指令), "雷达通知指令", requestDataModel.Token, message, System.DateTime.Now); if (rnrModel.Result == "成功" && bCoinSuccess) { //出币后向客户端发送成功信息 try { TCPAnswerOrderModel taoModel = null; //如果订单缓存信息存在 if (MPOrderBusiness.ExistTCPAnswerOrder(rnrModel.OrderId, ref taoModel)) { string coinType = CoinBusiess.GetCoinOpetionName(taoModel.Action); string notifyMsg = string.Empty; string answerMsgType = string.Empty; string errMsg = string.Empty; SAppPushMessageCacheModel msgModel = null; if (taoModel.Action == "1") { notifyMsg = "成功出币" + taoModel.Coins.ToString() + "个"; answerMsgType = ((int)(TCPAnswerMessageType.出币)).ToString(); if (SAppPushMessageBusiness.GetModel(rnrModel.OrderId, ref msgModel)) { if (msgModel.SAppMessageType == SAppMessageType.MemberCoinsOperationNotify) { MemberCoinsOperationNotifyDataModel dataModel = (MemberCoinsOperationNotifyDataModel)(msgModel.DataObj); SAppMessageMana.PushMemberCoinsMsg(msgModel.OpenId, msgModel.SAppAccessToken, "提币", dataModel.StoreName, dataModel.Mobile, dataModel.ICCardId, int.Parse(requestDataModel.Coins), dataModel.LastBalance, msgModel.FormId, "", out errMsg); } else if (msgModel.SAppMessageType == SAppMessageType.MemberFoodSaleNotify) { MemberFoodSaleNotifyDataModel dataModel = (MemberFoodSaleNotifyDataModel)(msgModel.DataObj); SAppMessageMana.PushMemberFoodSaleMsg(msgModel.OpenId, msgModel.SAppAccessToken, "购币", dataModel.StoreName, msgModel.Mobile, msgModel.OrderId, dataModel.FoodName, dataModel.FoodNum, dataModel.ICCardId, dataModel.Money, dataModel.Coins, msgModel.FormId, out errMsg); } } } else if (taoModel.Action == "2") { notifyMsg = "成功存币" + requestDataModel.Coins.ToString() + "个"; answerMsgType = ((int)(TCPAnswerMessageType.存币)).ToString(); IconOutLockBusiness.RemoveByNoTimeList(taoModel.Mobile); if (int.Parse(requestDataModel.Coins) > 0) { try { int lastBalance = 0; string storeName = string.Empty; string mobile = string.Empty; if (MemberPreservationBusiness.PreservationBusiness(int.Parse(taoModel.ICCardId), int.Parse(taoModel.StoreId), int.Parse(requestDataModel.Coins), out lastBalance, out storeName, out mobile)) { if (SAppPushMessageBusiness.GetModel(rnrModel.OrderId, ref msgModel)) { MemberCoinsOperationNotifyDataModel dataModel = (MemberCoinsOperationNotifyDataModel)(msgModel.DataObj); SAppMessageMana.PushMemberCoinsMsg(msgModel.OpenId, msgModel.SAppAccessToken, "存币", dataModel.StoreName, dataModel.Mobile, dataModel.ICCardId, int.Parse(requestDataModel.Coins), dataModel.LastBalance, msgModel.FormId, "", out errMsg); } } } catch (Exception e) { LogHelper.SaveLog(TxtLogType.Api, TxtLogContentType.Debug, TxtLogFileType.Day, "MemberPreservationBusiness.PreservationBusiness:" + e.Message); } } } else if (taoModel.Action == "6")//投币 { MemberCoinsOperationNotifyDataModel dataModel = (MemberCoinsOperationNotifyDataModel)(msgModel.DataObj); SAppMessageMana.PushMemberCoinsMsg(msgModel.OpenId, msgModel.SAppAccessToken, "投币", dataModel.StoreName, dataModel.Mobile, dataModel.ICCardId, int.Parse(requestDataModel.Coins), dataModel.LastBalance, msgModel.FormId, "", out errMsg); } else if (taoModel.Action == "7")//退币 { MemberCoinsOperationNotifyDataModel dataModel = (MemberCoinsOperationNotifyDataModel)(msgModel.DataObj); SAppMessageMana.PushMemberCoinsMsg(msgModel.OpenId, msgModel.SAppAccessToken, "退币", dataModel.StoreName, dataModel.Mobile, dataModel.ICCardId, int.Parse(requestDataModel.Coins), dataModel.LastBalance, msgModel.FormId, "", out errMsg); } var dataObj = new { result_code = "1", answerMsg = notifyMsg, answerMsgType = answerMsgType }; MPOrderBusiness.RemoveTCPAnswerOrder(rnrModel.OrderId); TCPServiceBusiness.Send(taoModel.Mobile, dataObj); } } catch (Exception ex) { LogHelper.SaveLog(TxtLogType.UPDService, TxtLogContentType.Exception, TxtLogFileType.Day, "Exception:" + rnrModel.OrderId + Utils.GetException(ex) + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); } } }
protected void Page_Load(object sender, EventArgs e) { SortedDictionary <string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { //PayLogHelper.WritePayLog(Request.Form.ToString()); //Notify aliNotify = new Notify(); Notify aliNotify = new Notify(AliPayConfig.charset, AliPayConfig.sign_type, AliPayConfig.pid, AliPayConfig.mapiUrl, AliPayConfig.alipay_miniapp_public_key); bool verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]); //商户订单号 string out_trade_no = Request.Form["out_trade_no"]; Data_Order order = null; if (verifyResult && CheckParams(out order))//验证成功 { /////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 //支付宝交易号 string trade_no = Request.Form["trade_no"]; //交易状态 //在支付宝的业务通知中,只有交易通知状态为TRADE_SUCCESS或TRADE_FINISHED时,才是买家付款成功。 string trade_status = Request.Form["trade_status"]; //交易状态 if (trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") { try { if (MPOrderBusiness.UpdateOrderForPaySuccess(out_trade_no, trade_no)) { LogHelper.SaveLog(TxtLogType.AliPay, TxtLogContentType.Debug, TxtLogFileType.Day, "应用:莘拍档 订单号:" + out_trade_no + " 支付成功!"); //支付宝买家用户id string buyer_id = Request.Form["buyer_id"]; //支付时间 string gmt_payment = HttpUtility.UrlDecode(Request.Form["gmt_payment"]); string aliId = string.Empty; string msg = string.Empty; if (!MobileTokenBusiness.GetAliId(order.Mobile, out aliId, out msg)) { bool ret = MobileTokenBusiness.UpdateAliBuyerId(order.Mobile, buyer_id); } IAopClient client = new DefaultAopClient(AliPayConfig.serverUrl, AliPayConfig.miniAppId, AliPayConfig.merchant_miniapp_private_key, "json", "1.0", "RSA2", AliPayConfig.alipay_miniapp_public_key, AliPayConfig.charset, false); AlipayOpenAppMiniTemplatemessageSendRequest request = new AlipayOpenAppMiniTemplatemessageSendRequest(); request.BizContent = "{" + "\"to_user_id\":\"" + buyer_id + "\"," + "\"form_id\":\"" + trade_no + "\"," + "\"user_template_id\":\"" + AliPayConfig.MiniAppTemplateId + "\"," + "\"page\":\"pages/login/login\"," + "\"data\":\"{\\\"keyword1\\\":{\\\"value\\\":\\\"" + out_trade_no + "\\\"},\\\"keyword2\\\":{\\\"value\\\":\\\"" + order.Descript + "\\\"},\\\"keyword3\\\":{\\\"value\\\":\\\"" + order.Price.ToString("0.00") + "\\\"},\\\"keyword4\\\":{\\\"value\\\":\\\"" + order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss") + "\\\"},\\\"keyword5\\\":{\\\"value\\\":\\\"" + gmt_payment + "\\\"}}\"" + "}"; AlipayOpenAppMiniTemplatemessageSendResponse response = client.Execute(request); } else { LogHelper.SaveLog(TxtLogType.AliPay, TxtLogContentType.Debug, TxtLogFileType.Day, "应用:莘拍档 订单号:" + out_trade_no + " 已支付订单更新失败!!!"); } } catch (Exception ex) { //PayLogHelper.WriteError(ex); LogHelper.SaveLog(TxtLogType.AliPay, ex.InnerException != null ? ex.InnerException.Message : ex.Message); } //判断是否在商户网站中已经做过了这次通知返回的处理 //如果没有做过处理,那么执行商户的业务程序 //如果有做过处理,那么不执行商户的业务程序 Response.Write("success"); //请不要修改或删除 } else { Response.Write("fail"); } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— /////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { LogHelper.SaveLog(TxtLogType.AliPay, TxtLogContentType.Debug, TxtLogFileType.Day, "应用:莘拍档 订单号:" + out_trade_no + " 警告:支付回调验证失败!!!"); Response.Write("fail"); } } else { Response.Write("无通知参数"); } }