suggestFeedBack.js 947 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 (!feedbackId || !questionId || !answer || !solution) {

        suggestFeedBackModel.feedBackApi(feedbackId, questionId, answer, solution).then((result) => {

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

        }).catch(next);

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

};

module.exports = {
    getFeedBack
};