增加船只接口

This commit is contained in:
LN
2026-06-13 18:05:55 +08:00
parent f6323aba8e
commit a68368d227
13 changed files with 475 additions and 75 deletions

View File

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

View File

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