From c63d290273ab60acbeb2fbe5a4f05d63a79693f3 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Wed, 7 Aug 2024 18:09:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/im.go | 6 +++--- handler/im.go | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dao/im.go b/dao/im.go index 0488b59..a0f6a59 100644 --- a/dao/im.go +++ b/dao/im.go @@ -178,9 +178,9 @@ func FindFriend(from_user_id, to_user_id int) []Friend { } type FriendRet struct { - ID int `json:"id"` //用户id - Username string `json:"username"` //用户名 - Email string `json:"email"` //邮箱 + ID int `json:"id"` //用户id + Name string `json:"name"` //用户名 + Email string `json:"email"` //邮箱 } func FindFriends(user_id int) []FriendRet { diff --git a/handler/im.go b/handler/im.go index 298841f..82e9295 100644 --- a/handler/im.go +++ b/handler/im.go @@ -25,11 +25,11 @@ type SMessage struct { } type Message struct { - ID int `json:"id"` - To_user_id int `json:"to_user_id"` - From_user_id int `json:"from_user_id"` - Index int `json:"index"` - Type int `json:"type"` + ID int `json:"id" form:"id" ` + To_user_id int `json:"to_user_id" form:"to_user_id" ` + From_user_id int `json:"from_user_id" form:"from_user_id" ` + Index int `json:"index" form:"index" ` + Type int `json:"type" form:"type" ` } type CGroup struct { @@ -86,6 +86,7 @@ func GetMessage(c *gin.Context) { var req Message user_id, _ := c.Get("id") id := int(user_id.(float64)) + //解析参数 if err := c.ShouldBind(&req); err == nil { fmt.Println(req) msgs, err2 := service.GetMsgUserByIndexService(id, req.To_user_id, req.Index, req.Type, req.From_user_id)