123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <?php
- namespace app\mainapp\controller;
- use app\common\model\ComjobsCate as ComjobsCateModel;
- use app\common\model\ResumeInvite as ResumeInviteModel;
- use app\common\model\User as UserModel;
- use app\common\model\UserWill as UserWillModel;
- use app\mainapp\BaseController;
- use chuanglan\Chuanglan;
- class Resume extends BaseController
- {
- /**
- * 简历列表
- */
- public function listResume()
- {
- $ppage = input('ppage/d', 1);
- $psize = input('psize/d', 20);
- $model = new UserModel();
- $model = $model->where('status', 2)->where('authstatus', '=', 3);
- $jobintention = input('jobintention/d', 0);
- if (!empty($jobintention)) {
- $model = $model->where('jobintention', $jobintention);
- }
- $cateid = input('cateid/d', 0);
- if (!empty($cateid)) {
- $cate_name = ComjobsCateModel::where('id', $cateid)->value('title');
- if (!empty($cate_name)) {
- $model->whereRaw("json_contains(com_cate,CONCAT('\"',:name,'\"'))", ['name' => $cate_name]);
- }
- }
- $plist = $model->page($ppage)->limit($psize)->append(['jobintention_text', 'education_text', 'worker_text'])->select();
- $year = date('Y');
- foreach ($plist as $v) {
- if ($v['com_cate_type'] == 2) {
- if (empty($v['com_cate_other'])) {
- $v['com_cate'] = [];
- } else {
- $v['com_cate'] = [$v['com_cate_other']];
- }
- }
- if (!empty($v['birthday'])) {
- $v['age'] = $year - date('Y', strtotime($v['birthday']));
- } else {
- $v['age'] = 0;
- }
- }
- page_result(0, "", [
- 'plist' => $plist,
- 'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
- ]);
- }
- /**
- * 简历搜索条件
- */
- public function searchItem()
- {
- $catelist = ComjobsCateModel::field('id as value, title, priority')->order(['priority' => 'desc', 'id' => 'desc'])
- ->select()->toArray();
- array_unshift($catelist, ['value' => 0, 'title' => '全部']);
- $jobintentionlist = UserWillModel::field('id as value, title')->select()->toArray();
- array_unshift($jobintentionlist, ['value' => 0, 'title' => '全部']);
- page_result(0, "", [
- 'catelist' => $catelist,
- 'jobintentionlist' => $jobintentionlist,
- ]);
- }
- /**
- * 简历详情
- */
- public function detail()
- {
- //简历信息
- $id = input('id/d', 0);
- if (empty($id)) {
- page_result(1, "简历不存在。");
- }
- $info = UserModel::where('id', $id)->find();
- if ($info->isEmpty()) {
- page_result(1, "简历不存在。");
- }
- if ($info->status != 2 || $info->authstatus != 3) {
- page_result(1, "简历未通过系统验证。");
- }
- $info->append(['jobintention_text', 'education_text', 'worker_text']);
- $info->volume++;
- $info->save();
- //邀请记录
- $workerid = input('workerid/d', 0);
- $invite = ResumeInviteModel::where('userid', $id)->where('workerid', $workerid)->find();
- page_result(0, "", [
- 'info' => $info,
- 'invite' => $invite,
- ]);
- }
- /**
- * 邀请面试
- */
- public function invite()
- {
- $userid = input('userid/d', 0);
- $workerid = input('workerid/d', 0);
- $check = ResumeInviteModel::where('workerid', $workerid)->where('userid', $userid)->find();
- if (!empty($check)) {
- page_result(1, "请勿重复邀请", $check);
- }
- $info = ResumeInviteModel::create([
- 'workerid' => $workerid,
- 'userid' => $userid,
- 'createtime' => time(),
- ]);
- $user = UserModel::where('id', $userid)->find();
- if ($user['mobile']) {
- $msg = '尊敬的求职者你好!您已在“晋江人力”小程序上收到雇主邀请,请您及时查看处理!';
- $mobile = $user['mobile'];
- $sms = new Chuanglan();
- $sms->send($mobile, ['message' => $msg]);
- }
- page_result(0, "邀请成功", $info);
- }
- /**
- * 收到的邀请
- */
- public function userLog()
- {
- $ppage = input('ppage/d', 1);
- $psize = input('psize/d', 20);
- $userid = input('userid/d', 0);
- $list = ResumeInviteModel::with(['worker'])->where('userid', $userid)->page($ppage)->limit($psize)->append(['status_text'])->select();
- page_result(0, "", [
- 'list' => $list,
- 'status' => $psize > count($list) ? 'noMore' : 'more',
- ]);
- }
- /**
- * 处理邀请
- */
- public function dealInvite()
- {
- $id = input('id/d', 0);
- $status = input('status/d', 0);
- if (empty($id) || empty($status)) {
- page_result(1, "参数错误");
- }
- $info = ResumeInviteModel::where('id', $id)->find();
- if ($info['status'] != 1) {
- page_result(1, "请勿重复操作");
- }
- $info->status = $status;
- $info->save();
- page_result(0, "操作成功", $info);
- }
- /**
- * 发出的邀请
- */
- public function workerLog()
- {
- $ppage = input('ppage/d', 1);
- $psize = input('psize/d', 20);
- $workerid = input('workerid/d', 0);
- $list = ResumeInviteModel::with(['user'])->where('workerid', $workerid)->page($ppage)->limit($psize)->append(['status_text'])->select();
- page_result(0, "", [
- 'list' => $list,
- 'status' => $psize > count($list) ? 'noMore' : 'more',
- ]);
- }
- }
|