Authored by 陈轩

save

... ... @@ -76,5 +76,5 @@ exports.fetchOrderList = (uid, createTimeBegin) => {
val && (params[key] = val)
});
return ImAPI.get('/api/order/queryUserLastTenOrdersNgoodsInfo', params);
return ImAPI.get('/api/order/queryLastTenOrdersNgoodsInfo', params);
};
... ...
... ... @@ -8,17 +8,7 @@ const sign = global.yoho.sign;
exports.appAdapter = (req, res, next) => {
if (req.yoho.isApp) {
let unixTimeStamp = parseInt(req.query.session_t, 10) || 0;
if (unixTimeStamp > Math.ceil(Date.now() / 1000)) {
return next('error');
}
if (req.query.client_type === 'android') {
delete req.query.session_key; // android bug;
}
req.query.client_secret = req.yoho.client_secret;
if (sign.checkSign(req.query)) {
let uid = (req.query.uid || '').trim();
... ...
... ... @@ -10,6 +10,10 @@ module.exports = () => {
return (req, res, next) => {
if (req.query) {
_.forEach(BLACK_LIST, (key) => {
if (key === 'client_secret') {
req.yoho.client_secret = req.query[key];
}
if (req.query[key]) {
delete req.query[key];
}
... ...
... ... @@ -254,17 +254,17 @@ var chat = {
];
cmEntity.message.type = 10;
cmEntity.message.content = arr;
cmEntity.chatMessage.type = 10;
cmEntity.chatMessage.content = arr;
break;
case 'picture':
cmEntity.message.content = data.content;
cmEntity.message.type = 2;
cmEntity.chatMessage.content = data.content;
cmEntity.chatMessage.type = 2;
break;
case 'text':
default:
cmEntity.message.type = 1;
cmEntity.message.content = data.content;
cmEntity.chatMessage.type = 1;
cmEntity.chatMessage.content = data.content;
}
... ... @@ -288,7 +288,7 @@ var chat = {
*/
buildViewData: function(cm) {
var viewData = {};
var message = cm.message;
var chatMessage = cm.chatMessage;
var allTypes = socketConf.recType;
switch (cm.type) {
... ... @@ -309,30 +309,30 @@ var chat = {
return null;
}
switch (message.type) {
switch (chatMessage.type) {
case 1:
viewData.type = msgTypeMap[1];
viewData.data = {
content: message.content
content: chatMessage.content
};
break;
case 2:
viewData.type = msgTypeMap[2];
viewData.data = {
content: message.content
content: chatMessage.content
};
break;
case 10:
message.content = JSON.parse(message.content);
chatMessage.content = JSON.parse(chatMessage.content);
viewData.type = msgTypeMap[10];
viewData.data = {
orderCode: message.content[1],
cost: message.content[3],
createTime: message.content[5],
orderStatus: message.content[7],
orderCode: chatMessage.content[1],
cost: chatMessage.content[3],
createTime: chatMessage.content[5],
orderStatus: chatMessage.content[7],
};
break;
... ... @@ -349,8 +349,8 @@ var chat = {
*/
handleReceiveMSG: function(rec) {
var recType = rec.type,
message = rec.message,
msgType = message.type,
chatMessage = rec.chatMessage,
msgType = chatMessage.type,
allTypes = socketConf.recType;
// var uuid = rec.uuid;
... ... @@ -378,8 +378,8 @@ var chat = {
// ------------------------------------------
// 用户进入
case allTypes.ENTER:
if (message.type === 0) {
this._sysInfo(message.content);
if (chatMessage.type === 0) {
this._sysInfo(chatMessage.content);
}
break;
... ... @@ -393,7 +393,7 @@ var chat = {
case allTypes.TRANSFER:
break;
case allTypes.MANUAL_SERVICE:
this._manualState(message.type, rec);
this._manualState(chatMessage.type, rec);
break;
case allTypes.CS_CHANGE_STATE:
break;
... ... @@ -415,7 +415,7 @@ var chat = {
const $chatHeader = self.$header;
const $chatWin = self.$chatWin;
const sysInfo = self._sysInfo.bind(this);
const message = cmEntity.message;
const chatMessage = cmEntity.chatMessage;
function noService() {
$chatHeader.find('.js-service-txt').text('YOHO客服');
... ... @@ -425,7 +425,7 @@ var chat = {
// state 1: 排队中
function inQueue() {
let info = `${message.content}您可以<span class="blue" data-trigger="leave-msg">留言</span>`;
let info = `${chatMessage.content}您可以<span class="blue" data-trigger="leave-msg">留言</span>`;
sysInfo(info);
}
... ... @@ -539,8 +539,8 @@ var chat = {
records.reverse();
records.forEach(message => {
let data = self.buildViewData(message); //eslint-disable-line
records.forEach(chatMessage => {
let data = self.buildViewData(chatMessage); //eslint-disable-line
if (data) {
arr.push(data);
... ... @@ -600,10 +600,10 @@ var chat = {
},
// 刚进入提示
enterSuccess: function(message) {
enterSuccess: function(chatMessage) {
append(time(Date.now()).show());
self._sysInfo();
self._sysInfo(message.content);
self._sysInfo(chatMessage.content);
}
};
... ... @@ -624,6 +624,10 @@ $upload.on('change', function() {
var files = input.files;
var formData = new FormData();
if (!files[0]) {
return;
}
formData.append('files[]', files[0]);
... ...
... ... @@ -47,7 +47,8 @@ var config = {
serviceSortId: 0,
serviceSortCode: '',
customerSettingId: 0,
message: {
roleType: 0,
chatMessage: {
messageObjectId: '',
type: 0,
content: '',
... ...