This commit is contained in:
2026-07-14 21:15:27 +08:00
parent 73850ff7a2
commit 77fcf4ea47
4 changed files with 130 additions and 116 deletions

View File

@@ -24,6 +24,7 @@ public static class GoodsEnum
Practise,//修炼道具
Durability,//耐久道具
AddExp,//扣除经验获得道具
Collect,//收集的物品
GetExp//使用后获得经验
}

View File

@@ -448,7 +448,7 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
List<TowerGet> AddMapGoods = new List<TowerGet>();
var opGoods = JsonConvert.DeserializeObject<List<TowerGet>>(fightAward.award.ToString());
string addGoodsUser = fightData.areaCode == nameof(GameEnum.AreaCode.Public) ? "0" : fightData.winUser;
if (userConfig.autoBag == 1)
if (userConfig.autoBag != 0)
{
var weightService = App.GetService<IUnitUserWeight>();
bool auto = true;

View File

@@ -7,6 +7,8 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
#region
public async Task<UserAttrModel> GetUserAttrModel(string userId, string scene = "Default")
{
try
{
UserAttrModel result = new UserAttrModel();
result.id = userId;
@@ -130,6 +132,12 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
return result;
}
catch (Exception e)
{
Console.WriteLine($"错误ID{userId},错误信息:{e.Message}");
throw;
}
}
private async Task<UserAttrModel> ReviseUserRoleAttr(UserAttrModel result)
{

View File

@@ -112,6 +112,11 @@ public class UnitUserWeight(ISqlSugarClient DbClient, IRedisCache redis) : IUnit
public async Task<bool> CheckUserWeight(string userId, int useWeight)
{
if (useWeight <= 0)
{
return true;
}
bool result = false;
var weightInfo = await GetUserWeightInfo(userId);
if (weightInfo != null)