diff --git a/Service/Application.Domain.Entity/game/user/unit_user_config.cs b/Service/Application.Domain.Entity/game/user/unit_user_config.cs index dce56a9..6dc352e 100644 --- a/Service/Application.Domain.Entity/game/user/unit_user_config.cs +++ b/Service/Application.Domain.Entity/game/user/unit_user_config.cs @@ -35,5 +35,11 @@ namespace Application.Domain.Entity /// [SugarColumn(IsNullable = true)] public int? autoDrug { get; set; } + + /// + /// 0 不限制赠送 1限制好友赠送 + /// + [SugarColumn(IsNullable = true)] + public int? giveRole { get; set; } } } \ No newline at end of file diff --git a/Service/Application.Domain/Config/GameConfig.cs b/Service/Application.Domain/Config/GameConfig.cs index 47505a0..12de65c 100644 --- a/Service/Application.Domain/Config/GameConfig.cs +++ b/Service/Application.Domain/Config/GameConfig.cs @@ -9,8 +9,10 @@ public static class GameConfig public const int SendChatGoodsService = 10002;//金海螺 public const int UpLevAddWeight = 10;//升级增加负重 public const int GameBaseVigour = 50;//初始活力 - public const int GameRelationEnemyNeedGold = 50;//添加仇人所需金元 + public const int GameRelationEnemyNeedGold = 300;//添加仇人所需金元 public const int GameUpdateNickNeedGoods = 10001;//更新昵称所需道具 public const int GameUpdateSexNeedGoods = 10001;//更新性别所需道具 public const int GameUserFriendMaxCount = 50;//好友最大上限人数 + public const int GameAutoBagGoodsId = 10001;//百宝箱物品ID + public const int GameAutoDrugGoodsId = 10001;//急救箱物品ID } \ No newline at end of file diff --git a/Service/Application.Domain/Enum/UserEnum.cs b/Service/Application.Domain/Enum/UserEnum.cs index f211f58..8bc9c51 100644 --- a/Service/Application.Domain/Enum/UserEnum.cs +++ b/Service/Application.Domain/Enum/UserEnum.cs @@ -13,5 +13,6 @@ public static class UserEnum ChatRole, AutoBag, AutoDrug, + GiveRole, } } \ No newline at end of file diff --git a/Service/Application.Domain/Services/Service/User/UnitUserService.cs b/Service/Application.Domain/Services/Service/User/UnitUserService.cs index 48be7cf..4094445 100644 --- a/Service/Application.Domain/Services/Service/User/UnitUserService.cs +++ b/Service/Application.Domain/Services/Service/User/UnitUserService.cs @@ -206,6 +206,7 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni config.chatRole = 0; config.autoBag = -1; config.autoDrug = -1; + config.giveRole = 0; db.Insertable(config).AddQueue(); //注册个人血量 @@ -355,6 +356,7 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni .SetColumnsIF(code == "ChatRole", it => it.chatRole == state) .SetColumnsIF(code == "AutoBag", it => it.autoBag == state) .SetColumnsIF(code == "AutoDrug", it => it.autoDrug == state) + .SetColumnsIF(code == "GiveRole", it => it.giveRole == state) .Where(it => it.userId == userId).ExecuteCommandAsync() > 0; if (result) { diff --git a/Service/Application.Web/Controllers/User/SettingController.cs b/Service/Application.Web/Controllers/User/SettingController.cs new file mode 100644 index 0000000..92e9a7a --- /dev/null +++ b/Service/Application.Web/Controllers/User/SettingController.cs @@ -0,0 +1,193 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Application.Web.Controllers.User; + +/// +/// 设置接口 +/// +[ApiExplorerSettings(GroupName = "User")] +[Route("User/[controller]/[action]")] +[ApiController] +[Authorize] +public class SettingController : ControllerBase +{ + private readonly IUnitUserService _userService; + private readonly IGameGoodsService _goodsService; + + public SettingController(IUnitUserService userService,IGameGoodsService goodsService) + { + _userService = userService; + _goodsService = goodsService; + } + + /// + /// 获取个人配置 + /// + /// + [HttpGet] + public async Task GetUserConfig(int type) + { + int result = 0; + string userId = StateHelper.userId; + var data = await _userService.GetUserConfigInfo(userId); + switch (type) + { + case 0: + result = (int)data.friendRole; + break; + case 1: + result = (int)data.giveRole; + break; + case 2: + result = (int)data.autoBag; + break; + case 3: + result = (int)data.autoDrug; + break; + } + + return PoAction.Ok(result); + } + + /// + /// 设置配置 + /// + /// + /// + /// + [HttpGet] + public async Task UpdateUserConfig(int type, int state) + { + string userId = StateHelper.userId; + if (type == 0) + { + int[] target = [0, 1, 2]; + if (target.Contains(state)) + { + if (await _userService.UpdateUserConfigInfo(userId, nameof(UserEnum.ConfigCode.FriendRole), state)) + { + return PoAction.Ok(true); + } + else + { + return PoAction.Message("设置失败,请稍后尝试!"); + } + } + else + { + return PoAction.Message("无效的设置!"); + } + } + else if (type == 1) + { + int[] target = [0, 1]; + if (target.Contains(state)) + { + if (await _userService.UpdateUserConfigInfo(userId, nameof(UserEnum.ConfigCode.GiveRole), state)) + { + return PoAction.Ok(true); + } + else + { + return PoAction.Message("设置失败,请稍后尝试!"); + } + } + else + { + return PoAction.Message("无效的设置!"); + } + } + else if (type == 2) + { + int[] target = [0, 1]; + if (target.Contains(state)) + { + var data = await _userService.GetUserConfigInfo(userId); + if (data.autoBag == -1)//判断物品开通 + { + var goodsCount = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameAutoBagGoodsId); + if (goodsCount < 1) + { + return PoAction.Message("您暂无百宝箱,无法开启!"); + } + + if (await _goodsService.UpdateUserGoods(userId, 0, GameConfig.GameAutoBagGoodsId, 1, "使用物品")) + { + if (await _userService.UpdateUserConfigInfo(userId, nameof(UserEnum.ConfigCode.AutoBag), state)) + { + return PoAction.Ok(true); + } + else + { + return PoAction.Message("开启失败,请稍后尝试!"); + } + } + else + { + return PoAction.Message("开启失败,请稍后尝试!"); + } + } + if (await _userService.UpdateUserConfigInfo(userId, nameof(UserEnum.ConfigCode.AutoBag), state)) + { + return PoAction.Ok(true); + } + else + { + return PoAction.Message("设置失败,请稍后尝试!"); + } + } + else + { + return PoAction.Message("无效的设置!"); + } + } + else if (type == 3) + { + int[] target = [0, 1]; + if (target.Contains(state)) + { + var data = await _userService.GetUserConfigInfo(userId); + if (data.autoBag == -1)//判断物品开通 + { + var goodsCount = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameAutoDrugGoodsId); + if (goodsCount < 1) + { + return PoAction.Message("您暂无急救箱,无法开启!"); + } + + if (await _goodsService.UpdateUserGoods(userId, 0, GameConfig.GameAutoDrugGoodsId, 1, "使用物品")) + { + if (await _userService.UpdateUserConfigInfo(userId, nameof(UserEnum.ConfigCode.AutoDrug), state)) + { + return PoAction.Ok(true); + } + else + { + return PoAction.Message("开启失败,请稍后尝试!"); + } + } + else + { + return PoAction.Message("开启失败,请稍后尝试!"); + } + } + if (await _userService.UpdateUserConfigInfo(userId, nameof(UserEnum.ConfigCode.AutoDrug), state)) + { + return PoAction.Ok(true); + } + else + { + return PoAction.Message("设置失败,请稍后尝试!"); + } + } + else + { + return PoAction.Message("无效的设置!"); + } + } + else + { + return PoAction.Message("暂无法设置!"); + } + } +} \ No newline at end of file diff --git a/Web/src/config/BaseConfig.ts b/Web/src/config/BaseConfig.ts index fdde357..d72993f 100644 --- a/Web/src/config/BaseConfig.ts +++ b/Web/src/config/BaseConfig.ts @@ -2,7 +2,6 @@ 统一配置中心 */ export class BaseConfig { -//public static BaseUrl:string="https://localhost:7198"; -public static BaseUrl:string="http://192.168.0.110:5032"; +public static BaseUrl:string="https://localhost:7198"; public static BaseMediaUrl:string="https://localhost:7198"; } \ No newline at end of file diff --git a/Web/src/pages/chat/index.vue b/Web/src/pages/chat/index.vue index 6801f0d..64a23e7 100644 --- a/Web/src/pages/chat/index.vue +++ b/Web/src/pages/chat/index.vue @@ -131,10 +131,8 @@ const ChangeChat = async (typeid: string): Promise => { //删除记录 const DelChat = async (data: any) => { - MessageExtend.ShowConfirmDialogAsyc("频道管理", `您确定要删除该发言吗?`, async () => { - MessageExtend.LoadingToast("删除中..."); - let result = await ChatService.DeleteChat(data.chatId); - MessageExtend.LoadingClose(); + MessageExtend.ShowConfirmDialogAsyc("频道管理", `您确定要删除该发言吗?`, async () => { + let result = await ChatService.DeleteChat(data.chatId); if (result.code == 0) { await BindData(); MessageExtend.Notify("删除成功!", "success"); diff --git a/Web/src/pages/map/index.vue b/Web/src/pages/map/index.vue index 5f7b1c6..b38fefa 100644 --- a/Web/src/pages/map/index.vue +++ b/Web/src/pages/map/index.vue @@ -6,7 +6,7 @@ {{ cityInfo.cityName }}·{{ mapInfo.mapName }} 刷新 任务 - 消息{{ messageCount > 0 ? "(" + messageCount + ")" : "" }} + 消息{{ messageCount > 0 ? "(" + messageCount + ")" : "" }}
diff --git a/Web/src/pages/message/index.vue b/Web/src/pages/user/message/index.vue similarity index 97% rename from Web/src/pages/message/index.vue rename to Web/src/pages/user/message/index.vue index 7eaafca..9fbaa23 100644 --- a/Web/src/pages/message/index.vue +++ b/Web/src/pages/user/message/index.vue @@ -17,7 +17,7 @@
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}. - + {{ item.user.nick }}:{{ item.sign }} [×]
@@ -51,7 +51,7 @@
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}. - + {{ item.name }} (未读) (未领取) diff --git a/Web/src/pages/message/log.vue b/Web/src/pages/user/message/log.vue similarity index 100% rename from Web/src/pages/message/log.vue rename to Web/src/pages/user/message/log.vue diff --git a/Web/src/pages/message/mail.vue b/Web/src/pages/user/message/mail.vue similarity index 93% rename from Web/src/pages/message/mail.vue rename to Web/src/pages/user/message/mail.vue index 58a25db..69e8fa9 100644 --- a/Web/src/pages/message/mail.vue +++ b/Web/src/pages/user/message/mail.vue @@ -1,6 +1,6 @@