- GetQiniuUploadToken add fileName.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package cms
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/basesch"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
@@ -47,7 +51,7 @@ func GetServiceInfo() interface{} {
|
||||
return serviceInfo
|
||||
}
|
||||
|
||||
func GetQiniuUploadToken() (upTokenInfo map[string]interface{}, err error) {
|
||||
func GetQiniuUploadToken(suffix string) (upTokenInfo map[string]interface{}, err error) {
|
||||
putPolicy := storage.PutPolicy{
|
||||
Scope: globals.QiniuBucket,
|
||||
Expires: qiniuTokenExpires,
|
||||
@@ -55,5 +59,11 @@ func GetQiniuUploadToken() (upTokenInfo map[string]interface{}, err error) {
|
||||
upTokenInfo = make(map[string]interface{})
|
||||
upTokenInfo["token"] = putPolicy.UploadToken(api.QiniuAPI)
|
||||
upTokenInfo["expires"] = putPolicy.Expires
|
||||
upTokenInfo["fileName"] = genPicFileName(suffix)
|
||||
return upTokenInfo, err
|
||||
}
|
||||
|
||||
/////
|
||||
func genPicFileName(suffix string) string {
|
||||
return fmt.Sprintf("%x%s", md5.Sum([]byte(utils.GetUUID()+suffix)), suffix)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user