Resume.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. use chuanglan\Chuanglan;
  9. class Resume extends BaseController
  10. {
  11. /**
  12. * 简历列表
  13. */
  14. public function listResume()
  15. {
  16. $ppage = input('ppage/d', 1);
  17. $psize = input('psize/d', 20);
  18. $model = new UserModel();
  19. $model = $model->where('status', 2)->where('authstatus', '=', 3);
  20. $jobintention = input('jobintention/d', 0);
  21. if (!empty($jobintention)) {
  22. $model = $model->where('jobintention', $jobintention);
  23. }
  24. $cateid = input('cateid/d', 0);
  25. if (!empty($cateid)) {
  26. $cate_name = ComjobsCateModel::where('id', $cateid)->value('title');
  27. if (!empty($cate_name)) {
  28. $model->whereRaw("json_contains(com_cate,CONCAT('\"',:name,'\"'))", ['name' => $cate_name]);
  29. }
  30. }
  31. $plist = $model->page($ppage)->limit($psize)->append(['jobintention_text'])->select();
  32. foreach ($plist as $v) {
  33. if ($v['com_cate_type'] == 2) {
  34. if (empty($v['com_cate_other'])) {
  35. $v['com_cate'] = [];
  36. } else {
  37. $v['com_cate'] = [$v['com_cate_other']];
  38. }
  39. }
  40. }
  41. page_result(0, "", [
  42. 'plist' => $plist,
  43. 'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
  44. ]);
  45. }
  46. /**
  47. * 简历搜索条件
  48. */
  49. public function searchItem()
  50. {
  51. $catelist = ComjobsCateModel::field('id as value, title, priority')->order(['priority' => 'desc', 'id' => 'desc'])
  52. ->select()->toArray();
  53. array_unshift($catelist, ['value' => 0, 'title' => '全部']);
  54. $jobintentionlist = UserWillModel::field('id as value, title')->select()->toArray();
  55. array_unshift($jobintentionlist, ['value' => 0, 'title' => '全部']);
  56. page_result(0, "", [
  57. 'catelist' => $catelist,
  58. 'jobintentionlist' => $jobintentionlist,
  59. ]);
  60. }
  61. /**
  62. * 简历详情
  63. */
  64. public function detail()
  65. {
  66. //简历信息
  67. $id = input('id/d', 0);
  68. if (empty($id)) {
  69. page_result(1, "简历不存在。");
  70. }
  71. $info = UserModel::where('id', $id)->find();
  72. if ($info->isEmpty()) {
  73. page_result(1, "简历不存在。");
  74. }
  75. if ($info->status != 2 || $info->authstatus != 3) {
  76. page_result(1, "简历未通过系统验证。");
  77. }
  78. $info->append(['jobintention_text', 'education_text', 'worker_text']);
  79. $info->volume = 2;
  80. $info->save();
  81. //邀请记录
  82. $workerid = input('workerid/d', 0);
  83. $invite = ResumeInviteModel::where('userid', $id)->where('workerid', $workerid)->find();
  84. page_result(0, "", [
  85. 'info' => $info,
  86. 'invite' => $invite,
  87. ]);
  88. }
  89. /**
  90. * 邀请面试
  91. */
  92. public function invite()
  93. {
  94. $userid = input('userid/d', 0);
  95. $workerid = input('workerid/d', 0);
  96. $check = ResumeInviteModel::where('workerid', $workerid)->where('userid', $userid)->find();
  97. if (!empty($check)) {
  98. page_result(1, "请勿重复邀请", $check);
  99. }
  100. $info = ResumeInviteModel::create([
  101. 'workerid' => $workerid,
  102. 'userid' => $userid,
  103. 'createtime' => time(),
  104. ]);
  105. /*$user = UserModel::where('id',$userid)->find();
  106. if ($user['mobile']) {
  107. $msg = '尊敬的求职者你好!您已在“晋江人力”小程序上收到雇主邀请,请您及时查看处理!';
  108. $mobile = $user['mobile'];
  109. $sms = new Chuanglan();
  110. $sms->send($mobile,['message'=>$msg]);
  111. }*/
  112. page_result(0, "邀请成功", $info);
  113. }
  114. /**
  115. * 收到的邀请
  116. */
  117. public function userLog()
  118. {
  119. $ppage = input('ppage/d', 1);
  120. $psize = input('psize/d', 20);
  121. $userid = input('userid/d', 0);
  122. $list = ResumeInviteModel::with(['worker'])->where('userid',$userid)->page($ppage)->limit($psize)->append(['status_text'])->select();
  123. page_result(0, "", [
  124. 'list' => $list,
  125. 'status' => $psize > count($list) ? 'noMore' : 'more',
  126. ]);
  127. }
  128. /**
  129. * 处理邀请
  130. */
  131. public function dealInvite()
  132. {
  133. $id = input('id/d', 0);
  134. $status = input('status/d', 0);
  135. if (empty($id) || empty($status)) {
  136. page_result(1, "参数错误");
  137. }
  138. $info = ResumeInviteModel::where('id',$id)->find();
  139. if ($info['status'] != 1) {
  140. page_result(1, "请勿重复操作");
  141. }
  142. $info->status = $status;
  143. $info->save();
  144. page_result(0, "操作成功", $info);
  145. }
  146. /**
  147. * 发出的邀请
  148. */
  149. public function workerLog()
  150. {
  151. $ppage = input('ppage/d', 1);
  152. $psize = input('psize/d', 20);
  153. $workerid = input('workerid/d', 0);
  154. $list = ResumeInviteModel::with(['user'])->where('workerid',$workerid)->page($ppage)->limit($psize)->append(['status_text'])->select();
  155. page_result(0, "", [
  156. 'list' => $list,
  157. 'status' => $psize > count($list) ? 'noMore' : 'more',
  158. ]);
  159. }
  160. }