This commit is contained in:
Putoo
2026-07-14 17:51:41 +08:00
parent 578d6f23db
commit 171388d7e8
2 changed files with 7 additions and 5 deletions

View File

@@ -209,7 +209,7 @@ public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
private async Task<long> GetUserDrugLockTime(string userId, int goodsId) private async Task<long> GetUserDrugLockTime(string userId, int goodsId)
{ {
long result = 0; long result = 0;
string key = string.Format(UserCache.BaseCacheKey, "UserDrug", $"Lock:{userId}_{goodsId}"); string key = string.Format(UserCache.BaseCacheKeys, "UserDrug", $"Lock:{userId}_{goodsId}");
if (await redis.ExistsAsync(key)) if (await redis.ExistsAsync(key))
{ {
long end = await redis.GetAsync<long>(key); long end = await redis.GetAsync<long>(key);
@@ -225,7 +225,7 @@ public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
if (time > 0) if (time > 0)
{ {
long end = TimeExtend.GetTimeStampSeconds + time; long end = TimeExtend.GetTimeStampSeconds + time;
string key = string.Format(UserCache.BaseCacheKey, "UserDrug", $"Lock:{userId}_{goodsId}"); string key = string.Format(UserCache.BaseCacheKeys, "UserDrug", $"Lock:{userId}_{goodsId}");
await redis.SetAsync(key, end, time); await redis.SetAsync(key, end, time);
} }
} }
@@ -235,7 +235,8 @@ public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
int result = 0; int result = 0;
if (!string.IsNullOrEmpty(scene)) if (!string.IsNullOrEmpty(scene))
{ {
string key = string.Format(UserCache.BaseCacheKey, "UserDrug", $"Count:{scene}:{userId}_{goodsId}"); string maiId = $"Count:{scene}:{userId}_{goodsId}";
string key = string.Format(UserCache.BaseCacheKeys, "UserDrug", maiId);
if (await redis.ExistsAsync(key)) if (await redis.ExistsAsync(key))
{ {
result = await redis.GetAsync<int>(key); result = await redis.GetAsync<int>(key);
@@ -251,7 +252,8 @@ public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
{ {
var count = await GetUserDrugLockCount(userId, goodsId, scene); var count = await GetUserDrugLockCount(userId, goodsId, scene);
count += 1; count += 1;
string key = string.Format(UserCache.BaseCacheKey, "UserDrug", $"Count:{scene}:{userId}_{goodsId}"); string maiId = $"Count:{scene}:{userId}_{goodsId}";
string key = string.Format(UserCache.BaseCacheKeys, "UserDrug",maiId);
await redis.SetAsync(key, count, 43200); await redis.SetAsync(key, count, 43200);
} }
} }

View File

@@ -11,7 +11,7 @@
<div class="timeService"> <div class="timeService">
小G报时({{ timeTips }}) 小G报时({{ timeTips }})
</div> </div>
<p style="font-weight:bold;font-size:14px">官方QQ群931835791</p> <p style="font-weight:bold;font-size:14px">官方QQ群238938639</p>
</div> </div>
</template> </template>
<script setup> <script setup>