Browse Source

修复群消息被看见的问题

Sand 8 years ago
parent
commit
267532a5e4

+ 15 - 0
src/doctor/endpoints/groups.endpoint.js

@ -10,6 +10,21 @@ var APIv1 = require('../include/endpoints').APIv1;
var groupRepo = require('../repository/group.repo.js');
/**
 * 获取团队成员。
 *
 * 请求URL:
 *  /groups/:group_id/members?type=1
 */
router.get(APIv1.Groups.Members, function (req, res) {
    var gruopId = req.params.group_id;
    var groupType = req.query.type;
    if(!groupType){
        throw {httpStatus: 406, message: "Missing fields: type"};
    }
});
/**
 * 获取成员头像。每个组最多返回5个成员的头像。
 *

+ 1 - 0
src/doctor/include/endpoints.js

@ -56,6 +56,7 @@ var APIv1 = {
    Groups: {
        Base: '/api/v1/groups',
        Members: '/:group_id/members',
        MembersAvatar: '/member/avatars'
    },

+ 1 - 0
src/doctor/models/patient.js

@ -45,6 +45,7 @@ Patient.prototype.isPatientCode = function (code, trueCallback, falseCallback) {
 * 向患者发送消息。
 *
 * @param userId
 * @param messageType
 * @param feedback
 */
Patient.prototype.sendMessage = function (userId, messageType, feedback) {

+ 3 - 2
src/doctor/repository/group.msg.repo.js

@ -61,13 +61,14 @@ exports.findAllGroupsWithPatient = function (userId, handler) {
        " SELECT g.code code, g.name name, g.type type FROM wlyy.wlyy_talk_group g, wlyy.wlyy_talk_group_member m " +
        " WHERE g.code = m.group_code and m.member_code = ?) g, wlyy.wlyy_patient p , " +
        " ( SELECT new_msg_count, from_gid  FROM  msg_statistic  WHERE uid =?  GROUP BY from_gid  ORDER BY  `timestamp` DESC ) msgcount " +
        " WHERE (ms.uid = ? and ms.from_uid = p.code) " +
        " WHERE ((ms.uid = ? and ms.from_uid = p.code)) " +
        " and ms.from_gid = g.code and ms.msg_type = 2 AND ms.last_content_type in (1,2,3,5,6) AND msgcount.from_gid=ms.from_gid " +
        " UNION " +
        " SELECT m.group_code code, m.group_name name, ms.last_content_type, ms.last_content, ms.timestamp, ms.new_msg_count, '2' group_type " +
        " FROM wlyy.wlyy_talk_group g, wlyy.wlyy_talk_group_member m, wlyy.wlyy_doctor d, msg_statistic ms, " +
        " ( SELECT new_msg_count, from_gid  FROM  msg_statistic  WHERE uid =?  GROUP BY from_gid  ORDER BY  `timestamp` DESC ) msgcount " +
        " WHERE d.code = ? AND d.code = m.member_code AND msgcount.from_gid=ms.from_gid AND m.group_code = g.code AND g.type=1  AND g.code = ms.from_gid group by m.group_code, m.group_name" +
        " WHERE d.code = ? AND d.code = m.member_code AND msgcount.from_gid=ms.from_gid " +
        "   AND m.group_code = g.code AND g.type=1  AND g.code = ms.from_gid group by m.group_code, m.group_name" +
        ") X ORDER BY timestamp DESC";
    imRepo.execQuery({

+ 1 - 1
src/doctor/repository/private.msg.repo.js

@ -83,7 +83,7 @@ exports.findAllP2PWithPatient = function (userId, handler) {
    var sql = "SELECT p.code, p.name, p.birthday, p.sex, p.photo, ms.last_content_type, ms.last_content, ms.timestamp, ms.new_msg_count " +
        "FROM msg_statistic ms, wlyy.wlyy_patient p " +
        "WHERE ms.msg_type = 1 AND ms.last_content_type in (1,2,3,5,6) " +
        "AND (ms.from_uid = ? AND ms.uid = p.code) OR (ms.uid = ? AND ms.from_uid = p.code) ORDER BY ms.timestamp";
        "AND ((ms.from_uid = ? AND ms.uid = p.code) OR (ms.uid = ? AND ms.from_uid = p.code)) ORDER BY ms.timestamp";
    imRepo.execQuery({
        "sql": sql,