You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/api/user/user.go

73 lines
1.9 KiB

3 years ago
package user
import (
2 years ago
"OpenIM/internal/a2r"
2 years ago
"OpenIM/pkg/common/config"
2 years ago
"OpenIM/pkg/proto/user"
3 years ago
"context"
2 years ago
"github.com/OpenIMSDK/openKeeper"
2 years ago
"github.com/gin-gonic/gin"
3 years ago
)
2 years ago
var _ context.Context // 解决goland编辑器bug
3 years ago
2 years ago
func NewUser(zk *openKeeper.ZkClient) *User {
return &User{zk: zk}
3 years ago
}
2 years ago
type User struct {
zk *openKeeper.ZkClient
}
2 years ago
func (u *User) getGroupClient() (user.UserClient, error) {
conn, err := u.zk.GetConn(config.Config.RpcRegisterName.OpenImGroupName)
3 years ago
if err != nil {
2 years ago
return nil, err
3 years ago
}
2 years ago
return user.NewUserClient(conn), nil
3 years ago
}
2 years ago
func (u *User) UpdateUserInfo(c *gin.Context) {
a2r.Call(user.UserClient.UpdateUserInfo, u.getGroupClient, c)
3 years ago
}
2 years ago
2 years ago
func (u *User) SetGlobalRecvMessageOpt(c *gin.Context) {
a2r.Call(user.UserClient.SetGlobalRecvMessageOpt, u.getGroupClient, c)
}
3 years ago
2 years ago
func (u *User) GetUsersPublicInfo(c *gin.Context) {
a2r.Call(user.UserClient.GetDesignateUsers, u.getGroupClient, c)
3 years ago
}
2 years ago
func (u *User) GetSelfUserInfo(c *gin.Context) {
a2r.Call(user.UserClient.GetSelfUserInfo, u.getGroupClient, c)
}
3 years ago
2 years ago
func (u *User) GetUsersOnlineStatus(c *gin.Context) {
a2r.Call(user.UserClient.GetUsersOnlineStatus, u.getGroupClient, c)
}
3 years ago
2 years ago
func (u *User) GetUsersInfoFromCache(c *gin.Context) {
a2r.Call(user.UserClient.GetUsersInfoFromCache, u.getGroupClient, c)
}
3 years ago
2 years ago
func (u *User) GetFriendIDListFromCache(c *gin.Context) {
a2r.Call(user.UserClient.GetFriendIDListFromCache, u.getGroupClient, c)
}
2 years ago
func (u *User) GetBlackIDListFromCache(c *gin.Context) {
a2r.Call(user.UserClient.GetBlackIDListFromCache, u.getGroupClient, c)
}
2 years ago
2 years ago
//func (u *User) GetAllUsersUid(c *gin.Context) {
// a2r.Call(user.UserClient.GetAllUsersUid, u.getGroupClient, c)
//}
//
//func (u *User) AccountCheck(c *gin.Context) {
// a2r.Call(user.UserClient.AccountCheck, u.getGroupClient, c)
//}
func (u *User) GetUsers(c *gin.Context) {
a2r.Call(user.UserClient.GetPaginationUsers, u.getGroupClient, c)
2 years ago
}