作者 tangxvhui

接口改动

... ... @@ -161,6 +161,10 @@ func (c *AdminUserController) ListAdminUser() {
"id": adminusers[i].Id,
"account": adminusers[i].Account,
"permission": permissionTypes,
"statue": 0,
}
if adminusers[i].IsUsable {
m["statue"] = 1
}
listData = append(listData, m)
}
... ... @@ -172,6 +176,7 @@ func (c *AdminUserController) ForbiddenAdminUser() {
//用与适配前端定义的数据结构
type Paramter struct {
Id int64 `json:"id"`
Statue int `json:"statue"`
}
var (
param Paramter
... ... @@ -183,7 +188,17 @@ func (c *AdminUserController) ForbiddenAdminUser() {
return
}
newAdminUserService := adminuserservice.NewAdminUserService(nil)
err = newAdminUserService.UpdateAdminIsUsable(param.Id, false)
var isUsable bool
if param.Statue == 1 {
isUsable = true
} else if param.Statue == 0 {
isUsable = false
} else {
c.ResponseError(errors.New("参数错误"))
return
}
err = newAdminUserService.UpdateAdminIsUsable(param.Id, isUsable)
if err != nil {
c.ResponseError(err)
return
... ...