MobileFollow.php 804 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class MobileFollow extends Model
  5. {
  6. // 设置字段信息
  7. protected $schema = [
  8. 'id' => 'int',
  9. 'agent_id' => 'int',
  10. 'mobile' => 'string',
  11. 'content' => 'string',
  12. 'receive_time' => 'int',
  13. 'status' => 'int',
  14. ];
  15. // 设置字段自动转换类型
  16. protected $type = [
  17. 'receive_time' => 'timestamp:Y-m-d H:i:s',
  18. ];
  19. // 关联User
  20. public function user()
  21. {
  22. return $this->hasOne(User::class, "mobile", "mobile");
  23. }
  24. public static $statusText = [1 => '待跟进', 2 => '跟进中', 3 => '跟进完成'];
  25. public function getStatusTextAttr($value, $data)
  26. {
  27. return self::$statusText[$data['status']];
  28. }
  29. }