Commit 3aa2c438 authored by liudong1993's avatar liudong1993

1

parent 73d671c3
......@@ -27,5 +27,10 @@ namespace Mall.CacheManager.DataStatistic
///订单支付缓存
/// </summary>
public static readonly string DATA_OrderPayId = "DATA_OrderPayId_";
/// <summary>
/// 支付宝支付信息
/// </summary>
public static readonly string DATA_AliPay_Order = "D_AliPay_Order_";
}
}
......@@ -561,5 +561,20 @@ namespace Mall.CacheManager.User
return downLoad;
}
#region 支付宝支付信息
/// <summary>
/// 获取用户支付信息
/// </summary>
/// <param name="cacheKey"></param>
/// <returns></returns>
public static List<UserWaitPayInfo> GetOrderPay(string cacheKey)
{
var payInfo = redis.StringGet<List<UserWaitPayInfo>>(cacheKey);
return payInfo ?? new List<UserWaitPayInfo>();
}
#endregion
}
}
......@@ -4,6 +4,8 @@ using System.Linq;
using AdapayCore;
using AdapaySDK;
using Mall.CacheManager.AppletWeChat;
using Mall.CacheManager.User;
using Mall.Common;
using Mall.Common.API;
using Mall.Common.Plugin;
using Mall.Model.Extend.Product;
......@@ -84,7 +86,35 @@ namespace Mall.WebApi.Controllers.Adapay
if (pay_channel == "alipay_qr")
{
pay_info = JObject.Parse(expend.ToString()).GetStringValue("qrcode_url");
#region 存入缓存
try
{
string payInfoKey = CacheManager.DataStatistic.DataConstant.DATA_AliPay_Order + userInfo.OpenId;
var zfbPayList = UserReidsCache.GetOrderPay(payInfoKey);
if (zfbPayList.Where(x => x.OrderId == orderId).Any())
{
//存在
foreach (var item in zfbPayList.Where(x => x.OrderId == orderId))
{
item.PayInfo = pay_info;
}
UserReidsCache.Set(payInfoKey, JsonHelper.Serialize(zfbPayList), 1800);//储存30分钟
}
else
{
zfbPayList.Add(new UserWaitPayInfo()
{
OrderId = orderId,
PayInfo = pay_info
});
UserReidsCache.Set(payInfoKey, JsonHelper.Serialize(zfbPayList), 1800);//储存30分钟
}
}
catch (Exception ex)
{
LogHelper.Write(ex, "GetOrderPay 支付信息存缓存失败");
}
#endregion
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment