diff --git a/config.yml b/config.yml index 9f37e8e..b37cce7 100644 --- a/config.yml +++ b/config.yml @@ -37,4 +37,4 @@ minio: # 文件存储初始化容量大小配置 oss: - capacitySize: 10 #文件存储初始化容量(单位G) \ No newline at end of file + capacitySize: 500 #文件存储初始化容量(单位MB) \ No newline at end of file diff --git a/main.go b/main.go index 6bc49bf..3e7e14e 100644 --- a/main.go +++ b/main.go @@ -23,7 +23,7 @@ func main() { controller.File, }) - gtimer.AddSingleton(ctx, time.Minute*1, func(ctx context.Context) { + gtimer.AddSingleton(ctx, time.Minute*5, func(ctx context.Context) { err := service.TenantOssTotal.UpdateUsedOssSize(ctx) if err != nil { glog.Error(ctx, "UpdateUsedOssSize err: %v", err) diff --git a/service/file_service.go b/service/file_service.go index a74c1e1..19c2fc1 100644 --- a/service/file_service.go +++ b/service/file_service.go @@ -59,7 +59,7 @@ func (f *file) UploadFile(ctx context.Context, req *dto.UploadFileReq) (res *dto if tenantOssTotal.Id.IsZero() { tenantOssTotalEntity.TenantId = user.TenantId tenantOssTotalEntity.UsedOssSize = 0 - tenantOssTotalEntity.TotalOssSize = g.Cfg().MustGet(ctx, "oss.capacitySize").Int() * 1024 * 1024 * 1024 + tenantOssTotalEntity.TotalOssSize = g.Cfg().MustGet(ctx, "oss.capacitySize").Int() * 1024 * 1024 } else { tenantOssTotalEntity = tenantOssTotal.TenantOssTotal } @@ -107,8 +107,7 @@ func (f *file) UploadFile(ctx context.Context, req *dto.UploadFileReq) (res *dto FileURL: fileURL, FileSize: fileSize, } - err = dao.File.Insert(ctx, ossEntity) - if err != nil { + if err = dao.File.Insert(ctx, ossEntity); err != nil { return nil, err } // 返回图片url