Refactor code

pull/131/head
wenxu12345 3 years ago
parent 479ce592fa
commit ca92bc899b

@ -47,7 +47,7 @@ func main() {
//group related routing group //group related routing group
groupRouterGroup := r.Group("/group") groupRouterGroup := r.Group("/group")
{ {
groupRouterGroup.POST("/create_group", group.CreateGroup) groupRouterGroup.POST("/create_group", group.CreateGroup) //1
groupRouterGroup.POST("/set_group_info", group.SetGroupInfo) groupRouterGroup.POST("/set_group_info", group.SetGroupInfo)
groupRouterGroup.POST("join_group", group.JoinGroup) groupRouterGroup.POST("join_group", group.JoinGroup)
groupRouterGroup.POST("/quit_group", group.QuitGroup) groupRouterGroup.POST("/quit_group", group.QuitGroup)

@ -443,7 +443,7 @@ func SetGroupInfo(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
return return
} }
resp := api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg} resp := api.SetGroupInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}}
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
log.NewInfo(req.OperationID, "SetGroupInfo api return ", resp) log.NewInfo(req.OperationID, "SetGroupInfo api return ", resp)
} }

@ -1,6 +1,7 @@
package base_info package base_info
import ( import (
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
open_im_sdk "Open_IM/pkg/proto/sdk_ws" open_im_sdk "Open_IM/pkg/proto/sdk_ws"
) )
@ -135,7 +136,7 @@ type QuitGroupResp struct {
} }
type SetGroupInfoReq struct { type SetGroupInfoReq struct {
open_im_sdk.GroupInfo imdb.Group
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type SetGroupInfoResp struct { type SetGroupInfoResp struct {

@ -63,17 +63,19 @@ type FriendRequest struct {
//} //}
// open_im_sdk.GroupInfo (OwnerUserID , MemberCount )> imdb.Group // open_im_sdk.GroupInfo (OwnerUserID , MemberCount )> imdb.Group
type Group struct { type Group struct {
GroupID string `gorm:"column:group_id;primaryKey;"` //`json:"operationID" binding:"required"`
GroupName string `gorm:"column:name"` //`protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` `json:"operationID" binding:"required"`
Notification string `gorm:"column:notification"` GroupID string `gorm:"column:group_id;primaryKey;" json:"groupID" binding:"required"`
Introduction string `gorm:"column:introduction"` GroupName string `gorm:"column:name" json:"groupName"`
FaceUrl string `gorm:"column:face_url"` Notification string `gorm:"column:notification" json:"notification"`
Introduction string `gorm:"column:introduction" json:"introduction"`
FaceUrl string `gorm:"column:face_url" json:"faceUrl"`
CreateTime time.Time `gorm:"column:create_time"` CreateTime time.Time `gorm:"column:create_time"`
Status int32 `gorm:"column:status"` Status int32 `gorm:"column:status"`
CreatorUserID string `gorm:"column:creator_user_id"` CreatorUserID string `gorm:"column:creator_user_id"`
GroupType int32 `gorm:"column:group_type"` GroupType int32 `gorm:"column:group_type"`
Ex string `gorm:"column:ex"` Ex string `gorm:"column:ex" json:"ex"`
} }
//message GroupMemberFullInfo { //message GroupMemberFullInfo {

Loading…
Cancel
Save