"use strict"; var log = require('../util/log'); var imRepo = require("./database/im.db.js"); exports.save = function(to, contentType, title, summary, content, handler) { imRepo.execQuery({ "sql": "INSERT INTO msg_system (to_uid,type,title,content,data) VALUES (?,?,?,?,?)", "args": [to, contentType, title, summary, content], "handler": handler }); }; exports.getSystemList=function(userId, handler){ let sql ="select m.content as lastContent FROM ydf_message m where m.receiver = ? and m.sender<>? and m.type in(301,302,303,304,305) and m.readonly =1 order by m.czrq desc"; imRepo.execQuery({ "sql": sql, "args": [userId,userId], "handler": handler }); } exports.getAppoList = function (userId, handler) { var sql="select m.content as lastContent FROM ydf_message m,ydf_appointment a where m.appointment_id = a.id and a.`status` = 0 and m.type=201 and m.receiver = ? order by m.czrq desc " ; imRepo.execQuery({ "sql": sql, "args": [userId], "handler": handler }); };