client-service.js
817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* 客服用户端 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)
];
return Promise.all(apiMethod)
.then(res => {
let history = res[1].data;
let hasHistory = history.length > 0;
return {
csSetting: res[0].data.config,
hasHistory: hasHistory,
orders: res[2].data,
qas: []
};
});
};
module.exports = {
getClientData
};