client-service.js 785 Bytes
/**
 * 客服用户端 service
 *
 * @author: liqi <qi.li@yoho.cn>
 * @date: 2016/11/4
 */

'use strict';

const Promise = require('bluebird');
const clientAPI = require('./client-api');

/**
 *  在线客服客服端页面
 */
const getClientData = (type, uid, imgSize) => {
    let apiMethod = [
        clientAPI.getCsSetting(type),
        clientAPI.getMsgHistory(uid),
        clientAPI.getLastTenOrders(uid, imgSize)
        // clientAPI.getQas(),       // TODO 常见问题
    ];

    return Promise.all(apiMethod)
        .then(res => {
            return {
                csSetting: res[0].data.config,
                msgHistory: res[1].data,
                orders: res[2].data,
                qas: []
            }
        })
};

module.exports = {
    getClientData
};