RecordRead.php 773 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace addons\qingdongams\model;
  3. use think\Model;
  4. /**
  5. *跟进阅读记录
  6. */
  7. class RecordRead Extends Model {
  8. // 表名,不含前缀
  9. protected $name = 'qingdongams_record_read';
  10. // 开启自动写入时间戳字段
  11. protected $autoWriteTimestamp = 'int';
  12. // 定义时间戳字段名
  13. protected $createTime = 'createtime';
  14. protected $updateTime = 'updatetime';
  15. //添加阅读记录
  16. public static function addRead($record_id, $staff_id) {
  17. return self::create([ 'record_id' => $record_id, 'staff_id' => $staff_id]);
  18. }
  19. //是否阅读
  20. public static function isRead($record_id, $staff_id) {
  21. if (self::where(['record_id' => $record_id, 'staff_id' => $staff_id])->find()) {
  22. return 1;
  23. }
  24. return 0;
  25. }
  26. }