Skip to content

Commit 6824c39

Browse files
committed
企业菜单发送的图文,改为真实发送,坐席也要收到。
消息流处理 order & track 类型,其会附带“转人工客服”发送,但是不能在访客端显示上屏。
1 parent 495af67 commit 6824c39

File tree

3 files changed

+59
-26
lines changed

3 files changed

+59
-26
lines changed

src/js/app/modules/channel.js

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,11 @@ function _handleMessage(msg, options){
347347
officialAccount && _attemptToAppendOfficialAccount(officialAccount);
348348
targetOfficialAccount = _getOfficialAccountById(officialAccountId);
349349

350+
351+
// ===========
352+
// 消息类型预取
353+
// ===========
354+
350355
// 满意度评价
351356
if(utils.getDataByPath(msg, "ext.weichat.ctrlType") === "inviteEnquiry"){
352357
type = "satisfactionEvaluation";
@@ -370,6 +375,14 @@ function _handleMessage(msg, options){
370375
else if(utils.getDataByPath(msg, "ext.msgtype.articles")){
371376
type = "article";
372377
}
378+
// track 消息在访客端不与处理
379+
else if(utils.getDataByPath(msg, "ext.msgtype.track")){
380+
type = "track";
381+
}
382+
// order 消息在访客端不与处理
383+
else if(utils.getDataByPath(msg, "ext.msgtype.order")){
384+
type = "order";
385+
}
373386
else if(utils.getDataByPath(msg, "ext.type") === "html/form"){
374387
type = "html-form";
375388
}
@@ -380,7 +393,14 @@ function _handleMessage(msg, options){
380393
else if(customMagicEmoji){
381394
type = "customMagicEmoji";
382395
}
383-
else{}
396+
else{
397+
398+
}
399+
400+
401+
// ===========
402+
// 消息类型重写
403+
// ===========
384404

385405
switch(type){
386406
case "txt":
@@ -436,8 +456,10 @@ function _handleMessage(msg, options){
436456
);
437457
break;
438458
case "article":
459+
case "track":
460+
case "order":
439461
message = msg;
440-
message.type = "article";
462+
message.type = type;
441463
break;
442464
case "robotList":
443465
message = msg;
@@ -530,13 +552,13 @@ function _handleMessage(msg, options){
530552
marketingTaskId
531553
&& type === "txt"
532554
&& eventListener.excuteCallbacks(
533-
_const.SYSTEM_EVENT.MARKETING_MESSAGE_RECEIVED,
534-
[
535-
targetOfficialAccount,
536-
marketingTaskId,
537-
msg
538-
]
539-
);
555+
_const.SYSTEM_EVENT.MARKETING_MESSAGE_RECEIVED,
556+
[
557+
targetOfficialAccount,
558+
marketingTaskId,
559+
msg
560+
]
561+
);
540562

541563
if(eventName){
542564
_handleSystemEvent(eventName, eventObj, msg);
@@ -552,6 +574,11 @@ function _handleMessage(msg, options){
552574
}
553575
}
554576

577+
578+
// ===========
579+
// 消息类型上屏
580+
// ===========
581+
555582
if(
556583
!message
557584
// 空文本消息不上屏
@@ -560,6 +587,8 @@ function _handleMessage(msg, options){
560587
|| (type === "article" && _.isEmpty(utils.getDataByPath(msg, "ext.msgtype.articles")))
561588
// 视频邀请不上屏
562589
|| (type === "rtcVideoTicket")
590+
// 订单轨迹不上屏
591+
|| (type === "track" || type === "order")
563592
) return;
564593

565594
// 给收到的消息加id,用于撤回消息
@@ -959,4 +988,3 @@ function _messagePrompt(message, officialAccount){
959988
});
960989
}
961990
}
962-

src/js/app/modules/init.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,16 @@ function chat_window_mode_init(){
162162
}
163163

164164
function updateCustomerInfo(e){
165+
var trackMsg;
165166
var temp;
166167
var data = e.data;
167168
if(typeof data === "string"){
168169
data = JSON.parse(data);
169170
}
170171
temp = utils.getDataByPath(data, "easemob.kefu.cta");
171172
if(temp){
172-
var trackMsg = {
173+
trackMsg = {
173174
ext: {
174-
// imageName: "mallImage3.png",
175-
// // custom代表自定义消息,无需修改
176-
// type: "custom",
177175
msgtype: {
178176
track: {
179177
// 消息标题

src/js/app/modules/tenantInfo/index.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,26 @@ module.exports = function(){
9999
prop: article.prop,
100100
};
101101
});
102-
channel.handleMessage(
103-
{
104-
ext: {
105-
msgtype: {
106-
articles: articles,
107-
}
108-
},
102+
channel.sendText("", {
103+
ext: {
104+
msgtype: {
105+
articles: articles,
106+
}
109107
},
110-
{
111-
type: "article",
112-
noPrompt: true
113-
}
114-
);
108+
});
109+
// channel.handleMessage(
110+
// {
111+
// ext: {
112+
// msgtype: {
113+
// articles: articles,
114+
// }
115+
// },
116+
// },
117+
// {
118+
// type: "article",
119+
// noPrompt: true
120+
// }
121+
// );
115122
});
116123
}
117124

0 commit comments

Comments
 (0)