uniugm/admin/apps/user/api/api_user.go
2025-07-10 18:22:25 +08:00

63 lines
1.2 KiB
Go

package api
import "context"
var userApiInstance IUserApi
func GetUserApiInstance() IUserApi {
return userApiInstance
}
type IUserApi interface {
Auth(ctx context.Context, req *AuthReq) (*AuthRsp, error)
OpPermissionNeedReview(ctx context.Context, req *OpPermissionNeedReviewReq) (*OpPermissionNeedReviewRsp, error)
GetUserInfoByID(ctx context.Context, req *GetUserInfoReq) (*GetUserInfoRsp, error)
}
func RegisterUserApiHandler(handler IUserApi) {
userApiInstance = handler
}
type AuthReq struct {
Token string
UserId int
Url string
}
type UserInfo struct {
UserId int `json:"user_id"`
UserName string `json:"user_name"`
NickName string `json:"nick_name"`
Icon string `json:"icon"`
Character string `json:"character"`
Permissions []string `json:"permissions"`
}
type TokenInfo struct {
Token string `json:"token"`
ExpireAt int64 `json:"expire_at"`
}
type AuthRsp struct {
User *UserInfo
Token *TokenInfo
}
type OpPermissionNeedReviewReq struct {
Token string
UserId int
}
type OpPermissionNeedReviewRsp struct {
IsNeedReview bool
ReviewCharacters []string
}
type GetUserInfoReq struct {
UserId int
}
type GetUserInfoRsp struct {
Find bool
User *UserInfo
}