Resume.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. /**
  98. * 收到的邀请
  99. */
  100. public function userLog()
  101. {
  102. $ppage = input('ppage/d', 1);
  103. $psize = input('psize/d', 20);
  104. $userid = input('userid/d', 0);
  105. $list = ResumeInviteModel::with(['worker'])->where('userid',$userid)->page($ppage)->limit($psize)->append(['status_text'])->select();
  106. page_result(0, "", [
  107. 'list' => $list,
  108. 'status' => $psize > count($list) ? 'noMore' : 'more',
  109. ]);
  110. }
  111. /**
  112. * 处理邀请
  113. */
  114. public function dealInvite()
  115. {
  116. $id = input('id/d', 0);
  117. $status = input('status/d', 0);
  118. if (empty($id) || empty($status)) {
  119. page_result(1, "参数错误");
  120. }
  121. $info = ResumeInviteModel::where('id',$id)->find();
  122. if ($info['status'] != 1) {
  123. page_result(1, "请勿重复操作");
  124. }
  125. $info->status = $status;
  126. $info->save();
  127. page_result(0, "操作成功", $info);
  128. }
  129. /**
  130. * 发出的邀请
  131. */
  132. public function workerLog()
  133. {
  134. $ppage = input('ppage/d', 1);
  135. $psize = input('psize/d', 20);
  136. $workerid = input('workerid/d', 0);
  137. $list = ResumeInviteModel::with(['user'])->where('workerid',$workerid)->page($ppage)->limit($psize)->append(['status_text'])->select();
  138. page_result(0, "", [
  139. 'list' => $list,
  140. 'status' => $psize > count($list) ? 'noMore' : 'more',
  141. ]);
  142. }
  143. }