Files
open-im-server/internal/api/user.go
T

57 lines
1.3 KiB
Go
Raw Normal View History

2023-02-28 14:20:26 +08:00
package api
2021-12-27 16:48:05 +08:00
import (
2023-02-28 14:20:26 +08:00
"OpenIM/internal/api/a2r"
2023-02-23 19:15:30 +08:00
"OpenIM/pkg/common/config"
2023-03-08 17:29:03 +08:00
"OpenIM/pkg/discoveryregistry"
2023-02-28 11:38:05 +08:00
"OpenIM/pkg/proto/user"
2021-12-27 16:48:05 +08:00
"context"
2022-08-17 14:57:57 +08:00
"github.com/gin-gonic/gin"
2021-12-27 16:48:05 +08:00
)
2023-02-28 11:38:05 +08:00
var _ context.Context // 解决goland编辑器bug
2022-04-28 15:13:39 +08:00
2023-03-08 17:29:03 +08:00
func NewUser(client discoveryregistry.SvcDiscoveryRegistry) *User {
return &User{c: client}
2022-04-28 15:13:39 +08:00
}
2023-02-28 11:38:05 +08:00
type User struct {
2023-03-08 17:29:03 +08:00
c discoveryregistry.SvcDiscoveryRegistry
2022-04-27 14:43:46 +08:00
}
2023-03-02 14:41:59 +08:00
func (o *User) client() (user.UserClient, error) {
2023-03-08 17:29:03 +08:00
conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImUserName)
2022-04-25 20:05:21 +08:00
if err != nil {
2023-02-28 11:38:05 +08:00
return nil, err
2021-12-27 16:48:05 +08:00
}
2023-02-28 11:38:05 +08:00
return user.NewUserClient(conn), nil
2021-12-27 16:48:05 +08:00
}
2023-03-03 18:08:26 +08:00
func (o *User) UserRegister(c *gin.Context) {
a2r.Call(user.UserClient.UserRegister, o.client, c)
}
2023-03-02 14:41:59 +08:00
func (o *User) UpdateUserInfo(c *gin.Context) {
a2r.Call(user.UserClient.UpdateUserInfo, o.client, c)
2021-12-27 16:48:05 +08:00
}
2022-06-24 17:45:33 +08:00
2023-03-02 14:41:59 +08:00
func (o *User) SetGlobalRecvMessageOpt(c *gin.Context) {
a2r.Call(user.UserClient.SetGlobalRecvMessageOpt, o.client, c)
2022-06-16 19:33:35 +08:00
}
2022-01-13 11:10:29 +08:00
2023-03-02 14:41:59 +08:00
func (o *User) GetUsersPublicInfo(c *gin.Context) {
a2r.Call(user.UserClient.GetDesignateUsers, o.client, c)
2022-01-13 11:10:29 +08:00
}
2022-04-18 14:27:12 +08:00
2023-03-03 19:44:34 +08:00
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)
}
2023-02-28 11:38:05 +08:00
2023-03-02 14:41:59 +08:00
func (o *User) GetUsers(c *gin.Context) {
a2r.Call(user.UserClient.GetPaginationUsers, o.client, c)
2022-08-26 17:51:01 +08:00
}