|
@ -1358,12 +1358,11 @@ class Sessions extends RedisModel {
|
|
|
let patientCount = 0;
|
|
|
let doctorCount = 0;
|
|
|
let patientEndCount = 0;
|
|
|
SessionRepo.findAll(userId, function (err, res) {
|
|
|
// SessionRepo.findUnEndAll(userId, function (err, res) {
|
|
|
SessionRepo.findAllByTypes(userId,type, function (err, res) {
|
|
|
// SessionRepo.findUnEndAll(userId, function (err, res) {
|
|
|
if (err) {
|
|
|
if(handler)
|
|
|
{
|
|
|
handler(err,res);
|
|
|
if (handler) {
|
|
|
handler(err, res);
|
|
|
return;
|
|
|
}
|
|
|
ModelUtil.logError("getAllSessionsUnreadMessageCount is failed", err);
|
|
@ -1371,33 +1370,31 @@ class Sessions extends RedisModel {
|
|
|
}
|
|
|
|
|
|
if (res && res.length == 0) {
|
|
|
if(handler)
|
|
|
{
|
|
|
handler(err,count);
|
|
|
if (handler) {
|
|
|
handler(err, count);
|
|
|
return;
|
|
|
}
|
|
|
ModelUtil.emitOK(self.eventEmitter, {count: count});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let has = false;
|
|
|
/*let has = false;*/
|
|
|
for (let j in res) {
|
|
|
has = false;
|
|
|
//是否过滤指定类型
|
|
|
if( type != null){
|
|
|
let typeString = type.split(",");
|
|
|
var str = res[j].type;
|
|
|
var str1 = str.toString();
|
|
|
if(typeString.indexOf(str1)<0){
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
/* has = false;
|
|
|
//是否过滤指定类型
|
|
|
if( type != null){
|
|
|
let typeString = type.split(",");
|
|
|
var str = res[j].type;
|
|
|
var str1 = str.toString();
|
|
|
if(typeString.indexOf(str1)<0){
|
|
|
continue;
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
if (res[j].type == SESSION_TYPES.SYSTEM) {
|
|
|
|
|
|
if (j == res.length - 1) {
|
|
|
if(handler){
|
|
|
handler(err,count);
|
|
|
if (handler) {
|
|
|
handler(err, count);
|
|
|
return;
|
|
|
}
|
|
|
ModelUtil.emitOK(self.eventEmitter, {count: count, patient: patientCount, doctor: doctorCount});
|
|
@ -1405,11 +1402,11 @@ class Sessions extends RedisModel {
|
|
|
continue;
|
|
|
}
|
|
|
callback(res, j, res[j]);
|
|
|
has = true
|
|
|
}
|
|
|
if(!has){
|
|
|
ModelUtil.emitOK(self.eventEmitter, {count: count, patient: patientCount,patientEnd: 0, doctor: doctorCount});
|
|
|
/* has = true*/
|
|
|
}
|
|
|
/* if(!has){
|
|
|
ModelUtil.emitOK(self.eventEmitter, {count: count, patient: patientCount,patientEnd: 0, doctor: doctorCount});
|
|
|
}*/
|
|
|
});
|
|
|
|
|
|
/*function callback(res, j, session) {
|