From 2096e6ea8d4b4ea61be414483cc6ccc9d1a9e99b Mon Sep 17 00:00:00 2001 From: 710leo <710leo@gmail.com> Date: Mon, 23 Aug 2021 19:46:18 +0800 Subject: [PATCH] feat: support get user by name api --- http/router.go | 2 +- http/router_auth.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/http/router.go b/http/router.go index a873be93..4994b5c5 100644 --- a/http/router.go +++ b/http/router.go @@ -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)) diff --git a/http/router_auth.go b/http/router_auth.go index 90a39496..7688a6da 100644 --- a/http/router_auth.go +++ b/http/router_auth.go @@ -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) +}