代码规范性优化

This commit is contained in:
qimiao
2021-09-16 10:19:54 +08:00
parent bca1bcb42d
commit 98c5e8d774
19 changed files with 72 additions and 9 deletions

View File

@@ -58,6 +58,9 @@ func (e *FileUploadAndDownloadService) DeleteFileChunk(fileMd5 string, fileName
var chunks []example.ExaFileChunk
var file example.ExaFile
err := global.GVA_DB.Where("file_md5 = ? AND file_name = ?", fileMd5, fileName).First(&file).Update("IsFinish", true).Update("file_path", filePath).Error
if err != nil {
return err
}
err = global.GVA_DB.Where("exa_file_id = ?", file.ID).Delete(&chunks).Unscoped().Error
return err
}

View File

@@ -68,6 +68,9 @@ func (exa *CustomerService) GetCustomerInfoList(sysUserAuthorityID string, info
var a system.SysAuthority
a.AuthorityId = sysUserAuthorityID
err, auth := systemService.AuthorityServiceApp.GetAuthorityInfo(a)
if err != nil {
return
}
var dataId []string
for _, v := range auth.DataAuthorityId {
dataId = append(dataId, v.AuthorityId)

View File

@@ -42,6 +42,9 @@ func (e *FileUploadAndDownloadService) FindFile(id uint) (error, example.ExaFile
func (e *FileUploadAndDownloadService) DeleteFile(file example.ExaFileUploadAndDownload) (err error) {
var fileFromDb example.ExaFileUploadAndDownload
err, fileFromDb = e.FindFile(file.ID)
if err != nil {
return
}
oss := upload.NewOss()
if err = oss.DeleteFile(fileFromDb.Key); err != nil {
return errors.New("文件删除失败")
@@ -62,6 +65,9 @@ func (e *FileUploadAndDownloadService) GetFileRecordInfoList(info request.PageIn
db := global.GVA_DB
var fileLists []example.ExaFileUploadAndDownload
err = db.Find(&fileLists).Count(&total).Error
if err != nil {
return
}
err = db.Limit(limit).Offset(offset).Order("updated_at desc").Find(&fileLists).Error
return err, fileLists, total
}