client-api.js
1.51 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* 客服用户端 api
*
* @author: liqi <qi.li@yoho.cn>
* @date: 2016/11/4
*/
'use strict';
let config = require('../../../config/common');
let api = new global.yoho.ApiBase(config.domains.imCs, {
name: 'imCs',
cache: global.yoho.cache,
useCache: false
});
// api urls
let urls = {
lastTen: '/api/cs/queryUserLastTenOrdersNgoodsInfo',
msgHistory: '/api/conversationMessage/pageList',
csSetting: '/api/cs/queryByType',
qas: '' // TODO 没有接口功能暂缓
};
/**
* 用户最近10笔订单
* @function getLastTenOrders
* @param { string } encryptedUid 用户ID
* @return { Object } 最近10条订单
*/
const getLastTenOrders = (encryptedUid, imgSize) => {
return api.get(urls.lastTen, {
method: '',
encryptedUid,
imgSize
});
};
/**
* 常见问题
* @function getQas
* @return { Object } 问答列表
*/
const getQas = () => {
return api.get(urls.qas, {
method: ''
});
};
/**
* 客服设置
* @param { number } type
* @return { Object } 客服设置
*/
const getCsSetting = (type) => {
return api.get(urls.csSetting, {
method: '',
type
});
};
/**
* 最近聊天记录
* @function getMsgHistory
* @param { string } encryptedUid 用户id
* @return { Array } 历史聊天记录
*/
const getMsgHistory = (encryptedUid) => {
return api.get(urls.msgHistory, {
encryptedUid,
method: ''
});
};
module.exports = {
getQas,
getCsSetting,
getMsgHistory,
getLastTenOrders
};