php74 骑士 火车头采集简历 接口及采集规则
研究了下骑士官方发布的火车头采集接口api并没有相关简历对应的采集接口
因此就自己写了个方法对应简历采集接口实现可查询。相关字段匹配等。和企业采集接口匹配基本一样。
支持图片采集。
图片采集到的文件目录需要自己对采集规则进行再修改。
现在对api文件修改如下
\admin\api\locoyspider.php 该文件就是接口文件 现在存在的有普通文章采集接口和企业采集接口没有建立采集接口。那么我们就添加个简历采集接口
再最下面添加代码
elseif($act==resumes){ locoyspider_addresumes(); exit(添加失败);}
然后找到
/admin/include/admin_locoyspider_fun.php
文件。该文件就是处理火车头数据的方法文件
可以再最下面添加
//匹配简历婚姻状况function locoyspider_resumes_marriage($str=null){ return get_locoyspider_resumes_marriage($str);}function get_locoyspider_resumes_marriage($marriage_cn=null,$marriage=null){ if ($marriage_cn==未婚 || $marriage==1) { return array(id=>1,cn=>未婚); } elseif ($marriage_cn==已婚 || $marriage==2) { return array(id=>2,cn=>未婚); } elseif ($marriage_cn==保密 || $marriage==3) { return array(id=>3,cn=>保密); } else { return get_locoyspider_resumes_marriage(,3);//匹配不到的情况下防护保密状态 }}
找到
再传参里面添加一参数
$utype=1
//采集注册会员function locoyspider_user_register($email=null,$utype=1){...}然后就在该方法体里面查找
$setsqlarr['utype']=1; 修改为 $setsqlarr['utype']=$utype;
然后 添加简历的方法
//添加简历function locoyspider_addresumes(){ global $locoyspider; //添加会员 个人会员类型 $setsqlarr['uid']=locoyspider_user_register(trim($_post['email']),2); if ($setsqlarr['uid']==) exit(添加会员出错); $uid=$setsqlarr['uid'];//用户id //step1添加简历基本信息 $setsqlarr['title']=trim($_post['title'])?trim($_post['title']):exit('请填写简历名称!'); $setsqlarr['fullname']=trim($_post['fullname'])?trim($_post['fullname']):exit('请填写姓名!'); //匹配简历 性别 $sex=locoyspider_jobs_sex(trim($_post['sex_cn'])); $setsqlarr['sex']=$sex['id']; $setsqlarr['sex_cn']=$sex['cn']; $birthage=intval($_post['birthdate']); if($birthage1945?intval($_post['birthdate']):exit('请正确填写出生年份'); } $setsqlarr['height']=intval($_post['height']); //匹配婚姻状况 $marriage=locoyspider_resumes_marriage($_post['marriage_cn']); $setsqlarr['marriage']=$marriage['id'];//婚姻状况 1 未婚 2 已婚 3 保密 $setsqlarr['marriage_cn']=$marriage['cn']; //匹配要求工作经验 $experience=locoyspider_jobs_experience(trim($_post['experience_cn'])); $setsqlarr['experience']=$experience['id']; $setsqlarr['experience_cn']=$experience['cn']; //户口所在地 $setsqlarr['householdaddress']=trim($_post['householdaddress'])?trim($_post['householdaddress']):exit('请填写户口所在地!'); //匹配要求学历 $education=locoyspider_jobs_education(trim($_post['education_cn'])); $setsqlarr['education']=$education['id']; $setsqlarr['education_cn']=$education['cn']; $setsqlarr['tag']=''; $setsqlarr['telephone']=trim($_post['telephone']); $setsqlarr['email']=trim($_post['email']); $setsqlarr['email_notify']=0; $setsqlarr['address']=trim($_post['address']); $setsqlarr['website']=trim($_post['website']); $setsqlarr['qq']=trim($_post['qq']); $setsqlarr['addtime']=$timestamp; $setsqlarr['refreshtime']=$timestamp; $setsqlarr['subsite_id']=0; //图片路径问题 if(!empty($_post['photosrc'])){ $imgurllength=strpos($_post['photosrc'],style)-strpos($_post['photosrc'],thumb)-9; $imgurl=substr($_post['photosrc'],strpos($_post['photosrc'],thumb)+6,$imgurllength); $setsqlarr['photo_img']=trim($_post['photosrc'])==''?'':$imgurl; } $setsqlarr['display_name']=(trim($setsqlarr['fullname'])==某某?2:3);//姓名显示方式 1 真实姓名 2 编号 3 姓** if(trim($setsqlarr['fullname'])==某某){ $setsqlarr['fullname']=trim($setsqlarr['fullname']).res_randstr(4); } $setsqlarr['audit']=1;//审核状态1 通过 2未通过 3 删除 $pid=inserttable(table('resume'),$setsqlarr,1);//简历id if (empty($pid)) exit(简历保存失败!); unset($setsqlarr); //step2 //更新详细信息 $resumearr['recentjobs']=trim($_post['recentjobs']);//最近工作过的职位 //期望岗位性质 $nature=locoyspider_jobs_nature(trim($_post['nature_cn'])); $resumearr['nature']=$nature['id']; $resumearr['nature_cn']=$nature['cn']; //期望工作地区 $district=locoyspider_jobs_district(trim($_post['district_cn'])); $resumearr['district']=$district['district']; $resumearr['sdistrict']=$district['sdistrict']; $resumearr['district_cn']=$district['district_cn']; //期望月薪 $wage=locoyspider_jobs_wage(trim($_post['wage_cn'])); $resumearr['wage']=$wage['id']; $resumearr['wage_cn']=$wage['cn']; //期望从事行业 $trade=locoyspider_company_trade(trim($_post['trade_cn'])); $resumearr['trade']=$trade['id']; $resumearr['trade_cn']=$trade['cn']; $resumearr['audit']=1; //匹配职位 一个职位 require_once(qishi_root_path.'include/fun_personal.php'); $category=locoyspider_jobs_category(trim($_post['intention_jobs']));//$_post['jobs_category'] $resumearr['intention_jobs']=trim($category['category_cn']); add_resume_jobs($pid,$uid,$category['category'].$category['subclass'])?:exit('求职意向更新失败'); //更新一个求职意向 updatetable(table('resume'),$resumearr, id='{$pid}' and uid='{$uid}'); updatetable(table('resume_tmp'),$resumearr, id='{$pid}' and uid='{$uid}'); unset($resumearr); //step3 //技能特长 $setsqlarrspecialty['specialty']=!empty($_post['specialty'])?$_post['specialty']:'未填写求职意向!'; $setsqlarrspecialty['audit']=1; updatetable(table('resume'),$setsqlarrspecialty, id='.intval($pid).' and uid='.intval($uid).'); updatetable(table('resume_tmp'),$setsqlarrspecialty, id='.intval($pid).' and uid='.intval($uid).'); unset($setsqlarrspecialty); //step4 //教育经历 $seteducationarr['uid']=$uid; $seteducationarr['pid']=$pid; $seteducationarr['start']=trim($_post['educationstart']); $seteducationarr['endtime']=trim(!empty($_post['educationendtime'])?$_post['educationendtime']:'未添加教育经历'); $seteducationarr['school']=trim($_post['educationschool']); $seteducationarr['speciality']=trim($_post['educationspeciality']); $educationstep4=locoyspider_jobs_education(trim($_post['educationstep4'])); $seteducationarr['education']=$educationstep4['id']; $seteducationarr['education_cn']=$educationstep4['cn']; if (!inserttable(table('resume_education'),$seteducationarr)){ exit(保存学历失败!); } unset($seteducationarr); //step5 //工作经验 $setworkarr['uid']=$uid; $setworkarr['pid']=$pid; $setworkarr['start']=trim($_post['workstart']); $setworkarr['endtime']=trim($_post['workendtime']); $setworkarr['companyname']=trim(!empty($_post['workcompanyname'])?$_post['workcompanyname']:'未添加工作经验'); $setworkarr['jobs']=trim($_post['workjobs']); $setworkarr['companyprofile']=trim($_post['workcompanyprofile']); $setworkarr['achievements']=trim($_post['workachievements']); if (!inserttable(table('resume_work'),$setworkarr)) { exit(保存工作经历失败); } unset($setworkarr); //step6 //培训经历 $settrainingarr['uid']=$uid; $settrainingarr['pid']=$pid; $settrainingarr['start']=trim($_post['trainingstart']); $settrainingarr['endtime']=trim($_post['trainingendtime']); $settrainingarr['agency']=trim(!empty($_post['trainingagency'])?$_post['trainingagency']:'未添加培训经历'); $settrainingarr['course']=trim($_post['trainingcourse']); $settrainingarr['description']=trim($_post['trainingdescription']); if (!inserttable(table('resume_training'),$settrainingarr)) { exit(保存培训经历失败!); } unset($settrainingarr); //step7 //头像照片 require_once(qishi_root_path.'include/upload.php'); global $db; $j=$db->getone(select * from .table('resume'). where id='{$pid}' and uid='{$uid}' limit 1); $searchtab['id']=$j['id']; $searchtab['uid']=$j['uid']; $searchtab['subsite_id']=$j['subsite_id']; $searchtab['sex']=$j['sex']; $searchtab['nature']=$j['nature']; $searchtab['marriage']=$j['marriage']; $searchtab['experience']=$j['experience']; $searchtab['district']=$j['district']; $searchtab['sdistrict']=$j['sdistrict']; $searchtab['wage']=$j['wage']; $searchtab['education']=$j['education']; $searchtab['photo']=$j['photo']; $searchtab['refreshtime']=$j['refreshtime']; $searchtab['talent']=$j['talent']; if(!inserttable(table('resume_search_rtime'),$searchtab)){ exit(resume_search_rtime 失败); } $searchtab['key']=$j['key']; if(!inserttable(table('resume_search_key'),$searchtab)){ exit(resume_search_key 失败); } unset($searchtab); $tag=explode('|',$j['tag']); $tagindex=1; $tagsql['tag1']=$tagsql['tag2']=$tagsql['tag3']=$tagsql['tag4']=$tagsql['tag5']=0; if (!empty($tag) && is_array($tag)) { foreach($tag as $v) { $vid=explode(',',$v); $tagsql['tag'.$tagindex]=intval($vid[0]); $tagindex++; } } $tagsql['id']=$j['id']; $tagsql['uid']=$j['uid']; $tagsql['subsite_id']=$j['subsite_id']; $tagsql['experience']=$j['experience']; $tagsql['district']=$j['district']; $tagsql['sdistrict']=$j['sdistrict']; $tagsql['education']=$j['education']; if(!inserttable(table('resume_search_tag'),$tagsql)){ exit(resume_search_tag 失败); } //更新完成度 check_resume($uid,$pid); exit(简历保存成功!);}
再方法中对于某些网站采集不到简历姓名的可直接传入某某两字。还有头像图片的一些都可以看下代码。
到此修改介绍。
关于修改好的文件和火车头采集规则请到我的资源里面找。文章不能上传文件
名字为 php骑士火车头简历采集接口和发布规则
http://download.csdn.net/detail/lihaiboas1/4401542