Resume.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. namespace app\mobile\controller;
  3. use app\mobile\EmpBaseController;
  4. use app\common\model\User as UserModel;
  5. use app\common\model\ComjobsCate as ComjobsCateModel;
  6. use app\common\model\UserWill as UserWillModel;
  7. use app\common\model\ResumeInvite as ResumeInviteModel;
  8. class Resume extends EmpBaseController
  9. {
  10. /**
  11. * 列表
  12. */
  13. public function index()
  14. {
  15. $catelist = ComjobsCateModel::field('id as value, title as text')->order(['priority' => 'desc', 'id' => 'desc'])
  16. ->select()->toArray();
  17. array_unshift($catelist, ['value' => 0, 'text' => '不限岗位']);
  18. $userwill = UserWillModel::field('id as value, title as text')->select()->toArray();
  19. array_unshift($userwill, ['value' => 0, 'text' => '不限意向']);
  20. return view('resume/index', [
  21. 'catelist' => json_encode($catelist),
  22. 'userwill' => json_encode($userwill),
  23. ]);
  24. }
  25. public function list()
  26. {
  27. $page = input('page/d', 1);
  28. $size = input('size/d', 20);
  29. $model = new UserModel();
  30. $model = $model->where('status', 2)->where('authstatus', '=', 3)->where('gender',2);
  31. $jobintention = input('jobintention/d', 0);
  32. if (!empty($jobintention)) {
  33. $model = $model->where('jobintention', $jobintention);
  34. }
  35. $cateid = input('cateid/d', 0);
  36. if (!empty($cateid)) {
  37. $cate_name = ComjobsCateModel::where('id', $cateid)->value('title');
  38. if (!empty($cate_name)) {
  39. $model->whereRaw("json_contains(com_cate,CONCAT('\"',:name,'\"'))", ['name' => $cate_name]);
  40. }
  41. }
  42. $list = $model->page($page)->limit($size)->append(['jobintention_text', 'education_text', 'worker_text'])->select();
  43. $year = date('Y');
  44. foreach ($list as $v) {
  45. if (!empty($v['birthday'])) {
  46. $v['age'] = $year - date('Y', strtotime($v['birthday']));
  47. } else {
  48. $v['age'] = 0;
  49. }
  50. }
  51. page_result(0, "", $list);
  52. }
  53. /**
  54. * 详情
  55. */
  56. public function detail()
  57. {
  58. //简历信息
  59. $id = input('id/d', 0);
  60. if (empty($id)) {
  61. return $this->jump('简历不存在');
  62. }
  63. $info = UserModel::where('id', $id)->find();
  64. if ($info->isEmpty()) {
  65. return $this->jump('简历不存在');
  66. }
  67. if ($info->status != 2 || $info->authstatus != 3) {
  68. return $this->jump('简历未通过系统验证');
  69. }
  70. $info->append(['jobintention_text', 'education_text', 'worker_text']);
  71. $info->volume++;
  72. $info->save();
  73. $info['eduexperience'] = addPByN($info['eduexperience']);
  74. //邀请记录
  75. $workerid = $this->worker->id;
  76. $invite = ResumeInviteModel::where('userid', $id)->where('workerid', $workerid)->find();
  77. return view('resume/detail', [
  78. 'info' => $info,
  79. 'invite' => $invite ? 'true' : 'false',
  80. ]);
  81. }
  82. /**
  83. * 发出邀请
  84. */
  85. public function invite()
  86. {
  87. $userid = input('id/d', 0);
  88. $workerid = $this->worker->id;
  89. $check = ResumeInviteModel::where('workerid', $workerid)->where('userid', $userid)->find();
  90. if (!empty($check)) {
  91. page_result(1, "请勿重复邀请");
  92. }
  93. ResumeInviteModel::create([
  94. 'workerid' => $workerid,
  95. 'userid' => $userid,
  96. 'createtime' => time(),
  97. ]);
  98. page_result(0, "邀请成功");
  99. }
  100. }