🎨 Improve upload assets tip

This commit is contained in:
Daniel 2024-01-01 16:48:52 +08:00
parent 876e95ef27
commit b9f1da33f0
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
7 changed files with 15 additions and 9 deletions

View file

@ -17,6 +17,7 @@
package api
import (
"fmt"
"net/http"
"path/filepath"
"strings"
@ -257,14 +258,15 @@ func uploadCloud(c *gin.Context) {
}
rootID := arg["id"].(string)
err := model.UploadAssets2Cloud(rootID)
count, err := model.UploadAssets2Cloud(rootID)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
ret.Data = map[string]interface{}{"closeTimeout": 3000}
} else {
util.PushMsg(model.Conf.Language(41), 3000)
return
}
util.PushMsg(fmt.Sprintf(model.Conf.Language(41), count), 3000)
}
func insertLocalAssets(c *gin.Context) {

View file

@ -509,13 +509,17 @@ func GetAssetAbsPath(relativePath string) (ret string, err error) {
return "", errors.New(fmt.Sprintf(Conf.Language(12), relativePath))
}
func UploadAssets2Cloud(rootID string) (err error) {
func UploadAssets2Cloud(rootID string) (count int, err error) {
if !IsSubscriber() {
return
}
sqlAssets := sql.QueryRootBlockAssets(rootID)
err = uploadAssets2Cloud(sqlAssets, bizTypeUploadAssets)
if nil != err {
return
}
count = len(sqlAssets)
return
}