|
@ -59,9 +59,8 @@ class Topics extends RedisModel {
|
|
|
* @param users 发起议题的患者,格式:{"userId1:role", "userId2:role"}
|
|
|
* @param messages 发送的消息对象,格式:{description:"",title:"",img:"image1,image2",senderId:"",senderName:""},多个图片用逗号隔开
|
|
|
*/
|
|
|
createTopic(topicName, topicId, sessionId, users, messages) {
|
|
|
createTopic(topicName, topicId, sessionId, users, messages,sessionType) {
|
|
|
let self = this;
|
|
|
|
|
|
//MUC模式中sessionID就是患者ID
|
|
|
let topics_key = RedisModel.makeRedisKey(REDIS_KEYS.Topics, sessionId);
|
|
|
let topic_key = RedisModel.makeRedisKey(REDIS_KEYS.Topic, topicId);
|
|
@ -81,20 +80,19 @@ class Topics extends RedisModel {
|
|
|
"description", messages.description,
|
|
|
"status", TOPIC_STATUS.NEW)
|
|
|
.then(function (res) {
|
|
|
sessions.getSessions(sessionId, function (err, res) {
|
|
|
participants.getMucSessionIdByParticipants(users, function (err, res) {
|
|
|
// 已经存在对应的会话更新全科为旁听
|
|
|
if (res && res.length > 0) {
|
|
|
for (var j in users) {
|
|
|
participants.updateUser(sessionId, j, users[j]);
|
|
|
}
|
|
|
|
|
|
callbegin();
|
|
|
} else {
|
|
|
// 不存在创建SESSION
|
|
|
for (var j in users) {
|
|
|
pars.push(j + ":" + users[j]);
|
|
|
}
|
|
|
sessions.createSession(sessionId, messages.senderName, SESSION_TYPES.MUC, pars, function (res) {
|
|
|
sessions.createSession(sessionId, messages.senderName, sessionType, pars, function (res) {
|
|
|
if (res) {
|
|
|
callbegin();
|
|
|
}
|