123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026 |
- <?php
- namespace app\api\controller;
- use AlibabaCloud\SDK\Vod\V20170321\Models\GetMediaDNAResultResponseBody\DNAResult\videoDNA\detail\input;
- use app\common\model\PlatformLike;
- use app\common\model\PlatformSwitch;
- use app\common\model\RecruitCate;
- use app\common\model\RecruitResume;
- use app\common\model\Recruit as RecruitModel;
- use app\common\model\TopSearch;
- use app\common\model\User;
- use app\common\model\UserCollect;
- use app\common\model\UserMessage;
- use app\common\model\UserSearch;
- use app\common\model\UserTrack;
- use app\common\service\CheckPower;
- use app\common\service\UserSynth;
- use library\tools\Data;
- use think\Db;
- /**
- * @title 招聘
- * @controller Recruit
- * @group base
- */
- class Recruit extends Base
- {
- // 需要登录的
- protected $need_login = [
- 'sendResume',
- 'recruitTags',
- 'recruitCollect',
- 'recruitTransmit',
- 'getTagsRecruit',
- 'resumeToRecruits',
- 'getRecruitResumeList',
- 'getOwnRecruitList',
- 'getBrowseList',
- 'getRecruitCollect',
- 'getFollowUpList',
- 'getFollowUpMessage',
- 'batchesDel',
- 'unreadChange',
- ];
- public function initialize()
- {
- parent::initialize();
- parent::setUid();
- }
- /**
- * @title 招聘接口说明
- * @desc 招聘接口说明
- * @author qc
- * @url /api/Recruit/classIntro
- * @method GET
- * @return name:1 type:string default:-- desc:--
- */
- public function classIntro(){}
- /**
- * @title 获取招聘分类
- * @desc 三级分类
- * @author qc
- * @url /api/Recruit/getRecruitCate
- * @method GET
- * @header name:Authorization require:1 desc:Token
- * @return name:id type:int default:-- desc:分类id
- * @return name:title type:string default:0 desc:分类名称
- * @return name:children type:array default:0 desc:下级分类
- */
- public function getRecruitCate()
- {
- $list = RecruitCate::where(['is_deleted'=>0])->field('id,title,pid')->order('sort desc,id asc')->select()->toArray();
- $list = make_tree($list);
- $this->success('ok',['list'=>$list]);
- }
- /**
- * @title 获取第三级分类
- * @desc 获取第三级分类
- * @author qc
- * @url /api/Recruit/getThirdCate
- * @method GET
- * @header name:Authorization require:1 desc:Token
- * @param name:fid type:int default:-- desc:一级分类id
- * @param name:pid type:int default:-- desc:二级分类id【不传查一级分类下全部的三级分类】
- * @return name:id type:int default:-- desc:分类id
- * @return name:title type:string default:0 desc:分类名称
- * @return name:lev type:int default:0 desc:分类等级
- * @return name:children type:array default:0 desc:下级分类
- *
- */
- public function getThirdCate()
- {
- $where = [];
- $where[]=['is_deleted','=',0];
- $where[]=['pid','=',input('fid')];
- $sort_type = input('get.sort_type',1);
- if(!$sort_type){
- $order = ['sort'=>'desc','id'=>'asc'];
- }
- switch ($sort_type) {
- case 1:
- $order = 'sort desc,id asc';
- break;
- case 2:
- $order = 'id asc,sort desc';
- break;
- case 3:
- $order = 'id desc,sort desc';
- break;
- }
- if(input('pid')) $where[] = ['id','=',input('pid')];
- $list = RecruitCate::where($where)->field('id,title,pid,lev')->order('sort desc,id asc')->select()->toArray();
- foreach ($list as &$v) {
- $v['children'] = RecruitCate::where([['is_deleted','=',0],['pid','=',$v['id']]])->field('id,title,pid,lev')->order($order)->select()->toArray();
- foreach ($v['children'] as $key => $val){
- //third_classify
- $v['children'][$key]['recruit'] = RecruitModel::where('third_classify',$val['id'])->limit(2)->select();
- }
- }
- $this->success('ok',['list'=>$list]);
- }
- /**
- * @title 投递简历
- * @desc 投递简历
- * @author qc
- * @url /api/Recruit/sendResume
- * @method POST
- * @header name:Authorization require:1 desc:Token
- * @param name:recruit_id type:int default:-- desc:招聘记录id
- * @param name:type type:int default:0 desc:类型0图片1pdf
- * @param name:images type:string default:0 desc:pdf||图片(多张|隔开)
- */
- public function sendResume()
- {
- $images = input('post.images');
- $type = input('post.type',0);
- if(empty($images)) $this->error('请上传文件');
- $Resume = RecruitResume::create([
- 'user_id'=>$this->user_id,
- 'recruit_id'=>input('post.recruit_id'),
- 'images'=>$images,
- 'type'=>$type,
- ]);
- $detail = \app\common\model\Recruit::field('id,phone,email,hr_code,principal,user_id')->where('id',input('post.recruit_id'))->find()->toArray();
- UserMessage::sendUserMessage($detail['user_id'],'recruit',4,0,0,$Resume->id,'有人投递简历',$Resume->id);
- $this->success('投递成功');
- }
- /**
- * @title 获取简历详情
- * @desc 获取简历详情
- * @author qc
- * @url /api/Recruit/getResumeInfo
- * @method GET
- * @header name:Authorization require:1 desc:Token
- * @param name:resume_id type:int default:-- desc:简历记录id
- * @return name:images type:string default:-- desc:图片||pdf
- * @return name:images_arr type:array default:-- desc:数组
- * @return name:type type:int default:0 desc:类型0图片1pdf
- */
- public function getResumeInfo()
- {
- $info = RecruitResume::field('r.id,user_id,r.images,r.create_at,r.type,m.name')->alias('r')
- ->leftJoin('StoreMember m','m.id = r.user_id')
- ->where('r.id',input('get.resume_id'))->where(['r.is_deleted'=>0])->find();
- if(!$info) $this->error('简历详情不存在');
- $info = $info->toArray();
- $info['images_arr'] = explode('|',$info['images']);
- $this->success('ok',$info);
- }
- /**
- * @title 联系我们【两个二维码】(招聘详情内部)
- * @desc 联系HR
- * @author qc
- * @method GET
- * @url /api/Recruit/getRecruitContact
- * @header name:Authorization require:1 desc:Token
- * @param name:id type:int default:-- desc:招聘记录id
- * @return name:phone type:string default:-- desc:招聘电话
- * @return name:email type:string default:-- desc:招聘email
- * @return name:hr_code type:int default:-- desc:招聘二维码
- * @return name:principal type:string default:-- desc:招聘联系人
- * @return name:qrcode type:string default:-- desc:平台二维码
- * @return name:contact_phone type:string default:-- desc:平台电话
- * @return name:contact_email type:string default:-- desc:平台邮箱
- */
- public function getRecruitContact()
- {
- $sel_where[] = ['id','=',input('get.id')];
- $detail = \app\common\model\Recruit::field('id,phone,email,hr_code,principal')->where($sel_where)->find()->toArray();
- $contact = Db::name('contact')->where('tag','recruit')->field('qrcode,phone contact_phone,email contact_email')->find();
- $contact['phone'] = $detail['phone'];
- $contact['email'] = $detail['email'];
- $contact['hr_code'] = $detail['hr_code'];
- $contact['principal'] = $detail['principal'];
- $this->success('ok',$contact);
- }
- /**
- * @title 招聘推荐
- * @desc 招聘推荐
- * @author qc
- * @method GET
- * @url /api/Recruit/getRecommendList
- * @header name:Authorization require:1 desc:Token
- * @param name:page type:int default:0 desc:页数
- * @param name:page_num type:int default:20 desc:每页数
- * @param name:is_over type:int default:20 desc:每页数
- * @param name:rand_user type:string default:-- desc:随机id(非登录状态必传,page=1时生成(a123),其他页数(a123),一直查询到没有数据)
- * @param name:city type:string default:1 desc:城市名称
- * @param name:education type:string default:1 desc:学历
- * @return name:id type:int default:-- desc:记录ID
- * @return name:title type:string default:-- desc:标题
- * @return name:company type:string default:-- desc:公司名
- * @return name:principal type:string default:-- desc:联系人
- * @return name:hr_headimg type:string default:-- desc:hr头像
- * @return name:cover type:string default:-- desc:公司logo
- * @return name:label_name type:array default:-- desc:标签
- * @return name:welfare_arr type:array default:-- desc:岗位福利
- * @return name:education type:string default:-- desc:学历
- * @return name:experience_min type:int default:0 desc:最低工作年限
- * @return name:experience_max type:int default:0 desc:最高工作年限
- * @return name:price_min type:int default:-- desc:最低薪资[弃用]
- * @return name:price_max type:int default:-- desc:最高薪资[弃用]
- * @return name:salary type:int default:-- desc:薪资【文本】
- * @return name:work_hours type:string default:-- desc:兼职、全职或具体时长
- * @return name:province type:string default:-- desc:省名
- * @return name:city type:string default:-- desc:市名
- * @return name:county type:string default:-- desc:县区
- * @return name:address type:string default:-- desc:地址
- * @return name:app_name type:string default:-- desc:发布方名称
- * @return name:app_logo type:string default:-- desc:发布方头像
- * @return name:release_time type:string default:-- desc:上架时间
- * @return name:company_intro type:string default:-- desc:公司简介
- * @return name:is_ss type:string default:-- desc:是否上市,1上市0未上市
- * @return name:scale type:string default:-- desc:公司规模(人数)
- */
- public function getRecommendList()
- {
- $user_id = $this->user_id ? $this->user_id : input('rand_user');
- if(!$user_id) $this->error('参数错误');
- $list = UserSynth::getRecommendList($user_id,'recruit',$this->page,$this->page_num,['city'=>input('city'),'education'=>input('education')]);
- if($list['code'] != 200) $this->error($list['msg']);
- $this->success('ok',$list);
- $data = input();
- $search_log = UserSearch::getSearchTitle($this->user_id,8);
- $search_arr = [];
- $where_str = 'b.id > 0';
- foreach ($search_log as $t){
- $search_arr[] = " b.title like '".'%'.$t."%'" .' ';
- $search_arr[] = " b.label like '".'%'.$t."%'" .' ';
- }
- if(!empty($search_arr)) $where_str = implode(' OR ',$search_arr);
- $field = 'a.id,title,a.user_id,label,salary,work_hours,principal,hr_headimg,address,price_min,price_max,company,education,experience_min,experience_max,welfare,province,city,county,IFNULL(is_recommend,0) is_recommend ';
- $table = 'dd_recruit';
- $order_by_two = 'a.id';
- $sql = "SELECT $field FROM " .$table . " a LEFT JOIN ( SELECT id,IF(id,1,1) is_recommend FROM $table b WHERE ( $where_str )) AS c ON c.id = a.id WHERE a.status = 1 AND a.is_deleted = 0 ORDER BY is_recommend DESC , $order_by_two desc LIMIT {$this->off_set},{$this->page_num}";
- $list = Db::query($sql);
- $list = dispose_recommend($list);
- array_walk($list,function (&$v,$k){
- $auth_info = \app\common\model\Recruit::getAuth($v['user_id'],APPNAME,APPLOGO);
- $v['app_name'] = $auth_info['app_name'];
- $v['app_logo'] = $auth_info['app_logo'];
- $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null;
- $v['welfare_arr'] = explode(',',trim($v['welfare'],','));
- });
- $sql2 = "SELECT count(a.id) num FROM " .$table . " a LEFT JOIN ( SELECT id,IF(id,1,1) is_recommend FROM $table b WHERE ( $where_str )) AS c ON c.id = a.id WHERE a.status = 1 AND a.is_deleted = 0 ORDER BY is_recommend DESC , $order_by_two desc LIMIT {$this->off_set},{$this->page_num}";
- $total = Db::query($sql2);
- $this->success('ok',['list'=>$list,'total_count'=>$total[0]['num'],'page_num'=>$this->page_num]);
- }
- /**
- * @title 合集列表
- * @desc 合集列表
- * @author qc
- * @method GET
- * @url /api/Recruit/getRecruitList
- * @header name:Authorization require:1 desc:Token
- * @param name:page type:int default:0 desc:页数
- * @param name:page_num type:int default:20 desc:每页数
- * @param name:sort_type type:int default:1 desc:1默认2时间升序3时间降序
- * @param name:city type:string default:1 desc:城市名称
- * @param name:education type:int default:0 desc:学历
- * @param name:first_classify type:int default:0 desc:一级分类id
- * @param name:second_classify type:int default:0 desc:二级分类id
- * @param name:third_classify type:int default:0 desc:三级分类id
- *
- * @return name:title type:string default:-- desc:标题
- * @return name:company type:string default:-- desc:公司名
- * @return name:cover type:string default:-- desc:公司logo
- * @return name:salary type:int default:-- desc:薪资【文本】
- * @return name:work_hours type:string default:-- desc:兼职、全职或具体时长s
- * @return name:phone type:string default:-- desc:电话
- * @return name:email type:string default:-- desc:email
- * @return name:label_name type:array default:-- desc:标签
- * @return name:welfare_arr type:array default:-- desc:岗位福利
- * @return name:principal type:string default:-- desc:HR
- * @return name:hr_headimg type:string default:-- desc:HR头像
- * @return name:province type:string default:-- desc:省名
- * @return name:city type:string default:-- desc:市名
- * @return name:county type:string default:-- desc:县区
- * @return name:address type:string default:-- desc:地址
- * @return name:num type:int default:-- desc:招聘人数
- * @return name:app_name type:string default:-- desc:发布方名称
- * @return name:app_logo type:string default:-- desc:发布方头像
- * @return name:release_time type:string default:-- desc:上架时间
- * @return name:follow_switch type:int default:-- desc:订阅开关状态【0关闭1开启】
- * @return name:third_title type:string default:-- desc:第三级分类名称
- * @return name:company_intro type:string default:-- desc:公司简介
- * @return name:is_ss type:string default:-- desc:是否上市,1上市0未上市
- * @return name:scale type:string default:-- desc:公司规模(人数)
- */
- public function getRecruitList(){
- $sort_type = input('get.sort_type',1);
- $first_classify = input('get.first_classify');
- $second_classify = input('get.second_classify');
- $third_classify = input('get.third_classify');
- $education = input('get.education');
- $city = input('get.city');
- switch ($sort_type) {
- case 1:
- $order = ['sort'=>'desc','read_num'=>'desc'];
- break;
- case 2:
- $order = ['id'=>'asc','sort'=>'desc'];
- break;
- case 3:
- $order = ['id'=>'desc','sort'=>'desc'];
- break;
- }
- $sel_where = [];
- $sel_where[] = ['is_deleted','=',0];
- $sel_where[] = ['status','=',1];
- if($first_classify) $sel_where[] = ['first_classify','=',$first_classify];
- if($second_classify) $sel_where[] = ['second_classify','=',$second_classify];
- if($third_classify) $sel_where[] = ['third_classify','=',$third_classify];
- if($city) $sel_where[] = ['city','like','%'.$city.'%'];
- if($education) $sel_where[] = ['education','=',$education];
- $field = "id,title,num,province,education,city,county,address,user_id,principal,hr_headimg,label,welfare,salary,work_hours,release_time,company,company_intro,is_ss,scale";
- $list = \app\common\model\Recruit::field($field)->where($sel_where)->order($order)->limit($this->off_set,$this->page_num)->select()->toArray();
- $third_title = RecruitCate::where('id',$third_classify)->value('title');
- foreach ($list as &$v) {
- $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null;
- $v['welfare_arr'] = explode(',',trim($v['welfare'],','));
- $auth_info = \app\common\model\Recruit::getAuth($v['user_id'],APPNAME,APPLOGO);
- $v['app_name'] = $auth_info['app_name'];
- $v['app_logo'] = $auth_info['app_logo'];
- }
- $total_num = \app\common\model\Recruit::where($sel_where)->count();
- $follow_switch = PlatformSwitch::checkSwitch($this->user_id,$third_classify,6);
- $this->success('ok',['list'=>$list,'third_title'=>$third_title,'follow_switch'=>$follow_switch,'total_num'=>$total_num,'total_count'=>$total_num,'page_num'=>$this->page_num]);
- }
- /**
- * @title 获取招聘详情
- * @desc 获取招聘详情
- * @author qc
- * @method GET
- * @url /api/Recruit/getRecruitDetail
- * @header name:Authorization require:1 desc:Token
- * @param name:id type:int default:-- desc:招聘记录id
- * @return name:title type:string default:-- desc:标题
- * @return name:company type:string default:-- desc:公司名
- * @return name:cover type:string default:-- desc:公司logo
- * @return name:company_label type:array default:-- desc:公司标签
- * @return name:principal type:string default:-- desc:RH
- * @return name:hr_headimg type:string default:-- desc:RH头像
- * @return name:phone type:string default:-- desc:电话
- * @return name:email type:string default:-- desc:email
- * @return name:label_name type:array default:-- desc:标签
- * @return name:welfare_arr type:array default:-- desc:岗位福利
- * @return name:education type:string default:-- desc:学历
- * @return name:experience_min type:int default:0 desc:最低工作年限
- * @return name:experience_max type:int default:0 desc:最高工作年限
- * @return name:salary type:string:-- desc:薪资【文本】
- * @return name:work_hours type:string default:-- desc:兼职、全职或具体时长
- * @return name:content type:string default:-- desc:招聘详情
- * @return name:create_at type:string default:-- desc:发布时间
- * @return name:praise_num type:int default:-- desc:点赞量
- * @return name:is_praise type:int default:-- desc:是否点赞【0否1是】
- * @return name:is_collect type:int default:-- desc:是否收藏【0否1是】
- * @return name:collect_num type:int default:-- desc:收藏量
- * @return name:transmit_num type:int default:-- desc:转发量
- * @return name:read_num type:int default:-- desc:阅读量
- * @return name:province type:string default:-- desc:省名
- * @return name:city type:string default:-- desc:市名
- * @return name:county type:string default:-- desc:县区
- * @return name:address type:string default:-- desc:地址
- * @return name:longitude type:string default:-- desc:经度
- * @return name:latitude type:string default:-- desc:纬度
- * @return name:num type:int default:-- desc:招聘人数
- * @return name:hr_code type:int default:-- desc:二维码
- * @return name:release_time type:string default:-- desc:上架时间
- * @return name:follow_switch type:int default:-- desc:订阅开关状态【0关闭1开启】
- * @return name:company_intro type:string default:-- desc:公司简介
- * @return name:is_ss type:string default:-- desc:是否上市,1上市0未上市
- * @return name:scale type:string default:-- desc:公司规模(人数)
- *
- */
- public function getRecruitDetail()
- {
- $sel_where[] = ['id','=',input('get.id')];
- $detail = \app\common\model\Recruit::where($sel_where)->find()->toArray();
- if($detail['is_deleted'] == 1 || $detail['status'] == 0) $this->error('该招聘信息已取消');
- $detail['label_name'] = explode(',',trim($detail['label'],','));
- $detail['welfare_arr'] = explode(',',trim($detail['welfare'],','));
- $detail['company_label'] = explode(',',trim($detail['company_label'],','));
- $detail['is_praise'] = PlatformLike::checkTags($this->user_id,$detail['id'],5);
- $detail['praise_num'] = PlatformLike::getPraiseNum($detail['id'],5);
- $detail['is_collect'] = UserCollect::checkCollectByType($this->user_id,8,$detail['id']);
- $detail['collect_num'] = UserCollect::getCollectNum(8,$detail['id']);
- $detail['transmit_num'] = numTransform($detail['transmit_num']);
- \app\common\model\Recruit::where('id',$detail['id'])->setInc('read_num');
- UserTrack::crateTrack($this->user_id,8,input('get.id'),0);
- if($this->user_id){
- TopSearch::seIncHotNum($detail['id'],$this->request->controller());
- }
- if($this->user_id){
- $General = new General();
- $General->label($detail['label']);
- }
- $this->success('ok',['detail'=>$detail]);
- }
- /**
- * @title 点赞||取消点赞
- * @desc 点赞||取消点赞
- * @author qc
- * @method POST
- * @url /api/Recruit/recruitTags
- * @header name:Authorization require:1 desc:Token
- * @param name:id type:int default:1 desc:招聘记录id
- * @return name:tags type:int default:1 desc:0取消成功,1点赞成功
- */
- public function recruitTags()
- {
- $ret_val = PlatformLike::userTags($this->user_id,input('post.id'),5);
- $this->success($ret_val == 1 ?'点赞成功':'取消成功',['tags'=>$ret_val]);
- }
- /**
- * @title 收藏||取消收藏
- * @desc 用户收藏
- * @author qc
- * @method POST
- * @url /api/Recruit/recruitCollect
- * @header name:Authorization require:1 desc:Token
- * @param name:id type:int require:1 default:-- desc:招聘记录id
- * @param name:status type:int default:0 desc:收藏状态(0取消收藏【未收藏】,1收藏)
- */
- public function recruitCollect(){
- $coll_status = UserCollect::plateCollect($this->user_id,8,input('post.id',0));
- $coll_status ? $this->success('收藏成功',['status'=>1]) : $this->success('取消收藏成功',['status'=>0]);
- }
- /**
- * @title 转发(转发数量统计)
- * @desc 转发成功后调用
- * @author qc
- * @method POST
- * @url /api/Recruit/recruitTransmit
- * @header name:Authorization require:1 desc:Token
- * @param name:id type:int default:-- desc:招聘记录id
- */
- public function recruitTransmit()
- {
- $id = input('post.id',0);
- \app\common\model\Recruit::where('id',$id)->setInc('transmit_num');
- $this->success('ok');
- }
- /**
- * @title 点赞我的
- * @desc 点赞我的
- * @author qc
- * @method GET
- * @url /api/Recruit/praiseRecruitList
- * @header name:Authorization require:1 desc:Token
- * @param name:page type:int default:-- desc:页数
- * @param name:page_num type:int default:-- desc:每页数
- * @return name:id type:int default:-- desc:记录id
- * @return name:label_name type:array default:-- desc:标签
- * @return name:recruit_id type:array default:-- desc:招聘id
- * @return name:create_at type:string default:-- desc:时间
- * @return name:user_name type:string default:-- desc:会员名称
- * @return name:headimg type:string default:-- desc:会员头像
- * @return name:salary type:int default:-- desc:薪资【文本】
- * @return name:work_hours type:string default:-- desc:兼职、全职或具体时长
- * @return name:company type:string default:-- desc:公司名
- * @return name:education type:string default:-- desc:学历
- * @return name:experience_min type:int default:0 desc:最低工作年限
- * @return name:experience_max type:int default:0 desc:最高工作年限
- * @return name:is_normal type:int default:-- desc:是否是正常记录(0已删除或是已禁用1可以正常跳转详情)
- * @return name:company_intro type:string default:-- desc:公司简介
- * @return name:is_ss type:string default:-- desc:是否上市,1上市0未上市
- * @return name:scale type:string default:-- desc:公司规模(人数)
- */
- public function praiseRecruitList()
- {
- $sel_where = [];
- $sel_where[] = ['p.type', '=', 5];
- $sel_where[] = ['f.user_id', '=', $this->user_id];
- $sel_where[] = ['p.user_id', '<>', $this->user_id];
- $sel_where[] = ['p.to_deleted', '=', 0];
- $list = PlatformLike::where($sel_where)
- ->field('p.id,p.like_id,f.title,u.name user_name,u.headimg,f.title,f.id recruit_id,f.label,salary,work_hours,f.company,f.company_intro,f.is_ss,f.scale,education,experience_min,experience_max,p.create_at,f.cover,f.hr_headimg,f.principal')
- ->alias('p')
- ->leftJoin('Recruit f', 'f.id = p.like_id')
- ->leftJoin('StoreMember u', 'u.id = p.user_id')
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- array_walk($list,function (&$v){
- $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null;
- $v['is_normal'] = CheckPower::checkModulesPower($v['like_id'], 0, $this->request->controller());
- });
- $total_num = PlatformLike::where($sel_where)->alias('p')->leftJoin('Recruit f', 'f.id = p.like_id')->leftJoin('StoreMember u', 'u.id = p.user_id')->count();
- $this->success('ok', ['list' => $list, 'total_count' => $total_num, 'page_num' => $this->page_num]);
- }
- /**
- * @title 我的点赞
- * @desc 我的点赞
- * @author qc
- * @method GET
- * @url /api/Recruit/getTagsRecruit
- * @header name:Authorization require:1 desc:Token
- * @param name:page type:int default:-- desc:页数
- * @param name:page_num type:int default:-- desc:每页数
- * @return name:id type:int default:-- desc:记录id
- * @return name:label_name type:array default:-- desc:标签
- * @return name:recruit_id type:array default:-- desc:招聘id
- * @return name:create_at type:string default:-- desc:时间
- * @return name:user_name type:string default:-- desc:会员名称
- * @return name:headimg type:string default:-- desc:会员头像
- * @return name:salary type:int default:-- desc:薪资【文本】
- * @return name:work_hours type:string default:-- desc:兼职、全职或具体时长
- * @return name:company type:string default:-- desc:公司名
- * @return name:education type:string default:-- desc:学历
- * @return name:experience_min type:int default:0 desc:最低工作年限
- * @return name:experience_max type:int default:0 desc:最高工作年限
- * @return name:principal type:string default:-- desc:联系人
- * @return name:hr_headimg type:string default:-- desc:联系人头像
- * @return name:is_normal type:int default:-- desc:是否是正常记录(0已删除或是已禁用1可以正常跳转详情)
- * @return name:company_intro type:string default:-- desc:公司简介
- * @return name:is_ss type:string default:-- desc:是否上市,1上市0未上市
- * @return name:scale type:string default:-- desc:公司规模(人数)
- */
- public function getTagsRecruit()
- {
- $sel_where = [];
- $sel_where[] = ['p.type', '=', 5];
- $sel_where[] = ['p.user_id', '=', $this->user_id];
- $sel_where[] = ['f.user_id', '<>', $this->user_id];
- $sel_where[] = ['p.to_deleted', '=', 0];
- $list = PlatformLike::where($sel_where)
- ->field('p.id,p.like_id,f.title,u.name user_name,u.headimg,f.title,f.id recruit_id,f.label,salary,work_hours,f.company,f.company_intro,f.is_ss,f.scale,education,experience_min,experience_max,principal,hr_headimg,f.cover,f.hr_headimg,f.principal')
- ->alias('p')
- ->leftJoin('Recruit f', 'f.id = p.like_id')
- ->leftJoin('StoreMember u', 'u.id = p.user_id')
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- array_walk($list,function (&$v){
- $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null;
- $v['is_normal'] = CheckPower::checkModulesPower($v['like_id'], 0, $this->request->controller());
- });
- $total_num = PlatformLike::where($sel_where)->alias('p')->leftJoin('Recruit f', 'f.id = p.like_id')->leftJoin('StoreMember u', 'u.id = p.user_id')->count();
- $this->success('ok', ['list' => $list, 'total_count' => $total_num, 'page_num' => $this->page_num]);
- }
- /**
- * @title 给我投的
- * @desc 给我投的
- * @author qc
- * @method GET
- * @url /api/Recruit/resumeToRecruits
- * @header name:Authorization require:1 desc:Token
- * @param name:page type:int default:-- desc:页数
- * @param name:page_num type:int default:-- desc:每页数
- * @return name:id type:int default:-- desc:招聘记录id
- * @return name:work_hours type:string default:-- desc:兼职、全职或具体时长
- * @return name:salary type:string default:-- desc:薪资
- * @return name:unread_num type:string default:-- desc:未读量
- * @return name:time_str type:string default:-- desc:时间
- * @return name:is_normal type:int default:-- desc:是否是正常记录(0已删除或是已禁用1可以正常跳转详情)
- */
- public function resumeToRecruits()
- {
- $recruits = \app\common\model\Recruit::where(['user_id'=>$this->user_id,'is_deleted'=>0])->column('id');
- $recruit_ids = RecruitResume::where('recruit_id','in',$recruits)->where('is_deleted',0)->where('to_deleted',0)->group('recruit_id')->column('recruit_id');
- $ids_str = implode(',',$recruit_ids);
- $list = \app\common\model\Recruit::where(['r.user_id'=>$this->user_id,'r.is_deleted'=>0,]) ->alias('r')
- ->where('r.id','in',$ids_str)
- //->field('r.id,IFNULL( (SELECT count( s.id) FROM dd_recruit_resume as s WHERE r.id=s.recruit_id ),0) as re_num,IFNULL( (SELECT max(y.id) FROM dd_recruit_resume as y WHERE r.id=y.recruit_id ),0) as max_id')
- ->field('r.id,r.title,r.salary,work_hours,IFNULL( (SELECT count( s.id) FROM dd_recruit_resume as s WHERE r.id=s.recruit_id ),0) as re_num')
- ->order('r.id desc')
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- array_walk($list,function (&$v){
- $v['unread_num'] = RecruitResume::getUnreadNum($v['id']);
- $new_info = RecruitResume::where(['recruit_id'=>$v['id'],'is_deleted'=>0,'is_read'=>0])->order('id desc')->find();
- $v['time_str'] = $new_info ? timeTransform($new_info->create_at) :null;
- $v['is_normal'] = CheckPower::checkModulesPower($v['id'],0,$this->request->controller());
- });
- $total_num = \app\common\model\Recruit::where(['r.user_id'=>$this->user_id,'r.is_deleted'=>0,]) ->alias('r') ->where('r.id','in',$ids_str)
- ->field('r.id,IFNULL( (SELECT count( s.id) FROM dd_recruit_resume as s WHERE r.id=s.recruit_id ),0) as re_num')
- ->order('r.id desc')->count();
- $this->success('ok', ['list' => $list, 'total_count' => $total_num, 'page_num' => $this->page_num]);
- }
- /**
- * @title 给我投的--简历列表
- * @desc 给我投的--简历列表
- * @author qc
- * @method GET
- * @url /api/Recruit/getRecruitResumeList
- * @header name:Authorization require:1 desc:Token
- * @param name:page type:int default:-- desc:页数
- * @param name:page_num type:int default:-- desc:每页数
- * @param name:recruit_id type:int default:-- desc:招聘记录id
- * @return name:images type:string default:-- desc:图片
- * @return name:images_arr type:array default:-- desc:数组
- * @return name:name type:string default:-- desc:名称
- * @return name:headimg type:string default:-- desc:头像
- * @return name:create_at type:string default:-- desc:时间
- * @return name:type type:int default:0 desc:类型0图片1pdf
- * @return name:is_read type:int default:-- desc:是否已读(0未读1已读)
- */
- public function getRecruitResumeList()
- {
- $list = RecruitResume::where(['r.recruit_id'=>input('get.recruit_id'),'r.is_deleted'=>0,'r.to_deleted'=>0])->alias('r')
- ->field('r.id,r.recruit_id,u.name,u.headimg,images,r.create_at,r.is_read,r.type')
- ->leftJoin('StoreMember u','u.id = r.user_id')
- ->limit($this->off_set,$this->page_num)
- ->order('r.id desc')
- ->select()->toArray();
- array_walk($list,function (&$v){
- $v['images_arr'] = explode('|',$v['images']);
- $v['create_at'] = substr($v['create_at'],0,10);
- });
- $total_num = RecruitResume::where(['r.recruit_id'=>input('get.recruit_id'),'r.is_deleted'=>0,'r.to_deleted'=>0])->alias('r')
- ->leftJoin('StoreMember u','u.id = r.user_id')->count();
- $this->success('ok', ['list' => $list, 'total_count' => $total_num, 'page_num' => $this->page_num]);
- }
- /**
- * @title 我的发布【招聘】
- * @desc 我的发布【招聘】
- * @author qc
- * @method GET
- * @url /api/Recruit/getOwnRecruitList
- * @header name:Authorization require:1 desc:Token
- * @param name:title type:string default:-- desc:标题
- * @param name:page type:int default:0 desc:页数
- * @param name:page_num type:int default:20 desc:每页数
- * @return name:title type:string default:-- desc:标题
- * @return name:company type:string default:-- desc:公司名
- * @return name:cover type:string default:-- desc:公司logo
- * @return name:label_name type:array default:-- desc:标签
- * @return name:welfare_arr type:array default:-- desc:岗位福利
- * @return name:education type:string default:-- desc:学历
- * @return name:experience_min type:int default:0 desc:最低工作年限
- * @return name:experience_max type:int default:0 desc:最高工作年限
- * @return name:price_min type:int default:-- desc:最低薪资[弃用]
- * @return name:price_max type:int default:-- desc:最高薪资[弃用]
- * @return name:salary type:int default:-- desc:薪资【文本】
- * @return name:work_hours type:string default:-- desc:兼职、全职或具体时长
- * @return name:create_at type:string default:-- desc:发布时间
- * @return name:num type:int default:-- desc:招聘人数
- * @return name:principal type:string default:-- desc:联系人
- * @return name:hr_headimg type:string default:-- desc:联系人头像
- * @return name:is_normal type:int default:-- desc:是否是正常记录(0已删除或是已禁用1可以正常跳转详情)
- * @return name:company_intro type:string default:-- desc:公司简介
- * @return name:is_ss type:string default:-- desc:是否上市,1上市0未上市
- * @return name:scale type:string default:-- desc:公司规模(人数)
- */
- public function getOwnRecruitList()
- {
- $title = input('get.title');
- $sel_where = [];
- $sel_where[] = ['is_deleted','=',0];
- $sel_where[] = ['status','=',1];
- $sel_where[] = ['user_id','=',$this->user_id];
- $list = \app\common\model\Recruit::where($sel_where)
- ->field('id,title,company,company_intro,work_hours,is_ss,scale,label,welfare,education,experience_min,salary,experience_max,price_min,price_max,create_at,num,principal,hr_headimg,province,city,county')
- ->when($title,function ($query)use($title){
- if($title) $query->where('title|label','like','%'.$title.'%');
- })->order(['id'=>'asc'])
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- $user_info = $this->userInfo('name,headimg');
- foreach ($list as &$v) {
- $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null;
- $v['welfare_arr'] = explode(',',trim($v['welfare'],','));
- $v['is_normal'] = CheckPower::checkModulesPower($v['id'],0,$this->request->controller());
- $v['app_name'] = $user_info['name'];
- $v['app_logo'] = $user_info['headimg'];
- }
- $total_num = \app\common\model\Recruit::where($sel_where)
- ->when($title,function ($query)use($title){
- if($title) $query->where('title|label','like','%'.$title.'%');
- })->count();
- $this->success('ok', ['list' => $list, 'total_count' => $total_num, 'page_num' => $this->page_num]);
- }
- /**
- * @title 浏览记录【招聘】
- * @desc 浏览记录【招聘】
- * @author qc
- * @method GET
- * @url /api/Recruit/getBrowseList
- * @header name:Authorization require:1 desc:Token
- * @param name:title type:string default:-- desc:标题
- * @param name:page type:int default:0 desc:页数
- * @param name:page_num type:int default:20 desc:每页数
- * @return name:id type:int default:-- desc:浏览记录id
- * @return name:title type:string default:-- desc:标题
- * @return name:recruit_id type:int default:-- desc:招聘记录id
- * @return name:company type:string default:-- desc:公司名
- * @return name:label_name type:array default:-- desc:标签
- * @return name:welfare_arr type:array default:-- desc:岗位福利
- * @return name:education type:string default:-- desc:学历
- * @return name:experience_min type:int default:0 desc:最低工作年限
- * @return name:experience_max type:int default:0 desc:最高工作年限
- * @return name:salary type:int default:-- desc:薪资【文本】
- * @return name:work_hours type:string default:-- desc:兼职、全职或具体时长
- * @return name:num type:int default:-- desc:招聘人数
- * @return name:time type:string default:-- desc:浏览时间
- * @return name:principal type:string default:-- desc:HR
- * @return name:hr_headimg type:string default:-- desc:HR头像
- * @return name:app_name type:string default:-- desc:发布人名称
- * @return name:app_logo type:string default:-- desc:发布人头像
- * @return name:is_normal type:int default:-- desc:是否是正常记录(0已删除或是已禁用1可以正常跳转详情)
- * @return name:company_intro type:string default:-- desc:公司简介
- * @return name:is_ss type:string default:-- desc:是否上市,1上市0未上市
- * @return name:scale type:string default:-- desc:公司规模(人数)
- */
- public function getBrowseList()
- {
- $sel_where = [];
- $sel_where[] = ['t.user_id','=',$this->user_id];
- $sel_where[] = ['t.type','=',8];
- $title = input('get.title');
- if($title) $sel_where[] = ['i.title|i.label','like','%'.$title.'%'];
- $list = UserTrack::where($sel_where)
- ->alias('t')
- ->field('t.id,t.update_int,t.first_id recruit_id,i.salary,work_hours,i.title,i.price_max,i.company,i.company_intro,i.is_ss,i.scale,i.label,province,city,county,i.welfare,i.education,i.experience_min,i.experience_max,price_min,price_max,i.num,principal,hr_headimg,i.user_id,i.cover,i.hr_headimg,i.principal')
- ->leftJoin('Recruit i','t.first_id = i.id')
- ->order('update_int desc')
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- foreach ($list as &$v) {
- $v['time'] = date("Y-m-d H:i:s",$v['update_int']);
- $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null;
- $v['welfare_arr'] = explode(',',trim($v['welfare'],','));
- $v['is_normal'] = CheckPower::checkModulesPower($v['recruit_id'],0,$this->request->controller());
- $auth_info = \app\common\model\Recruit::getAuth($v['user_id'],APPNAME,APPLOGO);
- $v['app_name'] = $auth_info['app_name'];
- $v['app_logo'] = $auth_info['app_logo'];
- }
- $total_num = UserTrack::where($sel_where)->alias('t')->leftJoin('Recruit i','t.first_id = i.id')->count();
- $this->success('ok', ['list' => $list, 'total_count' => $total_num, 'page_num' => $this->page_num]);
- }
- /**
- * @title 收藏记录【招聘】
- * @desc 收藏记录【招聘】
- * @author qc
- * @method GET
- * @url /api/Recruit/getRecruitCollect
- * @header name:Authorization require:1 desc:Token
- * @param name:title type:string default:-- desc:标题
- * @param name:page type:int default:0 desc:页数
- * @param name:page_num type:int default:20 desc:每页数
- * @return name:id type:int default:-- desc:收藏记录id
- * @return name:title type:string default:-- desc:标题
- * @return name:recruit_id type:int default:-- desc:招聘记录id
- * @return name:company type:string default:-- desc:公司名
- * @return name:cover type:string default:-- desc:公司logo
- * @return name:label_name type:array default:-- desc:标签
- * @return name:welfare_arr type:array default:-- desc:岗位福利
- * @return name:education type:string default:-- desc:学历
- * @return name:experience_min type:int default:0 desc:最低工作年限
- * @return name:experience_max type:int default:0 desc:最高工作年限
- * @return name:price_min type:int default:-- desc:最低薪资[弃用]
- * @return name:price_max type:int default:-- desc:最高薪资[弃用]
- * @return name:salary type:string default:-- desc:薪资【文本】
- * @return name:work_hours type:string default:-- desc:兼职、全职或具体时长
- * @return name:num type:int default:-- desc:招聘人数
- * @return name:time type:string default:-- desc:浏览时间
- * @return name:principal type:string default:-- desc:联系人
- * @return name:hr_headimg type:string default:-- desc:联系人头像
- * @return name:app_name type:string default:-- desc:发布人名称
- * @return name:app_logo type:string default:-- desc:发布人头像
- * @return name:is_normal type:int default:-- desc:是否是正常记录(0已删除或是已禁用1可以正常跳转详情)
- * @return name:company_intro type:string default:-- desc:公司简介
- * @return name:is_ss type:string default:-- desc:是否上市,1上市0未上市
- * @return name:scale type:string default:-- desc:公司规模(人数)
- */
- public function getRecruitCollect()
- {
- $sel_where = [];
- $title = input('get.title');
- if($title) $sel_where[] = ['i.title|i.label','like','%'.$title.'%'];
- $sel_where[] = ['t.user_id','=',$this->user_id];
- $sel_where[] = ['t.coll_type','=',8];
- $list = UserCollect::where($sel_where)
- ->alias('t')
- ->field('t.id,t.create_at,t.coll_id recruit_id,i.title,i.company,i.company_intro,i.is_ss,i.scale,i.label,i.salary,work_hours,i.welfare,i.education,i.experience_min,i.experience_max,price_min,price_max,i.num,principal,hr_headimg,province,city,county,i.user_id,i.cover,i.hr_headimg,i.principal')
- ->leftJoin('Recruit i','t.coll_id = i.id')
- ->order('id desc')
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- foreach ($list as &$v) {
- $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null;
- $v['welfare_arr'] = explode(',',trim($v['welfare'],','));
- $v['is_normal'] = CheckPower::checkModulesPower($v['recruit_id'],0,$this->request->controller());
- $auth_info = \app\common\model\Recruit::getAuth($v['user_id'],APPNAME,APPLOGO);
- $v['app_name'] = $auth_info['app_name'];
- $v['app_logo'] = $auth_info['app_logo'];
- }
- $total_num = UserCollect::where($sel_where)->alias('t')->leftJoin('Recruit i','t.coll_id = i.id')->count();
- $this->success('ok', ['list' => $list, 'total_count' => $total_num, 'page_num' => $this->page_num]);
- }
- /**
- * @title 我的订阅
- * @desc 我的订阅
- * @author qc
- * @method GET
- * @url /api/Recruit/getFollowUpList
- * @header name:Authorization require:1 desc:Token
- * @param name:title type:string default:-- desc:标题
- * @param name:page type:int default:0 desc:页数
- * @param name:page_num type:int default:20 desc:每页数
- * @return name:create_at type:string default:-- desc:追更设置时间
- * @return name:cate_id type:int default:-- desc:招聘分类id
- * @return name:title type:string default:-- desc:标题
- * @return name:logo type:string default:-- desc:分类图片
- */
- public function getFollowUpList()
- {
- $sel_where = [];
- $sel_where[] = ['p.user_id','=',$this->user_id];
- $sel_where[] = ['p.type','=',6];
- $sel_where[] = ['p.switch_value','=',1];
- $field = 'p.id,p.switch_id as cate_id,p.create_at,a.title,a.logo';
- $list = PlatformSwitch::field($field)
- ->alias('p')
- ->leftJoin('RecruitCate a','p.switch_id = a.id')
- ->where($sel_where)
- ->limit($this->off_set,$this->page_num)
- ->order('p.id desc')
- ->select()->toArray();
- $total_num = PlatformSwitch::alias('p')->leftJoin('RecruitCate a','p.switch_id = a.id') ->where($sel_where)->count();
- $this->success('ok', ['list' => $list, 'total_count' => $total_num, 'page_num' => $this->page_num]);
- }
- /**
- * @title 订阅消息
- * @desc 订阅消息
- * @author qc
- * @method GET
- * @url /api/Recruit/getFollowUpMessage
- * @header name:Authorization require:1 desc:Token
- * @param name:page type:int default:-- desc:页数
- * @param name:page_num type:int default:-- desc:每页数
- * @return name:id type:int default:-- desc:记录id
- * @return name:title type:string default:-- desc:标题
- * @return name:content type:string default:-- desc:内容
- * @return name:create_at type:string default:-- desc:时间
- * @return name:is_read type:int default:-- desc:是否已读【0否1是】
- * @return name:is_normal type:int default:-- desc:是否是正常记录(0已删除或是已禁用1可以正常跳转详情)
- */
- public function getFollowUpMessage()
- {
- $list = UserMessage::where(['m.user_id'=>$this->user_id,'m.is_deleted'=>0,'m.module'=>'recruit'])->where('m.type_id','in','4,5')->alias('m')
- ->field('m.id,m.create_at,m.is_read,m.children_id recruit_id,m.content,m.type_id')
- ->limit($this->off_set,$this->page_num)
- ->order(['m.id'=>'desc'])
- ->select()->toArray();
- array_walk($list,function (&$v){
- $v['is_normal'] = CheckPower::checkModulesPower($v['recruit_id'], 0, $this->request->controller(),$v['type_id']);
- });
- $total_num = UserMessage::where(['m.user_id'=>$this->user_id,'m.is_deleted'=>0,'m.module'=>'recruit'])->where('m.type_id','in','4,5')->alias('m')->count();
- $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
- }
- /**
- * @title 获取角标数量
- * @desc 获取角标数量
- * @author qc
- * @method GET
- * @url /api/Recruit/getMarkNum
- * @header name:Authorization require:1 desc:Token
- * @return name:praise_num type:int default:-- desc:点赞我的
- * @return name:follow_num type:int default:-- desc:我的订阅
- * @return name:resume_num type:int default:-- desc:给我投的
- * @return name:total_num type:int default:-- desc:总数
- */
- public function getMarkNum()
- {
- $praise_num = PlatformLike::where([['p.type', '=', 5],['f.user_id', '=', $this->user_id],['p.to_deleted', '=', 0],['p.is_read','=',0]])->alias('p') ->leftJoin('Recruit f', 'f.id = p.like_id')->count();
- $follow_num = UserMessage::where(['m.user_id'=>$this->user_id,'m.is_deleted'=>0,'m.module'=>'recruit','is_read'=>0])->where('m.type_id','in','4,5')->alias('m')->count();
- //1.返回一下给我投的角标数量
- $recruits = \app\common\model\Recruit::where(['user_id'=>$this->user_id,'is_deleted'=>0])->column('id');
- $resume_num = RecruitResume::where('recruit_id','in',$recruits)->where('is_deleted',0)->where('to_deleted',0)->where('is_read',0)->count();
- // $ids_str = implode(',',$recruit_ids);
- // $resume_num = \app\common\model\Recruit::where(['r.user_id'=>$this->user_id,'r.is_deleted'=>0,]) ->alias('r') ->where('r.id','in',$ids_str)
- // ->field('r.id,IFNULL( (SELECT count( s.id) FROM dd_recruit_resume as s WHERE r.id=s.recruit_id ),0) as re_num')
- // ->order('r.id desc')->count();
- $total_num = $praise_num + $follow_num + $resume_num;
- $this->success('ok',compact(['praise_num','follow_num','resume_num','total_num']));
- }
- /**
- * @title 批量删除||批量取消
- * @desc 删除||取消
- * @author qc
- * @method POST
- * @url /api/Recruit/batchesDel
- * @header name:Authorization require:1 desc:Token
- * @param name:id type:string default:1 desc:记录id【多个用逗号隔开=>'1,2'】
- * @param name:type type:string default:1 desc:消息类型【1点赞我的,2我的点赞,3我的收藏,4给我投的--简历列表,5订阅消息,6我的订阅】
- */
- public function batchesDel()
- {
- $type = input('post.type',1);
- $id = input('post.id');
- if(!$id) $this->error('请选择要删除的记录');
- $del_where = [];
- $del_where[] = ['id','in',$id];
- if(in_array($type,[2,3,5,6])) $del_where[] = ['user_id','=',$this->user_id];
- if(in_array($type,[1])) PlatformLike::where($del_where)->update(['to_deleted'=>1,'is_read'=>1]);
- if(in_array($type,[2])) PlatformLike::where($del_where)->where('user_id',$this->user_id)->delete();
- if(in_array($type,[3])) UserCollect::where($del_where)->where('user_id',$this->user_id)->where('coll_type',8)->delete();
- if(in_array($type,[4])) RecruitResume::where($del_where)->update(['to_deleted'=>1,'is_read'=>1]);
- if(in_array($type,[5])) UserMessage::where($del_where)->update(['is_deleted'=>1]);
- if(in_array($type,[6])) PlatformSwitch::where($del_where)->delete();
- $this->success('操作成功');
- }
- /**
- * @title 消息已读未读变更
- * @desc 消息已读
- * @author qc
- * @method POST
- * @url /api/Recruit/unreadChange
- * @header name:Authorization require:1 desc:Token
- * @param name:id type:string default:-- desc:记录id(多个逗号隔开,不传修改全部])
- * @param name:type type:string default:1 desc:消息类型【1给我投的--简历列表,2订阅消息,3点赞我的】
- * @param name:is_read type:int default:1 desc:变更类型【0消息变更为未读,1变更为已读】
- */
- public function unreadChange()
- {
- $type = input('post.type',1);
- $id = input('post.id');
- $is_read = input('post.is_read');
- switch ($type) {
- case 1:
- $recruit_ids = \app\common\model\Recruit::where(['user_id'=>$this->user_id,'is_deleted'=>0])->column('id');
- RecruitResume::where(['r.is_deleted'=>0,'r.to_deleted'=>0])
- ->where('r.recruit_id','in',$recruit_ids)
- ->alias('r')
- ->when($id ,function ($query)use ($id){
- if($id) return $query->where('r.id','in',$id);
- })->update(['is_read'=>$is_read]);
- break;
- case 2:
- $where[] = ['user_id','=',$this->user_id];
- $where[] = ['module','=','recruit'];
- if($id) $where[] = ['id','in',$id];
- UserMessage::where($where)->update(['is_read'=>$is_read]);
- break;
- case 3:
- PlatformLike::where([['p.type', '=', 5],['f.user_id', '=', $this->user_id]])
- ->alias('p') ->leftJoin('Recruit f', 'f.id = p.like_id')->update(['p.is_read'=>$is_read]);
- break;
- }
- $this->success('操作成功');
- }
- }
|