mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
cms
This commit is contained in:
parent
6774a8594f
commit
a317ebd8e7
@ -77,7 +77,7 @@ func UserRegister(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
pbDataToken := &rpc.UserTokenReq{Platform: params.Platform, FromUserID: params.UserID, OperationID: params.OperationID, LoginIp: params.CreateIp}
|
||||
pbDataToken := &rpc.UserTokenReq{Platform: params.Platform, FromUserID: params.UserID, OperationID: params.OperationID}
|
||||
replyToken, err := client.UserToken(context.Background(), pbDataToken)
|
||||
if err != nil {
|
||||
errMsg := req.OperationID + " " + " client.UserToken failed " + err.Error() + pbDataToken.String()
|
||||
|
@ -497,13 +497,10 @@ func GetUsers(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
for _, v := range respPb.UserList {
|
||||
resp.Data.UserList = append(resp.Data.UserList, &struct {
|
||||
open_im_sdk.UserInfo
|
||||
IsBlock bool "json:\"isBlock\""
|
||||
}{
|
||||
IsBlock: v.IsBlock,
|
||||
UserInfo: *v.User,
|
||||
})
|
||||
user := api.CMSUser{}
|
||||
utils.CopyStructFields(&user, v.User)
|
||||
user.IsBlock = v.IsBlock
|
||||
resp.Data.UserList = append(resp.Data.UserList, &user)
|
||||
}
|
||||
resp.CommResp.ErrCode = respPb.CommonResp.ErrCode
|
||||
resp.CommResp.ErrMsg = respPb.CommonResp.ErrMsg
|
||||
|
@ -102,15 +102,30 @@ type GetUsersReq struct {
|
||||
ShowNumber int32 `json:"showNumber" binding:"required"`
|
||||
}
|
||||
|
||||
type CMSUser struct {
|
||||
UserID string `json:"userID"`
|
||||
Nickname string `json:"nickname"`
|
||||
FaceURL string `json:"faceURL"`
|
||||
Gender int32 `json:"gender"`
|
||||
PhoneNumber string `json:"phoneNumber"`
|
||||
Birth uint32 `json:"birth"`
|
||||
Email string `json:"email"`
|
||||
Ex string `json:"ex"`
|
||||
CreateIp string `json:"createIp"`
|
||||
CreateTime uint32 `json:"createTime"`
|
||||
LastLoginIp string `json:"LastLoginIp"`
|
||||
LastLoginTime uint32 `json:"LastLoginTime"`
|
||||
AppMangerLevel int32 `json:"appMangerLevel"`
|
||||
GlobalRecvMsgOpt int32 `json:"globalRecvMsgOpt"`
|
||||
IsBlock bool `json:"isBlock"`
|
||||
}
|
||||
|
||||
type GetUsersResp struct {
|
||||
CommResp
|
||||
Data struct {
|
||||
UserList []*struct {
|
||||
server_api_params.UserInfo
|
||||
IsBlock bool `json:"isBlock"`
|
||||
} `json:"userList"`
|
||||
TotalNum int32 `json:"totalNum"`
|
||||
CurrentPage int32 `json:"currentPage"`
|
||||
ShowNumber int32 `json:"showNumber"`
|
||||
UserList []*CMSUser `json:"userList"`
|
||||
TotalNum int32 `json:"totalNum"`
|
||||
CurrentPage int32 `json:"currentPage"`
|
||||
ShowNumber int32 `json:"showNumber"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
@ -7,21 +7,16 @@ import (
|
||||
)
|
||||
|
||||
type ApiUserInfo struct {
|
||||
UserID string `json:"userID" binding:"required,min=1,max=64" swaggo:"true,用户ID,"`
|
||||
Nickname string `json:"nickname" binding:"omitempty,min=1,max=64" swaggo:"true,my id,19"`
|
||||
FaceURL string `json:"faceURL" binding:"omitempty,max=1024"`
|
||||
Gender int32 `json:"gender" binding:"omitempty,oneof=0 1 2"`
|
||||
PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"`
|
||||
Birth uint32 `json:"birth" binding:"omitempty"`
|
||||
Email string `json:"email" binding:"omitempty,max=64"`
|
||||
CreateIp string `json:"createIp" binding:"omitempty,max=15"`
|
||||
CreateTime int64 `json:"createTime"`
|
||||
LastLoginIp string `json:"LastLoginIp" binding:"omitempty,max=15"`
|
||||
LastLoginTime int64 `json:"lastLoginTime"`
|
||||
LoginTimes int32 `json:"loginTimes" binding:"omitempty"`
|
||||
LoginLimit int32 `json:"loginLimit" binding:"omitempty"`
|
||||
Ex string `json:"ex" binding:"omitempty,max=1024"`
|
||||
InvitationCode string `json:"invitationCode" binding:"omitempty"`
|
||||
UserID string `json:"userID" binding:"required,min=1,max=64" swaggo:"true,用户ID,"`
|
||||
Nickname string `json:"nickname" binding:"omitempty,min=1,max=64" swaggo:"true,my id,19"`
|
||||
FaceURL string `json:"faceURL" binding:"omitempty,max=1024"`
|
||||
Gender int32 `json:"gender" binding:"omitempty,oneof=0 1 2"`
|
||||
PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"`
|
||||
Birth uint32 `json:"birth" binding:"omitempty"`
|
||||
Email string `json:"email" binding:"omitempty,max=64"`
|
||||
CreateTime int64 `json:"createTime"`
|
||||
LoginLimit int32 `json:"loginLimit" binding:"omitempty"`
|
||||
Ex string `json:"ex" binding:"omitempty,max=1024"`
|
||||
}
|
||||
|
||||
//type Conversation struct {
|
||||
|
@ -77,7 +77,7 @@ func GetFriendByIDCMS(ownerUserID, friendUserID string) (friendUser *FriendUser,
|
||||
err = db.DB.MysqlDB.DefaultGormDB().Table("friends").
|
||||
Select("friends.*, users.name").
|
||||
Where("friends.owner_user_id=? and friends.friend_user_id=?", ownerUserID, friendUserID).
|
||||
Joins("left join friends on friends.friend_user_id = users.user_id").
|
||||
Joins("left join users on friends.friend_user_id = users.user_id").
|
||||
Take(friendUser).Error
|
||||
return friendUser, err
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog,
|
||||
}
|
||||
|
||||
func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
|
||||
var chatLogs []db.ChatLog
|
||||
var count int64
|
||||
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs")
|
||||
if chatLog.Content != "" {
|
||||
@ -62,6 +61,6 @@ func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
|
||||
db = db.Where("send_time > ? and send_time < ?", chatLog.SendTime, chatLog.SendTime.AddDate(0, 0, 1))
|
||||
}
|
||||
|
||||
err := db.Find(&chatLogs).Count(&count).Error
|
||||
err := db.Count(&count).Error
|
||||
return count, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user