From aefd94ccd6a320d804e6efb235bf73e02b34a0f2 Mon Sep 17 00:00:00 2001 From: Putoo <290555932@qq.com> Date: Fri, 26 Jun 2026 18:32:15 +0800 Subject: [PATCH] 1212 --- Service/Application.Domain.Entity/model/RandomModel.cs | 3 ++- Service/Application.Domain/Tool/Base/GameBus.cs | 5 +++-- .../Application.Web/Controllers/Pub/GoodsController.cs | 10 +++++++++- Web/src/pages/prop/goods.vue | 7 ++++++- Web/src/pages/user/bag/index.vue | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Service/Application.Domain.Entity/model/RandomModel.cs b/Service/Application.Domain.Entity/model/RandomModel.cs index 28f1277..8c3983f 100644 --- a/Service/Application.Domain.Entity/model/RandomModel.cs +++ b/Service/Application.Domain.Entity/model/RandomModel.cs @@ -22,6 +22,7 @@ public class RandomData public string code { get; set; } public string name { get; set; } public string par { get; set; } - public long count { get; set; } + public int minCount { get; set; } + public int maxCount { get; set; } public double chance { get; set; } } \ No newline at end of file diff --git a/Service/Application.Domain/Tool/Base/GameBus.cs b/Service/Application.Domain/Tool/Base/GameBus.cs index 64ead07..82647b6 100644 --- a/Service/Application.Domain/Tool/Base/GameBus.cs +++ b/Service/Application.Domain/Tool/Base/GameBus.cs @@ -364,6 +364,7 @@ public static class GameBus { return null; } + double totalWeight = data.Sum(it => it.random); int rnd = _randomInstance.Next(Convert.ToInt32(totalWeight) + 1); double current = 0; @@ -399,7 +400,7 @@ public static class GameBus var onAward = result.FindIndex(it => it.code == item.code && it.parameter == item.par); if (onAward > -1) { - result[onAward].count += item.count; + result[onAward].count += RandomAssist.GetFormatedNumeric(item.minCount, item.maxCount); } else { @@ -408,7 +409,7 @@ public static class GameBus code = item.code, name = item.name, parameter = item.par, - count = item.count + count = RandomAssist.GetFormatedNumeric(item.minCount, item.maxCount) }; result.Add(add); } diff --git a/Service/Application.Web/Controllers/Pub/GoodsController.cs b/Service/Application.Web/Controllers/Pub/GoodsController.cs index 5b0a2ab..d271bf6 100644 --- a/Service/Application.Web/Controllers/Pub/GoodsController.cs +++ b/Service/Application.Web/Controllers/Pub/GoodsController.cs @@ -33,7 +33,15 @@ public class GoodsController : ControllerBase string userId = StateHelper.userId; int count = await _goodsService.GetUserGoodsCount(userId, goodsId); + int UseState = 0; + switch (goodsInfo.code) + { + case "Pack": + UseState = 1; + break; + } + - return PoAction.Ok(new { goods = goodsInfo, count }); + return PoAction.Ok(new { goods = goodsInfo, count, use = UseState }); } } \ No newline at end of file diff --git a/Web/src/pages/prop/goods.vue b/Web/src/pages/prop/goods.vue index 3312244..9cf609c 100644 --- a/Web/src/pages/prop/goods.vue +++ b/Web/src/pages/prop/goods.vue @@ -3,7 +3,7 @@