pull/351/head
wangchuxiao 2 years ago
parent 7f5b12d4d2
commit 9b5e1465c3

@ -54,7 +54,6 @@ func NewGinRouter() *gin.Engine {
userRouterGroup.POST("/unblock_user", user.UnblockUser)
userRouterGroup.POST("/block_user", user.BlockUser)
userRouterGroup.GET("/get_block_users", user.GetBlockUsers)
userRouterGroup.GET("/get_block_user", user.GetBlockUserById)
}
messageCMSRouterGroup := r2.Group("/message")
{

@ -143,15 +143,13 @@ func GetBlockUsers(c *gin.Context) {
for _, v := range respPb.BlockUsers {
resp.BlockUsers = append(resp.BlockUsers, cms_api_struct.BlockUser{
UserResponse: cms_api_struct.UserResponse{
UserId: v.User.UserId,
ProfilePhoto: v.User.ProfilePhoto,
Nickname: v.User.Nickname,
IsBlock: v.User.IsBlock,
Birth: v.User.Birth,
PhoneNumber: v.User.PhoneNumber,
Email: v.User.Email,
Gender: int(v.User.Gender),
CreateTime: v.User.CreateTime,
UserID: v.UserInfo.UserID,
FaceURL: v.UserInfo.FaceURL,
Nickname: v.UserInfo.Nickname,
PhoneNumber: v.UserInfo.PhoneNumber,
Email: v.UserInfo.Email,
Gender: int(v.UserInfo.Gender),
// CreateTime: v.UserInfo.CreateTime,
},
BeginDisableTime: v.BeginDisableTime,
EndDisableTime: v.EndDisableTime,
@ -163,38 +161,3 @@ func GetBlockUsers(c *gin.Context) {
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp)
}
func GetBlockUserById(c *gin.Context) {
var (
req cms_api_struct.GetBlockUserRequest
resp cms_api_struct.GetBlockUserResponse
reqPb pb.GetBlockUserByIdReq
)
if err := c.ShouldBindQuery(&req); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())
openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return
}
reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.UserId = req.UserId
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn)
respPb, err := client.GetBlockUserById(context.Background(), &reqPb)
if err != nil {
log.NewError(reqPb.OperationID, "GetBlockUserById rpc failed ", err.Error())
openIMHttp.RespHttp200(c, err, nil)
return
}
resp.EndDisableTime = respPb.BlockUser.EndDisableTime
resp.BeginDisableTime = respPb.BlockUser.BeginDisableTime
utils.CopyStructFields(&resp, respPb.BlockUser.User)
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp)
}

@ -1,17 +1,17 @@
package cms_api_struct
type UserResponse struct {
ProfilePhoto string `json:"profile_photo"`
Nickname string `json:"nick_name"`
UserId string `json:"user_id"`
CreateTime string `json:"create_time,omitempty"`
CreateIp string `json:"create_ip,omitempty"`
LastLoginTime string `json:"last_login_time,omitempty"`
LastLoginIp string `json:"last_login_ip,omitempty"`
LoginTimes int32 `json:"login_times"`
LoginLimit int32 `json:"login_limit"`
IsBlock bool `json:"is_block"`
PhoneNumber string `json:"phone_number"`
FaceURL string `json:"faceURL"`
Nickname string `json:"nickName"`
UserID string `json:"userID"`
CreateTime string `json:"createTime,omitempty"`
CreateIp string `json:"createIp,omitempty"`
LastLoginTime string `json:"lastLoginTime,omitempty"`
LastLoginIp string `json:"lastLoginIP,omitempty"`
LoginTimes int32 `json:"loginTimes"`
LoginLimit int32 `json:"loginLimit"`
IsBlock bool `json:"isBlock"`
PhoneNumber string `json:"phoneNumber"`
Email string `json:"email"`
Birth string `json:"birth"`
Gender int `json:"gender"`

Loading…
Cancel
Save