suggestFeedBack.js 1003 Bytes
/**
 * 意见反馈 controller
 * @return jsonp
 * @author: gxh<xuhui.ge@yoho.cn>
 * @date: 2017/04/06
 */

'use strict';

const suggestFeedBackModel = require('../models/suggestFeedBack');
const _ = require('lodash');

const getFeedBack = (req, res, next) => {

    let feedbackId = req.query.feedback_id || 0;
    let questionId = req.query.question_id || 0;
    let answer = _.trim(req.query.answer) || '';
    let solution = req.query.solution || 0;

    if (!_.isEmpty(feedbackId) || !_.isEmpty(questionId) || !_.isEmpty(answer) || !_.isEmpty(solution)) {
        suggestFeedBackModel.FeedBackApi(feedbackId, questionId, answer, solution).then((result) => {

            return res.jsonp({
                code: result.code,
                data: result.data,
                message: result.message
            });

        }).catch(next);

    } else {
        return res.status(403).send({
            message: '意见反馈失败'
        });
    }

};

module.exports = {
    getFeedBack
};