<?php

namespace app\common\model;

use think\Model;

/**
 * 系统消息模型
 */
class Message extends Model
{

    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';

    /**
     * 添加系统消息
     */
    public static function addMessage($user_id,$title,$content) {
        if(!$user_id || !$title || !$content) {
            return false;
        }
        $data = [];
        $data["user_id"] = $user_id;
        $data["title"] = $title;
        $data["content"] = $content;
        $data["createtime"] = time();
        $data["status"] = 0;
        return self::insertGetId($data);
    }

}
