Browse Source

Merge pull request #719 from SliverHorn/sliver_horn_develop

fixed: Find两次数据库, db := global.GVA_DB加上Model 防止Count报错
main
奇淼(piexlmax 3 years ago
committed by GitHub
parent
commit
d93e05fcff
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      server/service/example/exa_file_upload_download.go
  2. 4
      server/service/system/sys_autocode_history.go
  3. 2
      server/service/system/sys_casbin.go

4
server/service/example/exa_file_upload_download.go

@ -62,9 +62,9 @@ func (e *FileUploadAndDownloadService) DeleteFile(file example.ExaFileUploadAndD
func (e *FileUploadAndDownloadService) GetFileRecordInfoList(info request.PageInfo) (err error, list interface{}, total int64) { func (e *FileUploadAndDownloadService) GetFileRecordInfoList(info request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize limit := info.PageSize
offset := info.PageSize * (info.Page - 1) offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
db := global.GVA_DB.Model(&example.ExaFileUploadAndDownload{})
var fileLists []example.ExaFileUploadAndDownload var fileLists []example.ExaFileUploadAndDownload
err = db.Find(&fileLists).Count(&total).Error
err = db.Count(&total).Error
if err != nil { if err != nil {
return return
} }

4
server/service/system/sys_autocode_history.go

@ -108,9 +108,9 @@ func (autoCodeHistoryService *AutoCodeHistoryService) GetMeta(id uint) (string,
func (autoCodeHistoryService *AutoCodeHistoryService) GetSysHistoryPage(info request.PageInfo) (err error, list interface{}, total int64) { func (autoCodeHistoryService *AutoCodeHistoryService) GetSysHistoryPage(info request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize limit := info.PageSize
offset := info.PageSize * (info.Page - 1) offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
db := global.GVA_DB.Model(&system.SysAutoCodeHistory{})
var fileLists []system.SysAutoCodeHistory var fileLists []system.SysAutoCodeHistory
err = db.Find(&fileLists).Count(&total).Error
err = db.Count(&total).Error
if err != nil { if err != nil {
return return
} }

2
server/service/system/sys_casbin.go

@ -39,7 +39,7 @@ func (casbinService *CasbinService) UpdateCasbin(authorityId string, casbinInfos
} }
e := casbinService.Casbin() e := casbinService.Casbin()
success, _ := e.AddPolicies(rules) success, _ := e.AddPolicies(rules)
if success == false {
if !success {
return errors.New("存在相同api,添加失败,请联系管理员") return errors.New("存在相同api,添加失败,请联系管理员")
} }
return nil return nil

Loading…
Cancel
Save