upload 上传 签名 直接上传都可以
This commit is contained in:
@@ -60,7 +60,7 @@ func (info *UserInfo) IsGuest() bool {
|
||||
|
||||
// IsOnlooker 白板用户: 非登录用户, 非游客, 判断为白板用户
|
||||
func (info *UserInfo) IsOnlooker() bool {
|
||||
return info.UserId != 0 && info.GuestId != 0
|
||||
return info.UserId == 0 && info.GuestId == 0
|
||||
}
|
||||
|
||||
type BackendUserInfo struct {
|
||||
|
||||
@@ -13,6 +13,9 @@ import (
|
||||
// 全局的BucketName
|
||||
var StorageBucketName = aws.String("storage.fusenpack.com")
|
||||
|
||||
// 全局的BucketName 缓存使用
|
||||
var TempfileBucketName = aws.String("tempfile.fusenpack.com")
|
||||
|
||||
const UploadFileLimitSize = 200 << 20
|
||||
|
||||
// File uploadfile 文件(multipart...)
|
||||
|
||||
@@ -56,15 +56,15 @@ func FormatS3KeyNameUser(userid int64, now time.Time, env string, category TypeC
|
||||
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)
|
||||
return fmt.Sprintf("/%s/%s/%d/%s_%d.%s", env, category, userid, name, now.UnixNano(), 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)
|
||||
return fmt.Sprintf("/%s/%s/%04d%02d/%d/%s_%d.%s", env, category, year, int(month), userid, name, now.UnixNano(), 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)
|
||||
return fmt.Sprintf("/%s/%s/%04d%02d/%d/%s_%d.%s", env, category, year, int(month), userid, name, now.UnixNano(), 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.UnixNano(), ext)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -87,17 +87,17 @@ func FormatS3KeyNameGuest(guestid int64, now time.Time, env string, category Typ
|
||||
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)
|
||||
return fmt.Sprintf("/%s/%s/%d/%s_%d.%s", env, category, guestid, name, now.UnixNano(), 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)
|
||||
// return fmt.Sprintf("/%s/%s/%04d%02d/%d/%s_%d.%s", env, category, year, int(month), guestid, name, now.UnixNano(), 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)
|
||||
// return fmt.Sprintf("/%s/%s/%04d%02d/%d/%s_%d.%s", env, category, year, int(month), guestid, name, now.UnixNano(), ext)
|
||||
default:
|
||||
return fmt.Sprintf("/%s/%s/%d/%04d%02d/%s_%d.%s", env, category, guestid, year, int(month), name, now.Unix(), ext)
|
||||
return fmt.Sprintf("/%s/%s/%d/%04d%02d/%s_%d.%s", env, category, guestid, year, int(month), name, now.UnixNano(), ext)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user