ResumeInvite.php 852 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class ResumeInvite extends Model
  5. {
  6. // 设置字段信息
  7. protected $schema = [
  8. 'id' => 'int',
  9. 'workerid' => 'int',
  10. 'userid' => 'int',
  11. 'status' => '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 getStatusTextAttr($value, $data)
  20. {
  21. $status = [1 => '邀请中', 2 => '邀请成功', 3 => '拒绝邀请'];
  22. return $status[$data['status']];
  23. }
  24. public function worker()
  25. {
  26. return $this->hasOne(Worker::class, 'id', 'workerid');
  27. }
  28. public function user()
  29. {
  30. return $this->hasOne(User::class, 'id', 'userid');
  31. }
  32. }