This commit is contained in:
Putoo
2026-06-01 18:49:17 +08:00
parent 8a5b6d31ca
commit eb81a1c381
50 changed files with 1367 additions and 59 deletions

View File

@@ -13,11 +13,15 @@ public class SettingController : ControllerBase
{
private readonly IUnitUserService _userService;
private readonly IGameGoodsService _goodsService;
private readonly IGameEquService _equService;
private readonly IUnitUserWeight _weightService;
public SettingController(IUnitUserService userService,IGameGoodsService goodsService)
public SettingController(IUnitUserService userService,IGameGoodsService goodsService,IGameEquService equService,IUnitUserWeight weightService)
{
_userService = userService;
_goodsService = goodsService;
_equService = equService;
_weightService = weightService;
}
/// <summary>
@@ -190,4 +194,45 @@ public class SettingController : ControllerBase
return PoAction.Message("暂无法设置!");
}
}
/// <summary>
/// 刷新/重置设置
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> RefreshSetting(int type)
{
string userId = StateHelper.userId;
if (type == 0)//刷新负重
{
var equWeight = await _equService.GetUserEquWeightSum(userId);
var goodsWeight = await _goodsService.GetUserGoodWeightSum(userId,0);
int onWeight = equWeight + goodsWeight;//当前总占用负重
var weightLog = await _weightService.GetUserWeightLog(userId);
int maxWeight = weightLog.Sum(it => (int)it.sum);
var weightInfo = await _weightService.GetUserWeightInfo(userId);
weightInfo.onWeight = onWeight;
weightInfo.maxWeight = maxWeight;
var shipWeight = await _goodsService.GetUserGoodWeightSum(userId,1);
weightInfo.shipOnWeight = shipWeight;
if (await _weightService.UpdateUserWeight(weightInfo))
{
return PoAction.Ok(true,"负重数据已刷新成功!");
}
else
{
return PoAction.Message("负重刷新失败,请稍后尝试!");
}
}
else if (type == 1)//刷新图标
{
return PoAction.Ok(true, "图标刷新成功!");
}
else
{
return PoAction.Message("无效的操作!");
}
}
}

View File

@@ -84,6 +84,40 @@ public class UserController : ControllerBase
var model = await UserModelTool.GetUserView(userId);
return PoAction.Ok(model);
}
/// <summary>
/// 获取基础属性信息
/// </summary>
/// <param name="no"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetUserBaseAttrInfo(string? no)
{
string userId = StateHelper.userId;
if (!string.IsNullOrEmpty(no))
{
var userInfo = await _userService.GetUserInfoByUserNo(no); //基础资料
if (userInfo == null)
{
return PoAction.Message("玩家不存在!", 102);
}
if (userInfo.userId == userId)
{
return PoAction.Message("用户本身!", 101);
}
if (userInfo.areaId != StateHelper.areaId)
{
return PoAction.Message("玩家不存在!", 102);
}
userId = userInfo.userId;
}
var model = await _attrService.GetUserAttrModel(userId);
return PoAction.Ok(model);
}
/// <summary>
/// 获取用户资料