From a91e61ea7213370c57e21feea74cd9c1dcb5f58d Mon Sep 17 00:00:00 2001 From: pixel <303176530@qq.com> Date: Wed, 11 Nov 2020 09:59:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=8B=E5=A5=BD=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/v1/sys_authority.go | 12 ++++++------ server/api/v1/sys_user.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/api/v1/sys_authority.go b/server/api/v1/sys_authority.go index a38dda91..4b3f7149 100644 --- a/server/api/v1/sys_authority.go +++ b/server/api/v1/sys_authority.go @@ -28,7 +28,7 @@ func CreateAuthority(c *gin.Context) { } if err, authBack := service.CreateAuthority(authority); err != nil { global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) - response.FailWithMessage("创建失败", c) + response.FailWithMessage("创建失败"+err.Error(), c) } else { response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "创建成功", c) } @@ -55,7 +55,7 @@ func CopyAuthority(c *gin.Context) { } if err, authBack := service.CopyAuthority(copyInfo); err != nil { global.GVA_LOG.Error("拷贝失败!", zap.Any("err", err)) - response.FailWithMessage("拷贝失败", c) + response.FailWithMessage("拷贝失败"+err.Error(), c) } else { response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "拷贝成功", c) } @@ -78,7 +78,7 @@ func DeleteAuthority(c *gin.Context) { } if err := service.DeleteAuthority(&authority); err != nil { // 删除角色之前需要判断是否有用户正在使用此角色 global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) - response.FailWithMessage("删除失败", c) + response.FailWithMessage("删除失败"+err.Error(), c) } else { response.OkWithMessage("删除成功", c) } @@ -101,7 +101,7 @@ func UpdateAuthority(c *gin.Context) { } if err, authority := service.UpdateAuthority(auth); err != nil { global.GVA_LOG.Error("更新失败!", zap.Any("err", err)) - response.FailWithMessage("更新失败", c) + response.FailWithMessage("更新失败"+err.Error(), c) } else { response.OkWithDetailed(response.SysAuthorityResponse{Authority: authority}, "更新成功", c) } @@ -124,7 +124,7 @@ func GetAuthorityList(c *gin.Context) { } if err, list, total := service.GetAuthorityInfoList(pageInfo); err != nil { global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) - response.FailWithMessage("获取失败", c) + response.FailWithMessage("获取失败"+err.Error(), c) } else { response.OkWithDetailed(response.PageResult{ List: list, @@ -152,7 +152,7 @@ func SetDataAuthority(c *gin.Context) { } if err := service.SetDataAuthority(auth); err != nil { global.GVA_LOG.Error("设置失败!", zap.Any("err", err)) - response.FailWithMessage("设置失败", c) + response.FailWithMessage("设置失败"+err.Error(), c) } else { response.OkWithMessage("设置成功", c) } diff --git a/server/api/v1/sys_user.go b/server/api/v1/sys_user.go index e55214de..1d5d07a8 100644 --- a/server/api/v1/sys_user.go +++ b/server/api/v1/sys_user.go @@ -32,7 +32,7 @@ func Login(c *gin.Context) { U := &model.SysUser{Username: L.Username, Password: L.Password} if err, user := service.Login(U); err != nil { global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误", zap.Any("err", err)) - response.FailWithMessage("登陆失败!", c) + response.FailWithMessage("用户名不存在或者密码错误", c) } else { tokenNext(c, *user) }