WorkerResume.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. use think\model\concern\SoftDelete;
  5. class WorkerResume extends Model
  6. {
  7. use SoftDelete;
  8. protected $deleteTime = 'deletetime';
  9. protected $defaultSoftDelete = 0;
  10. // 设置字段信息
  11. protected $schema = [
  12. 'id' => 'int',
  13. 'workerid' => 'int',
  14. 'groupsid' => 'int',
  15. 'nickname' => 'string',
  16. 'avatar' => 'string',
  17. 'mobile' => 'string',
  18. 'status' => 'tinyint',
  19. 'idcardzpic' => 'string',
  20. 'idcardfpic' => 'string',
  21. 'idcard' => 'string',
  22. 'gender' => 'tinyint',
  23. 'birthday' => 'string',
  24. 'address' => 'string',
  25. 'education' => 'string',
  26. 'createtime' => 'int',
  27. 'jobintention' => 'string',
  28. 'workexperience' => 'string',
  29. 'eduexperience' => 'string',
  30. 'followstatus' => 'tinyint',
  31. 'wxampcode' => 'string',
  32. 'bankcard' => 'string',
  33. 'emp_time' => 'string',
  34. 'user_tags' => 'string',
  35. 'com_cate' => 'string',
  36. 'volume' => 'int',
  37. 'deletetime' => 'int',
  38. 'work_place' => 'string',
  39. 'com_cate_type' => 'int',
  40. 'com_cate_other' => 'string',
  41. 'comment' => 'string',
  42. ];
  43. // 设置字段自动转换类型
  44. protected $type = [
  45. 'bankcard' => 'json',
  46. 'createtime' => 'timestamp:Y-m-d H:i:s',
  47. 'emp_time' => 'json',
  48. 'com_cate' => 'json',
  49. 'work_place' => 'json',
  50. 'user_tags' => 'json',
  51. ];
  52. protected $jsonAssoc = true;
  53. public function getFollowstatusTextAttr($value, $data)
  54. {
  55. $followstatus = [1 => '未跟进', 2 => '未面试', 3 => '面试通过', 4 => '面试未通过', 5 => '用户放弃', 6 => '已入职', 7 => '已离职'];
  56. return $followstatus[$data['followstatus']];
  57. }
  58. public function getEducationTextAttr($value, $data)
  59. {
  60. $education = ['' => '', 1 => '初中及以下', 2 => '高中', 3 => '中技', 4 => '中专', 5 => '大专', 6 => '本科', 7 => '硕士', 8 => '博士'];
  61. return $education[$data['education']];
  62. }
  63. public function getWorkerTextAttr($value, $data)
  64. {
  65. $experience = ['' => '', 1 => '无经验', 2 => '一年以下', 3 => '1-3年', 4 => '3-5年', 5 => '5-10年', 6 => '10年以上'];
  66. return $experience[$data['workexperience']];
  67. }
  68. public function getJobintentionTextAttr($value, $data)
  69. {
  70. $title = '';
  71. if ($data['jobintention']) {
  72. $title = UserWill::where('id', $data['jobintention'])->value('title');
  73. }
  74. return $title;
  75. }
  76. // 关联UserGroups
  77. public function userGroups()
  78. {
  79. return $this->hasOne(UserGroups::class, "id", "groupsid");
  80. }
  81. // 关联WorkerGroups
  82. public function workerGroup()
  83. {
  84. return $this->hasOne(WorkerGroup::class, "id", "groupid");
  85. }
  86. // 关联Worker
  87. public function worker()
  88. {
  89. return $this->hasOne(Worker::class, "id", "workerid");
  90. }
  91. }