Remind.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace addons\qingdongams\model;
  3. use think\Model;
  4. use traits\model\SoftDelete;
  5. /**
  6. *提醒设置
  7. */
  8. class Remind Extends Model {
  9. use SoftDelete;
  10. // 表名,不含前缀
  11. protected $name = 'qingdongams_remind';
  12. const CUSTOMER_TYPE = 'customer';//客户
  13. const RECORD_TYPE = 'record';//跟进记录
  14. const DAILY_TYPE = 'approval';//工作报告
  15. // 开启自动写入时间戳字段
  16. protected $autoWriteTimestamp = 'int';
  17. // 定义时间戳字段名
  18. protected $createTime = 'createtime';
  19. protected $updateTime = 'updatetime';
  20. protected $deleteTime = 'deletetime';
  21. // 追加属性
  22. protected $append = [
  23. 'staff_ids_text',
  24. ];
  25. public function getStaffIdsTextAttr($value,$data){
  26. if (!isset($data['staff_ids'])) {
  27. return '';
  28. }
  29. $ids=explode(',',$data['staff_ids']);
  30. $names=Staff::where(['id'=>['in',$ids]])->column('name');
  31. return implode(',',$names);
  32. }
  33. }