-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path000a9132fbde4d239e606a4c59793162_fwgk33yl.js
36 lines (36 loc) · 1.21 KB
/
000a9132fbde4d239e606a4c59793162_fwgk33yl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
let AbstractAPIHandler = require("AbstractAPIHandler");
class MyAPIHandler extends AbstractAPIHandler {
execute(request) {
const sql = "select * from GT4011AT27.GT4011AT27.expert_yonyou";
const data = ObjectStore.queryByYonQL(sql);
data.forEach((e) => {
const photoshow = JSON.parse(e.photoshow);
const imgUrl = getImageUrl(photoshow.fileID);
e.imgUrl = imgUrl;
e.fileId = photoshow.fileID;
});
function getImageUrl(id, name) {
let token = JSON.parse(AppContext()).token;
let url = `https://c2.yonyoucloud.com/iuap-apcom-file/rest/v1/file/batchFiles`;
let header = { "Content-Type": "application/json;charset=UTF-8", cookie: `yht_access_token=${token}` };
let attaches = [
{
businessId: id,
objectName: "caep"
}
];
let body = {
includeChild: false,
pageSize: 10,
batchFiles: JSON.stringify(attaches)
};
let apiResponse = postman("post", url, JSON.stringify(header), JSON.stringify(body));
let jsonData = JSON.parse(apiResponse);
return jsonData.data.length > 0 && jsonData.data[0].filePath;
}
return {
data
};
}
}
exports({ entryPoint: MyAPIHandler });