feat: support get user by name api

This commit is contained in:
710leo 2021-08-23 19:46:18 +08:00
parent 25cad60ef8
commit 2096e6ea8d
2 changed files with 6 additions and 1 deletions

View File

@ -206,7 +206,7 @@ func configRoutes(r *gin.Engine) {
v1.GET("/can-do-op-by-name", login(), canDoOpByName)
v1.GET("/can-do-op-by-token", login(), canDoOpByToken)
v1.GET("/get-user-by-name", login(), getUserByName)
}
push := r.Group("/v1/n9e/series").Use(gzip.Gzip(gzip.DefaultCompression))

View File

@ -90,3 +90,8 @@ func canDoOpByToken(c *gin.Context) {
can, err := user.CanDo(queryStr(c, "op"))
renderData(c, can, err)
}
func getUserByName(c *gin.Context) {
user, err := models.UserGetByUsername(queryStr(c, "name"))
renderData(c, user, err)
}