mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 02:16:16 +08:00
cms
This commit is contained in:
parent
6774a8594f
commit
a317ebd8e7
@ -77,7 +77,7 @@ func UserRegister(c *gin.Context) {
|
|||||||
return
|
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)
|
replyToken, err := client.UserToken(context.Background(), pbDataToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg := req.OperationID + " " + " client.UserToken failed " + err.Error() + pbDataToken.String()
|
errMsg := req.OperationID + " " + " client.UserToken failed " + err.Error() + pbDataToken.String()
|
||||||
|
@ -497,13 +497,10 @@ func GetUsers(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, v := range respPb.UserList {
|
for _, v := range respPb.UserList {
|
||||||
resp.Data.UserList = append(resp.Data.UserList, &struct {
|
user := api.CMSUser{}
|
||||||
open_im_sdk.UserInfo
|
utils.CopyStructFields(&user, v.User)
|
||||||
IsBlock bool "json:\"isBlock\""
|
user.IsBlock = v.IsBlock
|
||||||
}{
|
resp.Data.UserList = append(resp.Data.UserList, &user)
|
||||||
IsBlock: v.IsBlock,
|
|
||||||
UserInfo: *v.User,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
resp.CommResp.ErrCode = respPb.CommonResp.ErrCode
|
resp.CommResp.ErrCode = respPb.CommonResp.ErrCode
|
||||||
resp.CommResp.ErrMsg = respPb.CommonResp.ErrMsg
|
resp.CommResp.ErrMsg = respPb.CommonResp.ErrMsg
|
||||||
|
@ -102,13 +102,28 @@ type GetUsersReq struct {
|
|||||||
ShowNumber int32 `json:"showNumber" binding:"required"`
|
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 {
|
type GetUsersResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
Data struct {
|
Data struct {
|
||||||
UserList []*struct {
|
UserList []*CMSUser `json:"userList"`
|
||||||
server_api_params.UserInfo
|
|
||||||
IsBlock bool `json:"isBlock"`
|
|
||||||
} `json:"userList"`
|
|
||||||
TotalNum int32 `json:"totalNum"`
|
TotalNum int32 `json:"totalNum"`
|
||||||
CurrentPage int32 `json:"currentPage"`
|
CurrentPage int32 `json:"currentPage"`
|
||||||
ShowNumber int32 `json:"showNumber"`
|
ShowNumber int32 `json:"showNumber"`
|
||||||
|
@ -14,14 +14,9 @@ type ApiUserInfo struct {
|
|||||||
PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"`
|
PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"`
|
||||||
Birth uint32 `json:"birth" binding:"omitempty"`
|
Birth uint32 `json:"birth" binding:"omitempty"`
|
||||||
Email string `json:"email" binding:"omitempty,max=64"`
|
Email string `json:"email" binding:"omitempty,max=64"`
|
||||||
CreateIp string `json:"createIp" binding:"omitempty,max=15"`
|
|
||||||
CreateTime int64 `json:"createTime"`
|
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"`
|
LoginLimit int32 `json:"loginLimit" binding:"omitempty"`
|
||||||
Ex string `json:"ex" binding:"omitempty,max=1024"`
|
Ex string `json:"ex" binding:"omitempty,max=1024"`
|
||||||
InvitationCode string `json:"invitationCode" binding:"omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//type Conversation struct {
|
//type Conversation struct {
|
||||||
|
@ -77,7 +77,7 @@ func GetFriendByIDCMS(ownerUserID, friendUserID string) (friendUser *FriendUser,
|
|||||||
err = db.DB.MysqlDB.DefaultGormDB().Table("friends").
|
err = db.DB.MysqlDB.DefaultGormDB().Table("friends").
|
||||||
Select("friends.*, users.name").
|
Select("friends.*, users.name").
|
||||||
Where("friends.owner_user_id=? and friends.friend_user_id=?", ownerUserID, friendUserID).
|
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
|
Take(friendUser).Error
|
||||||
return friendUser, err
|
return friendUser, err
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
|
func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
|
||||||
var chatLogs []db.ChatLog
|
|
||||||
var count int64
|
var count int64
|
||||||
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs")
|
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs")
|
||||||
if chatLog.Content != "" {
|
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))
|
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
|
return count, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user