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

'use strict';
const aes = require('./aes-pwd');
const common = require('../../../config/common');
const clientService = require('../models/client-service');

/**
 * 在线客服客户端
 */
const index = (req, res) => {
    let type = 2;
    let imgSize = '86x120';
    let encryptedUid = aes.encryptionUid(req.user.uid);
    let data = {
        encryptedUid,
        layout: false
    };

    clientService.getClientData(type, encryptedUid, imgSize)
        .then(result => {
            res.render('client', Object.assign(data, result));
        });
};

/**
 * 在线客服客户端
 */
const domains = (req, res) => {
    // 返回当前环境的配置信息
    res.json(common.domains);
};


module.exports = {
    index,
    domains
};