|
@ -139,14 +139,13 @@ class SessionRepo {
|
|
|
* @param handler
|
|
|
*/
|
|
|
static findAllByTimestampAndType(userId, dateSpan, handler) {
|
|
|
let sql = "SELECT DISTINCT s.id, CASE WHEN TYPE = 2 THEN d.name ELSE s.name END 'name', s.type, s.create_date, s.business_type " +
|
|
|
let sql = "SELECT DISTINCT s.id, CASE WHEN TYPE = 2 THEN d.name ELSE s.name END 'name',s.last_content_type, s.type, s.create_date, s.business_type " +
|
|
|
"FROM sessions s, participants p " +
|
|
|
"LEFT JOIN doctors d ON p.participant_id = d.id " +
|
|
|
"WHERE s.id = p.session_id AND s.last_sender_id <> 'system' " +
|
|
|
"AND UNIX_TIMESTAMP(s.last_message_time) > UNIX_TIMESTAMP(NOW()) - ? " +
|
|
|
"AND p.participant_id <> ? AND s.type <> 1 AND s.business_type = 1 " +
|
|
|
"AND s.id in (select s.id from sessions s, participants p where s.id = p.session_id and p.participant_id = ?) " +
|
|
|
"AND s.id in (select s.id from participants p1, topics t where t.end_message_id is null and p1.session_id = t.session_id and p1.participant_id = ?) " +
|
|
|
"ORDER BY s.last_message_time DESC";
|
|
|
|
|
|
ImDb.execQuery({
|