Showing
2 changed files
with
4 additions
and
139 deletions
apps/serverAPI/im.js
deleted
100644 → 0
1 | -'use strict'; | ||
2 | - | ||
3 | -const _ = require('lodash'); | ||
4 | -const crypto = global.yoho.crypto; | ||
5 | -const config = global.yoho.config; | ||
6 | - | ||
7 | -const ImService = new global.yoho.ApiBase(config.domains.imCs, { | ||
8 | - name: 'im', | ||
9 | - cache: global.yoho.cache, | ||
10 | - useCache: false | ||
11 | -}); | ||
12 | - | ||
13 | -const encryptedUid = uid => crypto.encryption(null, uid + ''); | ||
14 | - | ||
15 | -/** | ||
16 | - * 新建留言信息 | ||
17 | - * path: {host}/leavemessage/saveLeavemessage | ||
18 | - * | ||
19 | - * @param {int} uid 用户id | ||
20 | - * @param {int} conversationId 会话id | ||
21 | - * @param {str} content 留言内容 | ||
22 | - */ | ||
23 | -exports.saveMessage = (uid, conversationId, content) => { | ||
24 | - let params = { | ||
25 | - uid, | ||
26 | - conversationId, | ||
27 | - content, | ||
28 | - encryptedUid: encryptedUid(uid) | ||
29 | - }; | ||
30 | - | ||
31 | - | ||
32 | - return ImService.post('/api/leavemessage/saveLeavemessage', params); | ||
33 | -}; | ||
34 | - | ||
35 | - | ||
36 | - | ||
37 | -/** | ||
38 | - * 查询用户聊天记录 | ||
39 | - * @param {int} uid 用户uid | ||
40 | - * @param [int] pageSize 每次加载的聊天记录 | ||
41 | - * @param [int] startTime | ||
42 | - * @param [int] endTime | ||
43 | - */ | ||
44 | -exports.fetchImHistory = (uid, endTime, pageSize, startTime) => { | ||
45 | - pageSize = pageSize || 10; | ||
46 | - | ||
47 | - let params = { | ||
48 | - uid, | ||
49 | - pageSize, | ||
50 | - encryptedUid: encryptedUid(uid) | ||
51 | - }; | ||
52 | - | ||
53 | - _.forEach({startTime, endTime}, (val, key) => { | ||
54 | - val && (params[key] = val); | ||
55 | - }); | ||
56 | - | ||
57 | - return ImService.get('/api/conversationMessage/pageList', params) | ||
58 | - .then(result => { | ||
59 | - return result; | ||
60 | - }, () => { | ||
61 | - return { | ||
62 | - code: 500, | ||
63 | - data: { | ||
64 | - records: [], totalCount: 0 | ||
65 | - } | ||
66 | - }; | ||
67 | - }); | ||
68 | -}; | ||
69 | - | ||
70 | -/** | ||
71 | - * 获取用户订单, 默认最近10笔 | ||
72 | - * @param {int} uid 用户uid | ||
73 | - * @param {init} createTimeBegin 开始时间 | ||
74 | - */ | ||
75 | -exports.fetchOrderList = (uid, createTimeBegin) => { | ||
76 | - let params = { | ||
77 | - uid, | ||
78 | - encryptedUid: encryptedUid(uid), | ||
79 | - imgSize: '90x120', | ||
80 | - }; | ||
81 | - | ||
82 | - _.forEach({createTimeBegin}, (key, val) => { | ||
83 | - val && (params[key] = val); | ||
84 | - }); | ||
85 | - | ||
86 | - return ImService.get('/api/order/queryLastTenOrder', params); | ||
87 | -}; | ||
88 | - | ||
89 | - | ||
90 | - | ||
91 | -/** | ||
92 | - * | ||
93 | -新建评价信息 | ||
94 | -### url | ||
95 | -``` | ||
96 | -{host}/evalute/saveEvalute | ||
97 | -``` | ||
98 | -### 请求参数说明 | ||
99 | -| 名称 | 类型 | 是否必须 | 描述 | | ||
100 | -| -------------- | ------ | ---- | --------------- | | ||
101 | -| conversationId | long | Y | 会话id | | ||
102 | -| uid | int | Y | 用户ID | | ||
103 | -|encryptedUid | String |Y |加密的用户标识 | | ||
104 | -| promoter | int | Y | 评价发起者 1 用户 2 客服 | | ||
105 | -| stars | int | Y | 评分星级 | | ||
106 | -| reasonIds | string | N | 固定原因Id用冒号隔开 | | ||
107 | -| reasonMsgs | string | N | 固定原因用分号隔开 | | ||
108 | -| reasonMsg | string | N | 其他原因 | | ||
109 | - | ||
110 | - */ | ||
111 | -exports.saveEvalute = (uid, conversationId, promoter, stars, reasonMsg) => { | ||
112 | - let params = { | ||
113 | - conversationId, | ||
114 | - uid, | ||
115 | - encryptedUid: encryptedUid(uid), | ||
116 | - promoter, | ||
117 | - stars, | ||
118 | - reasonMsg | ||
119 | - }; | ||
120 | - | ||
121 | - return ImService.post('/api/evalute/saveEvalute', params); | ||
122 | -}; | ||
123 | - | ||
124 | - | ||
125 | -/** | ||
126 | - * 获取全球购的订单 | ||
127 | - */ | ||
128 | - | ||
129 | -exports.queryGlobalOrder = uid => { | ||
130 | - let params = { | ||
131 | - uId: uid | ||
132 | - }; | ||
133 | - | ||
134 | - return ImService.get('/api/order/queryGlobalOrder', params); | ||
135 | -}; |
@@ -140,10 +140,6 @@ html, body { | @@ -140,10 +140,6 @@ html, body { | ||
140 | text-align: right; | 140 | text-align: right; |
141 | } | 141 | } |
142 | 142 | ||
143 | - .nav-back { | ||
144 | - text-align: left; | ||
145 | - } | ||
146 | - | ||
147 | /* 客服在线 */ | 143 | /* 客服在线 */ |
148 | .online { | 144 | .online { |
149 | .chat-status { | 145 | .chat-status { |
@@ -176,6 +172,10 @@ html, body { | @@ -176,6 +172,10 @@ html, body { | ||
176 | } | 172 | } |
177 | 173 | ||
178 | body.app-ios { | 174 | body.app-ios { |
175 | + .nav-back { | ||
176 | + text-align: left; | ||
177 | + } | ||
178 | + | ||
179 | #chat-window, | 179 | #chat-window, |
180 | .connection-failed, | 180 | .connection-failed, |
181 | .chat-page { | 181 | .chat-page { |
-
Please register or login to post a comment