生命周期的指令上传
This commit is contained in:
@@ -6,9 +6,13 @@ import (
|
||||
"net/http"
|
||||
"reflect"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
// 全局的BucketName
|
||||
var StorageBucketName = aws.String("storage.fusenpack.com")
|
||||
|
||||
const UploadFileLimitSize = 200 << 20
|
||||
|
||||
// File uploadfile 文件(multipart...)
|
||||
|
||||
@@ -52,10 +52,21 @@ func FormatS3KeyNameUser(userid int64, now time.Time, env string, category TypeC
|
||||
|
||||
switch category {
|
||||
case TCategoryPersonalization:
|
||||
// TODO:
|
||||
// /{env}/personalization/{userid}/{filename}
|
||||
return fmt.Sprintf("/%s/%s/%d/%s.%s", env, category, userid, name, ext)
|
||||
case TCategoryRenderMegre:
|
||||
// /{env}/render_megre/{userid}/{filename} 自动删除
|
||||
return fmt.Sprintf("/%s/%s/%d/%s_%d.%s", env, category, userid, name, now.Unix(), ext)
|
||||
case TCategory3DTools:
|
||||
// /{env}/3dtools/年月/{userid}/{filename}
|
||||
return fmt.Sprintf("/%s/%s/%04d%02d/%d/%s_%d.%s", env, category, year, int(month), userid, name, now.Unix(), ext)
|
||||
case TCategoryQuotation:
|
||||
// /{env}/quotation/年月/{userid}/{filename}
|
||||
return fmt.Sprintf("/%s/%s/%04d%02d/%d/%s_%d.%s", env, category, year, int(month), userid, name, now.Unix(), ext)
|
||||
default:
|
||||
return fmt.Sprintf("/%s/%s/%d/%04d%02d/%s_%d.%s", env, category, userid, year, int(month), name, now.Unix(), ext)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("/%s/%s/%d/%04d%02d/%s_%d.%s", env, category, userid, year, int(month), name, now.Unix(), ext)
|
||||
}
|
||||
|
||||
// FormatS3KeyNameGuest 游客的格式化存储
|
||||
@@ -69,5 +80,24 @@ func FormatS3KeyNameGuest(guestid int64, now time.Time, env string, category Typ
|
||||
name = names[0]
|
||||
ext = names[1]
|
||||
}
|
||||
return fmt.Sprintf("/%s/guest/%s/%d/%04d%02d/%s_%d.%s", env, category, guestid, year, int(month), name, now.Unix(), ext)
|
||||
|
||||
switch category {
|
||||
case TCategoryPersonalization:
|
||||
// /{env}/personalization/{guestid}/{filename}
|
||||
return fmt.Sprintf("/%s/%s/%d/%s.%s", env, category, guestid, name, ext)
|
||||
case TCategoryRenderMegre:
|
||||
// /{env}/render_megre/{guestid}/{filename} 自动删除
|
||||
return fmt.Sprintf("/%s/%s/%d/%s_%d.%s", env, category, guestid, name, now.Unix(), ext)
|
||||
case TCategory3DTools:
|
||||
panic(TCategory3DTools + "不存在游客")
|
||||
// /{env}/3dtools/年月/{guestid}/{filename}
|
||||
// return fmt.Sprintf("/%s/%s/%04d%02d/%d/%s_%d.%s", env, category, year, int(month), guestid, name, now.Unix(), ext)
|
||||
case TCategoryQuotation:
|
||||
panic(TCategoryQuotation + "不存在游客")
|
||||
// /{env}/quotation/年月/{guestid}/{filename}
|
||||
// return fmt.Sprintf("/%s/%s/%04d%02d/%d/%s_%d.%s", env, category, year, int(month), guestid, name, now.Unix(), ext)
|
||||
default:
|
||||
return fmt.Sprintf("/%s/%s/%d/%04d%02d/%s_%d.%s", env, category, guestid, year, int(month), name, now.Unix(), ext)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user