12121
This commit is contained in:
@@ -4,6 +4,7 @@ public interface IGameMagicService
|
||||
{
|
||||
Task UpdateUserMagicTime(string userId,int areaId);
|
||||
Task UpdateUserMagicEndTime(string userId, bool isWin);
|
||||
Task<bool> IsHaveWin(int areaId, string time);
|
||||
Task<bool> CheckInMagic(string userId);
|
||||
Task HandleMagicData();
|
||||
}
|
||||
@@ -35,6 +35,13 @@ public class GameMagicService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> IsHaveWin(int areaId, string time)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_magic>();
|
||||
return await db.Queryable<game_magic>().Where(it => it.areaId == areaId && it.time == time && it.isWin == 1)
|
||||
.AnyAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> CheckInMagic(string userId)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_magic>();
|
||||
@@ -83,11 +90,12 @@ public class GameMagicService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
||||
var users = await mapService.GetMapUserByAll(GameConfig.GameMagicMapId, area.areaId, 1, []);
|
||||
if (users.Count > 0)
|
||||
{
|
||||
bool isHaveWin = await IsHaveWin(area.areaId, time);
|
||||
for (int i = 1; i <= users.Count; i++)
|
||||
{
|
||||
string userId = users[i - 1].userId;
|
||||
bool isWin = false;
|
||||
if (i == users.Count)
|
||||
if (i == users.Count && isHaveWin == false)
|
||||
{
|
||||
isWin = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user