123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <?php
- namespace app\mobile\controller;
- use app\mobile\EmpBaseController;
- use app\common\model\User as UserModel;
- use app\common\model\ComjobsCate as ComjobsCateModel;
- use app\common\model\UserWill as UserWillModel;
- use app\common\model\ResumeInvite as ResumeInviteModel;
- class Resume extends EmpBaseController
- {
- /**
- * 列表
- */
- public function index()
- {
- $catelist = ComjobsCateModel::field('id as value, title as text')->order(['priority' => 'desc', 'id' => 'desc'])
- ->select()->toArray();
- array_unshift($catelist, ['value' => 0, 'text' => '不限岗位']);
- $userwill = UserWillModel::field('id as value, title as text')->select()->toArray();
- array_unshift($userwill, ['value' => 0, 'text' => '不限意向']);
- return view('resume/index', [
- 'catelist' => json_encode($catelist),
- 'userwill' => json_encode($userwill),
- ]);
- }
- public function list()
- {
- $page = input('page/d', 1);
- $size = input('size/d', 20);
- $model = new UserModel();
- $model = $model->where('status', 2)->where('authstatus', '=', 3)->where('gender',2);
- $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]);
- }
- }
- $list = $model->page($page)->limit($size)->append(['jobintention_text', 'education_text', 'worker_text'])->select();
- $year = date('Y');
- foreach ($list as $v) {
- if (!empty($v['birthday'])) {
- $v['age'] = $year - date('Y', strtotime($v['birthday']));
- } else {
- $v['age'] = 0;
- }
- }
- page_result(0, "", $list);
- }
- /**
- * 详情
- */
- public function detail()
- {
- //简历信息
- $id = input('id/d', 0);
- if (empty($id)) {
- return $this->jump('简历不存在');
- }
- $info = UserModel::where('id', $id)->find();
- if ($info->isEmpty()) {
- return $this->jump('简历不存在');
- }
- if ($info->status != 2 || $info->authstatus != 3) {
- return $this->jump('简历未通过系统验证');
- }
- $info->append(['jobintention_text', 'education_text', 'worker_text']);
- $info->volume++;
- $info->save();
- $info['eduexperience'] = addPByN($info['eduexperience']);
- //邀请记录
- $workerid = $this->worker->id;
- $invite = ResumeInviteModel::where('userid', $id)->where('workerid', $workerid)->find();
- return view('resume/detail', [
- 'info' => $info,
- 'invite' => $invite ? 'true' : 'false',
- ]);
- }
- /**
- * 发出邀请
- */
- public function invite()
- {
- $userid = input('id/d', 0);
- $workerid = $this->worker->id;
- $check = ResumeInviteModel::where('workerid', $workerid)->where('userid', $userid)->find();
- if (!empty($check)) {
- page_result(1, "请勿重复邀请");
- }
- ResumeInviteModel::create([
- 'workerid' => $workerid,
- 'userid' => $userid,
- 'createtime' => time(),
- ]);
- page_result(0, "邀请成功");
- }
- }
|