12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace addons\qingdongams\model;
- use think\Model;
- /**
- *公告阅读记录
- */
- class NoticeRead Extends Model {
- // 表名,不含前缀
- protected $name = 'qingdongams_notice_read';
- // 开启自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- //添加阅读记录
- public static function addRead($notice_id, $staff_id) {
- return self::create([ 'notice_id' => $notice_id, 'staff_id' => $staff_id]);
- }
- //是否阅读
- public static function isRead($notice_id, $staff_id) {
- if (self::where(['notice_id' => $notice_id, 'staff_id' => $staff_id])->find()) {
- return 1;
- }
- return 0;
- }
- }
|