StaffSignInRead.php 764 B

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