Resume.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. foreach ($plist as $v) {
  32. if ($v['com_cate_type'] == 2) {
  33. if (empty($v['com_cate_other'])) {
  34. $v['com_cate'] = [];
  35. } else {
  36. $v['com_cate'] = [$v['com_cate_other']];
  37. }
  38. }
  39. }
  40. page_result(0, "", [
  41. 'plist' => $plist,
  42. 'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
  43. ]);
  44. }
  45. /**
  46. * 简历搜索条件
  47. */
  48. public function searchItem()
  49. {
  50. $catelist = ComjobsCateModel::field('id as value, title, priority')->order(['priority' => 'desc', 'id' => 'desc'])
  51. ->select()->toArray();
  52. array_unshift($catelist, ['value' => 0, 'title' => '全部']);
  53. $jobintentionlist = UserWillModel::field('id as value, title')->select()->toArray();
  54. array_unshift($jobintentionlist, ['value' => 0, 'title' => '全部']);
  55. page_result(0, "", [
  56. 'catelist' => $catelist,
  57. 'jobintentionlist' => $jobintentionlist,
  58. ]);
  59. }
  60. /**
  61. * 简历详情
  62. */
  63. public function detail()
  64. {
  65. //简历信息
  66. $id = input('id/d', 0);
  67. if (empty($id)) {
  68. page_result(1, "简历不存在。");
  69. }
  70. $info = UserModel::where('id', $id)->find();
  71. if ($info->isEmpty()) {
  72. page_result(1, "简历不存在。");
  73. }
  74. if ($info->status != 2 || $info->authstatus != 3) {
  75. page_result(1, "简历未通过系统验证。");
  76. }
  77. $info->append(['jobintention_text', 'education_text', 'worker_text']);
  78. $info->volume = 2;
  79. $info->save();
  80. //邀请记录
  81. $workerid = input('workerid/d', 0);
  82. $invite = ResumeInviteModel::where('userid', $id)->where('workerid', $workerid)->find();
  83. page_result(0, "", [
  84. 'info' => $info,
  85. 'invite' => $invite,
  86. ]);
  87. }
  88. /**
  89. * 邀请面试
  90. */
  91. public function invite()
  92. {
  93. $userid = input('userid/d', 0);
  94. $workerid = input('workerid/d', 0);
  95. $check = ResumeInviteModel::where('workerid', $workerid)->where('userid', $userid)->find();
  96. if (!empty($check)) {
  97. page_result(1, "请勿重复邀请", $check);
  98. }
  99. $info = ResumeInviteModel::create([
  100. 'workerid' => $workerid,
  101. 'userid' => $userid,
  102. 'createtime' => time(),
  103. ]);
  104. page_result(0, "邀请成功", $info);
  105. }
  106. /**
  107. * 收到的邀请
  108. */
  109. public function userLog()
  110. {
  111. $ppage = input('ppage/d', 1);
  112. $psize = input('psize/d', 20);
  113. $userid = input('userid/d', 0);
  114. $list = ResumeInviteModel::with(['worker'])->where('userid',$userid)->page($ppage)->limit($psize)->append(['status_text'])->select();
  115. page_result(0, "", [
  116. 'list' => $list,
  117. 'status' => $psize > count($list) ? 'noMore' : 'more',
  118. ]);
  119. }
  120. /**
  121. * 处理邀请
  122. */
  123. public function dealInvite()
  124. {
  125. $id = input('id/d', 0);
  126. $status = input('status/d', 0);
  127. if (empty($id) || empty($status)) {
  128. page_result(1, "参数错误");
  129. }
  130. $info = ResumeInviteModel::where('id',$id)->find();
  131. if ($info['status'] != 1) {
  132. page_result(1, "请勿重复操作");
  133. }
  134. $info->status = $status;
  135. $info->save();
  136. page_result(0, "操作成功", $info);
  137. }
  138. /**
  139. * 发出的邀请
  140. */
  141. public function workerLog()
  142. {
  143. $ppage = input('ppage/d', 1);
  144. $psize = input('psize/d', 20);
  145. $workerid = input('workerid/d', 0);
  146. $list = ResumeInviteModel::with(['user'])->where('workerid',$workerid)->page($ppage)->limit($psize)->append(['status_text'])->select();
  147. page_result(0, "", [
  148. 'list' => $list,
  149. 'status' => $psize > count($list) ? 'noMore' : 'more',
  150. ]);
  151. }
  152. }