修复问题

This commit is contained in:
zpc 2024-11-19 19:02:20 +08:00
parent 59d020c430
commit 3389c83249
2 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,5 @@
### 20241119
1. 增加兑换码接口
### 20241119
1. 增加兑换码接口测试兑换码test
2. 增加首页排行榜接口
3. 增加游玩历史接口
4. 增加游戏时长接

View File

@ -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;