Resume.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. namespace app\mainapp\controller;
  3. use app\common\model\ComjobsCate as ComjobsCateModel;
  4. use app\common\model\ResumeInvite as ResumeInviteModel;
  5. use app\common\model\User as UserModel;
  6. use app\common\model\UserWill as UserWillModel;
  7. use app\mainapp\BaseController;
  8. class Resume extends BaseController
  9. {
  10. /**
  11. * 简历列表
  12. */
  13. public function listResume()
  14. {
  15. $ppage = input('ppage/d', 1);
  16. $psize = input('psize/d', 20);
  17. $model = new UserModel();
  18. $model = $model->where('status', 2)->where('authstatus', '=', 3);
  19. $jobintention = input('jobintention/d', 0);
  20. if (!empty($jobintention)) {
  21. $model = $model->where('jobintention', $jobintention);
  22. }
  23. $cateid = input('cateid/d', 0);
  24. if (!empty($cateid)) {
  25. $cate_name = ComjobsCateModel::where('id', $cateid)->value('title');
  26. if (!empty($cate_name)) {
  27. $model->whereRaw("json_contains(com_cate,CONCAT('\"',:name,'\"'))", ['name' => $cate_name]);
  28. }
  29. }
  30. $plist = $model->page($ppage)->limit($psize)->append(['jobintention_text'])->select();
  31. page_result(0, "", [
  32. 'plist' => $plist,
  33. 'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
  34. ]);
  35. }
  36. /**
  37. * 简历搜索条件
  38. */
  39. public function searchItem()
  40. {
  41. $catelist = ComjobsCateModel::field('id as value, title, priority')->order(['priority' => 'desc', 'id' => 'desc'])
  42. ->select()->toArray();
  43. array_unshift($catelist, ['value' => 0, 'title' => '全部']);
  44. $jobintentionlist = UserWillModel::field('id as value, title')->select()->toArray();
  45. array_unshift($jobintentionlist, ['value' => 0, 'title' => '全部']);
  46. page_result(0, "", [
  47. 'catelist' => $catelist,
  48. 'jobintentionlist' => $jobintentionlist,
  49. ]);
  50. }
  51. /**
  52. * 简历详情
  53. */
  54. public function detail()
  55. {
  56. //简历信息
  57. $id = input('id/d', 0);
  58. if (empty($id)) {
  59. page_result(1, "简历不存在。");
  60. }
  61. $info = UserModel::where('id', $id)->find();
  62. if ($info->isEmpty()) {
  63. page_result(1, "简历不存在。");
  64. }
  65. if ($info->status != 2 || $info->authstatus != 3) {
  66. page_result(1, "简历未通过系统验证。");
  67. }
  68. $info->append(['jobintention_text', 'education_text', 'worker_text']);
  69. $info->volume = 2;
  70. $info->save();
  71. //邀请记录
  72. $workerid = input('workerid/d', 0);
  73. $invite = ResumeInviteModel::where('userid', $id)->where('workerid', $workerid)->find();
  74. page_result(0, "", [
  75. 'info' => $info,
  76. 'invite' => $invite,
  77. ]);
  78. }
  79. /**
  80. * 邀请面试
  81. */
  82. public function invite()
  83. {
  84. $userid = input('userid/d', 0);
  85. $workerid = input('workerid/d', 0);
  86. $check = ResumeInviteModel::where('workerid', $workerid)->where('userid', $userid)->find();
  87. if (!empty($check)) {
  88. page_result(1, "请勿重复邀请", $check);
  89. }
  90. $info = ResumeInviteModel::create([
  91. 'workerid' => $workerid,
  92. 'userid' => $userid,
  93. 'createtime' => time(),
  94. ]);
  95. page_result(0, "邀请成功", $info);
  96. }
  97. }