121212
This commit is contained in:
@@ -42,25 +42,20 @@ public class GoodsController : ControllerBase
|
||||
string userId = StateHelper.userId;
|
||||
int count = await _goodsService.GetUserGoodsCount(userId, goodsId);
|
||||
int UseState = 0;
|
||||
switch (goodsInfo.code)
|
||||
string[] ShowViewNum = ["Pack", "Weight", "State"]; //显示带数量窗口
|
||||
string[] ShowView = ["Ship","Drug"]; //显示只能使用1个的窗口
|
||||
if (ShowViewNum.Any(it => it == goodsInfo.code))
|
||||
{
|
||||
case "Pack":
|
||||
UseState = 1;
|
||||
break;
|
||||
case "Weight":
|
||||
UseState = 1;
|
||||
break;
|
||||
case "State":
|
||||
UseState = 1;
|
||||
break;
|
||||
case "Ship":
|
||||
UseState = 2;
|
||||
break;
|
||||
case "ChoicePack":
|
||||
UseState = 3;
|
||||
break;
|
||||
UseState = 1;
|
||||
}
|
||||
else if (ShowView.Any(it => it == goodsInfo.code))
|
||||
{
|
||||
UseState = 2;
|
||||
}
|
||||
else if (goodsInfo.code == nameof(GoodsEnum.Code.ChoicePack))
|
||||
{
|
||||
UseState = 3;
|
||||
}
|
||||
|
||||
|
||||
return PoAction.Ok(new { goods = goodsInfo, count, use = UseState });
|
||||
}
|
||||
@@ -105,6 +100,15 @@ public class GoodsController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
if (goodsInfo.code == nameof(GoodsEnum.Code.Drug))
|
||||
{
|
||||
var ck = await _goodsService.CheckUseDrug(userId, goodsId, goodsInfo.content);
|
||||
if (!string.IsNullOrEmpty(ck))
|
||||
{
|
||||
return PoAction.Message(ck);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
if (await _goodsService.UpdateUserGoods(userId, 0, goodsId, count, "使用物品"))
|
||||
@@ -159,7 +163,11 @@ public class GoodsController : ControllerBase
|
||||
await _weightService.AddUserShip(userId, name, goodsId, speed, weight, copper, sale, remark);
|
||||
message = $"使用[{goodsInfo.goodsName}],获得{name}+1";
|
||||
}
|
||||
|
||||
if (goodsInfo.code == nameof(GoodsEnum.Code.Drug))
|
||||
{
|
||||
message = "使用成功!";
|
||||
await _goodsService.UseDrug(userId, goodsId, goodsInfo.content);
|
||||
}
|
||||
return PoAction.Ok(true, message);
|
||||
}
|
||||
else
|
||||
@@ -167,7 +175,7 @@ public class GoodsController : ControllerBase
|
||||
return PoAction.Message("使用失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 使用选择物品礼包
|
||||
/// </summary>
|
||||
@@ -200,6 +208,7 @@ public class GoodsController : ControllerBase
|
||||
{
|
||||
return PoAction.Message("无法使用该物品!");
|
||||
}
|
||||
|
||||
List<ChoiceGoods> choiceGoods = JsonConvert.DeserializeObject<List<ChoiceGoods>>(goodsInfo.content);
|
||||
var onAward = choiceGoods.Find(it => it.id == num);
|
||||
if (onAward == null)
|
||||
@@ -212,11 +221,12 @@ public class GoodsController : ControllerBase
|
||||
{
|
||||
if (await GameBus.UpdateBag(userId, 1, onAward.award, "打开礼包获取"))
|
||||
{
|
||||
string message = $"打开[{goodsInfo.goodsName}],获得:";
|
||||
string message = $"打开[{goodsInfo.goodsName}],获得:";
|
||||
foreach (var item in onAward.award)
|
||||
{
|
||||
message += $"{item.name}+{item.count},";
|
||||
}
|
||||
|
||||
message = message.TrimEnd(',');
|
||||
|
||||
await _messageService.SendBroadcast(userId, nameof(MessageEnum.BroadcastCode.Award), message);
|
||||
|
||||
@@ -55,9 +55,9 @@ public class UserController : ControllerBase
|
||||
var accInfo = await _accService.GetUserAccInfo(userId);
|
||||
object acc = new { accInfo.gold, accInfo.cowry, accInfo.teach, accInfo.renown };
|
||||
|
||||
var buff = await _attrService.GetUserStateData(userId,"ALL");
|
||||
|
||||
object result = new { user, attr = attrInfo, exp, vigourInfo.vitality, acc,buff };
|
||||
var buff = await _attrService.GetUserStateData(userId, "ALL");
|
||||
var stock = await _attrService.GetUserStock(userId);
|
||||
object result = new { user, attr = attrInfo, exp, vigourInfo.vitality, acc, buff, stock };
|
||||
return PoAction.Ok(result);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ public class UserController : ControllerBase
|
||||
var suit = await _equService.GetUserEquSuit(userInfo.userId);
|
||||
object result = new
|
||||
{
|
||||
user, attr = new { attrInfo.lev }, acc, isOnline, onMapName, isFriend, isEnemy, team, equ,suit
|
||||
user, attr = new { attrInfo.lev }, acc, isOnline, onMapName, isFriend, isEnemy, team, equ, suit
|
||||
};
|
||||
return PoAction.Ok(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user