...
|
...
|
@@ -5,32 +5,27 @@ |
|
|
*/
|
|
|
'use strict';
|
|
|
|
|
|
const api = require('./suggestFeedBack-api');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const api = require('./getBanner');
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const suggestFeedBack = (uid) => {
|
|
|
const QUESTION_CODE = '1337a9f26f3972060bb2a2ca3aba81fd';
|
|
|
|
|
|
return api.feedBackApi(uid).then((result) => {
|
|
|
let suggestData = [];
|
|
|
|
|
|
if (result && result.code === 200 && _.get(result, 'data.rows')) {
|
|
|
|
|
|
if (_.get(result, 'data.rows')) {
|
|
|
_.forEach(_.get(result, 'data.rows', []), it => {
|
|
|
let item = {
|
|
|
description: it.description,
|
|
|
title: it.title,
|
|
|
id: it.id,
|
|
|
url: helpers.urlFormat(`/3party/questionnaire/${it.id}`, null)
|
|
|
};
|
|
|
const suggestFeedBack = () => {
|
|
|
return api.getResource(QUESTION_CODE).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
let data = _.dropWhile(_.get(result, 'data', []), o => {
|
|
|
return o.template_name !== 'single_image'; // 取一张图资源位
|
|
|
});
|
|
|
let list = [];
|
|
|
|
|
|
suggestData.push(item);
|
|
|
_.forEach(data, value => {
|
|
|
list.push(_.get(value, 'data[0]', ''));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
result.data = _.compact(list);
|
|
|
}
|
|
|
|
|
|
return suggestData;
|
|
|
return result;
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|