public override void OnPaySucceed(AliWapPayCallBackInfo info) { ExceptionLog log = new ExceptionLog(); log.Message = string.Format("订单号:{0},支付宝交易号:{1}", info.out_trade_no, info.trade_no); ExceptionLogDAL.InsertExceptionLog(log); if (info.result.ToLower() == "success") { oid = info.out_trade_no; payid = info.trade_no; MSProductOrderDAL ptitleDal = new MSProductOrderDAL(); int paystate = 0; try { paystate = Convert.ToInt32(ptitleDal.GetOrderValueByID("PayState", info.out_trade_no).ToString()); } catch (Exception) { } if (paystate == 0) { bool updatepayway = ptitleDal.UpdateOrderPayWay(info.out_trade_no, "alipay"); bool updateOrderNum = MSProductOrderDAL.UpdateOrderPayState(info.out_trade_no, "1"); MSOrderLogDAL.AddMSOrderLog("订单【" + info.out_trade_no + "】支付成功,支付方式:支付宝支付"); if (updatepayway == true && updateOrderNum == true) { string countcost = string.Empty; string pid = string.Empty; string pname = string.Empty; #region -获取用户数据 string strOpenID = string.Empty; string customerid = string.Empty; try { customerid = ptitleDal.GetOrderValueByID("CustomerID", info.out_trade_no).ToString(); } catch (Exception) { } if (customerid != null && customerid != "") { MSCustomersDAL CustomerDal = new MSCustomersDAL(); try { strOpenID = CustomerDal.GetCustomerValueByID("OpenID", customerid).ToString(); } catch (Exception) { } } #endregion #region -获取产品信息 try { countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.out_trade_no).ToString(); } catch (Exception) { } try { pid = ptitleDal.GetOrderDetailValueByOID("PID", info.out_trade_no).ToString(); } catch (Exception) { } if (pid != null && pid != "") { MSProductDAL ProductDal = new MSProductDAL(); pname = ProductDal.GetMSProductVaueByID("Ptitle", pid).ToString(); } #endregion string strSiteCode = GetSiteCode(); WXConfigDAL dal = new WXConfigDAL(); WeiXinCore.WeiXin wx = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode); List <TemplateMessageParam> paramList = new List <TemplateMessageParam>(); paramList.Add(new TemplateMessageParam("first", "我们已收到您的货款,订单号为:" + info.out_trade_no + ";我们将尽快为您打包商品,请耐心等待: )")); paramList.Add(new TemplateMessageParam("orderMoneySum", countcost + " 元")); paramList.Add(new TemplateMessageParam("orderProductName", pname)); paramList.Add(new TemplateMessageParam("Remark", "如有问题请致电400-885-5790或直接在微信留言,小V将第一时间为您服务!")); wx.SendTemplateMessage(strOpenID, "IR3TlAC2Y3lW0jaksuPRwHrVHe5nmbWRcD6ZeUPZPlA", "http://www.vgo2013.com/PalmShop/ShopCode/OrderDetail.aspx?oid=" + info.out_trade_no, paramList.ToArray(), ""); MSOrderLogDAL.AddMSOrderLog("发送模板消息到客户OpenID为【" + strOpenID + "】大致为:我们已收到您的货款" + countcost + "元,产品名称【" + pname + "】我们将尽快为您打包商品,请耐心等待: )"); } } } }
public override void OnPaySucceed(WXJSAPIPayNotifyInfo info) { ExceptionLog log = new ExceptionLog(); log.Message = string.Format("Openid:{0},订单号:{1},附加消息:{2}", info.OpenId, info.OutTradeNo, info.Attach); ExceptionLogDAL.InsertExceptionLog(log); MSProductOrderDAL ptitleDal = new MSProductOrderDAL(); int paystate = 0; try { paystate = Convert.ToInt32(ptitleDal.GetOrderValueByID("PayState", info.OutTradeNo).ToString()); } catch (Exception) { } if (paystate == 0) { bool updatepayway = ptitleDal.UpdateOrderPayWay(info.OutTradeNo, "wxpay"); bool updateOrderNum = MSProductOrderDAL.UpdateOrderPayState(info.OutTradeNo, "1"); MSOrderLogDAL.AddMSOrderLog("订单【" + info.OutTradeNo + "】支付成功,支付方式:微支付"); if (updatepayway == true && updateOrderNum == true) { string countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.OutTradeNo).ToString(); string strSiteCode = "VYIGO"; string pid = string.Empty; string pname = string.Empty; #region -获取产品信息 try { countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.OutTradeNo).ToString(); } catch (Exception) { } try { pid = ptitleDal.GetOrderDetailValueByOID("PID", info.OutTradeNo).ToString(); } catch (Exception) { } if (pid != null && pid != "") { MSProductDAL ProductDal = new MSProductDAL(); pname = ProductDal.GetMSProductVaueByID("Ptitle", pid).ToString(); } #endregion WeiXinCore.WeiXin wx = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode); List <TemplateMessageParam> paramList = new List <TemplateMessageParam>(); paramList.Add(new TemplateMessageParam("first", "我们已收到您的货款,订单号为:" + info.OutTradeNo + ";我们将尽快为您打包商品,请耐心等待: )")); paramList.Add(new TemplateMessageParam("orderMoneySum", countcost + " 元")); paramList.Add(new TemplateMessageParam("orderProductName", pname)); paramList.Add(new TemplateMessageParam("Remark", "如有问题请致电400-885-5790或直接在微信留言,小V将第一时间为您服务!")); wx.SendTemplateMessage(info.OpenId, "IR3TlAC2Y3lW0jaksuPRwHrVHe5nmbWRcD6ZeUPZPlA", "http://www.vgo2013.com/PalmShop/ShopCode/OrderDetail.aspx?oid=" + info.OutTradeNo, paramList.ToArray(), ""); MSOrderLogDAL.AddMSOrderLog("发送模板消息到客户OpenID为【" + info.OpenId + "】大致为:我们已收到您的货款" + countcost + "元,产品名称【" + pname + "】我们将尽快为您打包商品,请耐心等待: )"); //JQDialog.SendWeiXinMsg(strSiteCode, info.OpenId, // "您的订单号【" + info.OutTradeNo + "】已于" + // DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + // "付款成功,支付金额:" + countcost + // "元;在等待卖家发货,详情请进入我的订单查询!"); } } }