常规推送
This commit is contained in:
@@ -92,7 +92,7 @@ module.exports = (app) => {
|
||||
const { senderAddress, msgData, encodingCategory } = outboundMsg;
|
||||
// socket接收消息后触发事件监听器,将消息发送给websocket客户端并存储在数据库中
|
||||
shunt.socketEmitter().emit(senderAddress.data, { encode_type: parseInt(encodingCategory.data), msg_data: msgData.data, created_at: new Date() });
|
||||
await app.curl('http://127.0.0.1:' + app.server.address().port + '/shortMsg', {
|
||||
const shortMsg = await app.curl('http://127.0.0.1:' + app.server.address().port + '/shortMsg', {
|
||||
dataType: 'json',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
method: 'POST',
|
||||
@@ -107,6 +107,20 @@ module.exports = (app) => {
|
||||
created_at: new Date()
|
||||
},
|
||||
});
|
||||
if (shortMsg.data.code == 404) {
|
||||
await app.curl('http://127.0.0.1:' + app.server.address().port + '/saveUnknown', {
|
||||
dataType: 'json',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
method: 'POST',
|
||||
timeout: 3000,
|
||||
data: {
|
||||
card_id: senderAddress.data,
|
||||
original_msg: originalMsg,
|
||||
msg_data: msgData.data,
|
||||
created_at: new Date()
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
// 重发消息处理
|
||||
if (resendResult && resendResult.type == 4) {
|
||||
@@ -114,8 +128,8 @@ module.exports = (app) => {
|
||||
const { outboundMsg, receiverAddress } = msgContent;
|
||||
const { senderAddress, msgData, encodingCategory } = outboundMsg;
|
||||
// socket接收消息后触发事件监听器,将消息发送给websocket客户端并存储在数据库中
|
||||
shunt.socketEmitter().emit(senderAddress.data, msgData.data);
|
||||
await app.curl('http://127.0.0.1:' + app.server.address().port + '/shortMsg', {
|
||||
shunt.socketEmitter().emit(senderAddress.data, { encode_type: parseInt(encodingCategory.data), msg_data: msgData.data, created_at: new Date() });
|
||||
const shortMsg = await app.curl('http://127.0.0.1:' + app.server.address().port + '/shortMsg', {
|
||||
dataType: 'json',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
method: 'POST',
|
||||
@@ -129,6 +143,20 @@ module.exports = (app) => {
|
||||
msg_data: msgData.data,
|
||||
},
|
||||
});
|
||||
if (shortMsg.data.code == 404) {
|
||||
await app.curl('http://127.0.0.1:' + app.server.address().port + '/saveUnknown', {
|
||||
dataType: 'json',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
method: 'POST',
|
||||
timeout: 3000,
|
||||
data: {
|
||||
card_id: senderAddress.data,
|
||||
original_msg: originalMsg,
|
||||
msg_data: msgData.data,
|
||||
created_at: new Date()
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user