This commit is contained in:
suyl
2021-07-08 18:23:13 +08:00
parent 2d0824f82a
commit b7ed047e7c
6 changed files with 30 additions and 53 deletions

View File

@@ -15,38 +15,6 @@ func RefreshCode(c *gin.Context) {
utils.Captcha(c, 4)
}
type GetUsersParam struct {
Name string `json:"name" uri:"name"` //用户名
UserID string `json:"user_id" uri:"user_id"` //用户名
Mobile string `json:"mobile" uri:"mobile"` //用户名
}
//查询用户 GET
func GetUsers(c *gin.Context) {
var (
err error
user = &GetUsersParam{}
)
globals.SugarLogger.Debugf("Begin API :%s params: %v ip: %s", c.Request.URL, c.Params, c.ClientIP())
if err = c.ShouldBindUri(&user); err != nil {
c.JSON(http.StatusOK, &CallBack{
Code: model.ErrCodeNormal,
Desc: err.Error(),
})
return
}
if tokenInfo := checkToken(c); tokenInfo == nil {
return
}
if !callFunc(c, func() (retVal interface{}, errCode string, err error) {
retVal, err = services.GetUsers(c, user.UserID, user.Name, user.Mobile)
return retVal, "", err
}) {
return
}
return
}
type UserParam struct {
Name string `json:"name" form:"name" binding:"required"` //用户名
Password string `json:"password" form:"password" binding:"required"` //密码md5后的