소스 검색

bug修复

wangzhinan 5 년 전
부모
커밋
068090acf4

+ 2 - 0
src/server/endpoints/v2/session.endpoint.js

@ -484,6 +484,8 @@ router.post(APIv2.Sessions.Messages, function (req, res) {
    let sessions = new Sessions();
    ControllerUtil.regModelEventHandler(sessions, res);
    log.info("入参"+payload);
    sessions.saveMessageBySession(req.params.session_id, payload);
});

+ 1 - 0
src/server/handlers/socket.handler.js

@ -327,6 +327,7 @@ class SocketHandler {
            // 客户端退出
            socket.on('logout', function (data) {
                log.info("data="+data);
                let client = clientCache.findBySocket(socket);
                if (client) {
                    //修改居民在线状态

+ 17 - 2
src/server/models/client/wechat.client.js

@ -471,6 +471,11 @@ class WechatClient extends RedisModel {
    }
    /**
     * 发送socket给居民
     * @param patientId
     * @param message
     */
    static sendSocketMessageToPatient(patientId, message) {
        let patientClient = clientCache.findByIdAndType(patientId,SOCKET_TYPES.PATIENT);
        let pc_patientClient = clientCache.findByIdAndType("pcpatient_"+patientId,SOCKET_TYPES.PC_PATIENT);
@ -999,9 +1004,19 @@ class WechatClient extends RedisModel {
                    }
                    log.info("内容类型"+message.content_type);
                    log.info("内容"+message.content);
                    //1、2、3、18、19、12、34
                    // 发送模板消息
                    if(map != null){
                    if(map != null && (message.content_type==CONTENT_TYPES.PlainText||
                        message.content_type==CONTENT_TYPES.Image||
                        message.content_type==CONTENT_TYPES.Audio||
                        message.content_type==CONTENT_TYPES.Video||
                        message.content_type==CONTENT_TYPES.PersonalCard||
                        message.content_type==CONTENT_TYPES.MessageForward||
                        message.content_type==CONTENT_TYPES.PrescriptionSuggest||
                        message.content_type==CONTENT_TYPES.ConsultSuggest)){
                        log.info("内容类型122:"+message.content_type);
                        let userName = map.get("name");
                        let idCard = map.get("idcard");
                        let phone = map.get("mobile");

+ 3 - 3
src/server/models/sessions/sessions.js

@ -1381,11 +1381,10 @@ class Sessions extends RedisModel {
            }
            for (let j in res) {
                //是否过滤指定类型
                if( type != null){
                    if(type != res[j].type){
                    let typeString = type.split(",");
                    if(!typeString.contains(res[j].type)){
                        continue;
                    }
                }
@ -1953,6 +1952,7 @@ class Sessions extends RedisModel {
     */
    static pushNotification(targetUserId, targetUserName, message,sessionType) {
        let self = this;
        log.info("targetUserId="+targetUserId)
        Users.isPatientId(targetUserId, function (err, isPatient) {
            if (isPatient) {
                if(config.environment!='local'){//pc版不直接发送给居民,通过redis的publish

+ 3 - 2
src/server/repository/mysql/session.repo.js

@ -42,6 +42,7 @@ class SessionRepo {
        let sys_session = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = 'system' and participant_role =0  group by w.session_id";
        let sessionSQL = "select id, name, type, create_date,business_type, last_sender_id, last_sender_name, last_content_type, last_content, last_message_time,status from "
            + DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.id not in ("+sys_session+")";
        log.info("sql"+sessionSQL);
        ImDb.execQuery({
            "sql": sessionSQL,
            "args": [userId],
@ -249,7 +250,7 @@ class SessionRepo {
            //中山医院无法查询到所有会话记录,暂时取消participant_role的判断条件 20190619
            sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? group by w.session_id";
            sessionSQL =  "select * from "
                + DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.business_type = ? and s.type!=0 order by s.create_date desc limit "+page+","+pagesize;
                + DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.business_type = ? and s.type!=0 order by s.last_message_time desc limit "+page+","+pagesize;
            ImDb.execQuery({
                "sql": sessionSQL,
                "args": [userId, businessType],
@ -264,7 +265,7 @@ class SessionRepo {
            //中山医院无法查询到所有会话记录,暂时取消participant_role的判断条件 20190619
            sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? group by w.session_id";
            sessionSQL =  "select * from "
                + DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.type!=0 order by s.create_date desc limit "+page+","+pagesize;
                + DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.type!=0 order by s.last_message_time desc limit "+page+","+pagesize;
            ImDb.execQuery({
                "sql": sessionSQL,
                "args": [userId],