fix(chaoxing): JSON parsing error in content
field (#5877)
* fix(chaoxing):fix JSON parsing error in `content` field * fix(chaoxing): optimizing `UnmarshalJSON` implementation * fix(chaoxing): use `objectID` when is empty
This commit is contained in:
@ -79,7 +79,7 @@ func (d *ChaoXing) GetFiles(parent string) ([]File, error) {
|
||||
return nil, err
|
||||
}
|
||||
if resp.Result != 1 {
|
||||
msg:=fmt.Sprintf("error code is:%d", resp.Result)
|
||||
msg := fmt.Sprintf("error code is:%d", resp.Result)
|
||||
return nil, errors.New(msg)
|
||||
}
|
||||
if len(resp.List) > 0 {
|
||||
@ -97,8 +97,12 @@ func (d *ChaoXing) GetFiles(parent string) ([]File, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(resps.List) > 0 {
|
||||
files = append(files, resps.List...)
|
||||
for _, file := range resps.List {
|
||||
// 手机端超星上传的文件没有fileID字段,但ObjectID与fileID相同,可代替
|
||||
if file.Content.FileID == "" {
|
||||
file.Content.FileID = file.Content.ObjectID
|
||||
}
|
||||
files = append(files, file)
|
||||
}
|
||||
return files, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user