Resume.php 5.7 KB

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