diff --git a/Service/Application.Domain/BusEvents/BusEventsEnum.cs b/Service/Application.Domain/BusEvents/BusEventsEnum.cs index 126ee20..f282d80 100644 --- a/Service/Application.Domain/BusEvents/BusEventsEnum.cs +++ b/Service/Application.Domain/BusEvents/BusEventsEnum.cs @@ -20,6 +20,8 @@ namespace Application.Domain HandleExchangeData,//处理兑换数据 HandleTaskLog,//处理任务日志 HandelTaskUser,//处理角色任务 + HandleClearChat,//清理频道信息 + HandleMessageData,//处理消息类 } } diff --git a/Service/Application.Domain/BusEvents/BusEventsSubscriber.cs b/Service/Application.Domain/BusEvents/BusEventsSubscriber.cs index b99ef8d..0acabb1 100644 --- a/Service/Application.Domain/BusEvents/BusEventsSubscriber.cs +++ b/Service/Application.Domain/BusEvents/BusEventsSubscriber.cs @@ -105,5 +105,22 @@ var taskService = App.GetService(); await taskService.HandleUserTask(); } + + /// + /// 清理频道信息 + /// + /// + [EventSubscribe(BusEventsEnum.BusEventsName.HandleClearChat, NumRetries = 0,RetryTimeout = 999999999)] + public async Task HandleClearChat(EventHandlerExecutingContext context) + { + var chatService = App.GetService(); + await chatService.ClearChat(); + } + [EventSubscribe(BusEventsEnum.BusEventsName.HandleMessageData, NumRetries = 0,RetryTimeout = 999999999)] + public async Task HandleMessageData(EventHandlerExecutingContext context) + { + var messageService = App.GetService(); + await messageService.HandleMessageData(); + } } } \ No newline at end of file diff --git a/Service/Application.Domain/Enum/GameEnum.cs b/Service/Application.Domain/Enum/GameEnum.cs index 054172b..a887bda 100644 --- a/Service/Application.Domain/Enum/GameEnum.cs +++ b/Service/Application.Domain/Enum/GameEnum.cs @@ -17,6 +17,8 @@ public static class GameEnum UpdateExchangeData,//更新兑换的记录 UpdateTaskLog,//更新任务日志 UpdateTaskUser,//更新角色任务 + ClearChat,//清理频道信息 + ClearMessage,//清理个人消息信息 } public enum PropCode//游戏资源编码 { diff --git a/Service/Application.Domain/Services/Interface/Chat/IGameChatService.cs b/Service/Application.Domain/Services/Interface/Chat/IGameChatService.cs index 8f55047..c306b35 100644 --- a/Service/Application.Domain/Services/Interface/Chat/IGameChatService.cs +++ b/Service/Application.Domain/Services/Interface/Chat/IGameChatService.cs @@ -12,4 +12,5 @@ public interface IGameChatService Task SendChat(string userId, string code, string sign, string par = ""); Task GetChatInfo(string chatId); Task DeleteChat(string chatId, string opUser); + Task ClearChat(); } \ No newline at end of file diff --git a/Service/Application.Domain/Services/Interface/Pub/IMessageService.cs b/Service/Application.Domain/Services/Interface/Pub/IMessageService.cs index bf453d8..02223d3 100644 --- a/Service/Application.Domain/Services/Interface/Pub/IMessageService.cs +++ b/Service/Application.Domain/Services/Interface/Pub/IMessageService.cs @@ -53,4 +53,6 @@ public interface IMessageService Task SendBroadcast(string userId, string code, string msg); #endregion + + Task HandleMessageData(); } \ No newline at end of file diff --git a/Service/Application.Domain/Services/Interface/Pub/INoticeService.cs b/Service/Application.Domain/Services/Interface/Pub/INoticeService.cs index a07b805..79a1a86 100644 --- a/Service/Application.Domain/Services/Interface/Pub/INoticeService.cs +++ b/Service/Application.Domain/Services/Interface/Pub/INoticeService.cs @@ -3,6 +3,7 @@ public interface INoticeService { Task> GetNoticeDataByTake(int take); + Task> GetNoticeDataByMap(); Task> GetNoticeData(int page, int limit, RefAsync total); Task GetNoticeInfo(string id); } \ No newline at end of file diff --git a/Service/Application.Domain/Services/Service/Chat/GameChatService.cs b/Service/Application.Domain/Services/Service/Chat/GameChatService.cs index 5935c6d..a8e6ba4 100644 --- a/Service/Application.Domain/Services/Service/Chat/GameChatService.cs +++ b/Service/Application.Domain/Services/Service/Chat/GameChatService.cs @@ -181,4 +181,11 @@ public class GameChatService : IGameChatService, ITransient .Where(it => it.chatId == chatId) .ExecuteCommandAsync() > 0; } + + public async Task ClearChat() + { + long time = TimeExtend.GetTimeStampSeconds; + var db = _dbClient.AsTenant().GetConnectionWithAttr(); + await db.Deleteable().Where(it => it.delTime < time).ExecuteCommandAsync(); + } } \ No newline at end of file diff --git a/Service/Application.Domain/Services/Service/Equ/GameEquService.cs b/Service/Application.Domain/Services/Service/Equ/GameEquService.cs index 0b36cb7..7201856 100644 --- a/Service/Application.Domain/Services/Service/Equ/GameEquService.cs +++ b/Service/Application.Domain/Services/Service/Equ/GameEquService.cs @@ -827,7 +827,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame private async Task> GetEquMakeData(int goodsId) { - string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquUpData"); + string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquMakeData"); if (await redis.HExistsHashAsync(key, goodsId.ToString())) { return await redis.GetHashAsync>(key, goodsId.ToString()); diff --git a/Service/Application.Domain/Services/Service/Pub/MessageService.cs b/Service/Application.Domain/Services/Service/Pub/MessageService.cs index d32322c..c1f8a90 100644 --- a/Service/Application.Domain/Services/Service/Pub/MessageService.cs +++ b/Service/Application.Domain/Services/Service/Pub/MessageService.cs @@ -435,4 +435,21 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess } #endregion + + public async Task HandleMessageData() + { + long time = TimeExtend.GetTimeStampSeconds; + var db = DbClient.AsTenant().GetConnectionWithAttr(); + + await db.Deleteable().Where(it => it.endTime < time && it.isRead == 1) + .ExecuteCommandAsync(); //清理邮件 + await db.Deleteable().Where(it => it.endTime < time && it.isRead == 1) + .ExecuteCommandAsync(); //清理消息 + await db.Deleteable().Where(it => it.endTime < time).ExecuteCommandAsync(); //清理通知 + //删除缓存 + string msgKey = string.Format(UserCache.BaseCacheKeys, "Message", "MsgCount"); + string eventKey = string.Format(UserCache.BaseCacheKeys, "Message", "EventCount"); + string mailKey = string.Format(UserCache.BaseCacheKeys, "Message", "MailCount"); + await redis.DelAsync(msgKey, eventKey, mailKey); + } } \ No newline at end of file diff --git a/Service/Application.Domain/Services/Service/Pub/NoticeService.cs b/Service/Application.Domain/Services/Service/Pub/NoticeService.cs index 76ba07a..094fd84 100644 --- a/Service/Application.Domain/Services/Service/Pub/NoticeService.cs +++ b/Service/Application.Domain/Services/Service/Pub/NoticeService.cs @@ -1,6 +1,6 @@ namespace Application.Domain; -public class NoticeService:INoticeService,ITransient +public class NoticeService : INoticeService, ITransient { private readonly ISqlSugarClient _dbClient; private readonly IRedisCache _redisClient; @@ -14,13 +14,14 @@ public class NoticeService:INoticeService,ITransient public async Task> GetNoticeDataByTake(int take) { var db = _dbClient.AsTenant().GetConnectionWithAttr(); - return await db.Queryable().Take(take).OrderByDescending(it=>it.addTime).ToListAsync(); + return await db.Queryable().Take(take).OrderByDescending(it => it.addTime).ToListAsync(); } public async Task> GetNoticeData(int page, int limit, RefAsync total) { var db = _dbClient.AsTenant().GetConnectionWithAttr(); - return await db.Queryable().OrderByDescending(it=>it.addTime).ToPageListAsync(page, limit, total); + return await db.Queryable().OrderByDescending(it => it.addTime) + .ToPageListAsync(page, limit, total); } public async Task GetNoticeInfo(string id) @@ -28,4 +29,19 @@ public class NoticeService:INoticeService,ITransient var db = _dbClient.AsTenant().GetConnectionWithAttr(); return await db.Queryable().Where(it => it.noticeId == id).SingleAsync(); } + + public async Task> GetNoticeDataByMap() + { + string key = string.Format(BaseCache.BaseCacheKey, "Notice"); + if (await _redisClient.ExistsAsync(key)) + { + return await _redisClient.GetAsync>(key); + } + + DateTime time = DateTime.Now; + var db = _dbClient.AsTenant().GetConnectionWithAttr(); + var data = await db.Queryable().OrderByDescending(it => it.endTime > time).ToListAsync(); + await _redisClient.SetAsync(key, data, 3600); + return data; + } } \ No newline at end of file diff --git a/Service/Application.Web/Business/Job/GameAutoJobService.cs b/Service/Application.Web/Business/Job/GameAutoJobService.cs index a9e5221..5cf0f7d 100644 --- a/Service/Application.Web/Business/Job/GameAutoJobService.cs +++ b/Service/Application.Web/Business/Job/GameAutoJobService.cs @@ -105,5 +105,17 @@ public class GameAutoJobService(ISqlSugarClient DbClient, IRedisCache redis, ITi await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandelTaskUser, data)); } + else if (data.code == nameof(GameEnum.JobCode.ClearChat)) //清理频道信息 + { + var _eventPublisher = App.GetService(); + await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandleClearChat, + data)); + } + else if (data.code == nameof(GameEnum.JobCode.ClearMessage)) //清理频道信息 + { + var _eventPublisher = App.GetService(); + await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandleMessageData, + data)); + } } } \ No newline at end of file diff --git a/Service/Application.Web/Controllers/Map/MapController.cs b/Service/Application.Web/Controllers/Map/MapController.cs index 8f15d0e..44dc1db 100644 --- a/Service/Application.Web/Controllers/Map/MapController.cs +++ b/Service/Application.Web/Controllers/Map/MapController.cs @@ -23,12 +23,13 @@ public class MapController : ControllerBase private readonly IGameFightService _fightService; private readonly IOnHookService _hookService; private readonly IGameTaskService _taskService; + private readonly INoticeService _noticeService; public MapController(IUnitUserService userService, IGameMapService mapService, IGameChatService chatService, IUnitUserAttrService attrService, IMessageService messageService, IUnitUserWeight weightService, IUnitUserAccService accService, IGameSkillService skillService, IGameGoodsService goodsService, IGameTeamService teamService, IGameMonsterService monsterService, IGameFightService fightService, - IOnHookService hookService, IGameTaskService taskService) + IOnHookService hookService, IGameTaskService taskService,INoticeService noticeService) { _userService = userService; _mapService = mapService; @@ -44,6 +45,7 @@ public class MapController : ControllerBase _fightService = fightService; _hookService = hookService; _taskService = taskService; + _noticeService = noticeService; } #region 地图相关 @@ -146,6 +148,8 @@ public class MapController : ControllerBase var onHook = await _hookService.GetUserOnHook(userId); isHook = (int)onHook.status; + var notice = await _noticeService.GetNoticeDataByMap(); + object ret = new { mapInfo, @@ -163,6 +167,7 @@ public class MapController : ControllerBase fightId, gameTips, isHook, + notice, taskCount = taskData.Count }; diff --git a/Service/Application.Web/Controllers/Pub/RecoverController.cs b/Service/Application.Web/Controllers/Pub/RecoverController.cs index 71aba23..7b741ac 100644 --- a/Service/Application.Web/Controllers/Pub/RecoverController.cs +++ b/Service/Application.Web/Controllers/Pub/RecoverController.cs @@ -296,6 +296,7 @@ public class RecoverController : ControllerBase myEqu = myEqu.FindAll(it => it.isAppr == 1 && it.durability < it.maxdurability && it.useEndTime > TimeExtend.GetTimeStampSeconds); int need = myEqu.Sum(it => (int)it.maxdurability - (int)it.durability); + need = need * 500; if (need < 1) { return PoAction.Message("耐久已满,无需恢复!"); @@ -351,6 +352,7 @@ public class RecoverController : ControllerBase } int need = (int)equInfo.maxdurability - (int)equInfo.durability; + need = need * 500; var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper)); if (need > myAcc) { diff --git a/Service/Application.Web/Controllers/User/GiveController.cs b/Service/Application.Web/Controllers/User/GiveController.cs index bf793d1..4ead461 100644 --- a/Service/Application.Web/Controllers/User/GiveController.cs +++ b/Service/Application.Web/Controllers/User/GiveController.cs @@ -257,6 +257,15 @@ public class GiveController : ControllerBase { return PoAction.Message("玩家不存在!"); } + //此处判断赠送玩家的设置 + var roleConfig = await _userService.GetUserConfigInfo(fromInfo.userId); + if (roleConfig.giveRole == 1)//判断是否为好友 + { + if (await _relationService.CheckIsFriend(userId, fromInfo.userId)==false) + { + return PoAction.Message("玩家设置了拒绝陌生人赠送!"); + } + } if (type == 0) { diff --git a/Web/src/config/BaseConfig.ts b/Web/src/config/BaseConfig.ts index 3f8dda4..300e453 100644 --- a/Web/src/config/BaseConfig.ts +++ b/Web/src/config/BaseConfig.ts @@ -2,8 +2,8 @@ 统一配置中心 */ export class BaseConfig { - // public static BaseUrl: string = 'https://localhost:7198' - // public static BaseMediaUrl: string = 'https://localhost:7198/' - public static BaseUrl:string="http://v3.pccsh.com"; - public static BaseMediaUrl:string="http://v3.pccsh.com"; + public static BaseUrl: string = 'https://localhost:7198' + public static BaseMediaUrl: string = 'https://localhost:7198/' + // public static BaseUrl:string="http://v3.pccsh.com"; + // public static BaseMediaUrl:string="http://v3.pccsh.com"; } diff --git a/Web/src/pages/business/retEqu.vue b/Web/src/pages/business/retEqu.vue index a15745b..46ca88c 100644 --- a/Web/src/pages/business/retEqu.vue +++ b/Web/src/pages/business/retEqu.vue @@ -12,7 +12,9 @@ {{ index + 1 }}. ({{ item.durability }}/{{ item.maxdurability }}) - [修复({{ item.maxdurability - item.durability }}铜)] + [修复({{ GameTool.FormatCopper((item.maxdurability - + item.durability) * 500) }}) + ] @@ -24,7 +26,7 @@
说明:
1.装备仅可修复当前穿戴中的装备。
- 2.每修复1点耐久消耗1铜贝。 + 2.每修复1点耐久消耗500铜。