Skip to content

Commit f8de928

Browse files
committed
优化列表接口
1 parent bc81b04 commit f8de928

5 files changed

Lines changed: 27 additions & 10 deletions

File tree

CHANGELOG.MD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
更新日志文档,版本顺序从新到旧,最新版本在最前(上)面。
44

5+
# 1.0.4
6+
7+
- 优化列表接口
8+
59
# 1.0.3
610

711
- 修正刷新token的api的基础域名

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
group=run.ikaros.plugin
22
description=A pan115 plugin for ikaros.
3-
version=1.0.3
3+
version=1.0.4

src/main/java/run/ikaros/plugin/pan115/Pan115AttachmentDriverFetcher.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,29 +97,29 @@ public Flux<Attachment> getChildren(Long driverId, Long pid, String remotePath)
9797
})
9898
.map(att -> {
9999
final String fid = att.getFid();
100-
Pan115Folder pan115Folder = pan115Repository.openFolderGetInfo(fid);
100+
//Pan115Folder pan115Folder = pan115Repository.openFolderGetInfo(fid);
101101
String path = "";
102-
for (Pan115Path pan115Path : pan115Folder.getPaths()) {
102+
for (Pan115Path pan115Path : att.getPath()) {
103103
path += pan115Path.getFile_name();
104104
path += "/";
105105
}
106106

107-
AttachmentType type = "1".equals(pan115Folder.getFile_category())
107+
AttachmentType type = "1".equals(att.getFc())
108108
? AttachmentType.Driver_File
109109
: AttachmentType.Driver_Directory;
110110
Attachment attachment = new Attachment();
111-
attachment.setSize(pan115Folder.getSize_byte());
111+
attachment.setSize(att.getFs());
112112
attachment.setType(type);
113-
attachment.setName(pan115Folder.getFile_name());
113+
attachment.setName(att.getFn());
114114
attachment.setUpdateTime(
115-
LocalDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong(pan115Folder.getUtime())),
115+
LocalDateTime.ofInstant(Instant.ofEpochMilli(att.getUpt()),
116116
ZoneId.systemDefault()));
117117
attachment.setDriverId(driverId);
118118
attachment.setDeleted(false);
119-
attachment.setSha1(pan115Folder.getSha1());
119+
attachment.setSha1(att.getSha1());
120120
attachment.setParentId(pid);
121-
attachment.setFsPath(pan115Folder.getFile_id()); // @see core: AttachmentDriverServiceImpl#refreshRemoteFileSystem
122-
String url = pan115Folder.getPick_code();
121+
attachment.setFsPath(att.getFid()); // @see core: AttachmentDriverServiceImpl#refreshRemoteFileSystem
122+
String url = att.getPc();
123123
if (StringUtils.isNotBlank(att.getIco())
124124
&& FileUtils.isImage(att.getIco())) {
125125
url = att.getUo();

src/main/java/run/ikaros/plugin/pan115/model/Pan115Attachment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,5 @@ public class Pan115Attachment {
4646
private String v_img;
4747
private String thumb;
4848
private String uo;
49+
private List<Pan115Path> path;
4950
}

src/main/java/run/ikaros/plugin/pan115/repository/DefaultPan115Repository.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ public List<Pan115Attachment> openUFileFiles(String cid, Integer limit, Integer
8484
Pan115Attachment[] pan115Attachments =
8585
JsonUtils.json2ObjArr(JsonUtils.obj2Json(data), new TypeReference<>() {
8686
});
87+
Object pathObj = map.remove("path");
88+
Pan115Path[] parentPath = JsonUtils.json2ObjArr(JsonUtils.obj2Json(pathObj), new TypeReference<>() {
89+
});
90+
for (Pan115Attachment pan115Attachment : pan115Attachments) {
91+
List<Pan115Path> newPaths = List.of(parentPath);
92+
Pan115Path lastPath = new Pan115Path();
93+
lastPath.setFile_id(Long.parseLong(pan115Attachment.getFid()));
94+
lastPath.setFile_name(pan115Attachment.getFn());
95+
lastPath.setIss(String.valueOf(pan115Attachment.getIss()));
96+
newPaths.add(lastPath);
97+
pan115Attachment.setPath(newPaths);
98+
}
8799
if (pan115Attachments == null) {
88100
return List.of();
89101
}

0 commit comments

Comments
 (0)