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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
5 additions and
5 deletions
-
server/service/example/exa_file_upload_download.go
-
server/service/system/sys_autocode_history.go
-
server/service/system/sys_casbin.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) { |
|
|
|
limit := info.PageSize |
|
|
|
offset := info.PageSize * (info.Page - 1) |
|
|
|
db := global.GVA_DB |
|
|
|
db := global.GVA_DB.Model(&example.ExaFileUploadAndDownload{}) |
|
|
|
var fileLists []example.ExaFileUploadAndDownload |
|
|
|
err = db.Find(&fileLists).Count(&total).Error |
|
|
|
err = db.Count(&total).Error |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
@ -108,9 +108,9 @@ func (autoCodeHistoryService *AutoCodeHistoryService) GetMeta(id uint) (string, |
|
|
|
func (autoCodeHistoryService *AutoCodeHistoryService) GetSysHistoryPage(info request.PageInfo) (err error, list interface{}, total int64) { |
|
|
|
limit := info.PageSize |
|
|
|
offset := info.PageSize * (info.Page - 1) |
|
|
|
db := global.GVA_DB |
|
|
|
db := global.GVA_DB.Model(&system.SysAutoCodeHistory{}) |
|
|
|
var fileLists []system.SysAutoCodeHistory |
|
|
|
err = db.Find(&fileLists).Count(&total).Error |
|
|
|
err = db.Count(&total).Error |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
@ -39,7 +39,7 @@ func (casbinService *CasbinService) UpdateCasbin(authorityId string, casbinInfos |
|
|
|
} |
|
|
|
e := casbinService.Casbin() |
|
|
|
success, _ := e.AddPolicies(rules) |
|
|
|
if success == false { |
|
|
|
if !success { |
|
|
|
return errors.New("存在相同api,添加失败,请联系管理员") |
|
|
|
} |
|
|
|
return nil |
|
|
|