浏览代码

Merge branch 'srx' of yeshijie/im.doctor into srx

yeshijie 7 年之前
父节点
当前提交
b10637b621

+ 12 - 4
src/server/include/commons.js

@ -10,15 +10,20 @@
"use strict";
let configFile = "config.";
let wlyyDBName = "";
if (process.env.IM_PROFILE === "prod") {
    configFile += "prod";
    wlyyDBName = "wlyy";
} else if (process.env.IM_PROFILE === "local") {
    configFile += "local";
    wlyyDBName = "wlyy";
} else if (process.env.IM_PROFILE === "test") {
    configFile += "test";
    wlyyDBName = "wlyy";
} else {
    configFile += "dev";
    wlyyDBName = "wlyy_sr";
}
exports.CONFIG_FILE = configFile;
@ -208,10 +213,13 @@ const DB_TABLES = {
    Topics: "topics",
    StickySessions: "sticky_sessions",
    WlyyConsult:"wlyy_consults",
    WlyyConsultTeam:"wlyy.wlyy_consult_team",
    WlyyConsultS:"wlyy.wlyy_consult",
    MessageNoticeSetting:"wlyy.wlyy_message_notice_setting",
    SignFamily:"wlyy.wlyy_sign_family",
    WlyyConsultTeam:wlyyDBName+".wlyy_consult_team",
    WlyyConsultS:wlyyDBName+".wlyy_consult",
    WxAccessToken:wlyyDBName+".wx_access_token",
    WlyyWxPushLog:wlyyDBName+".wlyy_wx_push_log",
    WeixinTemplateConfig:wlyyDBName+".weixin_template_config",
    MessageNoticeSetting:wlyyDBName+".wlyy_message_notice_setting",
    SignFamily:wlyyDBName+".wlyy_sign_family",
    sessionTypeToTableName: function (sessionType) {
        if (sessionType == SESSION_TYPES.SYSTEM)

+ 0 - 10
src/server/models/client/app.client.js

@ -10,7 +10,6 @@ let MessageNoticeSettingRepo = require('../../repository/mysql/message.noticeSet
let SignFamilyRepo = require('../../repository/mysql/sign.family.repo');
let ModelUtil = require('../../util/model.util');
let clientCache = require('../socket.io/client.cache').clientCache();
let WlyyAssistantSDK = require("../../util/wlyyAssistant.sdk");
let WlyySDK = require("../../util/wlyy.sdk");
let log = require("../../util/log.js");
@ -104,15 +103,6 @@ class AppClient extends RedisModel {
            doctorCode:targetId
        }
        // let params = 'sessionId='+(message.session_id||'')+'&sessionType='+sessionType+"&from="+(message.sender_id|| '')+'&content='+message.content+'&businessType='+(message.business_type || 1)+'&doctorCode='+targetId;
        // 医生助手有自己的模板消息,不需要通过im发送
        // WlyyAssistantSDK.request('admin', '0a5c5258-8863-4b07-a3f9-88c768528ab4', '', 'admin_imei', '/doctor/feldsher/sendDoctorTemplate', param, function (err, res) {
        //     // WlyySDK.request('admin', '0a5c5258-8863-4b07-a3f9-88c768528ab4', '', 'admin_imei', '/doctor/feldsher/sendDoctorTemplate?' + params, 'GET', function (err, res) {
        //     if(err){
        //         log.error(err);
        //     }else {
        //         log.info(res);
        //     }
        // });
        if (!userStatus) {
            log.warn("User's app status is not found, user id: " + targetId + ", maybe user never login yet or logout?");

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

@ -1628,13 +1628,13 @@ class Sessions extends RedisModel {
                    res =  JSON.parse(res)
                    if (res.status == 200) {
                        let data = res.data;
                        count = parseInt(JSON.parse(data.imMsgCount).count) + parseInt(data.system.amount) + parseInt(data.healthIndex.amount) + parseInt(data.sign.amount);
                        count = parseInt(JSON.parse(data.imMsgCount).count) + parseInt(data.system.amount) + parseInt(data.concern.amount);
                    }
                    if(config.environment!='local'){//pc版不推送个推,通过redis的publish
                        AppClient.sendNotification(targetUserId, message,sessionType,count);
                    }
                    //外网pcim通过socket推送
                    WechatClient.sendPcImSocket(targetUserId,message,sessionType);
                    //WechatClient.sendPcImSocket(targetUserId,message,sessionType);
                });
                message.targetUserId = targetUserId;

+ 13 - 38
src/server/resources/config/config.dev.js

@ -2,10 +2,10 @@
// IM数据库配置
let imDbConfig = {
    host: '172.19.103.85',
    user: 'linzhou',
    password: 'linzhou',
    database: 'im_new',
    host: '172.19.103.77',
    user: 'root',
    password: '123456',
    database: 'im_sr',
    connectionLimit: '50',
    charset: 'utf8mb4'
};
@ -22,13 +22,13 @@ let imDbConfig = {
let redisConfig = {
    host: '172.19.103.88',
    port: 6379,
    db: 1
    db: 2
};
// 内网Redis
let innerRedisConfig = {
    host: '172.19.103.88',
    port: 6379,
    db: 1
    db: 2
};
// 三师后台
@ -39,48 +39,24 @@ let innerRedisConfig = {
// };
let wlyyServerConfig = {
    host: '192.168.131.24',
    port: 8080,
    model:"/"
};
//医生助手配置
let wlyyDAServerConfig = {
    host: '192.168.131.113',
    port: 8080,
    port: 8082,
    model:"/"
};
// 个推AppStore版参数
let getTuiConfig = {
    HOST: 'https://api.getui.com/apiex.htm',
    APPID: 'qWmRh2X88l7HuE36z3qBe8',
    APPKEY: 'EzERfV8c849lBkZqHWzQG1',
    MASTERSECRET: 'veXiajQrId6iojy7Qv8kZ2'
    APPID: 'NamoCLe9no9pIihdoZ930A',
    APPKEY: 'db7PZsd7TX6JAsLKmWuAT8',
    MASTERSECRET: '5IFJjgxRiI7QpuArMMT3E5'
};
// let getTuiConfig = {
//     HOST: 'https://api.getui.com/apiex.htm',
//     APPID: 'DKgbGvbacm74nJJzen5ilA',
//     APPSECRET: '4kGcL7e7kU6mbSqfEGZFW7',
//     APPKEY: 'ArZfS2qvoA7N3hawOAGVC5',
//     MASTERSECRET: '9lpy5vEss46tVzP1RCJiC4'
// };
// 微信配置
// let wechatConfig = {
//     appId: 'wxd03f859efdf0873d',
//     appSecret: '2935b54b53a957d9516c920a544f2537',
//     token: '27eb3bb24f149a7760cf1bb154b08040',
//     baseUrl: 'weixin.xmtyw.cn/wlyy',
//     template: {
//         consultTemplate: 'qSOW0DBxO3qEBm4ucG0Ial0jxsOyD7_f2TFK5e-mQEc'  // 咨询回复模板
//     }
// };
// 微信配置
let wechatConfig = {
    appId: 'wx1f129f7b51701428',
    appSecret: '988f005d8309ed1795939e0f042431fb',
    appId: 'wxd03f859efdf0873d',
    appSecret: '2935b54b53a957d9516c920a544f2537',
    token: '27eb3bb24f149a7760cf1bb154b08040',
    accId: 'gh_ffd64560fb21',
    baseUrl: 'ehr.yihu.com/wlyy',
    template: {
        consultTemplate: '-dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18'  // 咨询回复模板
@ -120,7 +96,6 @@ exports.innerRedisConfig = innerRedisConfig;
exports.getTuiConfig = getTuiConfig;
exports.wlyyServerConfig = wlyyServerConfig;
exports.wlyyDAServerConfig = wlyyDAServerConfig;
exports.wechatConfig = wechatConfig;
exports.sessionConfig = sessionConfig;
exports.topicConfig = topicConfig;

+ 0 - 8
src/server/resources/config/config.local.js

@ -31,13 +31,6 @@ let wlyyServerConfig = {
    model:"/wlyy"
};
//医生助手配置
let wlyyDAServerConfig = {
    host: '27.155.100.191',
    port: 9660,
    model:"/wlyy"
};
// 个推AppStore版参数
let getTuiConfig = {
    HOST: 'https://api.getui.com/apiex.htm',
@ -90,7 +83,6 @@ exports.innerRedisConfig = innerRedisConfig;
exports.getTuiConfig = getTuiConfig;
exports.wlyyServerConfig = wlyyServerConfig;
exports.wlyyDAServerConfig = wlyyDAServerConfig;
exports.wechatConfig = wechatConfig;
exports.sessionConfig = sessionConfig;
exports.topicConfig = topicConfig;

+ 18 - 25
src/server/resources/config/config.prod.js

@ -1,10 +1,10 @@
"use strict";
let imDbConfig = {
    host: '59.61.92.90',
    user: 'im',
    host: '11.1.2.5',
    user: 'wlyy_sr',
    port:9069,
    password: 'im!)123',
    password: '123456',
    database: 'im',
    connectionLimit: '100',
    charset : 'utf8mb4'
@ -12,10 +12,10 @@ let imDbConfig = {
// Redis
let redisConfig = {
    host: '59.61.92.90',
    port: 9054,
    host: '11.1.2.22',
    port: 6390,
    db: 1,
    password:'jkzlehr'
    password:'Kb6wKDQP1W4'
};
// let redisConfig = {
//     host: '192.168.120.14',
@ -25,42 +25,36 @@ let redisConfig = {
// };
// 内网Redis
let innerRedisConfig = {
    host: '59.61.92.90',
    port: 9054,
    host: '11.1.2.22',
    port: 6390,
    db: 1,
    password:'jkzlehr'
    password:'Kb6wKDQP1W4'
};
// 三师后台
let wlyyServerConfig = {
    host: 'www.xmtyw.cn',
    host: 'srijk.yihu.com',
    port: 80,
    model:"/wlyy"
};
//医生助手配置
let wlyyDAServerConfig = {
    host: '192.168.120.167',
    port: 5550,
    model:"/assistant"
};
// 个推AppStore版参数
let getTuiConfig = {
    HOST: 'https://api.getui.com/apiex.htm',
    APPID: 'qWmRh2X88l7HuE36z3qBe8',
    APPKEY: 'EzERfV8c849lBkZqHWzQG1',
    MASTERSECRET: 'veXiajQrId6iojy7Qv8kZ2'
    APPID: 'NamoCLe9no9pIihdoZ930A',
    APPKEY: 'db7PZsd7TX6JAsLKmWuAT8',
    MASTERSECRET: '5IFJjgxRiI7QpuArMMT3E5'
};
// 微信配置
let wechatConfig = {
    appId: 'wxad04e9c4c5255acf',
    appSecret: 'ae77c48ccf1af5d07069f5153d1ac8d3',
    appId: 'wxe627ffaee2d05a40',
    appSecret: '7c29f6b28be7e54b742883a47ff39767',
    token: '27eb3bb24f149a7760cf1bb154b08040',
    baseUrl: 'www.xmtyw.cn/wlyy',
    accId: 'gh_ffd64560fb21',
    baseUrl: 'srijk.yihu.com/wlyy',
    template: {
        consultTemplate: '0mF_vHj-ILx8EH8DwzmAi7LqzjqYiU9IrSRRmziTZyc'  // 咨询回复模板
        consultTemplate: '-dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18'  // 咨询回复模板
    }
};
@ -97,7 +91,6 @@ exports.innerRedisConfig = innerRedisConfig;
exports.getTuiConfig = getTuiConfig;
exports.wlyyServerConfig = wlyyServerConfig;
exports.wlyyDAServerConfig = wlyyDAServerConfig;
exports.wechatConfig = wechatConfig;
exports.sessionConfig = sessionConfig;
exports.topicConfig = topicConfig;

+ 0 - 8
src/server/resources/config/config.test.js

@ -33,13 +33,6 @@ let wlyyServerConfig = {
    model:"/wlyy"
};
//医生助手配置
let wlyyDAServerConfig = {
    host: '172.19.103.88',
    port: 9092,
    model:"/wlyy"
};
// 个推AppStore版参数
let getTuiConfig = {
    HOST: 'https://api.getui.com/apiex.htm',
@ -91,7 +84,6 @@ exports.innerRedisConfig = innerRedisConfig;
exports.getTuiConfig = getTuiConfig;
exports.wlyyServerConfig = wlyyServerConfig;
exports.wlyyDAServerConfig = wlyyDAServerConfig;
exports.wechatConfig = wechatConfig;
exports.sessionConfig = sessionConfig;
exports.topicConfig = topicConfig;

+ 0 - 55
src/server/util/wlyyAssistant.sdk.js

@ -1,55 +0,0 @@
/**
 * 简易WLYY SDK,提供WLYY接口调用。
 */
'use strict';
let http = require('http');
let querystring = require('querystring');
let configFile = require('../include/commons').CONFIG_FILE;
let config = require('../resources/config/' + configFile);
let log = require('./log.js');
class WlyyAssistantSDK {
    constructor(){}
    static request(userId, adminToken, token, imei, endpoint, param, handler){
        let userAgent = {
            admin_token: adminToken,
            token: token,
            uid: userId,
            imei: imei
        };
        var postData=querystring.stringify(param);
        let options = {
            hostname: config.wlyyDAServerConfig.host,
            port: config.wlyyDAServerConfig.port,
            path: config.wlyyDAServerConfig.model+endpoint,
            method: 'POST',
            headers: {
                'userAgent': JSON.stringify(userAgent),
                'Content-Type': 'application/x-www-form-urlencoded;text/html;charset=utf-8'
            }
        };
        let req = http.request(options, function (res) {
            res.setEncoding('utf-8');
            res.on('data', function (chunk) {
                log.info('家庭医生助手平台->请求成功:', chunk);
                handler(null, chunk);
            });
        });
        req.on('error', function (err) {
            log.error('家庭医生助手平台->请求失败: ', err.message);
            handler(err, null);
        });
        req.write(postData);
        req.end();
    }
}
module.exports = WlyyAssistantSDK;