@@ -2,7 +2,6 @@ package system
2
2
3
3
import (
4
4
"github.com/flipped-aurora/gin-vue-admin/server/global"
5
- "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
6
5
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
7
6
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
8
7
systemRes "github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
@@ -77,7 +76,8 @@ func (a *AuthorityApi) CopyAuthority(c *gin.Context) {
77
76
response .FailWithMessage (err .Error (), c )
78
77
return
79
78
}
80
- authBack , err := authorityService .CopyAuthority (copyInfo )
79
+ adminAuthorityID := utils .GetUserAuthorityId (c )
80
+ authBack , err := authorityService .CopyAuthority (adminAuthorityID , copyInfo )
81
81
if err != nil {
82
82
global .GVA_LOG .Error ("拷贝失败!" , zap .Error (err ))
83
83
response .FailWithMessage ("拷贝失败" + err .Error (), c )
@@ -124,7 +124,7 @@ func (a *AuthorityApi) DeleteAuthority(c *gin.Context) {
124
124
// @Produce application/json
125
125
// @Param data body system.SysAuthority true "权限id, 权限名, 父角色id"
126
126
// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg=string} "更新角色信息,返回包括系统角色详情"
127
- // @Router /authority/updateAuthority [post ]
127
+ // @Router /authority/updateAuthority [put ]
128
128
func (a * AuthorityApi ) UpdateAuthority (c * gin.Context ) {
129
129
var auth system.SysAuthority
130
130
err := c .ShouldBindJSON (& auth )
@@ -156,29 +156,14 @@ func (a *AuthorityApi) UpdateAuthority(c *gin.Context) {
156
156
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取角色列表,返回包括列表,总数,页码,每页数量"
157
157
// @Router /authority/getAuthorityList [post]
158
158
func (a * AuthorityApi ) GetAuthorityList (c * gin.Context ) {
159
- var pageInfo request.PageInfo
160
- err := c .ShouldBindJSON (& pageInfo )
161
- if err != nil {
162
- response .FailWithMessage (err .Error (), c )
163
- return
164
- }
165
- err = utils .Verify (pageInfo , utils .PageInfoVerify )
166
- if err != nil {
167
- response .FailWithMessage (err .Error (), c )
168
- return
169
- }
170
- list , total , err := authorityService .GetAuthorityInfoList (pageInfo )
159
+ authorityID := utils .GetUserAuthorityId (c )
160
+ list , err := authorityService .GetAuthorityInfoList (authorityID )
171
161
if err != nil {
172
162
global .GVA_LOG .Error ("获取失败!" , zap .Error (err ))
173
163
response .FailWithMessage ("获取失败" + err .Error (), c )
174
164
return
175
165
}
176
- response .OkWithDetailed (response.PageResult {
177
- List : list ,
178
- Total : total ,
179
- Page : pageInfo .Page ,
180
- PageSize : pageInfo .PageSize ,
181
- }, "获取成功" , c )
166
+ response .OkWithDetailed (list , "获取成功" , c )
182
167
}
183
168
184
169
// SetDataAuthority
@@ -202,7 +187,8 @@ func (a *AuthorityApi) SetDataAuthority(c *gin.Context) {
202
187
response .FailWithMessage (err .Error (), c )
203
188
return
204
189
}
205
- err = authorityService .SetDataAuthority (auth )
190
+ adminAuthorityID := utils .GetUserAuthorityId (c )
191
+ err = authorityService .SetDataAuthority (adminAuthorityID , auth )
206
192
if err != nil {
207
193
global .GVA_LOG .Error ("设置失败!" , zap .Error (err ))
208
194
response .FailWithMessage ("设置失败" + err .Error (), c )
0 commit comments