1212
This commit is contained in:
@@ -98,7 +98,7 @@ public class ChatController : ControllerBase
|
||||
isSend = par != "0";
|
||||
break;
|
||||
case 2:
|
||||
isSend = true;
|
||||
isSend = false;
|
||||
code = nameof(GameChatEnum.Code.Group);
|
||||
par = "";
|
||||
break;
|
||||
|
||||
@@ -15,7 +15,8 @@ public class RecoverController : ControllerBase
|
||||
private readonly IUnitUserAccService _accService;
|
||||
private readonly IGameEquService _equService;
|
||||
|
||||
public RecoverController(IUnitUserAttrService attrService, IGameMapService mapService,IUnitUserAccService accService,IGameEquService equService)
|
||||
public RecoverController(IUnitUserAttrService attrService, IGameMapService mapService,
|
||||
IUnitUserAccService accService, IGameEquService equService)
|
||||
{
|
||||
_attrService = attrService;
|
||||
_mapService = mapService;
|
||||
@@ -144,7 +145,8 @@ public class RecoverController : ControllerBase
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
var data = await _attrService.GetUserVigourInfo(userId);
|
||||
return PoAction.Ok(data);
|
||||
long maxVigour = await _attrService.GetUserMaxVitality(userId);
|
||||
return PoAction.Ok(new { data, maxVigour });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -189,12 +191,14 @@ public class RecoverController : ControllerBase
|
||||
{
|
||||
return PoAction.Message("今天已恢复过活力啦!");
|
||||
}
|
||||
if (data.vitality >= data.upVitality)
|
||||
|
||||
long maxVitality = await _attrService.GetUserMaxVitality(userId);
|
||||
if (data.vitality >= maxVitality)
|
||||
{
|
||||
return PoAction.Message("活力满满,无需恢复!");
|
||||
}
|
||||
|
||||
bool result = await _attrService.UpdateUserVigour(userId, 2, (long)data.upVitality,time);
|
||||
bool result = await _attrService.UpdateUserVigour(userId, 2, maxVitality, time);
|
||||
if (result)
|
||||
{
|
||||
return PoAction.Ok(true);
|
||||
@@ -245,8 +249,8 @@ public class RecoverController : ControllerBase
|
||||
var data = await _equService.GetUserOnEqu(userId);
|
||||
var needData = data.FindAll(it =>
|
||||
it.isAppr == 1 && it.durability < it.maxdurability && it.useEndTime > TimeExtend.GetTimeStampSeconds);
|
||||
need = needData.Sum(it => (int)it.maxdurability - (int)it.durability);
|
||||
return PoAction.Ok(new { data, need });
|
||||
need = needData.Sum(it => (int)it.maxdurability - (int)it.durability);
|
||||
return PoAction.Ok(new { data, need });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -256,7 +260,7 @@ public class RecoverController : ControllerBase
|
||||
/// <param name="ueId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> RecoverEqu(int npcId,string? ueId)
|
||||
public async Task<IPoAction> RecoverEqu(int npcId, string? ueId)
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
|
||||
@@ -296,7 +300,7 @@ public class RecoverController : ControllerBase
|
||||
{
|
||||
return PoAction.Message("耐久已满,无需恢复!");
|
||||
}
|
||||
|
||||
|
||||
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
||||
if (need > myAcc)
|
||||
{
|
||||
@@ -310,6 +314,7 @@ public class RecoverController : ControllerBase
|
||||
item.durability = item.maxdurability;
|
||||
await _equService.UpdateUserEquInfo(item);
|
||||
}
|
||||
|
||||
return PoAction.Ok(true, $"恢复成功,花费{need}铜贝!");
|
||||
}
|
||||
else
|
||||
@@ -369,27 +374,5 @@ public class RecoverController : ControllerBase
|
||||
return PoAction.Message("恢复失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var data = await _attrService.GetUserVigourInfo(userId);
|
||||
string time = TimeAssist.GetDateTimeYMDString(0);
|
||||
if (data.upTime == time)
|
||||
{
|
||||
return PoAction.Message("今天已恢复过活力啦!");
|
||||
}
|
||||
if (data.vitality >= data.upVitality)
|
||||
{
|
||||
return PoAction.Message("活力满满,无需恢复!");
|
||||
}
|
||||
|
||||
bool result = await _attrService.UpdateUserVigour(userId, 2, (long)data.upVitality,time);
|
||||
if (result)
|
||||
{
|
||||
return PoAction.Ok(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("恢复失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user