tide-command.js
1.3 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const api = global.yoho.API;
const service = global.yoho.ServiceAPI;
const _ = require('lodash');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
// 文字说明
invitionText(uid) {
return api.get('', {
method: 'app.invitecode.my',
uid: uid
}, {
code: 200
}).then((result) => {
if (result && result.code === 200 && result.data) {
return result.data;
} else {
return {};
}
});
}
// 资源位图
resources(contentCode) {
return service.get('operations/api/v5/resource/get', {
content_code: contentCode
}, {
code: 200
}).then((result) => {
if (result && result.data) {
return result.data[0];
}
});
}
invitionData(uid, contentCode) {
return api.all([this.invitionText(uid), this.resources(contentCode)]).then((result) => {
let finaData = {};
finaData = Object.assign(finaData, result[0]);
finaData.imgSrc = _.get(result[1], 'data[0].src', '');
finaData.resourcesUrl = _.get(result[1], 'data[0].url', '');
return finaData;
});
}
};