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

57 lines
1.3 KiB

2 years ago
package api
3 years ago
import (
2 years ago
"OpenIM/internal/api/a2r"
2 years ago
"OpenIM/pkg/common/config"
2 years ago
"OpenIM/pkg/discoveryregistry"
2 years ago
"OpenIM/pkg/proto/user"
3 years ago
"context"
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 (o *User) client() (user.UserClient, error) {
2 years ago
conn, err := o.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 (o *User) UserRegister(c *gin.Context) {
a2r.Call(user.UserClient.UserRegister, o.client, c)
}
2 years ago
func (o *User) UpdateUserInfo(c *gin.Context) {
a2r.Call(user.UserClient.UpdateUserInfo, o.client, c)
3 years ago
}
2 years ago
2 years ago
func (o *User) SetGlobalRecvMessageOpt(c *gin.Context) {
a2r.Call(user.UserClient.SetGlobalRecvMessageOpt, o.client, c)
}
3 years ago
2 years ago
func (o *User) GetUsersPublicInfo(c *gin.Context) {
a2r.Call(user.UserClient.GetDesignateUsers, o.client, c)
3 years ago
}
2 years ago
func (o *User) GetAllUsersID(c *gin.Context) {
a2r.Call(user.UserClient.GetDesignateUsers, o.client, c)
}
func (u *User) AccountCheck(c *gin.Context) {
a2r.Call(user.UserClient.AccountCheck, u.client, c)
}
2 years ago
2 years ago
func (o *User) GetUsers(c *gin.Context) {
a2r.Call(user.UserClient.GetPaginationUsers, o.client, c)
2 years ago
}