|
@ -104,7 +104,7 @@ class Sessions extends RedisModel {
|
|
|
for (let i in participantArray) {
|
|
|
participantIdArray.push(participantArray[i].split(":")[0]);
|
|
|
}
|
|
|
if (type == SESSION_TYPES.P2P || type == SESSION_TYPES.SYSTEM) {
|
|
|
if (type == SESSION_TYPES.P2P || type == SESSION_TYPES.SCREENING_REFERRAL || type == SESSION_TYPES.SYSTEM) {
|
|
|
if (sessionId) {
|
|
|
callBusinessType(sessionId);
|
|
|
return;
|
|
@ -187,7 +187,7 @@ class Sessions extends RedisModel {
|
|
|
}
|
|
|
//流程1-判断是否存在sessionId不存在则创建对应的sessionId;
|
|
|
if (!sessionId) {
|
|
|
if (type == SESSION_TYPES.P2P || type == SESSION_TYPES.SYSTEM) {
|
|
|
if (type == SESSION_TYPES.P2P || type == SESSION_TYPES.SCREENING_REFERRAL || type == SESSION_TYPES.SYSTEM) {
|
|
|
ParticipantRepo.findSessionIdByParticipantIds(participantIdArray[0], participantIdArray[1], function (err, res) {
|
|
|
sessionId = res;
|
|
|
callBusinessType();
|
|
@ -359,7 +359,7 @@ class Sessions extends RedisModel {
|
|
|
let self = this;
|
|
|
let sessionKey = RedisModel.makeRedisKey(REDIS_KEYS.Session, sessionId);
|
|
|
redis.hgetallAsync(sessionKey).then(function(session){
|
|
|
if(session.type==SESSION_TYPES.P2P){
|
|
|
if(session.type==SESSION_TYPES.P2P||session.type == SESSION_TYPES.SCREENING_REFERRAL){
|
|
|
ParticipantRepo.findNameById(userId, function (err, res) {
|
|
|
session.name = res[0].name;
|
|
|
if(handler){
|
|
@ -603,7 +603,7 @@ class Sessions extends RedisModel {
|
|
|
}
|
|
|
let sessionName = "";
|
|
|
let otherUserId = "";
|
|
|
if (session.type == SESSION_TYPES.P2P) {
|
|
|
if (session.type == SESSION_TYPES.P2P||session.type == SESSION_TYPES.SCREENING_REFERRAL) {
|
|
|
for (let j in users) {
|
|
|
if (users[j] != userId) {
|
|
|
otherUserId = users[j];
|
|
@ -620,7 +620,7 @@ class Sessions extends RedisModel {
|
|
|
.then(function (count) {
|
|
|
if (!otherUserId) otherUserId = userId;
|
|
|
ParticipantRepo.findNameById(otherUserId, function (err, res) {
|
|
|
if ((res && res.length == 0) || session.type != SESSION_TYPES.P2P) {
|
|
|
if ((res && res.length == 0) || (session.type != SESSION_TYPES.P2P&&session.type != SESSION_TYPES.SCREENING_REFERRAL)) {
|
|
|
sessionName = session.name;
|
|
|
} else {
|
|
|
sessionName = res[0].name;
|
|
@ -747,7 +747,7 @@ class Sessions extends RedisModel {
|
|
|
}
|
|
|
let sessionName = "";
|
|
|
let otherUserId = "";
|
|
|
if (session.type == SESSION_TYPES.P2P) {
|
|
|
if (session.type == SESSION_TYPES.P2P || session.type == SESSION_TYPES.SCREENING_REFERRAL) {
|
|
|
for (let j in users) {
|
|
|
if (users[j] != userId) {
|
|
|
otherUserId = users[j];
|
|
@ -763,7 +763,7 @@ class Sessions extends RedisModel {
|
|
|
.then(function (count) {
|
|
|
if (!otherUserId) otherUserId = userId;
|
|
|
ParticipantRepo.findNameById(otherUserId, function (err, res) {
|
|
|
if ((res && res.length == 0) || session.type != SESSION_TYPES.P2P) {
|
|
|
if ((res && res.length == 0) || session.type != SESSION_TYPES.P2P || session.type != SESSION_TYPES.SCREENING_REFERRAL) {
|
|
|
sessionName = session.name;
|
|
|
} else {
|
|
|
sessionName = res[0].name;
|
|
@ -888,7 +888,7 @@ class Sessions extends RedisModel {
|
|
|
}
|
|
|
let sessionName = "";
|
|
|
let otherUserId = "";
|
|
|
if (session.type == SESSION_TYPES.P2P) {
|
|
|
if (session.type == SESSION_TYPES.P2P || session.type == SESSION_TYPES.SCREENING_REFERRAL) {
|
|
|
for (let j in users) {
|
|
|
if (users[j] != userId) {
|
|
|
otherUserId = users[j];
|
|
@ -905,7 +905,7 @@ class Sessions extends RedisModel {
|
|
|
.then(function (count) {
|
|
|
if (!otherUserId) otherUserId = userId;
|
|
|
ParticipantRepo.findNameById(otherUserId, function (err, res) {
|
|
|
if ((res && res.length == 0) || session.type != SESSION_TYPES.P2P) {
|
|
|
if ((res && res.length == 0) || session.type != SESSION_TYPES.P2P || session.type != SESSION_TYPES.SCREENING_REFERRAL) {
|
|
|
sessionName = session.name;
|
|
|
} else {
|
|
|
sessionName = res[0].name;
|
|
@ -1185,7 +1185,7 @@ class Sessions extends RedisModel {
|
|
|
handler(null, messages);
|
|
|
}).then(function () {
|
|
|
Sessions.updateParticipantLastFetchTime(sessionId, userId, new Date().getTime());
|
|
|
if(session.type == SESSION_TYPES.P2P){
|
|
|
if(session.type == SESSION_TYPES.P2P || session.type == SESSION_TYPES.SCREENING_REFERRAL){
|
|
|
for(var j in users){
|
|
|
if(users[j]==userId)continue;
|
|
|
WechatClient.sendAllRead(users[j],sessionId);
|
|
@ -1217,7 +1217,7 @@ class Sessions extends RedisModel {
|
|
|
handler(null, messages);
|
|
|
}).then(function () {
|
|
|
Sessions.updateParticipantLastFetchTime(sessionId, userId, new Date().getTime());
|
|
|
if(session.type == SESSION_TYPES.P2P){
|
|
|
if(session.type == SESSION_TYPES.P2P || session.type == SESSION_TYPES.SCREENING_REFERRAL){
|
|
|
for(var j in users){
|
|
|
if(users[j]==userId)continue;
|
|
|
//通知对方自己已经读取数据
|
|
@ -1841,7 +1841,7 @@ class Sessions extends RedisModel {
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
if(sessionType==SESSION_TYPES.P2P){
|
|
|
if(sessionType==SESSION_TYPES.P2P || sessionType == SESSION_TYPES.SCREENING_REFERRAL){
|
|
|
WechatClient.sendReadDoctorByDoctorId(targetUserId, message);
|
|
|
}
|
|
|
//告知医生新消息
|
|
@ -1912,7 +1912,7 @@ class Sessions extends RedisModel {
|
|
|
WechatClient.sendMessage(message.targetUserId, message.targetUserName, message);
|
|
|
}
|
|
|
} else {
|
|
|
if(message.sessionType==SESSION_TYPES.P2P){
|
|
|
if(message.sessionType==SESSION_TYPES.P2P || message.sessionType == SESSION_TYPES.SCREENING_REFERRAL){
|
|
|
WechatClient.sendReadDoctorByDoctorId(message.targetUserId, message);
|
|
|
}
|
|
|
//告知医生新消息
|
|
@ -1939,7 +1939,7 @@ class Sessions extends RedisModel {
|
|
|
*/
|
|
|
static pushIntoNotification(targetUserId, targetUserName, message,sessionType) {
|
|
|
|
|
|
if(sessionType==SESSION_TYPES.P2P){
|
|
|
if(sessionType==SESSION_TYPES.P2P || sessionType == SESSION_TYPES.SCREENING_REFERRAL){
|
|
|
WechatClient.sendReadDoctorByDoctorId(targetUserId, message);
|
|
|
}
|
|
|
//告知医生新消息
|