mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-04 22:51:47 +01:00
🎨 Improve upload assets tip
This commit is contained in:
parent
876e95ef27
commit
b9f1da33f0
7 changed files with 15 additions and 9 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue