121212
This commit is contained in:
@@ -17,6 +17,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<game_equ_suit> GetEuqSuitInfo(string suitCode)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "SuitInfo");
|
||||
@@ -27,6 +28,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
data = await db.Queryable<game_equ_suit>().Where(it => it.suitCode == suitCode).SingleAsync();
|
||||
await redis.AddHashAsync(key, suitCode, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -238,7 +240,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
return false;
|
||||
}
|
||||
|
||||
userEqu = userEqu.FindAll(it => it.isLock == 0);
|
||||
userEqu = userEqu.FindAll(it => it.isLock == 0 && it.isOn == 0);
|
||||
if (userEqu.Count < count)
|
||||
{
|
||||
return false;
|
||||
@@ -304,16 +306,22 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
await db.Insertable(logs).SplitTable().ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 辅助方法
|
||||
|
||||
public async Task<int> GetUserEquWeightSum(string userId)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
|
||||
var data = await db.Queryable<unit_user_equ>().Where(it => it.userId == userId).ToListAsync();
|
||||
return data.Sum(it => (int)it.weight);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user