12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace app\common\model;
- use think\Model;
- /**
- * 系统消息模型
- */
- class UserMsg extends Model
- {
- // 表名
- protected $table = 'user_msg';
- // 开启自动写入时间戳字段
- protected $autoWriteTimestamp = 'integer';
- // 定义时间戳字段名
- 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);
- }
- }
|