Skip to content

Commit

Permalink
企业菜单发送的图文,改为真实发送,坐席也要收到。
Browse files Browse the repository at this point in the history
消息流处理 order & track 类型,其会附带“转人工客服”发送,但是不能在访客端显示上屏。
  • Loading branch information
dcw1123 committed Apr 28, 2018
1 parent 495af67 commit 6824c39
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 26 deletions.
48 changes: 38 additions & 10 deletions src/js/app/modules/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ function _handleMessage(msg, options){
officialAccount && _attemptToAppendOfficialAccount(officialAccount);
targetOfficialAccount = _getOfficialAccountById(officialAccountId);


// ===========
// 消息类型预取
// ===========

// 满意度评价
if(utils.getDataByPath(msg, "ext.weichat.ctrlType") === "inviteEnquiry"){
type = "satisfactionEvaluation";
Expand All @@ -370,6 +375,14 @@ function _handleMessage(msg, options){
else if(utils.getDataByPath(msg, "ext.msgtype.articles")){
type = "article";
}
// track 消息在访客端不与处理
else if(utils.getDataByPath(msg, "ext.msgtype.track")){
type = "track";
}
// order 消息在访客端不与处理
else if(utils.getDataByPath(msg, "ext.msgtype.order")){
type = "order";
}
else if(utils.getDataByPath(msg, "ext.type") === "html/form"){
type = "html-form";
}
Expand All @@ -380,7 +393,14 @@ function _handleMessage(msg, options){
else if(customMagicEmoji){
type = "customMagicEmoji";
}
else{}
else{

}


// ===========
// 消息类型重写
// ===========

switch(type){
case "txt":
Expand Down Expand Up @@ -436,8 +456,10 @@ function _handleMessage(msg, options){
);
break;
case "article":
case "track":
case "order":
message = msg;
message.type = "article";
message.type = type;
break;
case "robotList":
message = msg;
Expand Down Expand Up @@ -530,13 +552,13 @@ function _handleMessage(msg, options){
marketingTaskId
&& type === "txt"
&& eventListener.excuteCallbacks(
_const.SYSTEM_EVENT.MARKETING_MESSAGE_RECEIVED,
[
targetOfficialAccount,
marketingTaskId,
msg
]
);
_const.SYSTEM_EVENT.MARKETING_MESSAGE_RECEIVED,
[
targetOfficialAccount,
marketingTaskId,
msg
]
);

if(eventName){
_handleSystemEvent(eventName, eventObj, msg);
Expand All @@ -552,6 +574,11 @@ function _handleMessage(msg, options){
}
}


// ===========
// 消息类型上屏
// ===========

if(
!message
// 空文本消息不上屏
Expand All @@ -560,6 +587,8 @@ function _handleMessage(msg, options){
|| (type === "article" && _.isEmpty(utils.getDataByPath(msg, "ext.msgtype.articles")))
// 视频邀请不上屏
|| (type === "rtcVideoTicket")
// 订单轨迹不上屏
|| (type === "track" || type === "order")
) return;

// 给收到的消息加id,用于撤回消息
Expand Down Expand Up @@ -959,4 +988,3 @@ function _messagePrompt(message, officialAccount){
});
}
}

6 changes: 2 additions & 4 deletions src/js/app/modules/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,16 @@ function chat_window_mode_init(){
}

function updateCustomerInfo(e){
var trackMsg;
var temp;
var data = e.data;
if(typeof data === "string"){
data = JSON.parse(data);
}
temp = utils.getDataByPath(data, "easemob.kefu.cta");
if(temp){
var trackMsg = {
trackMsg = {
ext: {
// imageName: "mallImage3.png",
// // custom代表自定义消息,无需修改
// type: "custom",
msgtype: {
track: {
// 消息标题
Expand Down
31 changes: 19 additions & 12 deletions src/js/app/modules/tenantInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,26 @@ module.exports = function(){
prop: article.prop,
};
});
channel.handleMessage(
{
ext: {
msgtype: {
articles: articles,
}
},
channel.sendText("", {
ext: {
msgtype: {
articles: articles,
}
},
{
type: "article",
noPrompt: true
}
);
});
// channel.handleMessage(
// {
// ext: {
// msgtype: {
// articles: articles,
// }
// },
// },
// {
// type: "article",
// noPrompt: true
// }
// );
});
}

Expand Down

0 comments on commit 6824c39

Please sign in to comment.