suggestFeedBack-service.js
969 Bytes
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
/**
* suggestFeedBack model
* @author: gxh<xuhui.ge@yoho.cn>
* @date: 2017/05/25
*/
'use strict';
const GetBanner = require('./getBanner');
const _ = require('lodash');
const QUESTION_CODE = '1337a9f26f3972060bb2a2ca3aba81fd';
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.getBanner = new GetBanner(ctx);
}
suggestFeedBack() {
return this.getBanner.getResource(QUESTION_CODE).then(result => {
if (result.code === 200) {
let data = _.dropWhile(_.get(result, 'data', []), o => {
return o.template_name !== 'single_image'; // 取一张图资源位
});
let list = [];
_.forEach(data, value => {
list.push(_.get(value, 'data[0]', ''));
});
result.data = _.compact(list);
}
return result;
});
}
};