suggestFeedBack-service.js 960 Bytes
/**
 * suggestFeedBack model
 * @author: gxh<xuhui.ge@yoho.cn>
 * @date: 2017/05/25
 */
'use strict';

const api = require('./suggestFeedBack-api');
const helpers = global.yoho.helpers;
const _ = require('lodash');

const suggestFeedBack = () => {

    return api.feedBackApi().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)
                    };

                    suggestData.push(item);
                });
            }
        }

        return suggestData;
    });
};

module.exports = {
    suggestFeedBack
};