This commit is contained in:
Putoo
2026-07-10 19:30:46 +08:00
parent 2ce226c4d7
commit 2c1bec379d
2 changed files with 4 additions and 2 deletions

View File

@@ -168,7 +168,9 @@ public class GameMonsterService(ISqlSugarClient DbClient, IRedisCache redis) : I
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_monster>();
return await db.Queryable<unit_user_monster>()
.Where(it => it.userId == userId && it.monsterId == monsterId && it.state == state).CountAsync();
.Where(it => it.userId == userId && it.monsterId == monsterId)
.WhereIF(state != -1, it => it.state == state)
.CountAsync();
}

View File

@@ -245,7 +245,7 @@ public class GameTaskService(ISqlSugarClient DbClient, IRedisCache redis) : IGam
if (!string.IsNullOrEmpty(item.mapId) && !string.IsNullOrEmpty(item.parameter))
{
int opCount = 0;
int count = await monsterService.GetUserMonsterCount(userId, item.parameter, 0);
int count = await monsterService.GetUserMonsterCount(userId, item.parameter, -1);
if (count < item.count)
{
opCount = (int)item.count - count;