mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:23:26 +08:00
【优化】用户支付api增加redis锁,防止出现多次点击可能存在二次支付的问题。
This commit is contained in:
@@ -67,11 +67,9 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
_unitOfWork.BeginTran();
|
||||
|
||||
//取用户实际余额
|
||||
//(会员陌小北提供)
|
||||
var userInfo = await userServices.QueryByClauseWithTranLockAsync(p => p.id == userId, p => p.id, OrderByType.Desc, true);
|
||||
var userInfo = await userServices.QueryByClauseAsync(p => p.id == userId, p => p.id, OrderByType.Desc, true);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
@@ -90,7 +88,6 @@ namespace CoreCms.Net.Services
|
||||
if (type != (int)GlobalEnumVars.UserBalanceSourceTypes.Admin)
|
||||
{
|
||||
//后台充值或调不改绝对值
|
||||
|
||||
}
|
||||
//如果是减余额的操作,还是加余额操作
|
||||
if (type is (int)GlobalEnumVars.UserBalanceSourceTypes.Pay or (int)GlobalEnumVars.UserBalanceSourceTypes.Tocash)
|
||||
@@ -117,6 +114,9 @@ namespace CoreCms.Net.Services
|
||||
balanceModel.sourceId = sourceId;
|
||||
balanceModel.memo = memo;
|
||||
balanceModel.createTime = DateTime.Now;
|
||||
|
||||
_unitOfWork.BeginTran();
|
||||
|
||||
//增加记录
|
||||
var balanceModelId = await _dal.InsertAsync(balanceModel);
|
||||
balanceModel.id = balanceModelId;
|
||||
|
||||
Reference in New Issue
Block a user