2222
This commit is contained in:
@@ -10,9 +10,12 @@ public interface IGameEquService
|
||||
#region 用户装备
|
||||
|
||||
Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex, int PageSize,
|
||||
RefAsync<int> Total);
|
||||
RefAsync<int> Total, bool isRemOn = false);
|
||||
|
||||
Task<List<unit_user_equ>> GetUserEquData(string userId, int equId);
|
||||
Task<unit_user_equ> GetUserEquInfo(string ueId);
|
||||
Task<int> GetUserEquByEquIdCount(string userId, int equId);
|
||||
Task<List<unit_user_equ>> GetUserEquByEquId(string userId, int equId);
|
||||
Task<bool> AddUserEqu(string userId, int equId, int count, string remark);
|
||||
|
||||
Task<bool> UpdateUserEquInfo(unit_user_equ equData, bool isAddLog = false, string code = "",
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public interface IGameStoreService
|
||||
{
|
||||
Task<List<game_city_npc_store>> GetStoreData(int npc, int area, int page, int limit,
|
||||
RefAsync<int> total);
|
||||
|
||||
Task<game_city_npc_store> GetStoreInfo(string storeId);
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
#region 用户装备
|
||||
|
||||
public async Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex,
|
||||
int PageSize, RefAsync<int> Total)
|
||||
int PageSize, RefAsync<int> Total, bool isRemOn = false)
|
||||
{
|
||||
long onTime = TimeExtend.GetTimeStampSeconds;
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
|
||||
@@ -31,6 +31,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
.WhereIF(type == 2, it => it.useEndTime < onTime)
|
||||
.WhereIF(type == 1, it => it.isOn == 1)
|
||||
.WhereIF(type == 3, it => it.isAppr == 0)
|
||||
.WhereIF(isRemOn, it => it.isOn == 0)
|
||||
.WhereIF(!string.IsNullOrEmpty(equName),
|
||||
it => it.equName.Contains(equName) || it.unitEquName.Contains(equName))
|
||||
.OrderByDescending(it => it.lev)
|
||||
@@ -44,6 +45,26 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
return await db.Queryable<unit_user_equ>().Where(it => it.userId == userId && it.equId == equId).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<unit_user_equ> GetUserEquInfo(string ueId)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
|
||||
return await db.Queryable<unit_user_equ>().Where(i => i.ueId == ueId).SingleAsync();
|
||||
}
|
||||
|
||||
public async Task<int> GetUserEquByEquIdCount(string userId, int equId)
|
||||
{
|
||||
int result = 0;
|
||||
var data = await GetUserEquByEquId(userId, equId);
|
||||
result = data.Count;
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<unit_user_equ>> GetUserEquByEquId(string userId, int equId)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
|
||||
return await db.Queryable<unit_user_equ>().Where(i => i.userId == userId && i.equId == equId).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> AddUserEqu(string userId, int equId, int count, string remark)
|
||||
{
|
||||
bool result = false;
|
||||
@@ -109,6 +130,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
ue.EquAwaken = new List<EquAwaken>();
|
||||
ue.GemMent = new List<EquGem>();
|
||||
ue.useEndTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddYears(20));
|
||||
ue.isOn = 0;
|
||||
adds.Add(ue);
|
||||
}
|
||||
|
||||
@@ -234,7 +256,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
log.remark = remark;
|
||||
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ_log>();
|
||||
await db.Insertable(log).ExecuteCommandAsync();
|
||||
await db.Insertable(log).SplitTable().ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
private async Task AddEquLogs(List<unit_user_equ> ues, int code, string remark,
|
||||
@@ -261,13 +283,13 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
}
|
||||
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ_log>();
|
||||
await db.Insertable(adds).ExecuteCommandAsync();
|
||||
await db.Insertable(adds).SplitTable().ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
private async Task AddEquLogs(List<unit_user_equ_log> logs)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ_log>();
|
||||
await db.Insertable(logs).ExecuteCommandAsync();
|
||||
await db.Insertable(logs).SplitTable().ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -153,7 +153,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
onLine.userId = userId;
|
||||
onLine.mapId = mapId;
|
||||
onLine.ip = ip;
|
||||
onLine.upTime = TimeAssist.GetTimeStampNum;
|
||||
onLine.upTime = TimeExtend.GetTimeStampSeconds;
|
||||
string key = string.Format(UserCache.BaseCacheKey, "UserOnline");
|
||||
if (await redis.AddHashAsync(key, userId, onLine))
|
||||
{
|
||||
@@ -165,7 +165,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
public async Task<bool> UpdateUserOnMap(unit_user_online data, string mapId)
|
||||
{
|
||||
data.mapId = mapId;
|
||||
data.upTime = TimeAssist.GetTimeStampNum;
|
||||
data.upTime = TimeExtend.GetTimeStampSeconds;
|
||||
string key = string.Format(UserCache.BaseCacheKey, "UserOnline");
|
||||
if (await redis.AddHashAsync(key, data.userId, data))
|
||||
{
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class GameStoreService(ISqlSugarClient DbClient, IRedisCache redis) : IGameStoreService, ITransient
|
||||
{
|
||||
public async Task<List<game_city_npc_store>> GetStoreData(int npc, int area, int page, int limit,
|
||||
RefAsync<int> total)
|
||||
{
|
||||
string _area = area.ToString();
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_city_npc_store>();
|
||||
return await db.Queryable<game_city_npc_store>()
|
||||
.Where(it => it.npcId == npc && (it.areaId == "0" || it.areaId == _area))
|
||||
.ToPageListAsync(page, limit, total);
|
||||
}
|
||||
|
||||
public async Task<game_city_npc_store> GetStoreInfo(string storeId)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_city_npc_store>();
|
||||
return await db.Queryable<game_city_npc_store>().Where(it => it.storeId == storeId).SingleAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user