UserFollow.php 832 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class UserFollow extends Model
  5. {
  6. // 设置字段信息
  7. protected $schema = [
  8. 'id' => 'int',
  9. 'userid' => 'int',
  10. 'ftype' => 'string',
  11. 'fstatus' => 'tinyint',
  12. 'remark' => 'string',
  13. 'createtime' => 'int'
  14. ];
  15. // 设置字段自动转换类型
  16. protected $type = [
  17. 'createtime' => 'timestamp:Y-m-d H:i:s'
  18. ];
  19. public function getFstatusTextAttr($value,$data)
  20. {
  21. $fstatus = [1=>'未跟进', 2=>'未面试', 3=>'面试通过', 4=>'面试未通过', 5=>'用户放弃', 6=>'已入职', 7=>'已离职'];
  22. return $fstatus[$data['fstatus']];
  23. }
  24. // 关联User
  25. public function user()
  26. {
  27. return $this->hasOne(User::class, "id", "userid");
  28. }
  29. }