fix 包装异常结果

This commit is contained in:
2024-04-07 17:43:04 +08:00
parent e7c0b929fb
commit beb8f3e5a1
4 changed files with 56 additions and 63 deletions

View File

@@ -569,13 +569,11 @@ public class BalanceService : IBalanceService
//金额 +
canteenUser.Balance += Math.Abs(balanceRecord.Amount);
var effect = await _dbContext.Updateable<GainfoMealEntity>()
await _dbContext.Updateable<GainfoMealEntity>()
.SetColumns(x => x.Balance == canteenUser.Balance)
.SetColumns(x => x.Version == x.Version + 1)
.Where(x => x.UserNo == balanceRecord.UserNo && x.Version == canteenUser.Version)
.ExecuteCommandAsync();
if (effect <= 0) throw new VersionExceptions("更新版本冲突");
.ExecuteCommandThrowVersionAsync();
await _dbContext.UpdateAsync(balanceRecord);