system.msg.repo.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. var log = require('../util/log');
  3. var imRepo = require("./database/im.db.js");
  4. exports.save = function(to, contentType, title, summary, content, handler) {
  5. imRepo.execQuery({
  6. "sql": "INSERT INTO msg_system (to_uid,type,title,content,data) VALUES (?,?,?,?,?)",
  7. "args": [to, contentType, title, summary, content],
  8. "handler": handler
  9. });
  10. };
  11. exports.getSystemList=function(userId, handler){
  12. 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";
  13. imRepo.execQuery({
  14. "sql": sql,
  15. "args": [userId,userId],
  16. "handler": handler
  17. });
  18. }
  19. exports.getAppoList = function (userId, handler) {
  20. 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 " ;
  21. imRepo.execQuery({
  22. "sql": sql,
  23. "args": [userId],
  24. "handler": handler
  25. });
  26. };