feat: query user by userId (#879)

* feat: add `getUserByUserId` func

* Update user.go

Co-authored-by: Yang Luo <hsluoyz@qq.com>
This commit is contained in:
q1anx1
2022-07-14 21:46:13 +08:00
committed by GitHub
parent 10449e89ab
commit f0b0891ac9
2 changed files with 30 additions and 7 deletions

View File

@ -86,6 +86,7 @@ func (c *ApiController) GetUsers() {
func (c *ApiController) GetUser() {
id := c.Input().Get("id")
email := c.Input().Get("email")
userId := c.Input().Get("userId")
owner := c.Input().Get("owner")
if owner == "" {
@ -103,10 +104,12 @@ func (c *ApiController) GetUser() {
}
var user *object.User
if email == "" {
user = object.GetUser(id)
} else {
if email != "" {
user = object.GetUserByEmail(owner, email)
} else if userId != "" {
user = object.GetUserByUserId(owner, userId)
} else {
user = object.GetUser(id)
}
c.Data["json"] = object.GetMaskedUser(user)