mirror of https://github.com/Xhofe/alist
🎇 139yun family support
parent
602994e213
commit
ddf6a4955f
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/Xhofe/alist/utils"
|
||||
"github.com/go-resty/resty/v2"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"path"
|
||||
"time"
|
||||
)
|
||||
|
@ -18,11 +19,16 @@ func (driver Cloud139) Request(pathname string, method int, headers, query, form
|
|||
req := base.RestyClient.R()
|
||||
randStr := randomStr(16)
|
||||
ts := time.Now().Format("2006-01-02 15:04:05")
|
||||
log.Debugf("%+v", data)
|
||||
body, err := utils.Json.Marshal(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sign := calSign(string(body), ts, randStr)
|
||||
svcType := "1"
|
||||
if isFamily(account) {
|
||||
svcType = "2"
|
||||
}
|
||||
req.SetHeaders(map[string]string{
|
||||
"Accept": "application/json, text/plain, */*",
|
||||
"CMS-DEVICE": "default",
|
||||
|
@ -40,7 +46,7 @@ func (driver Cloud139) Request(pathname string, method int, headers, query, form
|
|||
"x-inner-ntwk": "2",
|
||||
"x-m4c-caller": "PC",
|
||||
"x-m4c-src": "10002",
|
||||
"x-SvcType": "1",
|
||||
"x-SvcType": svcType,
|
||||
})
|
||||
if headers != nil {
|
||||
req.SetHeaders(headers)
|
||||
|
@ -75,6 +81,7 @@ func (driver Cloud139) Request(pathname string, method int, headers, query, form
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Debugln(res.String())
|
||||
if !e.Success {
|
||||
return nil, errors.New(e.Message)
|
||||
}
|
||||
|
|
|
@ -54,6 +54,12 @@ func (driver Cloud139) Items() []base.Item {
|
|||
Type: base.TypeString,
|
||||
Required: true,
|
||||
},
|
||||
{
|
||||
Name: "site_id",
|
||||
Label: "cloud_id",
|
||||
Type: base.TypeString,
|
||||
Required: false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +111,11 @@ func (driver Cloud139) Files(path string, account *model.Account) ([]model.File,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
files, err = driver.GetFiles(file.Id, account)
|
||||
if isFamily(account) {
|
||||
files, err = driver.familyGetFiles(file.Id, account)
|
||||
} else {
|
||||
files, err = driver.GetFiles(file.Id, account)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -169,12 +179,26 @@ func (driver Cloud139) MakeDir(path string, account *model.Account) error {
|
|||
},
|
||||
}
|
||||
pathname := "/orchestration/personalCloud/catalog/v1.0/createCatalogExt"
|
||||
if isFamily(account) {
|
||||
data = base.Json{
|
||||
"cloudID": account.SiteId,
|
||||
"commonAccountInfo": base.Json{
|
||||
"account": account.Username,
|
||||
"accountType": 1,
|
||||
},
|
||||
"docLibName": utils.Base(path),
|
||||
}
|
||||
pathname = "/orchestration/familyCloud/cloudCatalog/v1.0/createCloudDoc"
|
||||
}
|
||||
_, err = driver.Post(pathname,
|
||||
data, nil, account)
|
||||
return err
|
||||
}
|
||||
|
||||
func (driver Cloud139) Move(src string, dst string, account *model.Account) error {
|
||||
if isFamily(account) {
|
||||
return base.ErrNotSupport
|
||||
}
|
||||
srcFile, err := driver.File(src, account)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -211,6 +235,9 @@ func (driver Cloud139) Move(src string, dst string, account *model.Account) erro
|
|||
}
|
||||
|
||||
func (driver Cloud139) Rename(src string, dst string, account *model.Account) error {
|
||||
if isFamily(account) {
|
||||
return base.ErrNotSupport
|
||||
}
|
||||
srcFile, err := driver.File(src, account)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -243,6 +270,9 @@ func (driver Cloud139) Rename(src string, dst string, account *model.Account) er
|
|||
}
|
||||
|
||||
func (driver Cloud139) Copy(src string, dst string, account *model.Account) error {
|
||||
if isFamily(account) {
|
||||
return base.ErrNotSupport
|
||||
}
|
||||
srcFile, err := driver.File(src, account)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -251,19 +281,21 @@ func (driver Cloud139) Copy(src string, dst string, account *model.Account) erro
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
argName := "contentInfoList"
|
||||
var contentInfoList []string
|
||||
var catalogInfoList []string
|
||||
if srcFile.IsDir() {
|
||||
argName = "catalogInfoList"
|
||||
catalogInfoList = append(catalogInfoList, srcFile.Id)
|
||||
} else {
|
||||
contentInfoList = append(contentInfoList, srcFile.Id)
|
||||
}
|
||||
data := base.Json{
|
||||
"createBatchOprTaskReq": base.Json{
|
||||
"taskType": 3,
|
||||
"actionType": 309,
|
||||
"taskInfo": base.Json{
|
||||
"contentInfoList": []string{},
|
||||
"catalogInfoList": []string{},
|
||||
"contentInfoList": contentInfoList,
|
||||
"catalogInfoList": catalogInfoList,
|
||||
"newCatalogID": dstParentFile.Id,
|
||||
argName: []string{srcFile.Id},
|
||||
},
|
||||
"commonAccountInfo": base.Json{
|
||||
"account": "18627147660",
|
||||
|
@ -281,17 +313,21 @@ func (driver Cloud139) Delete(path string, account *model.Account) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
argName := "contentInfoList"
|
||||
var contentInfoList []string
|
||||
var catalogInfoList []string
|
||||
if file.IsDir() {
|
||||
argName = "catalogInfoList"
|
||||
catalogInfoList = append(catalogInfoList, file.Id)
|
||||
} else {
|
||||
contentInfoList = append(contentInfoList, file.Id)
|
||||
}
|
||||
data := base.Json{
|
||||
"createBatchOprTaskReq": base.Json{
|
||||
"taskType": 2,
|
||||
"actionType": 201,
|
||||
"taskInfo": base.Json{
|
||||
"newCatalogID": "",
|
||||
argName: []string{file.Id},
|
||||
"newCatalogID": "",
|
||||
"contentInfoList": contentInfoList,
|
||||
"catalogInfoList": contentInfoList,
|
||||
},
|
||||
"commonAccountInfo": base.Json{
|
||||
"account": "18627147660",
|
||||
|
@ -300,6 +336,19 @@ func (driver Cloud139) Delete(path string, account *model.Account) error {
|
|||
},
|
||||
}
|
||||
pathname := "/orchestration/personalCloud/batchOprTask/v1.0/createBatchOprTask"
|
||||
if isFamily(account) {
|
||||
data = base.Json{
|
||||
"catalogList": catalogInfoList,
|
||||
"contentList": contentInfoList,
|
||||
"commonAccountInfo": base.Json{
|
||||
"account": "18627147660",
|
||||
"accountType": 1,
|
||||
},
|
||||
"sourceCatalogType": 1002,
|
||||
"taskType": 2,
|
||||
}
|
||||
pathname = "/orchestration/familyCloud/batchOprTask/v1.0/createBatchOprTask"
|
||||
}
|
||||
_, err = driver.Post(pathname, data, nil, account)
|
||||
return err
|
||||
}
|
||||
|
@ -333,6 +382,23 @@ func (driver Cloud139) Upload(file *model.FileStream, account *model.Account) er
|
|||
},
|
||||
}
|
||||
pathname := "/orchestration/personalCloud/uploadAndDownload/v1.0/pcUploadFileRequest"
|
||||
if isFamily(account) {
|
||||
data = newJson(base.Json{
|
||||
"fileCount": 1,
|
||||
"manualRename": 2,
|
||||
"operation": 0,
|
||||
"path": "",
|
||||
"seqNo": "",
|
||||
"totalSize": file.Size,
|
||||
"uploadContentList": []base.Json{{
|
||||
"contentName": file.Name,
|
||||
"contentSize": file.Size,
|
||||
// "digest": "5a3231986ce7a6b46e408612d385bafa"
|
||||
}},
|
||||
}, account)
|
||||
pathname = "/orchestration/familyCloud/content/v1.0/getFileUploadURL"
|
||||
return base.ErrNotSupport
|
||||
}
|
||||
var resp UploadResp
|
||||
_, err = driver.Post(pathname, data, &resp, account)
|
||||
if err != nil {
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package _39
|
||||
|
||||
import (
|
||||
"github.com/Xhofe/alist/conf"
|
||||
"github.com/Xhofe/alist/drivers/base"
|
||||
"github.com/Xhofe/alist/model"
|
||||
"github.com/Xhofe/alist/utils"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"path"
|
||||
)
|
||||
|
||||
func (driver Cloud139) familyGetFiles(catalogID string, account *model.Account) ([]model.File, error) {
|
||||
pageNum := 1
|
||||
files := make([]model.File, 0)
|
||||
for {
|
||||
data := newJson(base.Json{
|
||||
"catalogID": catalogID,
|
||||
"contentSortType": 0,
|
||||
"pageInfo": base.Json{
|
||||
"pageNum": pageNum,
|
||||
"pageSize": 100,
|
||||
},
|
||||
"sortDirection": 1,
|
||||
}, account)
|
||||
|
||||
var resp QueryContentListResp
|
||||
_, err := driver.Post("/orchestration/familyCloud/content/v1.0/queryContentList", data, &resp, account)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, catalog := range resp.Data.CloudCatalogList {
|
||||
f := model.File{
|
||||
Id: catalog.CatalogID,
|
||||
Name: catalog.CatalogName,
|
||||
Size: 0,
|
||||
Type: conf.FOLDER,
|
||||
Driver: driver.Config().Name,
|
||||
UpdatedAt: getTime(catalog.LastUpdateTime),
|
||||
}
|
||||
files = append(files, f)
|
||||
}
|
||||
for _, content := range resp.Data.CloudContentList {
|
||||
f := model.File{
|
||||
Id: content.ContentID,
|
||||
Name: content.ContentName,
|
||||
Size: int64(content.ContentSize),
|
||||
Type: utils.GetFileType(path.Ext(content.ContentName)),
|
||||
Driver: driver.Config().Name,
|
||||
UpdatedAt: getTime(content.LastUpdateTime),
|
||||
Thumbnail: content.ThumbnailURL,
|
||||
//Thumbnail: content.BigthumbnailURL,
|
||||
}
|
||||
files = append(files, f)
|
||||
}
|
||||
if 100*pageNum > resp.Data.TotalCount {
|
||||
break
|
||||
}
|
||||
pageNum++
|
||||
}
|
||||
return files, nil
|
||||
}
|
||||
|
||||
func (driver Cloud139) familyLink(contentId string, account *model.Account) (string, error) {
|
||||
data := newJson(base.Json{
|
||||
"contentID": contentId,
|
||||
//"path":"",
|
||||
}, account)
|
||||
res, err := driver.Post("/orchestration/familyCloud/content/v1.0/getFileDownLoadURL",
|
||||
data, nil, account)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return jsoniter.Get(res, "data", "downloadURL").ToString(), nil
|
||||
}
|
|
@ -7,87 +7,87 @@ type BaseResp struct {
|
|||
}
|
||||
|
||||
type Catalog struct {
|
||||
CatalogID string `json:"catalogID"`
|
||||
CatalogName string `json:"catalogName"`
|
||||
CatalogType int `json:"catalogType"`
|
||||
CreateTime string `json:"createTime"`
|
||||
UpdateTime string `json:"updateTime"`
|
||||
IsShared bool `json:"isShared"`
|
||||
CatalogLevel int `json:"catalogLevel"`
|
||||
ShareDoneeCount int `json:"shareDoneeCount"`
|
||||
OpenType int `json:"openType"`
|
||||
ParentCatalogID string `json:"parentCatalogId"`
|
||||
DirEtag int `json:"dirEtag"`
|
||||
Tombstoned int `json:"tombstoned"`
|
||||
ProxyID interface{} `json:"proxyID"`
|
||||
Moved int `json:"moved"`
|
||||
IsFixedDir int `json:"isFixedDir"`
|
||||
IsSynced interface{} `json:"isSynced"`
|
||||
Owner string `json:"owner"`
|
||||
Modifier interface{} `json:"modifier"`
|
||||
Path string `json:"path"`
|
||||
ShareType int `json:"shareType"`
|
||||
SoftLink interface{} `json:"softLink"`
|
||||
ExtProp1 interface{} `json:"extProp1"`
|
||||
ExtProp2 interface{} `json:"extProp2"`
|
||||
ExtProp3 interface{} `json:"extProp3"`
|
||||
ExtProp4 interface{} `json:"extProp4"`
|
||||
ExtProp5 interface{} `json:"extProp5"`
|
||||
ETagOprType int `json:"ETagOprType"`
|
||||
CatalogID string `json:"catalogID"`
|
||||
CatalogName string `json:"catalogName"`
|
||||
//CatalogType int `json:"catalogType"`
|
||||
//CreateTime string `json:"createTime"`
|
||||
UpdateTime string `json:"updateTime"`
|
||||
//IsShared bool `json:"isShared"`
|
||||
//CatalogLevel int `json:"catalogLevel"`
|
||||
//ShareDoneeCount int `json:"shareDoneeCount"`
|
||||
//OpenType int `json:"openType"`
|
||||
//ParentCatalogID string `json:"parentCatalogId"`
|
||||
//DirEtag int `json:"dirEtag"`
|
||||
//Tombstoned int `json:"tombstoned"`
|
||||
//ProxyID interface{} `json:"proxyID"`
|
||||
//Moved int `json:"moved"`
|
||||
//IsFixedDir int `json:"isFixedDir"`
|
||||
//IsSynced interface{} `json:"isSynced"`
|
||||
//Owner string `json:"owner"`
|
||||
//Modifier interface{} `json:"modifier"`
|
||||
//Path string `json:"path"`
|
||||
//ShareType int `json:"shareType"`
|
||||
//SoftLink interface{} `json:"softLink"`
|
||||
//ExtProp1 interface{} `json:"extProp1"`
|
||||
//ExtProp2 interface{} `json:"extProp2"`
|
||||
//ExtProp3 interface{} `json:"extProp3"`
|
||||
//ExtProp4 interface{} `json:"extProp4"`
|
||||
//ExtProp5 interface{} `json:"extProp5"`
|
||||
//ETagOprType int `json:"ETagOprType"`
|
||||
}
|
||||
|
||||
type Content struct {
|
||||
ContentID string `json:"contentID"`
|
||||
ContentName string `json:"contentName"`
|
||||
ContentSuffix string `json:"contentSuffix"`
|
||||
ContentSize int `json:"contentSize"`
|
||||
ContentDesc string `json:"contentDesc"`
|
||||
ContentType int `json:"contentType"`
|
||||
ContentOrigin int `json:"contentOrigin"`
|
||||
UpdateTime string `json:"updateTime"`
|
||||
CommentCount int `json:"commentCount"`
|
||||
ThumbnailURL string `json:"thumbnailURL"`
|
||||
BigthumbnailURL string `json:"bigthumbnailURL"`
|
||||
PresentURL string `json:"presentURL"`
|
||||
PresentLURL string `json:"presentLURL"`
|
||||
PresentHURL string `json:"presentHURL"`
|
||||
ContentTAGList interface{} `json:"contentTAGList"`
|
||||
ShareDoneeCount int `json:"shareDoneeCount"`
|
||||
Safestate int `json:"safestate"`
|
||||
Transferstate int `json:"transferstate"`
|
||||
IsFocusContent int `json:"isFocusContent"`
|
||||
UpdateShareTime interface{} `json:"updateShareTime"`
|
||||
UploadTime string `json:"uploadTime"`
|
||||
OpenType int `json:"openType"`
|
||||
AuditResult int `json:"auditResult"`
|
||||
ParentCatalogID string `json:"parentCatalogId"`
|
||||
Channel string `json:"channel"`
|
||||
GeoLocFlag string `json:"geoLocFlag"`
|
||||
Digest string `json:"digest"`
|
||||
Version string `json:"version"`
|
||||
FileEtag string `json:"fileEtag"`
|
||||
FileVersion string `json:"fileVersion"`
|
||||
Tombstoned int `json:"tombstoned"`
|
||||
ProxyID string `json:"proxyID"`
|
||||
Moved int `json:"moved"`
|
||||
MidthumbnailURL string `json:"midthumbnailURL"`
|
||||
Owner string `json:"owner"`
|
||||
Modifier string `json:"modifier"`
|
||||
ShareType int `json:"shareType"`
|
||||
ExtInfo struct {
|
||||
Uploader string `json:"uploader"`
|
||||
Address string `json:"address"`
|
||||
} `json:"extInfo"`
|
||||
Exif struct {
|
||||
CreateTime string `json:"createTime"`
|
||||
Longitude interface{} `json:"longitude"`
|
||||
Latitude interface{} `json:"latitude"`
|
||||
LocalSaveTime interface{} `json:"localSaveTime"`
|
||||
} `json:"exif"`
|
||||
CollectionFlag interface{} `json:"collectionFlag"`
|
||||
TreeInfo interface{} `json:"treeInfo"`
|
||||
IsShared bool `json:"isShared"`
|
||||
ETagOprType int `json:"ETagOprType"`
|
||||
ContentID string `json:"contentID"`
|
||||
ContentName string `json:"contentName"`
|
||||
//ContentSuffix string `json:"contentSuffix"`
|
||||
ContentSize int `json:"contentSize"`
|
||||
//ContentDesc string `json:"contentDesc"`
|
||||
//ContentType int `json:"contentType"`
|
||||
//ContentOrigin int `json:"contentOrigin"`
|
||||
UpdateTime string `json:"updateTime"`
|
||||
//CommentCount int `json:"commentCount"`
|
||||
ThumbnailURL string `json:"thumbnailURL"`
|
||||
//BigthumbnailURL string `json:"bigthumbnailURL"`
|
||||
//PresentURL string `json:"presentURL"`
|
||||
//PresentLURL string `json:"presentLURL"`
|
||||
//PresentHURL string `json:"presentHURL"`
|
||||
//ContentTAGList interface{} `json:"contentTAGList"`
|
||||
//ShareDoneeCount int `json:"shareDoneeCount"`
|
||||
//Safestate int `json:"safestate"`
|
||||
//Transferstate int `json:"transferstate"`
|
||||
//IsFocusContent int `json:"isFocusContent"`
|
||||
//UpdateShareTime interface{} `json:"updateShareTime"`
|
||||
//UploadTime string `json:"uploadTime"`
|
||||
//OpenType int `json:"openType"`
|
||||
//AuditResult int `json:"auditResult"`
|
||||
//ParentCatalogID string `json:"parentCatalogId"`
|
||||
//Channel string `json:"channel"`
|
||||
//GeoLocFlag string `json:"geoLocFlag"`
|
||||
//Digest string `json:"digest"`
|
||||
//Version string `json:"version"`
|
||||
//FileEtag string `json:"fileEtag"`
|
||||
//FileVersion string `json:"fileVersion"`
|
||||
//Tombstoned int `json:"tombstoned"`
|
||||
//ProxyID string `json:"proxyID"`
|
||||
//Moved int `json:"moved"`
|
||||
//MidthumbnailURL string `json:"midthumbnailURL"`
|
||||
//Owner string `json:"owner"`
|
||||
//Modifier string `json:"modifier"`
|
||||
//ShareType int `json:"shareType"`
|
||||
//ExtInfo struct {
|
||||
// Uploader string `json:"uploader"`
|
||||
// Address string `json:"address"`
|
||||
//} `json:"extInfo"`
|
||||
//Exif struct {
|
||||
// CreateTime string `json:"createTime"`
|
||||
// Longitude interface{} `json:"longitude"`
|
||||
// Latitude interface{} `json:"latitude"`
|
||||
// LocalSaveTime interface{} `json:"localSaveTime"`
|
||||
//} `json:"exif"`
|
||||
//CollectionFlag interface{} `json:"collectionFlag"`
|
||||
//TreeInfo interface{} `json:"treeInfo"`
|
||||
//IsShared bool `json:"isShared"`
|
||||
//ETagOprType int `json:"ETagOprType"`
|
||||
}
|
||||
|
||||
type GetDiskResp struct {
|
||||
|
@ -130,3 +130,58 @@ type UploadResp struct {
|
|||
} `json:"uploadResult"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type CloudContent struct {
|
||||
ContentID string `json:"contentID"`
|
||||
Modifier string `json:"modifier"`
|
||||
Nickname string `json:"nickname"`
|
||||
CloudNickName string `json:"cloudNickName"`
|
||||
ContentName string `json:"contentName"`
|
||||
ContentType int `json:"contentType"`
|
||||
ContentSuffix string `json:"contentSuffix"`
|
||||
ContentSize int `json:"contentSize"`
|
||||
ContentDesc string `json:"contentDesc"`
|
||||
CreateTime string `json:"createTime"`
|
||||
Shottime interface{} `json:"shottime"`
|
||||
LastUpdateTime string `json:"lastUpdateTime"`
|
||||
ThumbnailURL string `json:"thumbnailURL"`
|
||||
MidthumbnailURL string `json:"midthumbnailURL"`
|
||||
BigthumbnailURL string `json:"bigthumbnailURL"`
|
||||
PresentURL string `json:"presentURL"`
|
||||
PresentLURL string `json:"presentLURL"`
|
||||
PresentHURL string `json:"presentHURL"`
|
||||
ParentCatalogID string `json:"parentCatalogID"`
|
||||
Uploader string `json:"uploader"`
|
||||
UploaderNickName string `json:"uploaderNickName"`
|
||||
TreeInfo interface{} `json:"treeInfo"`
|
||||
UpdateTime interface{} `json:"updateTime"`
|
||||
ExtInfo struct {
|
||||
Uploader string `json:"uploader"`
|
||||
} `json:"extInfo"`
|
||||
EtagOprType interface{} `json:"etagOprType"`
|
||||
}
|
||||
|
||||
type CloudCatalog struct {
|
||||
CatalogID string `json:"catalogID"`
|
||||
CatalogName string `json:"catalogName"`
|
||||
CloudID string `json:"cloudID"`
|
||||
CreateTime string `json:"createTime"`
|
||||
LastUpdateTime string `json:"lastUpdateTime"`
|
||||
Creator string `json:"creator"`
|
||||
CreatorNickname string `json:"creatorNickname"`
|
||||
}
|
||||
|
||||
type QueryContentListResp struct {
|
||||
BaseResp
|
||||
Data struct {
|
||||
Result struct {
|
||||
ResultCode string `json:"resultCode"`
|
||||
ResultDesc string `json:"resultDesc"`
|
||||
} `json:"result"`
|
||||
Path string `json:"path"`
|
||||
CloudContentList []CloudContent `json:"cloudContentList"`
|
||||
CloudCatalogList []CloudCatalog `json:"cloudCatalogList"`
|
||||
TotalCount int `json:"totalCount"`
|
||||
RecallContent interface{} `json:"recallContent"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package _39
|
|||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"github.com/Xhofe/alist/drivers/base"
|
||||
"github.com/Xhofe/alist/model"
|
||||
"github.com/Xhofe/alist/utils"
|
||||
"math/rand"
|
||||
|
@ -55,3 +56,26 @@ func unicode(str string) string {
|
|||
textUnquoted := textQuoted[1 : len(textQuoted)-1]
|
||||
return textUnquoted
|
||||
}
|
||||
|
||||
func MergeMap(mObj ...map[string]interface{}) map[string]interface{} {
|
||||
newObj := map[string]interface{}{}
|
||||
for _, m := range mObj {
|
||||
for k, v := range m {
|
||||
newObj[k] = v
|
||||
}
|
||||
}
|
||||
return newObj
|
||||
}
|
||||
|
||||
func newJson(data map[string]interface{}, account *model.Account) map[string]interface{} {
|
||||
common := map[string]interface{}{
|
||||
"catalogType": 3,
|
||||
"cloudID": account.SiteId,
|
||||
"cloudType": 1,
|
||||
"commonAccountInfo": base.Json{
|
||||
"account": account.Username,
|
||||
"accountType": 1,
|
||||
},
|
||||
}
|
||||
return MergeMap(data, common)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue