@@ -347,6 +347,11 @@ function _handleMessage(msg, options){
347
347
officialAccount && _attemptToAppendOfficialAccount ( officialAccount ) ;
348
348
targetOfficialAccount = _getOfficialAccountById ( officialAccountId ) ;
349
349
350
+
351
+ // ===========
352
+ // 消息类型预取
353
+ // ===========
354
+
350
355
// 满意度评价
351
356
if ( utils . getDataByPath ( msg , "ext.weichat.ctrlType" ) === "inviteEnquiry" ) {
352
357
type = "satisfactionEvaluation" ;
@@ -370,6 +375,14 @@ function _handleMessage(msg, options){
370
375
else if ( utils . getDataByPath ( msg , "ext.msgtype.articles" ) ) {
371
376
type = "article" ;
372
377
}
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
+ }
373
386
else if ( utils . getDataByPath ( msg , "ext.type" ) === "html/form" ) {
374
387
type = "html-form" ;
375
388
}
@@ -380,7 +393,14 @@ function _handleMessage(msg, options){
380
393
else if ( customMagicEmoji ) {
381
394
type = "customMagicEmoji" ;
382
395
}
383
- else { }
396
+ else {
397
+
398
+ }
399
+
400
+
401
+ // ===========
402
+ // 消息类型重写
403
+ // ===========
384
404
385
405
switch ( type ) {
386
406
case "txt" :
@@ -436,8 +456,10 @@ function _handleMessage(msg, options){
436
456
) ;
437
457
break ;
438
458
case "article" :
459
+ case "track" :
460
+ case "order" :
439
461
message = msg ;
440
- message . type = "article" ;
462
+ message . type = type ;
441
463
break ;
442
464
case "robotList" :
443
465
message = msg ;
@@ -530,13 +552,13 @@ function _handleMessage(msg, options){
530
552
marketingTaskId
531
553
&& type === "txt"
532
554
&& 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
+ ) ;
540
562
541
563
if ( eventName ) {
542
564
_handleSystemEvent ( eventName , eventObj , msg ) ;
@@ -552,6 +574,11 @@ function _handleMessage(msg, options){
552
574
}
553
575
}
554
576
577
+
578
+ // ===========
579
+ // 消息类型上屏
580
+ // ===========
581
+
555
582
if (
556
583
! message
557
584
// 空文本消息不上屏
@@ -560,6 +587,8 @@ function _handleMessage(msg, options){
560
587
|| ( type === "article" && _ . isEmpty ( utils . getDataByPath ( msg , "ext.msgtype.articles" ) ) )
561
588
// 视频邀请不上屏
562
589
|| ( type === "rtcVideoTicket" )
590
+ // 订单轨迹不上屏
591
+ || ( type === "track" || type === "order" )
563
592
) return ;
564
593
565
594
// 给收到的消息加id,用于撤回消息
@@ -959,4 +988,3 @@ function _messagePrompt(message, officialAccount){
959
988
} ) ;
960
989
}
961
990
}
962
-
0 commit comments