增加船只接口
This commit is contained in:
@@ -163,7 +163,7 @@ public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
||||
return await db.Insertable(bagLog).SplitTable().ExecuteCommandAsync() > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -186,4 +186,20 @@ public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 船只
|
||||
public async Task<game_ship> GetShipInfo(int shipId)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKey, "ShipData");
|
||||
var data = await redis.GetHashAsync<game_ship>(key, shipId.ToString());
|
||||
if (data == null)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_ship>();
|
||||
data = await db.Queryable<game_ship>().Where(it => it.shipId == shipId).SingleAsync();
|
||||
await redis.AddHashAsync(key, shipId.ToString(), data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -119,7 +119,19 @@ public class UnitUserWeight(ISqlSugarClient DbClient, IRedisCache redis) : IUnit
|
||||
}
|
||||
|
||||
#region 船只相关
|
||||
public async Task<unit_user_ship> GetUserShipInfo(string usId)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserShip", "Info");
|
||||
var data = await redis.GetHashAsync<unit_user_ship>(key, usId);
|
||||
if (data == null)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_ship>();
|
||||
data = await db.Queryable<unit_user_ship>().Where(it => it.usId == usId).SingleAsync();
|
||||
await redis.AddHashAsync(key, usId, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
public async Task<List<unit_user_ship>> GetUserShip(string userId)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "WeightData", "Ship");
|
||||
|
||||
Reference in New Issue
Block a user