Authored by 毕凯

Merge branch 'feature/cs-session-key' into 'gray'

Feature/cs session key

客服相关接口session_key验证和开关链接删除

See merge request !689
... ... @@ -12,9 +12,7 @@ const _ = require('lodash');
const helpers = global.yoho.helpers;
const getOnlineServiceInfo = (req, res, next) => {
let serviceUrl = _.get(req.app.locals.wap, 'clientService.new', false) ?
helpers.urlFormat('/service/im') :
'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=';
let serviceUrl = helpers.urlFormat('/service/im');
onlineModel.getOnlineServiceInfo().then((result) => {
... ...
... ... @@ -18,9 +18,7 @@ const addressProcess = require(global.utils + '/address-process');
const orderDetailData = (req, res, next) => {
let uid = req.user.uid;
let orderCode = req.query.order_code;
let serviceUrl = _.get(req.app.locals.wap, 'clientService.new', false) ?
helpers.urlFormat('/service/im') :
'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=';
let serviceUrl = helpers.urlFormat('/service/im');
if (req.query.openId) {
// 微信支付成功,发送支付确认接口
... ...
... ... @@ -37,9 +37,7 @@ const bind = {
let openId = req.query.openId;
let sourceType = req.query.sourceType;
let serviceUrl = _.get(req.app.locals.wap, 'clientService.new', false) ?
helpers.urlFormat('/service/im') :
'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=';
let serviceUrl = helpers.urlFormat('/service/im');
res.render('bind/index', {
bindIndex: true, // js标识
... ...
... ... @@ -178,9 +178,7 @@ let codeAction = (req, res, next) => {
});
}
let serviceUrl = _.get(req.app.locals.wap, 'clientService.new', false) ?
helpers.urlFormat('/service/im') :
'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=';
let serviceUrl = helpers.urlFormat('/service/im');
res.render('reg/code', {
page: 'code',
... ...
... ... @@ -62,10 +62,11 @@ exports.getOrders = (req, res, next) => {
*
*/
exports.fetchHistory = (req, res) => {
const uid = req.user.uid || req.query.uid;
const encryptedUid = req.body.encryptedUid;
const endTime = req.body.endTime;
imApi.fetchImHistory(encryptedUid, endTime).then(result => {
imApi.fetchImHistory(uid, encryptedUid, endTime).then(result => {
res.json(result);
});
};
... ... @@ -78,11 +79,12 @@ exports.fetchHistory = (req, res) => {
* content 留言内容
*/
exports.saveMSG = (req, res) => {
let encryptedUid = req.body.encryptedUid;
const uid = req.user.uid || req.query.uid;
const encryptedUid = req.body.encryptedUid;
const conversationId = req.body.conversationId;
const content = req.body.content;
imApi.saveMessage(encryptedUid, conversationId, content)
imApi.saveMessage(uid, encryptedUid, conversationId, content)
.then(result => {
res.json(result);
});
... ... @@ -97,9 +99,10 @@ exports.saveMSG = (req, res) => {
* 2. 失败情况
*/
exports.fetchOrders = (req, res) => {
let encryptedUid = req.body.encryptedUid;
const uid = req.user.uid || req.query.uid;
const encryptedUid = req.body.encryptedUid;
imApi.fetchOrderList(encryptedUid)
imApi.fetchOrderList(uid, encryptedUid)
.then(result => {
imModel.handleOrderList(result.data, 128, 170);
res.json(result);
... ... @@ -112,7 +115,8 @@ exports.fetchOrders = (req, res) => {
};
exports.saveEvalute = (req, res) => {
const params = {};
const uid = req.user.uid || req.query.uid;
const params = { uid };
params.encryptedUid = req.body.encryptedUid;
params.conversationId = req.body.conversationId;
... ... @@ -140,7 +144,8 @@ exports.saveEvalute = (req, res) => {
exports.queryGlobalOrder = (req, res) => {
let encryptedUid = req.body.encryptedUid;
const uid = req.user.uid || req.query.uid;
const encryptedUid = req.body.encryptedUid;
let emptyOrder = {
code: 200,
... ... @@ -148,9 +153,12 @@ exports.queryGlobalOrder = (req, res) => {
message: '获取失败'
};
imApi.queryGlobalOrder(encryptedUid)
imApi.queryGlobalOrder(uid, encryptedUid)
.then(result=> {
imModel.handleOrderList(result.data, 128, 170);
if (result.code === 200) {
imModel.handleOrderList(result.data, 128, 170);
}
res.json(result);
}, () => {
res.json(emptyOrder);
... ... @@ -165,8 +173,10 @@ exports.queryGlobalOrder = (req, res) => {
*/
exports.queryReasons = (req, res) => {
const type = req.body.type;
const uid = req.user.uid || req.query.uid;
const encryptedUid = crypto.encryption(null, uid + '');
imApi.queryReasons(type)
imApi.queryReasons(uid, encryptedUid, type)
.then(result=> {
res.json(result);
})
... ...
... ... @@ -18,8 +18,9 @@ const ImService = new global.yoho.ApiBase(config.domains.imCs, {
* @param {int} conversationId 会话id
* @param {str} content 留言内容
*/
exports.saveMessage = (encryptedUid, conversationId, content) => {
exports.saveMessage = (uid, encryptedUid, conversationId, content) => {
let params = {
uid,
conversationId,
content,
encryptedUid
... ... @@ -38,8 +39,9 @@ exports.saveMessage = (encryptedUid, conversationId, content) => {
* @param [int] startTime
* @param [int] endTime
*/
exports.fetchImHistory = (encryptedUid, endTime, pageSize, startTime) => {
exports.fetchImHistory = (uid, encryptedUid, endTime, pageSize, startTime) => {
let params = {
uid,
encryptedUid
};
... ... @@ -66,8 +68,9 @@ exports.fetchImHistory = (encryptedUid, endTime, pageSize, startTime) => {
* @param {string} encryptedUid 用户加密uid
* @param {init} createTimeBegin 开始时间
*/
exports.fetchOrderList = (encryptedUid, createTimeBegin) => {
exports.fetchOrderList = (uid, encryptedUid, createTimeBegin) => {
let params = {
uid,
encryptedUid,
imgSize: '90x120',
};
... ... @@ -110,8 +113,9 @@ exports.saveEvalute = (params) => {
* 获取全球购的订单
*/
exports.queryGlobalOrder = encryptedUid => {
exports.queryGlobalOrder = (uid, encryptedUid) => {
let params = {
uid,
encryptedUid
};
... ... @@ -122,9 +126,11 @@ exports.queryGlobalOrder = encryptedUid => {
* 获取评价原因
* @param type 客服设置类型
*/
exports.queryReasons = type => {
exports.queryReasons = (uid, encryptedUid, type) => {
let params = {
type
uid,
type,
encryptedUid
};
return ImService.post('/api/evalute/queryReasonBySettingType', params);
... ...
... ... @@ -22,9 +22,5 @@
<p>抱歉,没有找到与“<span class="noKey"></span>”相关的问题,</p>
<p>您可以换个词再试试</p>
</div>
{{#if @root.wap.clientService.new}}
<div class="fix-tip">没有相关问题,请联系<a href="/service/im">在线客服</a></div>
{{else}}
<div class="fix-tip">没有相关问题,请联系<a href="http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=">在线客服</a></div>
{{/if}}
</div>
... ...
<div class="list-group">
{{#if @root.wap.clientService.new}}
<a class="list clearfix" href="/service/im">
{{else}}
<a class="list clearfix" href="http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=">
{{/if}}
<i class="gm-ico icon"></i>
<div style="border-bottom: solid 1px #e6e6e6;">
<p class="title">在线客服</p>
... ...
... ... @@ -815,6 +815,10 @@ let chat = {
return api.fetchHistory(msgHistory.endTime)
.done(function(result) {
if (result && result.code === 401) {
window.location.href = '//m.yohobuy.com/signin.html?refer=' + window.location.href;
}
if (!result || result.code !== 200 || !result.data) {
return false;
}
... ...
... ... @@ -64,7 +64,10 @@ LeaveMSGView.prototype = $.extend({}, EventEmitter.prototype, {
}
api.leaveMsg(content)
.done(function() {
.done(function(res) {
if (res && res.code === 401) {
window.location.href = '//m.yohobuy.com/signin.html?refer=' + window.location.href;
}
self.trigger('save.LeaveMSGView', '留言成功');
self.$input.val('');
})
... ... @@ -149,6 +152,10 @@ RatingView.prototype = $.extend({}, EventEmitter.prototype, {
type: YOHO_CS
})
.done(res => {
if (res && res.code === 401) {
window.location.href = '//m.yohobuy.com/signin.html?refer=' + window.location.href;
}
if (res && res.code === 200) {
let $html;
let cause = [];
... ... @@ -163,8 +170,6 @@ RatingView.prototype = $.extend({}, EventEmitter.prototype, {
self.$more.show();
return;
}
tip.show('拉取评价原因失败');
})
.fail(()=> {
tip.show('拉取评价原因失败');
... ... @@ -224,6 +229,10 @@ RatingView.prototype = $.extend({}, EventEmitter.prototype, {
api.saveEvalute(params)
.done(res => {
if (res && res.code === 401) {
window.location.href = '//m.yohobuy.com/signin.html?refer=' + window.location.href;
}
if (res && res.code === 200) {
elem.hide();
elem.trigger('rating-success', [self.rankText]);
... ... @@ -231,7 +240,7 @@ RatingView.prototype = $.extend({}, EventEmitter.prototype, {
return;
}
tip.show('评价失败');
tip.show(res.message);
})
.fail(()=> {
tip.show('评价失败');
... ... @@ -361,6 +370,10 @@ OrderListView.prototype = $.extend({}, EventEmitter.prototype, {
if (totalCount === null) { // 还未加载数据
api.fetchOrders(type).done(
result => {
if (result && result.code === 401) {
window.location.href = '//m.yohobuy.com/signin.html?refer=' + window.location.href;
}
let html = self.orderListT({
orders: result.data,
isApp: appBridge.isApp,
... ...