From 6aab4a2cf44e9f016aee0604be7444b1ec8a5487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=96=B9=E6=88=90?= Date: Wed, 22 Oct 2025 02:07:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E8=BE=93=E5=87=BA=E5=90=8D=E7=A7=B0=E5=92=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将构建输出文件名称从miniChat改为MINI 更新数据库配置为本地开发环境,包括地址、用户名和密码 在消息列表响应中添加消息ID字段并调整时间格式 --- README.md | 2 +- configs/fat_configs.toml | 14 +++++++------- internal/api/app/app_message_list.go | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f2f6674..5b66a39 100644 --- a/README.md +++ b/README.md @@ -13,5 +13,5 @@ ### MAC ``` -$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-w -s' -trimpath -o miniChat +$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-w -s' -trimpath -o MINI ``` diff --git a/configs/fat_configs.toml b/configs/fat_configs.toml index a05363f..72732e8 100644 --- a/configs/fat_configs.toml +++ b/configs/fat_configs.toml @@ -2,16 +2,16 @@ local = 'zh-cn' [mysql.read] -addr = 'sh-cynosdbmysql-grp-88th45wy.sql.tencentcdb.com:28555' +addr = '127.0.0.1:3306' name = 'mini_chat' -pass = 'api2api..' -user = 'root' +pass = 'zRXiHTHzRHTdShFZ' +user = 'mini_chat' [mysql.write] -addr = 'sh-cynosdbmysql-grp-88th45wy.sql.tencentcdb.com:28555' +addr = '127.0.0.1:3306' name = 'mini_chat' -pass = 'api2api..' -user = 'root' +pass = 'zRXiHTHzRHTdShFZ' +user = 'mini_chat' [jwt] -admin_secret = "m9ycX9RTPyuYTWw9FrCc" \ No newline at end of file +admin_secret = "X9Rm9ycFr66w9syuYTWCc" \ No newline at end of file diff --git a/internal/api/app/app_message_list.go b/internal/api/app/app_message_list.go index 26a2669..776238c 100644 --- a/internal/api/app/app_message_list.go +++ b/internal/api/app/app_message_list.go @@ -6,7 +6,6 @@ import ( "mini-chat/internal/code" "mini-chat/internal/pkg/core" - "mini-chat/internal/pkg/timeutil" "mini-chat/internal/pkg/validation" "gorm.io/gorm" @@ -20,6 +19,7 @@ type appMessagePageListRequest struct { } type listMessageData struct { + ID string `json:"id"` // 消息ID SendTime string `json:"send_time"` // 发送时间 SenderID string `json:"sender_id"` // 发送人ID SenderName string `json:"sender_name"` // 发送人昵称 @@ -117,7 +117,8 @@ func (h *handler) AppMessagePageList() core.HandlerFunc { for k, v := range resultData { res.List[k] = listMessageData{ - SendTime: timeutil.FriendlyTime(v.SendTime), + ID: fmt.Sprint(v.ID), + SendTime: v.SendTime.Format("2006-01-02 15:04:05"), SenderID: v.SenderID, SenderName: v.SenderName, ReceiverID: v.ReceiverID,