因此就自己写了个方法对应简历采集接口实现可查询。相关字段匹配等。和企业采集接口匹配基本一样。
支持图片采集。
图片采集到的文件目录需要自己对采集规则进行再修改。
现在对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($birthage<100){
$setsqlarr['birthdate']=intval(2012-$birthage);
}else{
$setsqlarr['birthdate']=intval($_POST['birthdate'])>1945?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骑士火车头简历采集接口和发布规则
资源压缩包里面有三个文件*.wpm是火车头数据采集平台免费版最新版本的发布模块
修改的2个php文件是基于官方的火车头数据处理文件。
locoyspider_li.php 放在admin/api 文件夹即可。
admin_locoyspider_fun.php 放在admin/include 替换前先最好备份。
一下是对有php基础的童鞋说明。可以用BCompare 软件比较对应原来的官方文件可看到修改了那些代码。
然后参考注释可以修改下自己对应字段的处理方式。。。。。。