/**
 * 保存服务端向客户端发送的“推送消息”。当用户A向用户B发送消息，服务器会保存此消息，并构建一条通知消息保存到数据库，
 * 并通过个推系统向B发送此消息。
 */
"use strict";

var log = require('../util/log');
var imRepo = require("./database/im.db.js");

exports.save = function(to, contentType, title, content, message, has_pushed, handler) {
    imRepo.execQuery({
        "sql": "INSERT INTO push_notify (to_uid,type,title,content,data,has_pushed) VALUES (?,?,?,?,?,?)",
        "args": [to, contentType, title, content, message, has_pushed],
        "handler": handler
    });
};

//exports.save = save;
