|
@ -134,7 +134,7 @@ class Sessions extends RedisModel {
|
|
|
let sessionKey = RedisModel.makeRedisKey(REDIS_KEYS.Session, sessionId);
|
|
|
let message = {
|
|
|
sender_id: "system",
|
|
|
sender_name: "system",
|
|
|
sender_name: "系统",
|
|
|
content_type: 11,
|
|
|
content: "会话创建成功",
|
|
|
timestamp: createDate,
|
|
@ -979,6 +979,7 @@ class Sessions extends RedisModel {
|
|
|
let participants = new Participants();
|
|
|
let sessionKey = RedisModel.makeRedisKey(REDIS_KEYS.Session, sessionId);
|
|
|
let messageId = mongoose.Types.ObjectId().toString();
|
|
|
let sessionType =0;
|
|
|
message.id = messageId;
|
|
|
|
|
|
// 检查会话中是否存在此成员
|
|
@ -990,7 +991,7 @@ class Sessions extends RedisModel {
|
|
|
|
|
|
if (res) {
|
|
|
redis.hmgetAsync(sessionKey, ["type", "name"]).then(function (res) {
|
|
|
let sessionType = res[0];
|
|
|
sessionType = res[0];
|
|
|
let sessionName = res[1];
|
|
|
if (sessionType == null) {
|
|
|
ModelUtil.emitError(self.eventEmitter, "Session " + sessionId + " is not found.");
|
|
@ -1046,7 +1047,7 @@ class Sessions extends RedisModel {
|
|
|
participants.forEach(function (participant) {
|
|
|
if (participant.id !== message.sender_id &&
|
|
|
participant.participant_role == PARTICIPANT_ROLES.HOST) {
|
|
|
Sessions.pushNotification(participant.id, participant.name, message);
|
|
|
Sessions.pushNotification(participant.id, participant.name, message,sessionType);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@ -1134,7 +1135,7 @@ class Sessions extends RedisModel {
|
|
|
participants.forEach(function (participant) {
|
|
|
if (participant.id !== message.sender_id &&
|
|
|
participant.participant_role == PARTICIPANT_ROLES.HOST) {
|
|
|
Sessions.pushNotification(participant.id, participant.name, message);
|
|
|
Sessions.pushNotification(participant.id, participant.name, message,sessionType);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@ -1222,13 +1223,15 @@ class Sessions extends RedisModel {
|
|
|
* @param targetUserId
|
|
|
* @param message
|
|
|
*/
|
|
|
static pushNotification(targetUserId, targetUserName, message) {
|
|
|
static pushNotification(targetUserId, targetUserName, message,sessionType) {
|
|
|
Users.isPatientId(targetUserId, function (err, isPatient) {
|
|
|
if (isPatient) {
|
|
|
WechatClient.sendMessage(targetUserId, targetUserName, message);
|
|
|
}
|
|
|
else {
|
|
|
WechatClient.sendReadDoctorByDoctorId(targetUserId, message);
|
|
|
if(sessionType==SESSION_TYPES.P2P){
|
|
|
WechatClient.sendReadDoctorByDoctorId(targetUserId, message);
|
|
|
}
|
|
|
AppClient.sendNotification(targetUserId, message);
|
|
|
}
|
|
|
});
|