fix(mopan): parameter error (#5091)

This commit is contained in:
foxxorcat
2023-08-25 14:10:05 +08:00
committed by GitHub
parent 31a033dff1
commit 8f493cccc4
4 changed files with 16 additions and 2 deletions

View File

@ -18,6 +18,7 @@ import (
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/avast/retry-go"
"github.com/foxxorcat/mopan-sdk-go"
log "github.com/sirupsen/logrus"
)
type MoPan struct {
@ -54,6 +55,16 @@ func (d *MoPan) Init(ctx context.Context) error {
return err
}
d.userID = info.UserID
log.Debugf("[mopan] Phone: %s UserCloudStorageRelations: %+v", d.Phone, data.UserCloudStorageRelations)
cloudCircleApp, _ := d.client.QueryAllCloudCircleApp()
log.Debugf("[mopan] Phone: %s CloudCircleApp: %+v", d.Phone, cloudCircleApp)
if d.RootFolderID == "" {
for _, userCloudStorage := range data.UserCloudStorageRelations {
if userCloudStorage.Path == "/文件" {
d.RootFolderID = userCloudStorage.FolderID
}
}
}
return nil
}
d.client = mopan.NewMoClientWithRestyClient(base.NewRestyClient()).
@ -94,6 +105,7 @@ func (d *MoPan) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([
break
}
log.Debugf("[mopan] Phone: %s folder: %+v", d.Phone, data.FileListAO.FolderList)
files = append(files, utils.MustSliceConvert(data.FileListAO.FolderList, folderToObj)...)
files = append(files, utils.MustSliceConvert(data.FileListAO.FileList, fileToObj)...)
}

View File

@ -9,7 +9,7 @@ type Addition struct {
Phone string `json:"phone" required:"true"`
Password string `json:"password" required:"true"`
RootFolderID string `json:"root_folder_id" default:"-11" required:"true" help:"be careful when using the -11 value, some operations may cause system errors"`
RootFolderID string `json:"root_folder_id" default:""`
CloudID string `json:"cloud_id"`