From 0016ef7e8312a0ef7f7e82f81e5de9e78034639b Mon Sep 17 00:00:00 2001 From: Putoo <290555932@qq.com> Date: Fri, 22 May 2026 09:07:38 +0800 Subject: [PATCH] 1111 --- .../Application.Domain.Entity.csproj | 4 - .../{resource => }/base/MapNear.cs | 0 .../game/game/game_chat.cs | 69 ++++++++ .../model/UserModel.cs | 11 ++ .../view/GameChatView.cs | 8 + .../Application.Domain/Enum/GameChatEnum.cs | 14 ++ Service/Application.Domain/GlobalUsings.cs | 3 +- .../Interface/Chat/IGameChatService.cs | 13 ++ .../Services/Service/Chat/GameChatService.cs | 153 ++++++++++++++++++ .../Tool/{ => Base}/GameTool.cs | 4 +- .../Tool/ModelTool/UserModelTool.cs | 32 ++++ .../Extends/TimeExtend.cs | 24 +++ .../Controllers/Chat/ChatController.cs | 117 ++++++++++++++ .../Controllers/Map/MapController.cs | 15 +- .../Model/RequestParms/Chat/SendChatParms.cs | 7 + Web/src/components/Base/Pagination.vue | 38 ++--- Web/src/components/Business/GameChat.vue | 51 ++++++ Web/src/components/Business/GameUser.vue | 10 ++ Web/src/extends/TimeExtend.ts | 27 ++++ Web/src/pages/chat/index.vue | 82 +++++++++- Web/src/pages/map/index.vue | 27 +--- Web/src/services/Index/ChatService.ts | 19 +++ 22 files changed, 666 insertions(+), 62 deletions(-) rename Service/Application.Domain.Entity/{resource => }/base/MapNear.cs (100%) create mode 100644 Service/Application.Domain.Entity/game/game/game_chat.cs create mode 100644 Service/Application.Domain.Entity/model/UserModel.cs create mode 100644 Service/Application.Domain.Entity/view/GameChatView.cs create mode 100644 Service/Application.Domain/Enum/GameChatEnum.cs create mode 100644 Service/Application.Domain/Services/Interface/Chat/IGameChatService.cs create mode 100644 Service/Application.Domain/Services/Service/Chat/GameChatService.cs rename Service/Application.Domain/Tool/{ => Base}/GameTool.cs (97%) create mode 100644 Service/Application.Domain/Tool/ModelTool/UserModelTool.cs create mode 100644 Service/Application.Service.Pub/Extends/TimeExtend.cs create mode 100644 Service/Application.Web/Controllers/Chat/ChatController.cs create mode 100644 Service/Application.Web/Model/RequestParms/Chat/SendChatParms.cs create mode 100644 Web/src/components/Business/GameChat.vue create mode 100644 Web/src/components/Business/GameUser.vue create mode 100644 Web/src/services/Index/ChatService.ts diff --git a/Service/Application.Domain.Entity/Application.Domain.Entity.csproj b/Service/Application.Domain.Entity/Application.Domain.Entity.csproj index f7d78e1..8f5e89a 100644 --- a/Service/Application.Domain.Entity/Application.Domain.Entity.csproj +++ b/Service/Application.Domain.Entity/Application.Domain.Entity.csproj @@ -10,8 +10,4 @@ - - - - diff --git a/Service/Application.Domain.Entity/resource/base/MapNear.cs b/Service/Application.Domain.Entity/base/MapNear.cs similarity index 100% rename from Service/Application.Domain.Entity/resource/base/MapNear.cs rename to Service/Application.Domain.Entity/base/MapNear.cs diff --git a/Service/Application.Domain.Entity/game/game/game_chat.cs b/Service/Application.Domain.Entity/game/game/game_chat.cs new file mode 100644 index 0000000..18eacb4 --- /dev/null +++ b/Service/Application.Domain.Entity/game/game/game_chat.cs @@ -0,0 +1,69 @@ +using SqlSugar; +using System; + +namespace Application.Domain.Entity +{ + [Tenant("Kg.SeaTime.Game")] + public class game_chat + { + /// + /// chatId + /// + [SugarColumn(IsPrimaryKey = true, Length = 50)] + public string chatId { get; set; } + + /// + /// code + /// + [SugarColumn(Length = 50, IsNullable = true)] + public string? code { get; set; } + + /// + /// areaId + /// + [SugarColumn(IsNullable = true)] + public int? areaId { get; set; } + + /// + /// userId + /// + [SugarColumn(Length = 50, IsNullable = true)] + public string? userId { get; set; } + + /// + /// par + /// + [SugarColumn(Length = 50, IsNullable = true)] + public string? par { get; set; } + + /// + /// sign + /// + [SugarColumn(Length = 255, IsNullable = true)] + public string? sign { get; set; } + + /// + /// addTime + /// + [SugarColumn(IsNullable = true)] + public DateTime? addTime { get; set; } + + /// + /// sort + /// + [SugarColumn(IsNullable = true)] + public long? sort { get; set; } + + /// + /// delTime + /// + [SugarColumn(IsNullable = true)] + public long? delTime { get; set; } + + /// + /// state + /// + [SugarColumn(IsNullable = true)] + public int? state { get; set; } + } +} \ No newline at end of file diff --git a/Service/Application.Domain.Entity/model/UserModel.cs b/Service/Application.Domain.Entity/model/UserModel.cs new file mode 100644 index 0000000..d1c58dc --- /dev/null +++ b/Service/Application.Domain.Entity/model/UserModel.cs @@ -0,0 +1,11 @@ +namespace Application.Domain.Entity; + +public class UserModel +{ + public string userNo { get; set; } + public string nick { get; set; } + public string sex { get; set; } + public string headImg { get; set; } + public int area { get; set; } + public string icon { get; set; } +} \ No newline at end of file diff --git a/Service/Application.Domain.Entity/view/GameChatView.cs b/Service/Application.Domain.Entity/view/GameChatView.cs new file mode 100644 index 0000000..20dd86b --- /dev/null +++ b/Service/Application.Domain.Entity/view/GameChatView.cs @@ -0,0 +1,8 @@ +namespace Application.Domain.Entity; + +public class GameChatView +{ + public game_chat chat { get; set; } + public UserModel user { get; set; } + +} \ No newline at end of file diff --git a/Service/Application.Domain/Enum/GameChatEnum.cs b/Service/Application.Domain/Enum/GameChatEnum.cs new file mode 100644 index 0000000..a30f4d3 --- /dev/null +++ b/Service/Application.Domain/Enum/GameChatEnum.cs @@ -0,0 +1,14 @@ +namespace Application.Domain; + +public class GameChatEnum +{ + public enum Code + { + Public,//公共 + Group,//帮派 + Team,//队伍 + Region,//全区 + Dress,//全服 + System//系统 + } +} \ No newline at end of file diff --git a/Service/Application.Domain/GlobalUsings.cs b/Service/Application.Domain/GlobalUsings.cs index 9a7ca0e..25af9a9 100644 --- a/Service/Application.Domain/GlobalUsings.cs +++ b/Service/Application.Domain/GlobalUsings.cs @@ -2,4 +2,5 @@ global using SqlSugar; global using Application.Domain.Entity; global using Photon.Core.Redis; -global using Photon.Core.Assist; \ No newline at end of file +global using Photon.Core.Assist; +global using Application.Service.Pub; diff --git a/Service/Application.Domain/Services/Interface/Chat/IGameChatService.cs b/Service/Application.Domain/Services/Interface/Chat/IGameChatService.cs new file mode 100644 index 0000000..6d1f618 --- /dev/null +++ b/Service/Application.Domain/Services/Interface/Chat/IGameChatService.cs @@ -0,0 +1,13 @@ +namespace Application.Domain; + +public interface IGameChatService +{ + Task> GetChatTop(int areaId, int top, string teamId, string groupId); + + Task> GetChatData(int type, int areaId, string teamId, string groupId, int page, int limit, + RefAsync total); + + Task SendChat(string userId, int areaId, string code, string sign, string par = ""); + Task DeleteChat(string chatId); + +} \ 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 new file mode 100644 index 0000000..a6c9a0c --- /dev/null +++ b/Service/Application.Domain/Services/Service/Chat/GameChatService.cs @@ -0,0 +1,153 @@ +namespace Application.Domain; + +public class GameChatService : IGameChatService, ITransient +{ + private readonly ISqlSugarClient _dbClient; + private readonly IRedisCache _redisClient; + + public GameChatService(ISqlSugarClient dbClient, IRedisCache redisClient) + { + _dbClient = dbClient; + _redisClient = redisClient; + } + + public async Task> GetChatTop(int areaId, int top, string teamId, string groupId) + { + var db = _dbClient.AsTenant().GetConnectionWithAttr(); + List allCode = new List() { "Public", "Region", "System" }; + var data = await db.Queryable().Where(it => it.state == 1 && + ( + (allCode.Contains(it.code) && it.areaId == areaId) || + (it.code == "Group" && it.par == groupId) || + (it.code == "Team" && it.par == teamId) || + (it.code == "Dress") + ) + ).Take(top).OrderByDescending(it => it.sort).ToListAsync(); + + var result = new List(); + foreach (var item in data) + { + var userModel = await UserModelTool.GetUserView(item.userId, true); + result.Add(new GameChatView() { chat = item, user = userModel }); + } + + return result; + } + + public async Task> GetChatData(int type, int areaId, string teamId, string groupId, int page, + int limit, + RefAsync total) + { + List data = new List(); + var db = _dbClient.AsTenant().GetConnectionWithAttr(); + if (type == 0) + { + List allCode = new List() { "Public", "Region", "System" }; + data = await db.Queryable().Where(it => it.state == 1 && + ( + (allCode.Contains(it.code) && it.areaId == areaId) || + (it.code == "Group" && it.par == groupId) || + (it.code == "Team" && it.par == teamId) || + (it.code == "Dress") + ) + ).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total); + } + else if (type == 1) //队伍 + { + data = await db.Queryable().Where(it => it.state == 1 && it.code == "Team" && it.par == teamId + ).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total); + } + else if (type == 2) //帮派 + { + data = await db.Queryable().Where(it => it.state == 1 && it.code == "Group" && it.par == groupId + ).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total); + } + else if (type == 3) //全区 + { + data = await db.Queryable() + .Where(it => it.state == 1 && it.code == "Region" && it.areaId == areaId + ).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total); + } + else if (type == 4) //全服 + { + data = await db.Queryable().Where(it => it.state == 1 && it.code == "Dress" + ).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total); + } + else if (type == 5) //系统 + { + data = await db.Queryable() + .Where(it => it.state == 1 && it.code == "System" && it.areaId == areaId + ).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total); + } + else + { + data = new List(); + } + var result = new List(); + foreach (var item in data) + { + var userModel = await UserModelTool.GetUserView(item.userId, true); + result.Add(new GameChatView() { chat = item, user = userModel }); + } + + return result; + } + + /// + /// 添加聊天 + /// + /// + /// + /// + /// + /// + /// + public async Task SendChat(string userId, int areaId, string code, string sign, string par = "") + { + game_chat chat = new game_chat(); + chat.chatId = StringAssist.NewGuid; + chat.userId = userId; + chat.areaId = areaId; + chat.code = code; + chat.par = par; + chat.sign = sign; + chat.state = 1; + chat.addTime = DateTime.Now; + chat.sort = TimeExtend.GetTimeStampSeconds; + chat.delTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddDays(3)); + switch (code) + { + case "Region": + chat.sort += 300; //五分钟 + break; + + case "Dress": + chat.sort += 600; //10分钟 + break; + case "System": + chat.delTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddHours(6)); + break; + case "Group": + chat.delTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddHours(6)); + break; + case "Team": + chat.delTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddHours(6)); + break; + } + + var db = _dbClient.AsTenant().GetConnectionWithAttr(); + return await db.Insertable(chat).ExecuteCommandAsync() > 0; + } + + /// + /// 删除聊天 + /// + /// + /// + public async Task DeleteChat(string chatId) + { + var db = _dbClient.AsTenant().GetConnectionWithAttr(); + return await db.Updateable().SetColumns(it => it.state == 0).Where(it => it.chatId == chatId) + .ExecuteCommandAsync() > 0; + } +} \ No newline at end of file diff --git a/Service/Application.Domain/Tool/GameTool.cs b/Service/Application.Domain/Tool/Base/GameTool.cs similarity index 97% rename from Service/Application.Domain/Tool/GameTool.cs rename to Service/Application.Domain/Tool/Base/GameTool.cs index 0c0cb61..bd90aba 100644 --- a/Service/Application.Domain/Tool/GameTool.cs +++ b/Service/Application.Domain/Tool/Base/GameTool.cs @@ -1,5 +1,4 @@ -using Photon.Core.Assist; - + namespace Application.Domain; public class GameTool @@ -38,4 +37,5 @@ public class GameTool List onArea = new List() {"0",area.ToString() }; return onArea.Any(it => areas.Contains(it)); } + } \ No newline at end of file diff --git a/Service/Application.Domain/Tool/ModelTool/UserModelTool.cs b/Service/Application.Domain/Tool/ModelTool/UserModelTool.cs new file mode 100644 index 0000000..b96c197 --- /dev/null +++ b/Service/Application.Domain/Tool/ModelTool/UserModelTool.cs @@ -0,0 +1,32 @@ +namespace Application.Domain; + +public class UserModelTool +{ + /// + /// 获取用户模型 + /// + /// + /// + /// + public static async Task GetUserView(string userId,bool addIcon=false) + { + UserModel result = new UserModel(); + var userService = App.GetService(); + var userInfo = await userService.GetUserInfoByUserId(userId); + if (userInfo != null) + { + result.userNo = userInfo.userNo; + result.nick = userInfo.nick; + result.sex = userInfo.sex; + result.headImg = userInfo.headImg; + result.area = (int)userInfo.areaId; + result.icon = ""; + if (addIcon)//获取图标信息 + { + result.icon = ""; + } + } + + return result; + } +} \ No newline at end of file diff --git a/Service/Application.Service.Pub/Extends/TimeExtend.cs b/Service/Application.Service.Pub/Extends/TimeExtend.cs new file mode 100644 index 0000000..be6027d --- /dev/null +++ b/Service/Application.Service.Pub/Extends/TimeExtend.cs @@ -0,0 +1,24 @@ +namespace Application.Service.Pub; + +public class TimeExtend +{ + public static long GetTimeStampSeconds + { + get => Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); + } + + public static long GetTimeStampMilliseconds + { + get => Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds); + } + + public static long GetTimeStampBySeconds(DateTime time) + { + return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); + } + + public static long GetTimeStampByMilliseconds(DateTime time) + { + return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds); + } +} \ No newline at end of file diff --git a/Service/Application.Web/Controllers/Chat/ChatController.cs b/Service/Application.Web/Controllers/Chat/ChatController.cs new file mode 100644 index 0000000..7c31719 --- /dev/null +++ b/Service/Application.Web/Controllers/Chat/ChatController.cs @@ -0,0 +1,117 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Application.Web.Controllers.Chat; + +/// +/// 公聊接口 +/// +[Route("Chat/[controller]/[action]")] +[ApiController] +[Authorize] +public class ChatController : ControllerBase +{ + private readonly IGameChatService _chatService; + + public ChatController(IGameChatService chatService) + { + _chatService = chatService; + } + + /// + /// 获取公聊信息 + /// + /// + /// + /// + [HttpGet] + public async Task GetChatData(int type, int page) + { + int areaId = StateHelper.areaId; + string teamId = ""; + string groupId = ""; + RefAsync Total = 0; + var data = await _chatService.GetChatData(type, areaId, teamId, groupId, page, 10, Total); + //物品数量 + int sendGoodsCount = 0; + string sendGoodsName = ""; + switch (type) + { + case 0: + sendGoodsCount = 199; + sendGoodsName = "小海螺"; + break; + case 3: + sendGoodsCount = 15; + sendGoodsName = "大海螺"; + break; + case 4: + sendGoodsCount = 9; + sendGoodsName = "金海螺"; + break; + } + + + return PoAction.Ok(new { data, total = Total.Value ,sendGoodsCount,sendGoodsName}); + } + + /// + /// 发言 + /// + /// + /// + [HttpPost] + public async Task SendChat([FromBody] SendChatParms pars) + { + if (string.IsNullOrEmpty(pars.sign)) + { + return PoAction.Message("发言内容不能为空!"); + } + + string userId = StateHelper.userId; + int areaId = StateHelper.areaId; + string par = string.Empty; + string code = GameChatEnum.Code.Public.ToString(); + bool isSend = false; + switch (pars.type) + { + case 0: + isSend = true; + code =nameof(GameChatEnum.Code.Public); + break; + case 1: + isSend = true; + code = nameof(GameChatEnum.Code.Team); + par = ""; + break; + case 2: + isSend = true; + code = nameof(GameChatEnum.Code.Group); + par=""; + break; + case 3: + isSend = true; + code = nameof(GameChatEnum.Code.Region); + break; + case 4: + isSend = true; + code = nameof(GameChatEnum.Code.Dress); + break; + + } + + if (isSend == false) + { + return PoAction.Message("无法发言!"); + } + string sign = StringAssist.NoHTML(pars.sign); + bool result = await _chatService.SendChat(userId, areaId, code, sign, par); + if (result) + { + return PoAction.Ok(true); + } + else + { + return PoAction.Message("发送失败,请稍后尝试!"); + } + } +} \ 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 eb75aac..99161a2 100644 --- a/Service/Application.Web/Controllers/Map/MapController.cs +++ b/Service/Application.Web/Controllers/Map/MapController.cs @@ -13,11 +13,13 @@ public class MapController : ControllerBase { private readonly IUnitUserService _userService; private readonly IGameMapService _mapService; + private readonly IGameChatService _chatService; - public MapController(IUnitUserService userService, IGameMapService mapService) + public MapController(IUnitUserService userService, IGameMapService mapService, IGameChatService chatService) { _userService = userService; _mapService = mapService; + _chatService = chatService; } /// @@ -29,6 +31,7 @@ public class MapController : ControllerBase public async Task GetMapData(string? map) { string userId = StateHelper.userId; + int area = StateHelper.areaId; var onMap = await _mapService.GetUserOnMap(userId); game_city_map mapInfo = new game_city_map(); if (string.IsNullOrEmpty(map)) @@ -40,10 +43,14 @@ public class MapController : ControllerBase mapInfo = await _mapService.GetMapInfo(map); } + //公聊信息 + string teamId = ""; + string groupId = ""; + var chatData = await _chatService.GetChatTop(area, 2, teamId, groupId); //NPC信息 - + var npcData = await _mapService.GetMapNpc(mapInfo.mapId); - npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId,it.areaId)); + npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId, it.areaId)); //城市信息 var cityInfo = await _mapService.GetCityInfo((int)mapInfo.cityId); @@ -54,7 +61,7 @@ public class MapController : ControllerBase #endregion - object ret = new { mapInfo, cityInfo, npcData }; + object ret = new { mapInfo, cityInfo, npcData, chatData }; return PoAction.Ok(ret); } diff --git a/Service/Application.Web/Model/RequestParms/Chat/SendChatParms.cs b/Service/Application.Web/Model/RequestParms/Chat/SendChatParms.cs new file mode 100644 index 0000000..685438d --- /dev/null +++ b/Service/Application.Web/Model/RequestParms/Chat/SendChatParms.cs @@ -0,0 +1,7 @@ +namespace Application.Web; + +public class SendChatParms +{ + public int type { get; set; } + public string sign { get; set; } +} \ No newline at end of file diff --git a/Web/src/components/Base/Pagination.vue b/Web/src/components/Base/Pagination.vue index 3df5894..784b5c4 100644 --- a/Web/src/components/Base/Pagination.vue +++ b/Web/src/components/Base/Pagination.vue @@ -1,31 +1,26 @@ @@ -114,10 +109,7 @@ const changePage = (type: 'first' | 'prev' | 'next' | 'last' | 'input') => { margin: 16px 0; } -.pagination-nav { - display: flex; - gap: 12px; -} +.pagination-nav {} .pagination-nav span { display: inline-block; @@ -128,7 +120,8 @@ const changePage = (type: 'first' | 'prev' | 'next' | 'last' | 'input') => { .pagination-nav span.disabled { color: #999; cursor: not-allowed; - pointer-events: none; /* 禁用点击 */ + pointer-events: none; + /* 禁用点击 */ } .pagination-info { @@ -140,7 +133,8 @@ const changePage = (type: 'first' | 'prev' | 'next' | 'last' | 'input') => { .page-input { width: 46px; - padding: 4px 6px; + font-size: 14px; + padding: 0px 6px; text-align: center; border: 1px solid #ccc; border-radius: 4px; diff --git a/Web/src/components/Business/GameChat.vue b/Web/src/components/Business/GameChat.vue new file mode 100644 index 0000000..6b85a50 --- /dev/null +++ b/Web/src/components/Business/GameChat.vue @@ -0,0 +1,51 @@ + + \ No newline at end of file diff --git a/Web/src/components/Business/GameUser.vue b/Web/src/components/Business/GameUser.vue new file mode 100644 index 0000000..e9afc77 --- /dev/null +++ b/Web/src/components/Business/GameUser.vue @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/Web/src/extends/TimeExtend.ts b/Web/src/extends/TimeExtend.ts index 4506237..cd5ea32 100644 --- a/Web/src/extends/TimeExtend.ts +++ b/Web/src/extends/TimeExtend.ts @@ -69,4 +69,31 @@ export class TimeExtend { public static GetTimeStr(): string { return this.Now('HH:mm:ss') } + + /** + * 时间字符串 转换为 指定格式字符串 + * 场景:把 "2025-01-01 12:30:45" 转成 "2025年01月01日" / "01-01 12:30" 等 + * @param timeStr 时间字符串(如 2025-01-01、2025/01/01 12:30、2025-01-01 12:30:45) + * @param format 目标格式 + */ + public static StrToFormat(timeStr: string, format = 'yyyy-MM-dd HH:mm:ss'): string { + return this.Format(timeStr, format); + } + /** + * 时间字符串 转 日期对象 + * @param timeStr 时间字符串 + */ + public static StrToDate(timeStr: string): Date | null { + const date = new Date(timeStr); + return isNaN(date.getTime()) ? null : date; + } + + /** + * 时间字符串 转 秒级时间戳 + * @param timeStr 时间字符串 + */ + public static StrToSecondStamp(timeStr: string): number | null { + const date = this.StrToDate(timeStr); + return date ? Math.floor(date.getTime() / 1000) : null; + } } \ No newline at end of file diff --git a/Web/src/pages/chat/index.vue b/Web/src/pages/chat/index.vue index f50056a..1dca849 100644 --- a/Web/src/pages/chat/index.vue +++ b/Web/src/pages/chat/index.vue @@ -4,26 +4,53 @@ *更新内容早知道
- 公共. + 公共. 队伍. 帮派. 全区. - 系统. - 全服 + 全服. + 系统
-
-
- 暂无发言. +
+ + 暂无发言. +
+
+ +
+
+ 请输入聊天信息:
+
+ {{ goodsName }}:{{ goodsCount }} (每次发言需要1个哦)
+
+ +
+
+ . + 刷新 +
+
+
+ *公聊频道发言规范
+ *游戏用户守则规范
\ No newline at end of file diff --git a/Web/src/pages/map/index.vue b/Web/src/pages/map/index.vue index 8b323de..9a63742 100644 --- a/Web/src/pages/map/index.vue +++ b/Web/src/pages/map/index.vue @@ -10,26 +10,7 @@
-
-
- [公共] - 头像   航海百曉生    vip 心愿星河  - : - 出身上天魔套15,复仇8,白副手10块,白四象5块,4级审判20,一套5级房子材料20 -
- -
+
您看到: @@ -38,8 +19,8 @@
- {{item.npcName}}{{item.tips}} -
+ {{ item.npcName }}{{ item.tips }} +
@@ -73,6 +54,7 @@ definePageMeta({ const mapInfo = ref({}); const cityInfo = ref({}); const npcData = ref>([]); +const chatData = ref>([]); onMounted(async () => { try { @@ -90,6 +72,7 @@ const BindData = async (map: string): Promise => { mapInfo.value = result.data.mapInfo; cityInfo.value = result.data.cityInfo; npcData.value = result.data.npcData; + chatData.value = result.data.chatData; MapVent(result.data.mapInfo.near); console.log(result.data); diff --git a/Web/src/services/Index/ChatService.ts b/Web/src/services/Index/ChatService.ts new file mode 100644 index 0000000..e7cdaf5 --- /dev/null +++ b/Web/src/services/Index/ChatService.ts @@ -0,0 +1,19 @@ +export class ChatService { + /** + * 获取公聊信息 + * GET /Chat/Chat/GetChatData + */ + static async GetChatData(type: number, page: number) { + return await ApiService.Request("get", "/Chat/Chat/GetChatData", { type, page }); + } + + /** + * 发言 + * POST /Chat/Chat/SendChat + * @param type body + * @param sign body + */ + static async SendChat(type: number, sign: string) { + return await ApiService.Request("post", "/Chat/Chat/SendChat", { type, sign }); + } +} \ No newline at end of file