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.go

58 lines
1.4 KiB

2 years ago
package api
3 years ago
import (
"context"
2 years ago
2 years ago
"github.com/OpenIMSDK/Open-IM-Server/pkg/a2r"
2 years ago
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user"
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(client discoveryregistry.SvcDiscoveryRegistry) *User {
return &User{c: client}
3 years ago
}
2 years ago
type User struct {
2 years ago
c discoveryregistry.SvcDiscoveryRegistry
}
2 years ago
func (u *User) client() (user.UserClient, error) {
conn, err := u.c.GetConn(config.Config.RpcRegisterName.OpenImUserName)
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) UserRegister(c *gin.Context) {
a2r.Call(user.UserClient.UserRegister, u.client, c)
2 years ago
}
2 years ago
func (u *User) UpdateUserInfo(c *gin.Context) {
a2r.Call(user.UserClient.UpdateUserInfo, u.client, c)
3 years ago
}
2 years ago
2 years ago
func (u *User) SetGlobalRecvMessageOpt(c *gin.Context) {
a2r.Call(user.UserClient.SetGlobalRecvMessageOpt, u.client, c)
}
3 years ago
2 years ago
func (u *User) GetUsersPublicInfo(c *gin.Context) {
a2r.Call(user.UserClient.GetDesignateUsers, u.client, c)
3 years ago
}
2 years ago
func (u *User) GetAllUsersID(c *gin.Context) {
a2r.Call(user.UserClient.GetDesignateUsers, u.client, c)
2 years ago
}
func (u *User) AccountCheck(c *gin.Context) {
a2r.Call(user.UserClient.AccountCheck, u.client, c)
}
2 years ago
2 years ago
func (u *User) GetUsers(c *gin.Context) {
a2r.Call(user.UserClient.GetPaginationUsers, u.client, c)
2 years ago
}