修复Senparc组件引入后支付bug;调整在线支付单号和订单单号一致;增加支付流水号,方便对账
This commit is contained in:
@@ -150,7 +150,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">下单IP:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="control-label">@Model.IP</label>
|
||||
<label class="control-label">@Model.Ip</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -251,16 +251,16 @@
|
||||
data: { id: Id, fare: Fare },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.Status == "success") {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.Message, {
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
window.location.href = window.location.href;
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.Message, { icon: 2 });
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
@@ -287,16 +287,16 @@
|
||||
data: { id: Id, DeliverType: DeliverType, DeliverNO: DeliverNO },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.Status == "success") {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.Message, {
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
window.location.href = window.location.href;
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.Message, { icon: 2 });
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
@@ -328,16 +328,16 @@
|
||||
data: { id: Id, Flag1: Flag1, Flag2: Flag2 },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.Status == "success") {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.Message, {
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
window.location.href = window.location.href;
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.Message, { icon: 2 });
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
||||
@@ -59,21 +59,26 @@ namespace COMCMS.Web.Controllers.api
|
||||
return new ReJson(40000, "用户状态错误,无法使用本功能!");
|
||||
}
|
||||
//开始生成支付订单
|
||||
OnlinePayOrder model = new OnlinePayOrder();
|
||||
model.OrderId = entity.Id;
|
||||
model.OrderNum = entity.OrderNum;
|
||||
model.PayId = 1;
|
||||
model.PaymentNotes = "微信支付";
|
||||
model.PaymentStatus = Utils.PaymentState[0];
|
||||
model.PayOrderNum = Utils.GetOrderNum();//在线支付订单的订单号
|
||||
model.PayType = "微信支付";
|
||||
model.TotalPrice = entity.TotalPay;
|
||||
model.TotalQty = entity.TotalQty;
|
||||
model.UId = entity.UId;
|
||||
model.IP = Utils.GetIP();
|
||||
model.IsOK = 0;
|
||||
model.AddTime = DateTime.Now;
|
||||
model.Insert();
|
||||
OnlinePayOrder model = OnlinePayOrder.Find(OnlinePayOrder._.OrderNum == entity.OrderNum);
|
||||
if(model == null)
|
||||
{
|
||||
model = new OnlinePayOrder();
|
||||
model.OrderId = entity.Id;
|
||||
model.OrderNum = entity.OrderNum;
|
||||
model.PayId = 1;
|
||||
model.PaymentNotes = "微信支付";
|
||||
model.PaymentStatus = Utils.PaymentState[0];
|
||||
model.PayOrderNum = Utils.GetOrderNum();//在线支付订单的订单号
|
||||
model.PayType = "微信支付";
|
||||
model.TotalPrice = entity.TotalPay;
|
||||
model.TotalQty = entity.TotalQty;
|
||||
model.UId = entity.UId;
|
||||
model.Ip = Utils.GetIP();
|
||||
model.IsOK = 0;
|
||||
model.AddTime = DateTime.Now;
|
||||
model.Insert();
|
||||
}
|
||||
|
||||
|
||||
//写入日志
|
||||
OrderLog log = new OrderLog();
|
||||
@@ -92,7 +97,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
|
||||
|
||||
|
||||
TenPayV3Info TenPayV3Info = new TenPayV3Info(appId, appSecrect, wxmchId, wxmchKey, Utils.GetServerUrl() + "/wxpayment/notify", Utils.GetServerUrl() + "/wxpayment/notify");
|
||||
TenPayV3Info TenPayV3Info = new TenPayV3Info(appId, appSecrect, wxmchId, wxmchKey,"","", Utils.GetServerUrl() + "/wxpayment/notify", Utils.GetServerUrl() + "/wxpayment/notify");
|
||||
TenPayV3Info.TenPayV3Notify = Utils.GetServerUrl() + "/wxpayment/notify";
|
||||
XTrace.WriteLine("微信支付异步通知地址:" + TenPayV3Info.TenPayV3Notify);
|
||||
//创建支付应答对象
|
||||
@@ -102,7 +107,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
string rtimeStamp = Utils.GetTimeStamp();
|
||||
|
||||
//创建请求统一订单接口参数
|
||||
var xmlDataInfo = new TenPayV3UnifiedorderRequestData(TenPayV3Info.AppId, TenPayV3Info.MchId, entity.Title, model.PayOrderNum, (int)(entity.TotalPay * 100), Utils.GetIP(), TenPayV3Info.TenPayV3Notify, Senparc.Weixin.TenPay.TenPayV3Type.JSAPI, my.WeixinAppOpenId, TenPayV3Info.Key, nonceStr);
|
||||
var xmlDataInfo = new TenPayV3UnifiedorderRequestData(TenPayV3Info.AppId, TenPayV3Info.MchId, entity.Title, model.OrderNum, (int)(entity.TotalPay * 100), Utils.GetIP(), TenPayV3Info.TenPayV3Notify, Senparc.Weixin.TenPay.TenPayV3Type.JSAPI, my.WeixinAppOpenId, TenPayV3Info.Key, nonceStr);
|
||||
|
||||
//返回给微信的请求
|
||||
RequestHandler res = new RequestHandler(null);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace COMCMS.Web.Controllers
|
||||
string wxmchId = cfg.MCHId;// ConfigurationManager.AppSettings["WeixinMCHId"];
|
||||
string wxmchKey = cfg.MCHKey;// ConfigurationManager.AppSettings["WeixinMCHKey"];
|
||||
|
||||
TenPayV3Info TenPayV3Info = new TenPayV3Info(appId, appSecrect, wxmchId, wxmchKey, Utils.GetServerUrl() + "/wxpayment/notify", Utils.GetServerUrl() + "/wxpayment/notify");
|
||||
TenPayV3Info TenPayV3Info = new TenPayV3Info(appId, appSecrect, wxmchId, wxmchKey,"","", Utils.GetServerUrl() + "/wxpayment/notify", Utils.GetServerUrl() + "/wxpayment/notify");
|
||||
string res = null;
|
||||
|
||||
resHandler.SetKey(TenPayV3Info.Key);
|
||||
@@ -54,7 +54,7 @@ namespace COMCMS.Web.Controllers
|
||||
string out_trade_no = resHandler.GetParameter("out_trade_no");//商户订单号
|
||||
XTrace.WriteLine("微信异步通知订单号:" + out_trade_no + ";" + JsonConvert.SerializeObject(resHandler));
|
||||
|
||||
OnlinePayOrder payOrder = OnlinePayOrder.Find(OnlinePayOrder._.PayOrderNum == out_trade_no);
|
||||
OnlinePayOrder payOrder = OnlinePayOrder.Find(OnlinePayOrder._.OrderNum == out_trade_no);
|
||||
if (payOrder == null)
|
||||
{
|
||||
XTrace.WriteLine($"支付成功,但是支付订单不存在:{out_trade_no}");
|
||||
@@ -67,6 +67,7 @@ namespace COMCMS.Web.Controllers
|
||||
//更新支付订单
|
||||
payOrder.PaymentStatus = Utils.PaymentState[1];
|
||||
payOrder.ReceiveTime = DateTime.Now;
|
||||
payOrder.OutTradeNo = out_trade_no;
|
||||
payOrder.IsOK = 1;
|
||||
payOrder.Update();
|
||||
|
||||
@@ -76,6 +77,8 @@ namespace COMCMS.Web.Controllers
|
||||
{
|
||||
order.PaymentStatus = Utils.PaymentState[1];
|
||||
order.PayType = "微信支付";
|
||||
order.OutTradeNo = out_trade_no;
|
||||
|
||||
if (order.MyType == (int)Utils.MyType.分销商认证)
|
||||
{
|
||||
order.OrderStatus = Utils.OrdersState[2];
|
||||
|
||||
Reference in New Issue
Block a user