|
@ -27,8 +27,8 @@ const REDIS_KEYS = require('../../include/commons').REDIS_KEYS;
|
|
|
const SESSION_TYPES = require('../../include/commons').SESSION_TYPES;
|
|
|
const STICKY_SESSION_BASE_SCORE = require('../../include/commons').STICKY_SESSION_BASE_SCORE;
|
|
|
const PARTICIPANT_ROLES = require('../../include/commons').PARTICIPANT_ROLES;
|
|
|
const SESSION_STATUS = require('../../include/commons').SESSION_STATUS;
|
|
|
const CONTENT_TYPES = require('../../include/commons').CONTENT_TYPES;
|
|
|
const SESSION_BUSINESS_TYPE = require('../../include/commons').SESSION_BUSINESS_TYPE;
|
|
|
|
|
|
|
|
|
class Sessions extends RedisModel {
|
|
@ -587,6 +587,11 @@ class Sessions extends RedisModel {
|
|
|
* @param pagesize 分页数量
|
|
|
* @param start_msg_id 消息会话最新的一条消息的ID
|
|
|
* @param end_msg_id 消息会话刚开始的消息ID
|
|
|
* @remark
|
|
|
* start_msg_id end_msg_id 为空取会话倒序的根据分页的消息数据
|
|
|
* start_msg_id 为空 end_msg_id 不为空根据end_msg_id取旧的消息(offset=1可以排除本身)返回指定分页的数据
|
|
|
* end_msg_id 为空 start_msg_id 不为空 根据 start_msg_id 取出新消息(offset=1可以排除本身)返回指定分页的数据
|
|
|
* end_msg_id start_msg_id 都不为空返回指定区间的消息
|
|
|
*/
|
|
|
getMessages(sessionId, user, start_msg_id, end_msg_id, page, pagesize, isoffset, handler) {
|
|
|
let self = this;
|
|
@ -745,6 +750,8 @@ class Sessions extends RedisModel {
|
|
|
handler(null, []);
|
|
|
return;
|
|
|
}
|
|
|
//结束大于开始,正序取数据,返回的数据顺序也是逆序的,反向拉取数据,
|
|
|
// 当end>start取出来都是空的,为了给前端获取新数据使用,一般不出现这种情况
|
|
|
if(endMsgScore>startMsgScore){
|
|
|
redis.zrangebyscoreAsync(messagesTimestampKey, startMsgScore, endMsgScore, "limit", offset, count)
|
|
|
.then(function (res) {
|
|
@ -792,11 +799,13 @@ class Sessions extends RedisModel {
|
|
|
if(session.type == SESSION_TYPES.P2P){
|
|
|
for(var j in users){
|
|
|
if(users[j]==userId)continue;
|
|
|
//通知对方自己已经读取数据
|
|
|
WechatClient.sendAllRead(users[j],sessionId);
|
|
|
}
|
|
|
}else if(session.type == SESSION_TYPES.MUC){
|
|
|
for(var j in users){
|
|
|
if(users[j]==userId)continue;
|
|
|
//如果是患者拉取数据告诉在线的医生患者已经读取数据
|
|
|
WechatClient.sendMucAllRead(users[j],userId,sessionId);
|
|
|
}
|
|
|
}
|
|
@ -849,7 +858,7 @@ class Sessions extends RedisModel {
|
|
|
}
|
|
|
|
|
|
count = count + con;
|
|
|
if (session.type == 2) {
|
|
|
if (session.type == SESSION_BUSINESS_TYPE.PATIENT) {
|
|
|
patientCount = patientCount + con;
|
|
|
} else {
|
|
|
doctorCount = doctorCount + con;
|