|
@ -643,15 +643,15 @@ class Sessions extends RedisModel {
|
|
|
if(j%2!=0)continue;
|
|
|
let participantsTimeJson = {};
|
|
|
//成员名字
|
|
|
let participantNames;
|
|
|
let sql = "SELECT u.name,u.avatar,1 as type FROM participants p, patients u " +
|
|
|
"WHERE p.session_id = ? AND p.participant_id = u.id AND P.participant_id=? union "+
|
|
|
let sql = "SELECT u.name,u.avatar,1 as type FROM patients u " +
|
|
|
"WHERE u.id =? union "+
|
|
|
" SELECT u.name,u.avatar,0 as type FROM participants p, doctors u " +
|
|
|
" WHERE p.session_id = ? AND p.participant_id = u.id AND P.participant_id=? ";
|
|
|
" WHERE u.id =? ";
|
|
|
ImDb.execQuery({
|
|
|
"sql": sql,
|
|
|
"args": [sessionId,participantsTimeArray[j],sessionId,participantsTimeArray[j]],
|
|
|
"args": [participantsTimeArray[j],participantsTimeArray[j]],
|
|
|
"handler": function(err,participantNames){
|
|
|
log.info("---participantNames:"+JSON.stringify(participantNames));
|
|
|
if(participantNames&&participantNames.length>0){
|
|
|
participantsTimeJson["name"] = participantNames[0].name;
|
|
|
participantsTimeJson["avatar"] = participantNames[0].avatar;
|
|
@ -1273,14 +1273,15 @@ class Sessions extends RedisModel {
|
|
|
if(j%2!=0)continue;
|
|
|
let participantsTimeJson = {};
|
|
|
let participantNames;
|
|
|
let sql = "SELECT u.name,u.avatar,1 as type FROM participants p, patients u " +
|
|
|
"WHERE p.session_id = ? AND p.participant_id = u.id AND P.participant_id=? union "+
|
|
|
" SELECT u.name,u.avatar,0 as type FROM participants p, doctors u " +
|
|
|
" WHERE p.session_id = ? AND p.participant_id = u.id AND P.participant_id=? ";
|
|
|
let sql = "SELECT u.name,u.avatar,1 as type FROM patients u " +
|
|
|
"WHERE u.id =? union "+
|
|
|
" SELECT u.name,u.avatar,0 as type FROM doctors u " +
|
|
|
" WHERE u.id =? ";
|
|
|
ImDb.execQuery({
|
|
|
"sql": sql,
|
|
|
"args": [sessionId,participantsTimeArray[j],sessionId,participantsTimeArray[j]],
|
|
|
"args": [participantsTimeArray[j],participantsTimeArray[j]],
|
|
|
"handler": function(err,participantNames){
|
|
|
log.info("-1--participantNames:"+JSON.stringify(participantNames));
|
|
|
if(participantNames&&participantNames.length>0){
|
|
|
participantsTimeJson["name"] = participantNames[0].name;
|
|
|
participantsTimeJson["avatar"] = participantNames[0].avatar;
|
|
@ -2170,7 +2171,7 @@ class Sessions extends RedisModel {
|
|
|
res.forEach(function (participant) {
|
|
|
if (participant.id == message.sender_id||sessionType==SESSION_TYPES.SYSTEM){
|
|
|
message.sender_img = participant.avatar;
|
|
|
callPush(res,message);
|
|
|
callPush(res,message,message.sender_name);
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@ -2182,12 +2183,12 @@ class Sessions extends RedisModel {
|
|
|
ModelUtil.emitDataNotFound(self.eventEmitter, {message: "当前会话找不到此发送者"});
|
|
|
}
|
|
|
});
|
|
|
function callPush(participants,message){
|
|
|
function callPush(participants,message,sender_name){
|
|
|
participants.forEach(function (participant) {
|
|
|
// if (
|
|
|
// // participant.id !== message.sender_id &&
|
|
|
// participant.participant_role == PARTICIPANT_ROLES.HOST) {
|
|
|
Sessions.pushNotification(participant.id, participant.name, message,sessionType);
|
|
|
Sessions.pushNotification(participant.id, participant.name, message,sessionType,sender_name);
|
|
|
// }
|
|
|
});
|
|
|
}
|
|
@ -2460,13 +2461,13 @@ class Sessions extends RedisModel {
|
|
|
* @param targetUserId
|
|
|
* @param message
|
|
|
*/
|
|
|
static pushNotification(targetUserId, targetUserName, message,sessionType) {
|
|
|
static pushNotification(targetUserId, targetUserName, message,sessionType,sender_name) {
|
|
|
let self = this;
|
|
|
log.info("targetUserId="+targetUserId)
|
|
|
Users.isPatientId(targetUserId, function (err, isPatient) {
|
|
|
if (isPatient) {
|
|
|
if(config.environment!='local'){//pc版不直接发送给居民,通过redis的publish
|
|
|
WechatClient.sendMessage(targetUserId, targetUserName, message);
|
|
|
WechatClient.sendMessage(targetUserId, targetUserName, message,sessionType,sender_name);
|
|
|
}
|
|
|
message.targetUserId = targetUserId;
|
|
|
message.targetUserName = targetUserName;
|