修复问题
This commit is contained in:
parent
59d020c430
commit
3389c83249
|
|
@ -1,5 +1,5 @@
|
|||
### 20241119
|
||||
1. 增加兑换码接口
|
||||
### 20241119
|
||||
1. 增加兑换码接口(测试兑换码:test)
|
||||
2. 增加首页排行榜接口
|
||||
3. 增加游玩历史接口
|
||||
4. 增加游戏时长接
|
||||
|
|
|
|||
|
|
@ -49,6 +49,11 @@ namespace CloudGaming.Code.Other
|
|||
{
|
||||
throw new ArgumentNullException("兑换码已过期");
|
||||
}
|
||||
var usageCount = Dao.DaoPhone.Context.T_User_RedemptionUsage.Where(it => it.Code == code && it.Status == (int)RedemptionUsageStatus.领取成功 && it.UserId == _UserId).Count();
|
||||
if (usageCount > 0)
|
||||
{
|
||||
throw new ArgumentNullException("兑换码已使用过");
|
||||
}
|
||||
start:
|
||||
if (red.UsageLimit > 0)
|
||||
{
|
||||
|
|
@ -57,6 +62,8 @@ namespace CloudGaming.Code.Other
|
|||
{
|
||||
throw new ArgumentNullException("兑换码已使用");
|
||||
}
|
||||
|
||||
|
||||
if (red.UsageLimit == 1)
|
||||
{
|
||||
var lockStr = $"lock:RedemptionCode:{code}";
|
||||
|
|
@ -94,10 +101,11 @@ namespace CloudGaming.Code.Other
|
|||
foreach (var raw in red.RewardConfigs)
|
||||
{
|
||||
var isSuccess = await this.UserConsumeDiamondMoneyAsync(raw.AwardNum, $"兑换码礼包");
|
||||
|
||||
if (!isSuccess)
|
||||
{
|
||||
t_User_RedemptionUsage.Status = (int)RedemptionUsageStatus.领取失败;
|
||||
t_User_RedemptionUsage.Remarks = msg;
|
||||
t_User_RedemptionUsage.Remarks = $"{msg},发放数量{raw.AwardNum},发放类型{raw.CurrencyType}";
|
||||
if (t_User_RedemptionUsage.Remarks.Length > 250)
|
||||
{
|
||||
t_User_RedemptionUsage.Remarks = t_User_RedemptionUsage.Remarks[^250..];
|
||||
|
|
@ -107,6 +115,12 @@ namespace CloudGaming.Code.Other
|
|||
}
|
||||
msg += $"获得{(UserCurrencyType)raw.CurrencyType}*{raw.AwardNum}";
|
||||
}
|
||||
t_User_RedemptionUsage.Remarks = msg;
|
||||
if (t_User_RedemptionUsage.Remarks.Length > 250)
|
||||
{
|
||||
t_User_RedemptionUsage.Remarks = t_User_RedemptionUsage.Remarks[^250..];
|
||||
}
|
||||
await Dao.DaoPhone.Context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
return msg;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user