From 8baae5e71209b70d3249c466c146c4b68b8ef393 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 20 Aug 2021 18:27:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=F0=9F=90=9B:=20=E4=BF=AE=E5=A4=8Djwt?= =?UTF-8?q?=E5=AF=86=E9=92=A5=E5=BC=95=E7=94=A8=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=88#545=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/middleware/auth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/middleware/auth.go b/common/middleware/auth.go index 95e035a1..6562cff8 100644 --- a/common/middleware/auth.go +++ b/common/middleware/auth.go @@ -20,7 +20,7 @@ func AuthInit() (*jwt.GinJWTMiddleware, error) { } return jwt.New(&jwt.GinJWTMiddleware{ Realm: "test zone", - Key: []byte(config.ApplicationConfig.JwtSecret), + Key: []byte(config.JwtConfig.Secret), Timeout: timeout, MaxRefresh: time.Hour, PayloadFunc: handler.PayloadFunc, @@ -33,4 +33,4 @@ func AuthInit() (*jwt.GinJWTMiddleware, error) { TimeFunc: time.Now, }) -} +} \ No newline at end of file From bb83a976131ff75a8719c2cd4e07ca074e25b82b Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 20 Aug 2021 18:28:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E4=BF=AE=E6=94=B9p?= =?UTF-8?q?ost=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/sys_post.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/admin/apis/sys_post.go b/app/admin/apis/sys_post.go index 33911fb8..a12d54a2 100644 --- a/app/admin/apis/sys_post.go +++ b/app/admin/apis/sys_post.go @@ -2,6 +2,7 @@ package apis import ( "fmt" + "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" "github.com/go-admin-team/go-admin-core/sdk/api" @@ -93,8 +94,7 @@ func (e SysPost) Get(c *gin.Context) { // @Accept application/json // @Product application/json // @Param data body dto.SysPostInsertReq true "data" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Success 200 {object} response.Response "{"code": 200, "data": [...]}" // @Router /api/v1/post [post] // @Security Bearer func (e SysPost) Insert(c *gin.Context) { @@ -126,8 +126,7 @@ func (e SysPost) Insert(c *gin.Context) { // @Accept application/json // @Product application/json // @Param data body dto.SysPostUpdateReq true "body" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Success 200 {object} response.Response "{"code": 200, "data": [...]}" // @Router /api/v1/post/{id} [put] // @Security Bearer func (e SysPost) Update(c *gin.Context) { @@ -159,8 +158,7 @@ func (e SysPost) Update(c *gin.Context) { // @Description 删除数据 // @Tags 岗位 // @Param id body dto.SysPostDeleteReq true "请求参数" -// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" -// @Success 500 {string} string "{"code": 500, "message": "删除失败"}" +// @Success 200 {object} response.Response "{"code": 200, "data": [...]}" // @Router /api/v1/post [delete] // @Security Bearer func (e SysPost) Delete(c *gin.Context) { @@ -183,4 +181,4 @@ func (e SysPost) Delete(c *gin.Context) { return } e.OK(req.GetId(), "删除成功") -} +} \ No newline at end of file