Browse Source

消除冗余代码 细节提示修复

main
pixel 5 years ago
parent
commit
e440b27216
  1. 2
      server/api/v1/exa_customer.go
  2. 4
      server/service/exa_customer.go
  3. 4
      server/service/exa_file_upload_download.go
  4. 5
      server/service/sys_api.go
  5. 4
      server/service/sys_authority.go
  6. 4
      server/service/sys_menu.go
  7. 4
      server/service/sys_user.go

2
server/api/v1/exa_customer.go

@ -105,7 +105,7 @@ func GetExaCustomerList(c *gin.Context) {
_ = c.ShouldBindJSON(&pageInfo)
err, customerList, total := service.GetCustomerInfoList(waitUse.AuthorityId, pageInfo)
if err != nil {
response.FailWithMessage(fmt.Sprintf("创建失败:%v", err), c)
response.FailWithMessage(fmt.Sprintf("获取失败:%v", err), c)
} else {
response.OkWithData(resp.PageResult{
List: customerList,

4
server/service/exa_customer.go

@ -52,9 +52,6 @@ func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
if err != nil {
return
} else {
var a model.SysAuthority
a.AuthorityId = sysUserAuthorityID
err, auth := GetAuthorityInfo(a)
@ -71,4 +68,3 @@ func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err
}
return err, CustomerList, total
}
}

4
server/service/exa_file_upload_download.go

@ -45,11 +45,7 @@ func GetFileRecordInfoList(info request.PageInfo) (err error, list interface{},
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
if err != nil {
return
} else {
var fileLists []model.ExaFileUploadAndDownload
err = db.Limit(limit).Offset(offset).Order("updated_at desc").Find(&fileLists).Error
return err, fileLists, total
}
}

5
server/service/sys_api.go

@ -45,10 +45,6 @@ func GetAPIInfoList(a model.SysApi, info request.PageInfo, Order string, Desc bo
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
if err != nil {
return
} else {
var apiList []model.SysApi
if a.Path != "" {
@ -83,7 +79,6 @@ func GetAPIInfoList(a model.SysApi, info request.PageInfo, Order string, Desc bo
}
return err, apiList, total
}
}
// @title GetAllApis
// @description get all apis, 获取所有的api

4
server/service/sys_authority.go

@ -60,9 +60,6 @@ func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, t
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
if err != nil {
return
} else {
var authority []model.SysAuthority
err = db.Limit(limit).Offset(offset).Preload("DataAuthorityId").Where("parent_id = 0").Find(&authority).Error
if len(authority) > 0 {
@ -72,7 +69,6 @@ func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, t
}
return err, authority, total
}
}
// @title GetAuthorityInfo
// @description 获取所有角色信息

4
server/service/sys_menu.go

@ -46,9 +46,6 @@ func GetInfoList(info request.PageInfo) (err error, list interface{}, total int)
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
if err != nil {
return
} else {
var menuList []model.SysBaseMenu
err = db.Limit(limit).Offset(offset).Where("parent_id = 0").Order("sort", true).Find(&menuList).Error
for i := 0; i < len(menuList); i++ {
@ -56,7 +53,6 @@ func GetInfoList(info request.PageInfo) (err error, list interface{}, total int)
}
return err, menuList, total
}
}
// @title getBaseChildrenList
// @description get children of menu, 获取菜单的子菜单

4
server/service/sys_user.go

@ -71,14 +71,10 @@ func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
if err != nil {
return
} else {
var userList []model.SysUser
err = db.Limit(limit).Offset(offset).Preload("Authority").Find(&userList).Error
return err, userList, total
}
}
// @title SetUserAuthority
// @description set the authority of a certain user, 设置一个用户的权限

Loading…
Cancel
Save