|
@ -17,6 +17,7 @@ let config = require('../../resources/config/' + configFile);
|
|
|
|
|
|
const REDIS_KEYS = require('../../include/commons').REDIS_KEYS;
|
|
|
const SESSION_USER_STATUS = require('../../include/commons').SESSION_USER_STATUS;
|
|
|
const SESSION_TYPES = require('../../include/commons').SESSION_TYPES;
|
|
|
|
|
|
class Topics extends RedisModel {
|
|
|
constructor() {
|
|
@ -85,7 +86,7 @@ class Topics extends RedisModel {
|
|
|
for(var j in users){
|
|
|
pars.push(j+":"+users[j]);
|
|
|
}
|
|
|
sessions.createSession(sessionId, messages.patientName, config.sessionConfig.MUC, pars, function (res) {
|
|
|
sessions.createSession(sessionId, messages.patientName, SESSION_TYPES.MUC, pars, function (res) {
|
|
|
if (res) {
|
|
|
callbegin();
|
|
|
}
|
|
@ -100,9 +101,9 @@ class Topics extends RedisModel {
|
|
|
*/
|
|
|
function callbegin() {
|
|
|
let msg = {};
|
|
|
msg.senderId = messages.patient;
|
|
|
msg.senderName = messages.patientName;
|
|
|
msg.contentType = 6;
|
|
|
msg.sender_id = messages.patient;
|
|
|
msg.sender_name = messages.patientName;
|
|
|
msg.content_type = 6;
|
|
|
msg.content = "开始咨询"
|
|
|
msg.timestamp = date;
|
|
|
sessions.saveMessageByTopic(msg, sessionId, function (err, msgId) {
|
|
@ -110,7 +111,7 @@ class Topics extends RedisModel {
|
|
|
ModelUtil.emitOK(self.eventEmitter, err);
|
|
|
} else {
|
|
|
self.saveTopicsToSql(topicName, topicId, sessionId, msgId, date);
|
|
|
callBeginMsg(startMsgId);
|
|
|
callBeginMsg(msgId);
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@ -120,12 +121,12 @@ class Topics extends RedisModel {
|
|
|
*/
|
|
|
function callBeginMsg(startMsgId) {
|
|
|
let msg = {};
|
|
|
msg.senderId = messages.patient;
|
|
|
msg.senderName = messages.patientName;
|
|
|
msg.contentType = 1;
|
|
|
msg.sender_id = messages.patient;
|
|
|
msg.sender_name = messages.patientName;
|
|
|
msg.content_type = 1;
|
|
|
msg.content = messages.description;
|
|
|
msg.timestamp = new Date();
|
|
|
sessions.saveMessageByTopic(msg, patient, function (err, msgId) {
|
|
|
msg.timestamp = new Date().getTime();
|
|
|
sessions.saveMessageByTopic(msg, messages.patient, function (err, msgId) {
|
|
|
log.info("begin send" + messages.description);
|
|
|
});
|
|
|
|
|
@ -133,12 +134,12 @@ class Topics extends RedisModel {
|
|
|
let imgs = messages.img.split(",");
|
|
|
for (var j in imgs) {
|
|
|
let msgimg = {};
|
|
|
msgimg.senderId = messages.patient;
|
|
|
msgimg.senderName = messages.patientName;
|
|
|
msgimg.contentType = 2;
|
|
|
msgimg.sender_id = messages.patient;
|
|
|
msgimg.sender_name = messages.patientName;
|
|
|
msgimg.content_type = 2;
|
|
|
msgimg.content = imgs[j];
|
|
|
msgimg.timestamp = new Date();
|
|
|
sessions.saveMessageByTopic(msgimg, patient, function (err, msgId) {
|
|
|
msgimg.timestamp = new Date().getTime();
|
|
|
sessions.saveMessageByTopic(msgimg, messages.patient, function (err, msgId) {
|
|
|
log.info("begin send" + imgs[j]);
|
|
|
})
|
|
|
}
|