ResumeRepository = $ResumeRepository;
$this->PersonalJobsApplyRepository = $PersonalJobsApplyRepository;
$this->ViewResumeRepository = $ViewResumeRepository;
$this->CompanyInterviewRepository = $CompanyInterviewRepository;
$this->CategoryRepository = $CategoryRepository;
$this->CategoryMajorRepository = $CategoryMajorRepository;
$this->CategoryDistrictRepository = $CategoryDistrictRepository;
$this->CategoryJobsRepository = $CategoryJobsRepository;
$this->TaskLogRepository = $TaskLogRepository;
$this->TaskService = $TaskService;
$this->ResumeEducationRepository = $ResumeEducationRepository;
$this->ResumeWorkRepository = $ResumeWorkRepository;
$this->ResumeTrainRepository = $ResumeTrainRepository;
$this->ResumeLanguageRepository = $ResumeLanguageRepository;
$this->ResumeCredentRepository = $ResumeCredentRepository;
$this->ResumeEntrustRepository = $ResumeEntrustRepository;
$this->CompanyDownResumeService = $CompanyDownResumeService;
$this->CompanyService = $CompanyService;
$this->companyFavoriteRepository = $companyFavoriteRepository;
$this->CategoryService = $CategoryService;
$this->jobsRepository = $jobsRepository;
$this->companyDownResumeRepository = $companyDownResumeRepository;
$this->viewJobRepository = $viewJobRepository;
$this->feedbackService = $feedbackService;
$this->memberInfoRepository = $memberInfoRepository;
$this->memberRepository = $memberRepository;
$this->memberSetmealRepository = $memberSetmealRepository;
$this->memberLogRepository = $memberLogRepository;
$this->personFocusComRepository = $personFocusComRepository;
$this->pmsRepository = $pmsRepository;
$this->registerService = $registerService;
$this->personTplRepository = $personTplRepository;
$this->tplRepository = $tplRepository;
$this->memberPointRepository = $memberPointRepository;
$this->paymentService = $paymentService;
$this->payService = $payService;
$this->taskRepository = $taskRepository;
$this->memberHandselRepository = $memberHandselRepository;
$this->smsService = $smsService;
$this->queueAutoRefreshRepository = $queueAutoRefreshRepository;
$this->emailService = $emailService;
}
public function loginValidate($user)
{
$member = $this->memberInfoRepository->getMemberInfo($user->id);
$resume = $this->ResumeRepository->getPersonInfo($user->id);
$resumeTitle = '简历' . date('Ymd');
if ($resume) {
$stick = PersonalServiceStickLog::where(['resume_id' => $resume->id, 'resume_uid' => $resume->uid])->first();
$intention_jobs_id = explode(',', $resume->intention_jobs_id);
$intenionArrTwo = [];
$intenionArrThree = [];
foreach ($intention_jobs_id as $key => $val) {
if (explode('.', $val)[2]) {
$intenionArrThree[] = explode('.', $val)[2];
} else {
$intenionArrTwo[] = explode('.', $val)[1];
}
}
//$recommend_jobs = $this->jobsRepository->recommendJobs($intenionArrTwo, $intenionArrThree, 1, getJobsStatus());
} else {
$stick = [];
$recommend_jobs = [];
}
return [
'resume' => $resume,
'stick' => $stick,
//'recommend_jobs'=>$recommend_jobs,
'resumeTitle' => $resumeTitle,
'member' => $member
];
}
public function popPms($user)
{
//获取当天
//当天开始时间
$start_time = strtotime(date("Y-m-d", time()));
//当天结束之间
$end_time = $start_time + 60 * 60 * 24;
$data[] = ['new', 1];
$data[] = ['msgtouid', $user->id];
$data[] = ['utype', $user->utype];
$data[] = ['msgtype', 2];
$data[] = ['msgfromuid', 0];
$data[] = ['msgfrom', 'admin'];
/*$data[] = ['started_at', '>=', $start_time];
$data[] = ['ended_at', '<', $end_time];*/
$data[] = ['started_at', '<=', $start_time];
$data[] = ['ended_at', '>=', $start_time];
return $this->pmsRepository->findFirstPms($data);
}
public function popPmsRead($id)
{
return $this->pmsRepository->updateNewById($id, ['new' => 2]);
}
/* public function ajax_get_interest_jobs($date)
{
$type = $date['type'];
$p = isset($date['p']) ? $date['p'] : 1;
$user = auth('web-member')->user();
if ($type=='recommend_jobs') {
$resume =$this->ResumeRepository->getPersonInfo($user->id);
if ($resume) {
$intention_jobs_id = explode(',', $resume->intention_jobs_id);
$intenionArrTwo = [];
$intenionArrThree = [];
foreach ($intention_jobs_id as $key => $val) {
if (explode('.', $val)[2]) {
$intenionArrThree[] = explode('.', $val)[2];
} else {
$intenionArrTwo[] = explode('.', $val)[1];
}
}
$recommend_jobs = $this->jobsRepository->recommendJobs($intenionArrTwo, $intenionArrThree, $p, getJobsStatus());
} else {
$recommend_jobs = (object)[];
}
return $recommend_jobs;
} elseif ($type=='nearby_jobs') {
$baidu_api_result = _get_baidumap_api();
$baidu_api_jsoninfo = json_decode($baidu_api_result, true);
if ($baidu_api_jsoninfo['status']==0) {
$lng = $baidu_api_jsoninfo['content']['point']['x'];
$lat = $baidu_api_jsoninfo['content']['point']['y'];
$squares = square_point($lng, $lat);
$lngArr = [];
$lngArr[] = $squares['lt']['lng'];
$lngArr[] = $squares['rb']['lng'];
$latArr = [];
$latArr[] = $squares['rb']['lat'];
$latArr[] = $squares['lt']['lat'];
$nearby_jobs = $this->jobsRepository->nearbyJobs($lngArr, $latArr, $p, getJobsStatus());
} else {
$nearby_jobs = (object)[];
}
return $nearby_jobs;
} else {
$newJobsArr = strtotime('-1 days');
$nearby_jobs = $this->jobsRepository->new_jobs($newJobsArr, $p, getJobsStatus());
return $nearby_jobs;
}
}*/
/**
* 我的简历
*/
public function myResume($user)
{
$uid = $user->id;
$resuem = $this->ResumeRepository->getAllResume($uid);
$resume_id = null;
foreach ($resuem as $key => $val) {
if ($val->def == 1) {
$resume_id = $val->id;
break;
}
}
if (!$resume_id) {
throw new ResponseException('抱歉,搜索不到简历!', '', 404);
}
$resumeArr = [];
$countResume = 0;
foreach ($resuem as $key => $val) {
$countResume++;
if ($val->level == 1) {
$level = '(优)';
} elseif ($val->level == 2) {
$level = '(良)';
} else {
$level = '(差)';
}
if (config('aix.personal_set.per_set.show_set.resume_display') == 2) {
if ($val->audit == 2) {
$audit = '审核通过';
$state = 'state';
$resumeStauts = true;
} elseif ($val->audit == 0) {
$state = 'state0';
$audit = '审核未通过';
$resumeStauts = false;
} else {
$audit = '审核通过';
$state = 'state';
$resumeStauts = true;
}
} else {
if ($val->audit == 2) {
$audit = '审核通过';
$state = 'state';
$resumeStauts = true;
} elseif ($val->audit == 0) {
$state = 'state0';
$audit = '审核未通过';
$resumeStauts = false;
} else {
$state = 'state1';
$audit = '审核中';
$resumeStauts = false;
}
}
$updated_at = date_format_new(strtotime($val->updated_at));
$updated_time = $updated_at ? $updated_at : '';
$expires = true;
if ($val->expires && $val->expires < time()) {
$expires = false;
}
if ($val->def == 1) {
$resumeArr['default']['id'] = $val->id;
$resumeArr['default']['lock'] = $val->display ? '' : 'close';
$resumeArr['default']['complete_percent'] = $val->complete_percent . "%";
$resumeArr['default']['level'] = $level;
$resumeArr['default']['expires'] = $expires;
$resumeArr['default']['audit'] = $audit;
$resumeArr['default']['updated_at'] = $updated_time;
$resumeArr['default']['title'] = $val->title;
$resumeArr['default']['state'] = $state;
$resumeArr['default']['resumeStauts'] = $resumeStauts;
$resumeArr['default']['display'] = $val->display;
$resumeArr['default']['tag'] = DB::table('personal_service_tag_logs')->where('resume_id', $val->id)->first();
$resumeArr['default']['stick'] = DB::table('personal_service_stick_logs')->where('resume_id', $val->id)->first();
$resumeArr['default']['viewResume'] = $this->ViewResumeRepository->getViewResume(explode(',', $val->id));
$resumeArr['default']['viewResumeDown'] = CompanyDownResume::whereHas('resumes')->where('resume_id', $val->id)->count();
if ($val->entrust) {
$resumeArr['default']['entrust'] = $val->entrust - time();
} else {
$resumeArr['default']['entrust'] = 0;
}
} else {
$resumeArr['noDefault'][$key]['id'] = $val->id;
$resumeArr['noDefault'][$key]['lock'] = $val->display ? '' : 'close';
$resumeArr['noDefault'][$key]['complete_percent'] = $val->complete_percent . "%";
$resumeArr['noDefault'][$key]['level'] = $level;
$resumeArr['noDefault'][$key]['expires'] = $expires;
$resumeArr['noDefault'][$key]['audit'] = $audit;
$resumeArr['noDefault'][$key]['updated_at'] = $updated_time;
$resumeArr['noDefault'][$key]['title'] = $val->title;
$resumeArr['noDefault'][$key]['state'] = $state;
$resumeArr['noDefault'][$key]['resumeStauts'] = $resumeStauts;
$resumeArr['noDefault'][$key]['display'] = $val->display;
$resumeArr['noDefault'][$key]['tag'] = DB::table('personal_service_tag_logs')->where('resume_id', $val->id)->first();
$resumeArr['noDefault'][$key]['stick'] = DB::table('personal_service_stick_logs')->where('resume_id', $val->id)->first();
$resumeArr['noDefault'][$key]['viewResume'] = $this->ViewResumeRepository->getViewResume(explode(',', $val->id));
$resumeArr['noDefault'][$key]['viewResumeDown'] = CompanyDownResume::whereHas('companys')->whereHas('resumes')->where('resume_id', $val->id)->count();
if ($val->entrust) {
$resumeArr['noDefault'][$key]['entrust'] = $val->entrust - time();
} else {
$resumeArr['noDefault'][$key]['entrust'] = 0;
}
}
}
$applyJobs = $this->PersonalJobsApplyRepository->getApplyJobsDef($resume_id, getJobsStatus());
$interview = $this->CompanyInterviewRepository->getInterviewDef($resume_id, getJobsStatus());
$viewResume = $this->ViewResumeRepository->getViewResume([$resume_id]);
return ['resume' => $resumeArr, 'countResume' => $countResume, 'applyJobs' => $applyJobs, 'interview' => $interview, 'viewResume' => $viewResume];
}
public function signIn($user)
{
$signCount = $this->TaskLogRepository->getTaskLogCount($user->id, 3, $user->utype);
if ($signCount) {
return ['code' => 0, 'info' => '您今天已经签到过了!'];
} else {
$res = $this->TaskService->doTask(3, $user->id, $user->utype);
if ($res['code'] == 1) {
$this->memberLogRepository->createLog($user, 8003, "");
return ['code' => 1, 'info' => $res['data']['points']];
} else {
return ['code' => 0, 'info' => $res['info']];
}
}
}
public function myAllResume($uid)
{
return $this->ResumeRepository->getAllResume($uid);
}
public function myResumeAjax($user)
{
$uid = $user->id;
return $this->ResumeRepository->getSuccessResume($uid, getResumeStatus());
}
public function getSuccessResumeCount($user)
{
$resumeCount = $this->ResumeRepository->getSuccessResumeCount($user->id, getResumeStatus());
$resumeList = $this->ResumeRepository->getSuccessResume($user->id, getResumeStatus());
if ($resumeCount == 0) {
return ['code' => 0, 'info' => '您没有审核通过的简历'];
} else {
return ['code' => 1, 'info' => $resumeList];
}
}
public function resumeCreate($date, $user)
{
if (empty($date['education'])) {
throw new ResponseException('最高学历不能为空!');
}
if (empty($date['experience'])) {
throw new ResponseException('工作经验不能为空!');
}
if (!vali_person_reg($date['card_t_cn'], $date['id_card'])) {
throw new ResponseException('证件号格式错误!');
}
if (isset($date['qq']) && !empty($date['qq'])) {
if (!preg_match('/^\d*$/', $date['qq'])) {
throw new ResponseException('qq号只能是数字!');
}
}
if (isset($date['weixin']) && !empty($date['weixin'])) {
if (preg_match('/[\x7f-\xff]/', $date['weixin'])) {
throw new ResponseException('微信号不能含有中文!');
}
}
if ($date['email']) {
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $date['email'])) {
throw new ResponseException('邮箱格式不正确!');
}
$member_vali = Member::where(['email' => $date['email']])->whereNotIn('id', [$user->id])->get()->toArray();
if (!empty($member_vali)) {
throw new ResponseException('邮箱格已被使用!');
}
}
$count = $this->ResumeRepository->getResumeCount($user->id);
if ($count >= config('aix.personal_set.per_set.per_set.resume_max')) {
throw new ResponseException('您最大可以创建' . config('aix.personal_set.per_set.per_set.resume_max') . '份简历', '', 400);
}
$member_info['uid'] = $user->id;
if (isset($date['display_name'])) {
$member_info['display_name'] = $date['display_name'];
}
$member_info['realname'] = $date['fullname'];
if ($date['sex'] == 1) {
$sex_cn = '男';
} else {
$sex_cn = '女';
}
$member_info['sex'] = $date['sex'];
$member_info['sex_cn'] = $sex_cn;
$member_info['birthday'] = $date['birthdate'];
$member_info['card_t_cn'] = 306;
$member_info['id_card'] = $date['id_card'];
$member_info['residence'] = $date['residence'];
$residenseArr = explode(',', $date['residence']);
$residenseArrId = [];
foreach ($residenseArr as $key => $val) {
$residenseArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
}
$residenseRes = $this->CategoryDistrictRepository->getManydistrict($residenseArrId);
$member_info['residence_cn'] = '';
foreach ($residenseRes as $key => $val) {
$nm = $this->CategoryDistrictRepository->getCategoryDistrict($val->parent_id);
$member_info['residence_cn'] .= $nm->name . '-' . $val->name . '+';
}
$member_info['residence_cn'] = rtrim($member_info['residence_cn'], '+');
$member_info['education'] = $date['education'];
$educationArr = $this->CategoryRepository->getCategory($date['education']);
$education_cn = $educationArr['demand'];
$member_info['education_cn'] = $education_cn;
if (isset($date['major']) && !empty($date['major'])) {
$majorArr = $this->CategoryMajorRepository->getCategoryMajor($date['major']);
$major_cn = $majorArr['name'];
$member_info['major'] = $date['major'];
$member_info['major_cn'] = $major_cn;
}
$member_info['experience'] = $date['experience'];
$experienceArr = $this->CategoryRepository->getCategory($date['experience']);
$experience_cn = $experienceArr['demand'];
$member_info['experience_cn'] = $experience_cn;
$member_info['phone'] = $date['telephone'];
$member_info['email'] = $date['email'] ? $date['email'] : '';
if (isset($date['height'])) {
$member_info['height'] = $date['height'];
}
if (isset($date['householdaddress'])) {
$member_info['householdaddress'] = $date['householdaddress'];
$member_info['householdaddress_cn'] = '';
if (!empty($date['householdaddress'])) {
$houseArr = explode(',', $date['householdaddress']);
$houseArrId = [];
foreach ($houseArr as $key => $val) {
$houseArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
}
$houseRes = $this->CategoryDistrictRepository->getManydistrict($houseArrId);
foreach ($houseRes as $key => $val) {
$nm = $this->CategoryDistrictRepository->getCategoryDistrict($val->parent_id);
$member_info['householdaddress_cn'] .= $nm->name . '-' . $val->name . '+';
}
$member_info['householdaddress_cn'] = rtrim($member_info['householdaddress_cn'], '+');
$resume_arr['householdaddress'] = $member_info['householdaddress_cn'];
$resumeArr['householdaddress'] = $member_info['householdaddress_cn'];
}
}
if (isset($date['techlevel']) && $date['techlevel']) {
$member_info['techlevel'] = $date['techlevel'];
$member_info['techlevel_cn'] = get_category($date['techlevel']);
}
if (isset($date['qq'])) {
$member_info['qq'] = $date['qq'];
$resumeArr['qq'] = $date['qq'];
$resume_arr['qq'] = $date['qq'];
}
if (isset($date['weixin'])) {
$member_info['weixin'] = $date['weixin'];
$resumeArr['weixin'] = $date['weixin'];
$resume_arr['weixin'] = $date['weixin'];
}
if (isset($date['marriage'])) {
if ($date['marriage'] == 1) {
$member_info['marriage'] = $date['marriage'];
$member_info['marriage_cn'] = '未婚';
} elseif ($date['marriage'] == 2) {
$member_info['marriage'] = $date['marriage'];
$member_info['marriage_cn'] = '已婚';
} else {
$member_info['marriage'] = $date['marriage'];
$member_info['marriage_cn'] = '保密';
}
}
if ($date['card_t_cn'] == 306) {
$card = strlen($date['id_card']) == 15 ? ('19' . substr($date['id_card'], 6, 2)) : substr($date['id_card'], 6, 4);
if ($member_info['birthday'] != $card) {
throw new ResponseException('出生年月和身份证不符合!');
}
}
$resume_arr['uid'] = $user->id;
if (isset($date['display_name'])) {
$resume_arr['display_name'] = $date['display_name'];
}
$resume_arr['title'] = isset($date['title']) ? $date['title'] : '简历' . date('Ymd');
$resume_arr['fullname'] = $date['fullname'];
$resume_arr['sex'] = $date['sex'];
$resume_arr['sex_cn'] = $sex_cn;
$resume_arr['nature'] = $date['nature'];
$natureArr = $this->CategoryRepository->getCategory($date['nature']);
$resume_arr['nature_cn'] = $natureArr['demand'];
$resume_arr['trade'] = $date['trade'];
// $resume_arr['techlevel'] = $date['techlevel'];
// $resume_arr['techlevel_cn'] = get_category($date['techlevel']);
$trade_cn = '';
if (!empty($date['trade'])) {
$tradeArr = $this->CategoryRepository->getManyCategory(explode(',', $date['trade']));
foreach ($tradeArr as $key => $val) {
$trade_cn .= $val->demand . '+';
}
$resume_arr['trade_cn'] = rtrim($trade_cn, '+');
}
$resume_arr['birthdate'] = $date['birthdate'];
$resume_arr['residence'] = $member_info['residence_cn'];
if (isset($date['height'])) {
$resume_arr['height'] = $date['height'];
}
if (isset($date['marriage'])) {
if ($date['marriage'] == 1) {
$resume_arr['marriage'] = $date['marriage'];
$resume_arr['marriage_cn'] = '未婚';
} elseif ($date['marriage'] == 2) {
$resume_arr['marriage'] = $date['marriage'];
$resume_arr['marriage_cn'] = '已婚';
} else {
$resume_arr['marriage'] = $date['marriage'];
$resume_arr['marriage_cn'] = '保密';
}
}
$resume_arr['experience'] = $date['experience'];
$resume_arr['experience_cn'] = $experience_cn;
$resume_arr['subsite_id'] = $user->subsite_id;
$resume_arr['district'] = $date['district'];
$resume_arr['expires'] = 0;
$expires = config('aix.personal_set.per_set.per_set.resume_expires');
if ($expires) {
$resume_arr['expires'] = strtotime("+{$expires} days");
}
$districtArr = explode(',', $date['district']);
$resumrArrId = [];
foreach ($districtArr as $key => $val) {
$resumrArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
}
$resumeRes = $this->CategoryDistrictRepository->getManydistrict($resumrArrId);
$resume_arr['district_cn'] = '';
foreach ($resumeRes as $key => $val) {
$resume_arr['district_cn'] .= $val->name . '+';
}
$resume_arr['district_cn'] = rtrim($resume_arr['district_cn'], '+');
if (intval($date['wage'])) {
$resume_arr['wage'] = $date['wage'];
$wageArr = $this->CategoryRepository->getCategory($date['wage']);
$resume_arr['wage_cn'] = $wageArr['demand'];
if ($date['wage'] == 61) {
$resume_arr['wage_min'] = 10000;
$resume_arr['wage_max'] = 0;
} else {
$resume_arr['wage_min'] = explode('~', format_wage($wageArr['demand']))[0];
$resume_arr['wage_max'] = explode('~', format_wage($wageArr['demand']))[1];
}
} else {
$resume_arr['wage'] = 0;
$resume_arr['wage_min'] = intval($date['wage_min']);
$resume_arr['wage_max'] = intval($date['wage_max']);
$resume_arr['wage_cn'] = intval($date['wage_min']) . '~' . intval($date['wage_max']) . '/月';
}
$resume_arr['education'] = $date['education'];
$resume_arr['education_cn'] = $education_cn;
if (isset($date['major']) && !empty($date['major'])) {
$majorArr = $this->CategoryMajorRepository->getCategoryMajor($date['major']);
$major_cn = $majorArr['name'];
$resume_arr['major'] = $date['major'];
$resume_arr['major_cn'] = $major_cn;
}
$resume_arr['telephone'] = $date['telephone'];
$resume_arr['email'] = $date['email'] ? $date['email'] : '';
$resume_arr['intention_jobs_id'] = $date['intention_jobs_id'];
$jobsArr = explode(',', $date['intention_jobs_id']);
$jobArrId = [];
foreach ($jobsArr as $key => $val) {
$jobArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
}
$jobsRes = $this->CategoryJobsRepository->getManyJobs($jobArrId);
$resume_arr['intention_jobs'] = '';
foreach ($jobsRes as $key => $val) {
$resume_arr['intention_jobs'] .= $val->name . '+';
}
$resume_arr['intention_jobs'] = rtrim($resume_arr['intention_jobs'], '+');
$resume_arr['current'] = $date['current'];
$currentArr = $this->CategoryRepository->getCategory($date['current']);
$resume_arr['current_cn'] = $currentArr['demand'];
$memberInfo = $this->memberInfoRepository->findMemberInfo(['uid' => $user->id]);
if (!isset($date['resume_id']) || empty($date['resume_id'])) { //一体机。
$resume_arr['complete_percent'] = 35;
$resume_arr['level'] = 0;
$personInfo = $this->ResumeRepository->getPersonInfo($user->id);
$personInfo ? $resume_arr['def'] = 0 : $resume_arr['def'] = 1;
if ($memberInfo) {
if ($memberInfo->images) {
$resume_arr['complete_percent'] = 40;
}
}
}
$memData = [];
$member = $this->memberRepository->getMemberById($user->id);
if (!$member->mobile_audit) {
$memData['mobile'] = $date['telephone'];
}
if (!$member->email_audit) {
$memData['email'] = $date['email'] ? $date['email'] : '';
}
$getResume = $this->ResumeRepository->getResumes(['uid' => $user->id]);
$this->TaskService->doTask(1);
$this->TaskService->doTask(2);
DB::beginTransaction();//检查数据库事务
try {
if ($memData) {
$this->memberRepository->updateInfo($user->id, $memData);
}
$memberInfo ? $this->memberInfoRepository->updateInfo($member_info, $user->id) : $this->memberInfoRepository->createInfo($member_info);
if (!$getResume->isEmpty()) {
$resume_id = array_column($getResume->toArray(), 'id');
if (isset($date['display_name'])) {
$resumeArr['display_name'] = $date['display_name'];
}
$resumeArr['fullname'] = $date['fullname'];
$resumeArr['sex'] = $date['sex'];
$resumeArr['sex_cn'] = $sex_cn;
$resumeArr['birthdate'] = $date['birthdate'];
$resumeArr['residence'] = $member_info['residence_cn'];
if (isset($date['height'])) {
$resumeArr['height'] = $date['height'];
}
if (isset($date['marriage'])) {
if ($date['marriage'] == 1) {
$resumeArr['marriage'] = $date['marriage'];
$resumeArr['marriage_cn'] = '未婚';
} elseif ($date['marriage'] == 2) {
$resumeArr['marriage'] = $date['marriage'];
$resumeArr['marriage_cn'] = '已婚';
} else {
$resumeArr['marriage'] = $date['marriage'];
$resumeArr['marriage_cn'] = '保密';
}
}
$resumeArr['experience'] = $date['experience'];
$resumeArr['experience_cn'] = $member_info['experience_cn'];
$resumeArr['education'] = $date['education'];
$resumeArr['education_cn'] = $education_cn;
if (isset($date['major']) && !empty($date['major'])) {
$majorArr = $this->CategoryMajorRepository->getCategoryMajor($date['major']);
$major_cn = $majorArr['name'];
$resumeArr['major'] = $date['major'];
$resumeArr['major_cn'] = $major_cn;
}
$resumeArr['telephone'] = $date['telephone'];
$resumeArr['email'] = $date['email'] ? $date['email'] : '';
$resumeArr['idcard'] = $date['id_card'];
$this->ResumeRepository->updateAllResume($resume_id, $resumeArr);
}
if (isset($date['resume_id']) && !empty($date['resume_id'])) {
$this->ResumeRepository->updateById($resume_arr, $date['resume_id']);
$result = (object)[];
$result->id = $date['resume_id'];
} else {
$result = $this->ResumeRepository->resumeAdd($resume_arr);
//通过学历判断人才类别前置操作
$this->edu_mate($resume_arr['education'], $user->id);
}
$subsiteDefault = [
[
'subsite_id' => $user->subsite_id,
'resume_id' => $result->id,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]
];
$subsiteArr = [];
if (isset($date['subsite']) && $date['subsite'] !== null) {
$subsite = explode(',', $date['subsite']);
foreach ($subsite as $key => $val) {
$subsiteArr[$key]['subsite_id'] = $val;
$subsiteArr[$key]['resume_id'] = $result->id;
$subsiteArr[$key]['created_at'] = date('Y-m-d H:i:s');
$subsiteArr[$key]['updated_at'] = date('Y-m-d H:i:s');
}
if (in_array($user->subsite_id, $subsite)) {
$subsiteDefault = $subsiteArr;
} else {
$subsiteDefault = array_merge($subsiteDefault, $subsiteArr);
}
}
SubsiteResume::insert($subsiteDefault);
event_search_update(Resume::class, (string)$result->id, 'update');
DB::commit();
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2010, $result->id)) {
throw new \Exception("日志记失败!");
}
return ['code' => 1, 'info' => $result->id];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage()];
}
}
/**
* 通过学历进行人才匹配前置方法
*/
public function edu_mate($edu, $uid)
{
$edu_cn = Category::where('id', $edu)->value('demand');
if ($edu_cn) {
$where['name'] = $edu_cn;
$p = PersonalCategory::where($where)->first();
//学历信息
$this->antic_personnel($uid, $p);
}
}
/**
* 最大人才类型预判断
* 人才分类id,指当前被提交组里面的五类人才集合
* 此功能是要指出最大的人才
*/
public function antic_personnel($uid, $p = null)
{
//结合ResumeAuthInfo表与PersonalCategory表多表联查,找出当前简历的大分类
$where['resume_auth_info.uid'] = $uid;
//只取最高级别的人才等级排序id
$p_id = ResumeAuthInfo::where($where)->leftJoin('personal_category', 'resume_auth_info.duties', '=', 'personal_category.id')->orderBy('personal_category.rc_order','desc')->first();
#获取福建最高级别的人才等级id
$fj_where = array('resume_auth_info.uid' => $uid, 'categorys.alias' => "RC_category_fj");
$fj_info = ResumeAuthInfo::where($fj_where)->leftJoin('personal_category', 'resume_auth_info.duties', '=', 'personal_category.id')
//->join(C('DB_PREFIX').'personal_category c on c.c_id = pc.rc_category_fj_id and c.c_alias = "RC_category_fj"','left')
->leftJoin('categorys', 'categorys.id', '=', 'personal_category.rc_category_fj_id')
->select('personal_category.rc_category_fj_id','personal_category.rc_category_fj','personal_category.rc_order')
->orderBy('categorys.order','desc')
->first();
//获取泉州最高级别的人才等级id
$qz_where = array('resume_auth_info.uid' => $uid, 'categorys.alias' => "RC_category_qz");
$qz_info = ResumeAuthInfo::where($fj_where)->leftJoin('personal_category', 'resume_auth_info.duties', '=', 'personal_category.id')
->leftJoin('categorys', 'categorys.id', '=', 'personal_category.rc_category_qz_id')
->select('personal_category.rc_category_qz_id','personal_category.rc_category_qz','personal_category.rc_order')
->where($qz_where)
->orderBy('categorys.order','desc')
->first();
//一共提交多少数据
$count = ResumeAuthInfo::where(array('uid' => $uid))->count();
//获取当前人才类别
if ($p == null || $p == '' || empty($p)) {
//找简历表的学历中文
$infor = Resume::where(array("uid" => $uid, 'def' => 1))->first();
if (!empty($infor->education_cn)) {
$wheres['name'] = $infor->education_cn;
$p = PersonalCategory::where($wheres)->first();
}
}
if ($p_id && $p) {
//如果荣誉..和学历都提交满足等级
if ($p_id->rc_order >= $p->rc_order) {
//新提交过来的等级判定信息
$level_info = $p_id;
} else {
$level_info = $p;
}
$count += 1;
} elseif ($p_id && !$p) {
//如果只有荣誉..满足人才等级,学历不满足等级
$level_info = $p_id;
} elseif (!$p_id && $p) {
//如果荣誉..不满足人才等级,学历满足等级
$level_info = $p;
$count += 1;
} else {
//如果荣誉..和学历都不满足人才等级
$level_info = [];
}
//判断福建人才类别信息
if ($fj_info && $p) {
//如果荣誉..和学历都提交满足等级
if ($fj_info['rc_order'] >= $p->rc_order) {
$level_info['rc_fj_level'] = $fj_info->rc_category_fj;
$level_info['rc_fj_level_id'] = $fj_info->rc_category_fj_id;
} else {
$level_info['rc_fj_level'] = $p->rc_category_fj;
$level_info['rc_fj_level_id'] = $p->rc_category_fj_id;
}
} else if ($fj_info && !$p) {
//如果只有荣誉..满足人才等级,学历不满足等级
$level_info['rc_fj_level'] = $fj_info->rc_category_fj;
$level_info['rc_fj_level_id'] = $fj_info->rc_category_fj_id;
} else if (!$fj_info && $p) {
//如果荣誉..不满足人才等级,学历满足等级
$level_info['rc_fj_level'] = $p->rc_category_fj;
$level_info['rc_fj_level_id'] = $p->rc_category_fj_id;
}
//判断泉州人才类别信息
if ($qz_info && $p) {
//如果荣誉..和学历都提交满足等级
if ($qz_info['rc_order'] >= $p->rc_order) {
$level_info['rc_qz_level'] = $qz_info->rc_category_qz;
$level_info['rc_qz_level_id'] = $qz_info->rc_category_qz_id;
} else {
$level_info['rc_qz_level'] = $p->rc_category_qz;
$level_info['rc_qz_level_id'] = $p->rc_category_qz_id;
}
} else if ($qz_info && !$p) {
//如果只有荣誉..满足人才等级,学历不满足等级
$level_info['rc_qz_level'] = $qz_info->rc_category_qz;
$level_info['rc_qz_level_id'] = $qz_info->rc_category_qz_id;
} else if (!$qz_info && $p) {
//如果荣誉..不满足人才等级,学历满足等级
$level_info['rc_qz_level'] = $p->rc_category_qz;
$level_info['rc_qz_level_id'] = $p->rc_category_qz_id;
}
//会员名
$username = Resume::where(array("uid" => $uid, 'def' => 1))->value('fullname');
//身份证号
$idcode = MemberInfo::where(array("uid" => $uid))->value("id_card");
//判断人才等级表有没有这个人员记录
$result = PersonalTalents::where(array("uid" => $uid))->first();
if (!empty($level_info)) {
$data['uid'] = $uid;
$data['rc_username'] = $username;
$data['rc_idcode'] = $idcode;
$data['rc_level'] = $level_info['rc_category'];
$data['rc_level_id'] = $level_info['rc_category_id'];
$data['rc_fj_level'] = $level_info['rc_fj_level'];
$data['rc_fj_level_id'] = $level_info['rc_fj_level_id'];
$data['rc_qz_level'] = $level_info['rc_qz_level'];
$data['rc_qz_level_id'] = $level_info['rc_qz_level_id'];
$data['rc_sort'] = $level_info['rc_order'];
$data['rc_audit'] = 2;
$data['rc_where'] = 1;
$data['rc_num'] = $count;
$data['ifconform'] = 1;
$data['personal_category_id'] = $level_info['id'];
if ($result) {
PersonalTalents::where(array("uid" => $uid))->update($data);
if ($data['rc_sort'] != $result->rc_sort) {
$info['talents_id'] = $result->id;
$info['log_class'] = 1;//日志类型会员个人更新
$info['content'] = $username . "更新人才资料,预判人才等级由‘" . $result->rc_level . "’转为‘" . $data['rc_level'] . "’,待重新审核";
$info['log_time'] = time();
$info['auth_man'] = $username;
PersonalTalentsLog::create($info);
}
} else {
$data['addtime'] = time();
$res = PersonalTalents::create($data);
$info['talents_id'] = $res->id;
$info['log_class'] = 1;//日志类型会员个人更新
$info['content'] = $username . "提交人才资料,预判人才等级为‘" . $data['rc_level'] . "’,待审核";
$info['log_time'] = time();
$info['auth_man'] = $username;
PersonalTalentsLog::create($info);
}
return true;
} else {
$data['uid'] = $uid;
$data['rc_username'] = $username;
$data['rc_idcode'] = $idcode;
$data['rc_level'] = '不符合人才标准';
$data['rc_level_id'] = 0;
$data['rc_sort'] = 0;
$data['rc_audit'] = 2;
$data['rc_where'] = 1;
$data['rc_num'] = 0;
$data['ifconform'] = 2;
$data['personal_category_id'] = 0;
if ($result) {
PersonalTalents::where(array("uid" => $uid))->update($data);
$info['talents_id'] = $result->id;
$info['log_class'] = 1;//日志类型会员个人更新
$info['content'] = $username . "更新人才资料,预判人才等级由‘" . $result->rc_level . "’转为‘不符合人才等级’,待重新审核";
$info['log_time'] = time();
$info['auth_man'] = $username;
PersonalTalentsLog::create($info);
}
return true;
}
}
public function getResumeById($id, $user)
{
$resume = $this->ResumeRepository->getResume($id);
$memberInfo = DB::table('member_infos')->where('uid', $user->id)->first();
$imgs = ResumeImg::where(['uid' => $user->id, 'resume_id' => $id])->get();
$resume->district_keep = isset($resume->district) ? $resume->district : '';
return ['resume' => $resume, 'imgs' => $imgs, 'member' => $memberInfo];
}
public function updateTitle($title, $id, $user)
{
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($id, $array_id)) {
throw new ResponseException('简历不存在!');
}
$data['title'] = $title;
$data['audit'] = 1;
$expires = config('aix.personal_set.per_set.per_set.resume_expires');
if ($expires) {
$data['expires'] = strtotime("+{$expires} days");
}
event_search_update(Resume::class, (string)$id, 'update');
return $this->ResumeRepository->updateById($data, $id);
}
public function updateHunting($date, $user)
{
$currentArr = $this->CategoryRepository->getCategory($date['current']);
$date['current_cn'] = $currentArr['demand'];
$natureArr = $this->CategoryRepository->getCategory($date['nature']);
$date['nature_cn'] = $natureArr['demand'];
if (intval($date['wage'])) {
$wageArr = $this->CategoryRepository->getCategory($date['wage']);
$date['wage_cn'] = $wageArr['demand'];
if ($date['wage'] == 61) {
$date['wage_min'] = 10000;
$date['wage_max'] = 0;
} else {
$date['wage_min'] = explode('~', format_wage($wageArr['demand']))[0];
$date['wage_max'] = explode('~', format_wage($wageArr['demand']))[1];
}
} else {
$date['wage'] = 0;
$date['wage_min'] = intval($date['wage_min']);
$date['wage_max'] = intval($date['wage_max']);
$date['wage_cn'] = intval($date['wage_min']) . '~' . intval($date['wage_max']) . '/月';
}
if (!empty($date['trade'])) {
$tradeArr = $this->CategoryRepository->getManyCategory(explode(',', $date['trade']));
$date['trade_cn'] = '';
foreach ($tradeArr as $key => $val) {
$date['trade_cn'] .= $val->demand . '+';
}
$date['trade_cn'] = rtrim($date['trade_cn'], '+');
}
if (!empty($date['techlevel'])) {
$date['techlevel_cn'] = get_category($date['techlevel']);
}
$jobsArr = explode(',', $date['intention_jobs_id']);
$jobArrId = [];
foreach ($jobsArr as $key => $val) {
$jobArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
}
$jobsRes = $this->CategoryJobsRepository->getManyJobs($jobArrId);
$date['intention_jobs'] = '';
foreach ($jobsRes as $key => $val) {
$date['intention_jobs'] .= $val->name . '+';
}
$date['intention_jobs'] = rtrim($date['intention_jobs'], '+');
$districtArr = explode(',', $date['district']);
$resumrArrId = [];
foreach ($districtArr as $key => $val) {
$resumrArrId[] = explode('.', $val)[2] ? explode('.', $val)[2] : explode('.', $val)[1];
}
$resumeRes = $this->CategoryDistrictRepository->getManydistrict($resumrArrId);
$date['district_cn'] = '';
foreach ($resumeRes as $key => $val) {
$date['district_cn'] .= $val->name . '+';
}
$date['district_cn'] = rtrim($date['district_cn'], '+');
$date['audit'] = 1;
$expires = config('aix.personal_set.per_set.per_set.resume_expires');
if ($expires) {
$date['expires'] = strtotime("+{$expires} days");
}
if (array_has($date, 'subsite_id')) {
$subsite_id = $date['subsite_id'];
unset($date['subsite_id']);
$subsiteArr = SubsiteResume::where('resume_id', $date['id'])->get();
if (!$subsiteArr->isEmpty()) {
SubsiteResume::where('resume_id', $date['id'])->delete();
}
$subsiteDefault = [
[
'subsite_id' => $user->subsite_id,
'resume_id' => $date['id'],
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]
];
$subsiteArr = [];
if ($subsite_id !== null) {
$subsite = explode(',', $subsite_id);
foreach ($subsite as $key => $val) {
$subsiteArr[$key]['subsite_id'] = $val;
$subsiteArr[$key]['resume_id'] = $date['id'];
$subsiteArr[$key]['created_at'] = date('Y-m-d H:i:s');
$subsiteArr[$key]['updated_at'] = date('Y-m-d H:i:s');
}
if (in_array($user->subsite_id, $subsite)) {
$subsiteDefault = $subsiteArr;
} else {
$subsiteDefault = array_merge($subsiteDefault, $subsiteArr);
}
}
SubsiteResume::insert($subsiteDefault);
}
event_search_update(Resume::class, (string)$date['id'], 'update');
return $this->ResumeRepository->updateById($date, $date['id']);
}
public function updateSpecialty($data, $user)
{
if (!$data['specialty']) {
throw new ResponseException('请填写自我描述!');
}
$resume_id = array_get($data, 'id');
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($resume_id, $array_id)) {
throw new ResponseException('简历不存在!');
}
$res = $this->ResumeRepository->getResumeById($data['id']);
DB::beginTransaction();//检查数据库事务
try {
if (!$res->specialty) {
if ($res->complete_percent + 5 <= 100) {
if ($res->complete_percent + 5 >= 70 && $res->complete_percent + 5 < 90) {
$this->TaskService->doTask(12);
$data['complete_percent'] = $res->complete_percent + 5;
$data['level'] = 2;
} elseif ($res->complete_percent + 5 >= 90 && $res->complete_percent + 5 <= 100) {
$this->TaskService->doTask(11);
$data['complete_percent'] = $res->complete_percent + 5;
$data['level'] = 1;
} else {
$data['complete_percent'] = $res->complete_percent + 5;
$data['level'] = 0;
}
}
}
$data['audit'] = 1;
$expires = config('aix.personal_set.per_set.per_set.resume_expires');
if ($expires) {
$data['expires'] = strtotime("+{$expires} days");
}
event_search_update(Resume::class, (string)$data['id'], 'update');
$result = $this->ResumeRepository->updateById($data, $data['id']);
DB::commit();
return ['code' => 1, 'info' => $result];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage()];
}
}
public function tagSave($data)
{
$resume_id = $data['resume_id'];
$tag = implode(',', $data['tag']);
$tag_cn = implode(',', $data['tag_cn']);
$resume = $this->ResumeRepository->getResumeById($resume_id);
DB::beginTransaction();//检查数据库事务
try {
$das['audit'] = 1;
$expires = config('aix.personal_set.per_set.per_set.resume_expires');
if ($expires) {
$das['expires'] = strtotime("+{$expires} days");
}
$this->ResumeRepository->updateById($das, $resume_id);
if (empty($resume->tag_cn)) {
if ($resume->complete_percent + 5 <= 100) {
if ($resume->complete_percent + 5 >= 70 && $resume->complete_percent + 5 < 90) {
$this->TaskService->doTask(12);
$result = $this->ResumeRepository->updateById([
'complete_percent' => $resume->complete_percent + 5,
'level' => 2,
'tag' => $tag,
'tag_cn' => $tag_cn,
], $resume_id);
} elseif ($resume->complete_percent + 5 >= 90 && $resume->complete_percent + 5 <= 100) {
$this->TaskService->doTask(11);
$result = $this->ResumeRepository->updateById([
'complete_percent' => $resume->complete_percent + 5,
'level' => 1,
'tag' => $tag,
'tag_cn' => $tag_cn,
], $resume_id);
} else {
$result = $this->ResumeRepository->updateById([
'complete_percent' => $resume->complete_percent + 5,
'level' => 0,
'tag' => $tag,
'tag_cn' => $tag_cn,
], $resume_id);
}
}
} else {
$result = $this->ResumeRepository->updateById(['tag' => $tag, 'tag_cn' => $tag_cn], $resume_id);
}
event_search_update(Resume::class, (string)$resume_id, 'update');
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2028, $resume_id)) {
throw new \Exception("日志记失败!");
}
DB::commit();
return ['code' => 1, 'info' => $result];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage()];
}
}
public function tagDelete($resume_id, $tag_cn, $user)
{
if (!$resume_id || !$tag_cn) {
throw new ResponseException('简历标签或简历不存在!');
}
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($resume_id, $array_id)) {
throw new ResponseException('简历不存在!');
}
DB::beginTransaction();//检查数据库事务
try {
$resume = $this->ResumeRepository->find($resume_id);
$resume_tag = isset($resume->tag) ? explode(',', $resume->tag) : [];
$resume_tag_cn = isset($resume->tag_cn) ? explode(',', $resume->tag_cn) : [];
foreach ($resume_tag_cn as $key => $val) {
if ($tag_cn == $val) {
unset($resume_tag_cn[$key]);
unset($resume_tag[$key]);
}
}
$res = $this->ResumeRepository->updateById(
['tag' => implode(',', $resume_tag), 'tag_cn' => implode(',', $resume_tag_cn)], $resume_id);
DB::commit();
return ['code' => 1, 'info' => $res];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage()];
}
}
public function resumeCopy($id, $user)
{
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($id, $array_id)) {
throw new ResponseException('简历不存在');
}
$resume_arr = []; //简历。
$res = $this->ResumeRepository->getArrayById($id);
$resume_arr['uid'] = $res['uid'];
$resume_arr['display_name'] = $res['display_name'];
$resume_arr['title'] = $res['title'];
$resume_arr['fullname'] = $res['fullname'];
$resume_arr['sex'] = $res['sex'];
$resume_arr['sex_cn'] = $res['sex_cn'];
$resume_arr['nature'] = $res['nature'];
$resume_arr['nature_cn'] = $res['nature_cn'];
$resume_arr['trade'] = $res['trade'];
$resume_arr['trade_cn'] = $res['trade_cn'];
$resume_arr['birthdate'] = $res['birthdate'];
$resume_arr['residence'] = $res['residence'];
$resume_arr['height'] = $res['height'];
$resume_arr['marriage'] = $res['marriage'];
$resume_arr['marriage_cn'] = $res['marriage_cn'];
$resume_arr['experience'] = $res['experience'];
$resume_arr['experience_cn'] = $res['experience_cn'];
$resume_arr['district'] = $res['district'];
$resume_arr['district_cn'] = $res['district_cn'];
$resume_arr['wage'] = $res['wage'];
$resume_arr['wage_cn'] = $res['wage_cn'];
$resume_arr['wage_min'] = $res['wage_min'];
$resume_arr['wage_max'] = $res['wage_max'];
$resume_arr['householdaddress'] = $res['householdaddress'];
$resume_arr['education'] = $res['education'];
$resume_arr['education_cn'] = $res['education_cn'];
$resume_arr['major'] = $res['major'];
$resume_arr['major_cn'] = $res['major_cn'];
$resume_arr['tag'] = $res['tag'];
$resume_arr['tag_cn'] = $res['tag_cn'];
$resume_arr['telephone'] = $res['telephone'];
$resume_arr['email'] = $res['email'];
$resume_arr['intention_jobs_id'] = $res['intention_jobs_id'];
$resume_arr['intention_jobs'] = $res['intention_jobs'];
$resume_arr['specialty'] = $res['specialty'];
$resume_arr['photo'] = $res['photo'];
$resume_arr['photo_audit'] = $res['photo_audit'];
$resume_arr['qq'] = $res['qq'];
$resume_arr['weixin'] = $res['weixin'];
$resume_arr['subsite_id'] = $res['subsite_id'];
$resume_arr['level'] = $res['level'];
$resume_arr['complete_percent'] = $res['complete_percent'];
$resume_arr['current'] = $res['current'];
$resume_arr['current_cn'] = $res['current_cn'];
$resume_arr['word_resume'] = $res['word_resume'];
$resume_arr['word_resume_title'] = $res['word_resume_title'];
$resume_arr['word_resume_addtime'] = $res['word_resume_addtime'];
$resume_arr['tpl'] = $res['tpl'];
$resume_arr['def'] = 0;
$resume_arr['is_quick'] = 1;
$Education = $this->ResumeEducationRepository->getEduByResumeU($id, $user->id);
$Education_arr = []; //教育。
$Work = $this->ResumeWorkRepository->getWorkByU($id, $user->id);
$Work_arr = []; //工作
$Train = $this->ResumeTrainRepository->getTrainByU($id, $user->id);
$Train_arr = []; //培训。
$Credent = $this->ResumeCredentRepository->getCredentByU($id, $user->id);
$Credent_arr = []; //证书。
$Language = $this->ResumeLanguageRepository->getCredentByU($id, $user->id);
$Language_arr = []; //语言。
$Imgs = DB::table('resume_imgs')->where(['resume_id' => $id, 'uid' => $user->id])->get();
$Imgs_arr = []; //照片。
$sub_resume_arr = []; //简历分站。
$subsiteResume = SubsiteResume::where('resume_id', $id)->get();
DB::beginTransaction();//检查数据库事务
try {
$resume_add = $this->ResumeRepository->resumeAdd($resume_arr);
$resume_id = $resume_add->id;
if (!$Education->isEmpty()) {
foreach ($Education as $key => $val) {
$Education_arr[$key]['uid'] = $val->uid;
$Education_arr[$key]['resume_id'] = $resume_id;
$Education_arr[$key]['startyear'] = $val->startyear;
$Education_arr[$key]['startmonth'] = $val->startmonth;
$Education_arr[$key]['endyear'] = $val->endyear;
$Education_arr[$key]['endmonth'] = $val->endmonth;
$Education_arr[$key]['school'] = $val->school;
$Education_arr[$key]['speciality'] = $val->speciality;
$Education_arr[$key]['education'] = $val->education;
$Education_arr[$key]['education_cn'] = $val->education_cn;
$Education_arr[$key]['todate'] = $val->todate;
$Education_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
$Education_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
}
}
if (!empty($Education_arr)) {
$this->ResumeEducationRepository->addInsert($Education_arr);
}
if (!$Work->isEmpty()) {
foreach ($Work as $key => $val) {
$Work_arr[$key]['uid'] = $val->uid;
$Work_arr[$key]['resume_id'] = $resume_id;
$Work_arr[$key]['startyear'] = $val->startyear;
$Work_arr[$key]['startmonth'] = $val->startmonth;
$Work_arr[$key]['endyear'] = $val->endyear;
$Work_arr[$key]['endmonth'] = $val->endmonth;
$Work_arr[$key]['companyname'] = $val->companyname;
$Work_arr[$key]['jobs'] = $val->jobs;
$Work_arr[$key]['achievements'] = $val->achievements;
$Work_arr[$key]['todate'] = $val->todate;
$Work_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
$Work_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
}
}
if (!empty($Work_arr)) {
$this->ResumeWorkRepository->addInsert($Work_arr);
}
if (!$Train->isEmpty()) {
foreach ($Train as $key => $val) {
$Train_arr[$key]['uid'] = $val->uid;
$Train_arr[$key]['resume_id'] = $resume_id;
$Train_arr[$key]['startyear'] = $val->startyear;
$Train_arr[$key]['startmonth'] = $val->startmonth;
$Train_arr[$key]['endyear'] = $val->endyear;
$Train_arr[$key]['endmonth'] = $val->endmonth;
$Train_arr[$key]['agency'] = $val->agency;
$Train_arr[$key]['course'] = $val->course;
$Train_arr[$key]['description'] = $val->description;
$Train_arr[$key]['todate'] = $val->todate;
$Train_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
$Train_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
}
}
if (!empty($Train_arr)) {
$this->ResumeTrainRepository->addInsert($Train_arr);
}
if (!$Credent->isEmpty()) {
foreach ($Credent as $key => $val) {
$Credent_arr[$key]['uid'] = $val->uid;
$Credent_arr[$key]['resume_id'] = $resume_id;
$Credent_arr[$key]['name'] = $val->name;
$Credent_arr[$key]['year'] = $val->year;
$Credent_arr[$key]['month'] = $val->month;
$Credent_arr[$key]['images'] = $val->images;
$Credent_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
$Credent_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
}
}
if (!empty($Credent_arr)) {
$this->ResumeCredentRepository->addInsert($Credent_arr);
}
if (!$Language->isEmpty()) {
foreach ($Language as $key => $val) {
$Language_arr[$key]['uid'] = $val->uid;
$Language_arr[$key]['resume_id'] = $resume_id;
$Language_arr[$key]['language'] = $val->language;
$Language_arr[$key]['language_cn'] = $val->language_cn;
$Language_arr[$key]['level'] = $val->level;
$Language_arr[$key]['level_cn'] = $val->level_cn;
$Language_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
$Language_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
}
}
if (!empty($Language_arr)) {
$this->ResumeLanguageRepository->resumeLanAdd($Language_arr);
}
if (!$Imgs->isEmpty()) {
foreach ($Imgs as $key => $val) {
$Imgs_arr[$key]['uid'] = $val->uid;
$Imgs_arr[$key]['resume_id'] = $resume_id;
$Imgs_arr[$key]['img'] = $val->img;
$Imgs_arr[$key]['title'] = $val->title;
$Imgs_arr[$key]['audit'] = $val->audit;
$Imgs_arr[$key]['subsite_id'] = $val->subsite_id;
$Imgs_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
$Imgs_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
}
}
if (!empty($Imgs_arr)) {
DB::table('resume_imgs')->insert($Imgs_arr);
}
if ($subsiteResume->isNotEmpty()) {
foreach ($subsiteResume as $key => $val) {
$sub_resume_arr[$key]['subsite_id'] = $val->subsite_id;
$sub_resume_arr[$key]['resume_id'] = $resume_id;
$sub_resume_arr[$key]['created_at'] = date('Y-m-d H:i:s', time());
$sub_resume_arr[$key]['updated_at'] = date('Y-m-d H:i:s', time());
}
}
if (!empty($sub_resume_arr)) {
SubsiteResume::insert($sub_resume_arr);
}
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2011, [$id, $resume_id])) {
throw new \Exception("日志记失败!");
}
DB::commit();
return ['code' => 1, 'info' => $resume_id];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage()];
}
}
public function saveBasicInfo($data, $user)
{
$resume_id = array_get($data, 'resume_id');
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($resume_id, $array_id)) {
throw new ResponseException('简历不存在');
}
$arr = $data;
unset($arr['resume_id']);
if (isset($data['marriage'])) {
if ($data['marriage'] == 1) {
$arr['marriage_cn'] = '未婚';
} elseif ($data['marriage'] == 2) {
$arr['marriage_cn'] = '已婚';
} else {
$arr['marriage_cn'] = '保密';
}
}
if (isset($data['sex'])) {
if ($data['sex'] == 1) {
$arr['sex_cn'] = '男';
} else {
$arr['sex_cn'] = '女';
}
}
if (isset($data['major'])) {
$currentArr = $this->CategoryMajorRepository->getCategoryMajor($data['major']);
$arr['major_cn'] = $currentArr['name'];
}
if (isset($data['education'])) {
$educationArr = $this->CategoryRepository->getCategory($data['education']);
$arr['education_cn'] = $educationArr['demand'];
}
if (isset($data['experience'])) {
$experienceArr = $this->CategoryRepository->getCategory($data['experience']);
$arr['experience_cn'] = $experienceArr['demand'];
}
$arr['audit'] = 1;
return $this->ResumeRepository->updateById($arr, $data['resume_id']);
}
public function refreshResume($id, $user)
{
$res_k = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res_k, 'id');
if (!in_array($id, $array_id)) {
throw new ResponseException('简历不存在');
}
$res = $this->ResumeRepository->getArrayById($id);
$resume_display = config('aix.personal_set.per_set.show_set.resume_display');
if ($resume_display != 2) {
if ($res['audit'] != 2) {
return ['code' => 0, 'info' => '审核中或审核未通过的简历无法刷新!'];
}
} else {
if ($res['audit'] == 0) {
return ['code' => 0, 'info' => '审核未通过的简历无法刷新!'];
}
}
if ($res['display'] != 1) {
return ['code' => 0, 'info' => '简历已关闭,无法刷新!'];
}
$timeSpace = config('aix.personal_set.per_set.per_set.refresh_resume_space') * 60;
$duringtime = time() - strtotime($res['updated_at']);
if ($duringtime <= $timeSpace && $timeSpace != 0) {
return ['code' => 0, 'info' => config('aix.personal_set.per_set.per_set.refresh_resume_space') . '分钟内不允许重复刷新简历!'];
}
$resNum = config('aix.personal_set.per_set.per_set.refresh_resume_num');
$startTime = time();
$endTime = strtotime(date('Y-m-d 23:59:59', time()));
if (Cache::has($user->id . $user->utype)) {
$value = Cache::get($user->id . $user->utype);
} else {
$value = 0;
}
if ($resNum != 0 && $value >= $resNum) {
return ['code' => 0, 'info' => '每天最多可刷新 ' . $resNum . " 次,您今天已达到最大刷新次数!"];
}
$result = $this->ResumeRepository->updateById(['updated_at' => date('Y-m-d H:i:s', time())], $id);
event_search_update(Resume::class, (string)$id, 'update');
if ($result) {
$taskPoints = $this->TaskService->doTask(6, $user->id, $user->utype);
Cache::put($user->id . $user->utype, $value + 1, intval(($endTime - $startTime) / 60));
if ($taskPoints['code'] == 1) {
//写入刷新日志
$this->memberLogRepository->createLog($user, 1006, [$id, "手动刷新"]);
return ['code' => 1, 'info' => $taskPoints['data']['points']];
} else {
return ['code' => 0, 'info' => $taskPoints['info']];
}
} else {
return ['code' => 0, 'info' => '刷新失败'];
}
}
public function getDuration($list)
{
if ($list) {
foreach ($list as $key => $value) {
$start = $value['startyear'] . '-' . $value['startmonth'];
$end = $value['endyear'] . '-' . $value['endmonth'];
if ($value['todate'] == 1) {
$end = date('Y-m');
}
$list[$key]['duration'] = ddate($start, $end);
}
}
return $list;
}
public function totalWorkDuration($list)
{
$total_year = 0;
$total_month = 0;
$return = '';
if ($list) {
foreach ($list as $key => $value) {
$current_duration = strpos($value['duration'], '年');
if ($current_duration === false) {
$total_month += intval($value['duration']);
} else {
$arr = explode("年", $value['duration']);
$total_year += intval($arr[0]);
$total_month += intval($arr[1]);
}
}
}
$add_year = intval($total_month / 12);
$total_year += $add_year;
$total_month = intval($total_month % 12);
if ($total_year > 0) {
$return .= $total_year . '年';
}
if ($total_month > 0) {
$return .= $total_month . '个月';
}
return $return;
}
public function resumeShow($id, $jobs_id = '', $user = null, $type = '', $guid = 0)
{
$request_all = \Illuminate\Support\Facades\Request::all();
$utype = 0;
$uid = 0;
if ($user) {
$utype = $user->utype;
$uid = $user->id;
}
$resume = $this->ResumeRepository->getResume($id);
if (!$resume) {
return array('status' => 0, 'msg' => '简历不存在!');
}
if ($type != 1) {
if (!isset(request()->token)) {
if (!($user && $utype == 2 && $user->id == $resume->uid)) {
if (!($user && $user->utype == '1' && $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user->id, $jobs_id))) {
if ($resume->display == 0) {
return array('status' => 0, 'msg' => '简历不公开!');
} else {
if ($type != 'qr') {
if (config('aix.personal_set.per_set.show_set.resume_display') == 1 && $resume->audit != '2') {
return array('status' => 0, 'msg' => '简历未审核通过!');
} elseif (config('aix.personal_set.per_set.show_set.resume_display') == 2 && $resume->audit == '0') {
return array('status' => 0, 'msg' => '简历审核未通过!');
}
}
}
}
}
}
}
//TODO 分站判断 - 判断简历是否可以显示
$resume->fullname_ = $resume->fullname;
$memberInfo = DB::table('member_infos')->where('uid', $resume->uid)->first(); //简历基本信息
$members = Member::find($resume->uid);
if ($members) {
$resume->login_last_time = date('Y-m-d', $members->last_login_time);
}
$resume->education_cn = $memberInfo->education_cn; //学历
$resume->experience = $memberInfo->experience; //工作经验——id
$resume->experience_cn = $memberInfo->experience_cn; //工作经验
$resume->sex_cn = $memberInfo->sex_cn;
//教育经历
$education = $this->ResumeEducationRepository->getResumeEducationByResumeId($id);
$education = $this->getDuration($education);
$resume->education_list = $education;
//工作经历
$work = $this->ResumeWorkRepository->getResumeWorkByResumeId($id);
$work = $this->getDuration($work);
$resume->work_list = $work;
$resume->work_count = count($work);
$work_duration = $this->totalWorkDuration($work); //工龄
$resume->work_duration = $work_duration;
//培训经历
$train = $this->ResumeTrainRepository->getResumeTrainByResumeId($id);
$train = $this->getDuration($train);
$resume->training_list = $train;
//语言能力
$language = $this->ResumeLanguageRepository->getResumeLanByResumeId($id);
$resume->language_list = $language;
//证书
$credent = $this->ResumeCredentRepository->getResumeCredentByResumeId($id);
$resume->credent_list = $credent;
//简历照片
$img_map = array(
array('resume_id', '=', $resume->id),
array('uid', '=', $resume->uid)
);
if (config('aix.personal_set.per_set.show_set.resume_img_display') == 1) {
$img_map[] = array('audit', '=', '2');
} else {
$img_map[] = array('audit', '<>', '0');
}
$images = DB::table('resume_imgs')->where($img_map)->get();
if ($images->isNotEmpty()) {
$resume->img_list = $images;
} else {
$resume->img_list = array();
}
$resume->age = date("Y") - $memberInfo->birthday; //年龄
//tag
if ($resume->tag_cn) {
$tag_cn = explode(',', $resume->tag_cn);
$resume->tag_cn = $tag_cn;
} else {
$resume->tag_cn = array();
}
$resume->refreshtime_cn = daterange(time(), strtotime($resume->updated_at), 'Y-m-d', "#FF3300");
//判断手机、微信、邮箱是否验证
$members = DB::table('members')->where('id', $resume->uid)->first();
$resume->is_audit_mobile = $members->mobile_audit;
//处理附件简历链接地址
if ($resume->word_resume) {
$resume->word_resume_url = upload_asset($resume->word_resume);
}
//处理微信二维码
$resume->label_id = 0;
$resume->label_type = 0;
$resume->label_resume = '';
$down_resume = false;
$jobs_apply = false;
if ($utype == 1) {
if (array_get($request_all, 'from_down') == 1) {
$down_resume = CompanyDownResume::find($request_all['down_id']);
} elseif (array_get($request_all, 'from_apply') == 1) {
$down_resume = CompanyDownResume::where(['company_uid' => $uid, 'resume_id' => $id])->first();
$jobs_apply = PersonalJobsApply::find($request_all['personal_jobs_id']);
} else {
$down_resume = CompanyDownResume::where(['company_uid' => $uid, 'resume_id' => $id])->first();
$jobs_apply = PersonalJobsApply::where(['company_id' => $uid, 'resume_id' => $id])->first();
}
}
$resume->label_arr = array();
//处理简历预览页面label 信息
if (array_get($request_all, 'from_down') == 1) {
$resume->label_arr = $this->companyDownResumeRepository->getStateArr();
$resume->label_resume = 'down';
$resume->label_type = 1;
$resume->label_id = $down_resume->is_reply;
} elseif (array_get($request_all, 'from_apply') == 1) {
$resume->label_arr = $this->PersonalJobsApplyRepository->getStateArr();
$resume->label_resume = 'apply';
$resume->label_type = 2;
$resume->label_id = $jobs_apply ? $jobs_apply->is_reply : '';
} elseif (array_get($request_all, 'from_interviews') == 1) { //从收到简历投递的页面来的
$resume->label_arr = $this->companyDownResumeRepository->getStateArr();
$resume->label_resume = 'interviews';
$resume->label_type = 0;
$resume->label_id = $jobs_apply ? $jobs_apply->is_reply : '';
}
if (!$jobs_id && $resume->label_resume == 'apply') {
$resume->label_resume = '';
}
$resume->show_contact = $this->getShowContact($resume, $down_resume, $jobs_apply, $user, $type);
// dd($resume->show_contact);
if ($resume->show_contact === false) { //处理联系信息
if ($memberInfo->display_name == "2") {
$resume->fullname = "N" . str_pad($resume->id, 7, "0", STR_PAD_LEFT);
} elseif ($memberInfo->display_name == "3") {
if ($resume->sex == 1) {
$resume->fullname = cut_str($resume->fullname, 1, 0, "先生");
} elseif ($resume->sex == 2) {
$resume->fullname = cut_str($resume->fullname, 1, 0, "女士");
}
}
$resume->telephone = contact_hide($memberInfo->phone, 2);
$resume->email = $memberInfo->email ? contact_hide($memberInfo->email, 3) : '';
$resume->qq = contact_hide($memberInfo->qq, 4);
$resume->weixin = contact_hide($memberInfo->weixin, 5);
} else {
$resume->telephone = $memberInfo->phone;
$resume->email = $memberInfo->email;
$resume->qq = $memberInfo->qq;
$resume->weixin = $memberInfo->weixin;
}
if (preg_match("/([\x81-\xfe][\x40-\xfe])/", $resume->weixin, $match)) {
$resume->weixin = null;
}
$resume->telephone_ = $resume->telephone;
$resume->email_ = $resume->email;
//联系方式展现形式 -图形化
if (config('aix.personal_set.per_set.contact_type_set.contact_img_resume') == 2) {
$pwdhash = config('aix.system.site_other.site_other.pwb_hash');
if ($resume->telephone) {
$resume->telephone = "
encrypt($resume->telephone, $pwdhash), 'type' => 'phone')) . "' />";
}
if ($resume->email) {
$resume->email = "
encrypt($resume->email, $pwdhash), 'type' => 'email')) . "' />";
}
if ($resume->qq) {
$resume->qq = "
encrypt($resume->qq, $pwdhash), 'type' => 'qq')) . "' />";
}
if ($resume->weixin) {
$resume->weixin = "
encrypt($resume->weixin, $pwdhash), 'type' => 'weixin')) . "' />";
}
}
$avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
if ($memberInfo->sex == 1) {
$avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
}
//1.照片为空
//2.照片主动不显示
//3.照片审核不通过
//4.先审核后显示:照片不是审核通过的(不等于1)
if ($memberInfo->images == '' || $memberInfo->display_images == 2 || $memberInfo->photo_audit == 0 || (config('aix.personal_set.per_set.show_set.resume_img_display') == 1 && $memberInfo->photo_audit != 2)) {
$resume->photosrc = $avatar_default; //不显示
$resume->photosrc_show = false;
} else {
$resume->photosrc = upload_asset($memberInfo->images); //显示
$resume->photosrc_show = true;
}
//期望薪资
$resume->wage_cn = '';
if ($resume->wage > 0) {
$wage_categories = $this->CategoryRepository->getCategories();
if ($wage_categories) {
if (config('aix.system.site_other.site_other.site_salary') == 1) {
$resume->wage_cn = array_has($wage_categories['AIX_wage_k'], [$resume->wage]) ? $wage_categories['AIX_wage_k'][$resume->wage] : '';
} elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
$resume->wage_cn = array_has($wage_categories['AIX_wage_c'], [$resume->wage]) ? $wage_categories['AIX_wage_c'][$resume->wage] : '';
}
}
} else {
//自定义薪资
$resume->wage_cn = $this->dealWage($resume->wage, $resume->wage_min, $resume->wage_max);
}
//期望职位
if (!$resume->intention_jobs) {
$job_cates = Cache::get('jobs_cate_list');
if (null === $job_cates) {
$job_cates = $this->CategoryJobsRepository->jobsCateInfoCache();
Cache::put('jobs_cate_list', $job_cates, '86400');
}
$i_ids = array();
if ($resume->intention_jobs_id) {
$i_ids = explode(',', $resume->intention_jobs_id);
}
$jobs_names = array();
if (count($i_ids) > 0) {
foreach ($i_ids as $key => $val) {
$intention_jobs_id_arr = explode('.', $val);
$count = count($intention_jobs_id_arr);
if ($count > 0) {
foreach ($intention_jobs_id_arr as $k => $v) {
if ($v && array_get($job_cates['id'], $v)) {
$jobs_names[$key] = $job_cates['id'][$v]['name'];
}
}
}
}
}
$resume->intention_jobs = implode('+', $jobs_names);
}
if (!$resume->trade_cn) {
$resume->trade_cn = '不限';
}
//企业用户 - 处理查看简历记录
if ($utype == 1) {
$view_where = array(
'uid' => $uid,
'resume_id' => $resume->id
);
$view_log = $this->ViewResumeRepository->findViewResume($view_where);
$stime = date('Y-m-d H:i:s', time());
if ($view_log) {
$set_data = array(
'created_at' => $stime
);
$this->ViewResumeRepository->update($set_data, $view_log->id);
} else {
$set_data = array(
'uid' => $uid,
'resume_id' => $resume->id,
'created_at' => $stime,
'updated_at' => $stime
);
$this->ViewResumeRepository->create($set_data);
}
if ($jobs_id) {
if (!empty($guid)) {
$apply_log = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user->id, $jobs_id, $guid);
} else {
$apply_log = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user->id, $jobs_id);
}
if ($apply_log) {
//企业对申请职位的简历设为已看
$set_where = array('id' => $apply_log->id, 'company_id' => $uid);
$apply_data = array('personal_look' => 2);
$set_rst = $this->PersonalJobsApplyRepository->setApply($set_where, $apply_data);
//添加会员日志
if ($set_rst !== false) {
$user_info = array(
'uid' => $uid,
'utype' => 1,
'username' => $user->username,
'ip' => ip2long(\Illuminate\Support\Facades\Request::getClientIp()),
'log_address' => '本机地址'
);
$this->feedbackService->addMembersLog($user_info, '', '标记申请职位记录(职位id:' . $apply_log->id . ')');
if (!$this->memberLogRepository->createLog($user, 1016, $apply_log->id)) {
throw new \Exception("日志记失败!");
}
}
}
}
}
//个人醒目标签
$PersonalServiceStickLog = PersonalServiceTagLog::where(['resume_id' => $resume->id, 'resume_uid' => $resume->uid])->first();
if ($PersonalServiceStickLog) {
if ($PersonalServiceStickLog->endtime - time() > 0) {
$resume->strong_tag = $PersonalServiceStickLog->tag_cn;
}
}
//preview - 个人用户
$resume->preview = 0;
if ($utype == 2 && $user->id == $resume->uid) {
$resume->preview = 1;
}
//简历是否已收藏 - 企业用户
$resume->favor = 0;
if ($utype == 1) {
$favor = $this->companyFavoriteRepository->findFavorite($resume->id, $user->id);
if ($favor) {
$resume->favor = 1;
}
}
//来源分站名称
$subsites = Cache::get('subsites_list');
if (array_has($subsites, $resume->subsite_id)) {
$resume->subsite_cn = $subsites[$resume->subsite_id]['sitename'];
} else {
$resume->subsite_cn = '';
}
$tag_logs = array();
$contentStatus = $this->CategoryService->connectStatus($resume->uid, $resume->id);
return ['resume' => $resume, 'member_infos' => $memberInfo, 'members' => $members, 'education' => $education, 'work' => $work, 'train' => $train, 'language' => $language, 'credent' => $credent, 'utype' => $utype, 'uid' => $uid, 'images' => $images, 'contentStatus' => $contentStatus, 'tag_log' => $tag_logs];
}
public function dealWage($wage, $minwage, $maxwage)
{
if (config('aix.system.site_other.site_other.site_salary') == 1) {
$minwage = $minwage % 1000 == 0 ? (($minwage / 1000) . 'K') : (round($minwage / 1000, 1) . 'K');
if ($minwage == 0) {
$maxwage = '以上';
} else {
$maxwage = $maxwage % 1000 == 0 ? (($maxwage / 1000) . 'K') : (round($maxwage / 1000, 1) . 'K');
}
} elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
if ($minwage >= 10000) {
if ($minwage % 10000 == 0) {
$minwage = ($minwage / 10000) . '万';
} else {
$minwage = round($minwage / 10000, 1);
$minwage = strpos($minwage, '.') ? str_replace('.', '万', $minwage) : $minwage . '万';
}
} else {
if ($minwage % 1000 == 0) {
$minwage = ($minwage / 1000) . '千';
} else {
$minwage = round($minwage / 1000, 1);
$minwage = strpos($minwage, '.') ? str_replace('.', '千', $minwage) : $minwage . '千';
}
}
if ($maxwage > 0) {
if ($maxwage >= 10000) {
if ($maxwage % 10000 == 0) {
$maxwage = ($maxwage / 10000) . '万';
} else {
$maxwage = round($maxwage / 10000, 1);
$maxwage = strpos($maxwage, '.') ? str_replace('.', '万', $maxwage) : $maxwage . '万';
}
} elseif ($maxwage) {
if ($maxwage % 1000 == 0) {
$maxwage = ($maxwage / 1000) . '千';
} else {
$maxwage = round($maxwage / 1000, 1);
$maxwage = strpos($maxwage, '.') ? str_replace('.', '千', $maxwage) : $maxwage . '千';
}
} else {
$maxwage = '0';
}
} else {
$maxwage = '0';
}
}
if ($minwage == $maxwage) {
$wage_cn = $minwage . '/月';
} else {
if ($minwage > 0 && $maxwage == 0) {
$wage_cn = $minwage . '以上/月';
} else {
$wage_cn = $minwage . '~' . $maxwage . '/月';
}
}
return $wage_cn;
}
public function getShowContact($val, $down, $apply, $user = null, $type = null)
{
$show_contact = false;
$route = Route::current()->action;
$prefix = $route['prefix'];
if (!$user) {
//if (!auth('web-company')->check() && !auth('web-member')->check()) { //情景1:游客访问
if ($prefix == '/content' && config('aix.personal_set.per_set.contact_set.show_resume_contact') == '0') { //web端
$show_contact = true;
}
if ($prefix == 'mobile/content' && config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') == '0') { //移动端
$show_contact = true;
}
//} elseif (auth('web-member')->check() && auth('web-member')->user()->id==$val->uid) {
} elseif ($user && $user->utype == 2 && $user->id == $val->uid) {
//情景2:个人会员访问并且是该简历发布者
$show_contact = true;
//} elseif (auth('web-company')->check()) {
} elseif ($user && $user->utype == 1) { //情景3:企业会员访问
//情景3-1:其他企业会员
if ($prefix == '/content' && (config('aix.personal_set.per_set.contact_set.show_resume_contact') == 1 || config('aix.personal_set.per_set.contact_set.show_resume_contact') == 0)) {
$show_contact = true;
}
if ($prefix == 'mobile/content' && (config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') == 1 || config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') == 0)) {
$show_contact = true;
}
if ($down) { //情景3-2:下载过该简历
$show_contact = true;
}
if ($apply) {//情景3-3:该简历申请过当前企业发布的职位
//判断会员套餐 - 收到简历的联系方式免费查看
//$user = auth('web-company')->user();
$user_setmeal = $this->memberSetmealRepository->getSetmealByUid($user->id, $user->utype);
if ($user_setmeal && $user_setmeal->show_apply_contact == 1) {
$show_contact = true;
}
}
//招聘会过来直接看
if ($type == 1) {
$show_contact = true;
}
}
return $show_contact;
}
public function resumeDoc($id)
{
if (empty($id)) {
return false;
}
$resume = $this->ResumeRepository->resumeShow($id);
if (!$resume) {
return false;
}
$education = $this->ResumeEducationRepository->getResumeEducationByResumeId($id);
$work = $this->ResumeWorkRepository->getResumeWorkByResumeId($id);
$train = $this->ResumeTrainRepository->getResumeTrainByResumeId($id);
$language = $this->ResumeLanguageRepository->getResumeLanByResumeId($id); //语言能力
$credent = $this->ResumeCredentRepository->getResumeCredentByResumeId($id); //获得证书
return ['resume' => $resume, 'education' => $education, 'work' => $work, 'train' => $train, 'language' => $language, 'credent' => $credent];
}
public function descript($res, $html)
{
$temp_path = "temp/" . uniqid() . '.doc';
Storage::disk('public')->put($temp_path, $html);
$filename = $res['resume']['member_infos']['realname'] . '.doc';
return response()->download(
Storage::disk('public')->path($temp_path),
$filename)->deleteFileAfterSend(true);
}
public function delResume($id)
{
if (empty($id)) {
throw new ResponseException('抱歉,搜索不到简历!', '', 400);
}
$count = $this->ResumeRepository->getResumeCount(auth('web-member')->user()->id);
if ($count == 1) {
return ['code' => 0, 'info' => '', 'data' => ['tips' => '该简历无法删除,请至少保留一份简历!', 'description' => '如果您目前暂无求职意向,将简历状态设置为【保密】即可免受企业骚扰。', 'hidden_val' => 0]];
} else {
return ['code' => 1, 'info' => '', 'data' => ['tips' => '您确定要删除该份简历吗?', 'description' => '如果您目前暂无求职意向,将简历状态设置为【保密】即可免受企业骚扰。', 'hidden_val' => 1]];
}
}
public function setDelResume($id, $user)
{
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($id, $array_id)) {
throw new ResponseException('简历不存在');
}
$resume = $this->ResumeRepository->getResume($id);
if ($resume->def == 1) {
$default = $this->ResumeRepository->getResumeInfo(['uid' => $user->id, 'def' => 0]);
if (!$default) {
throw new ResponseException('默认简历不能删除!');
}
DB::beginTransaction();//检查数据库事务
try {
$this->ResumeRepository->delResume($id);
$this->ResumeRepository->updateById(['def' => 1], $default->id);
Report::where('utype', 2)->whereIn('utype_id', [$id])->delete();
$this->antic_personnel($user->id,$p=null);
event_search_update(Resume::class, (string)$id, 'delete');
event_search_update(Resume::class, (string)$default->id, 'update');
DB::commit();
if (!$this->memberLogRepository->createLog($user, 2008, $id)) {
throw NEW \Exception("日志记失败!");
}
return true;
} catch (\Exception $e) {
DB::rollback();
return false;
}
} else {
event_search_update(Resume::class, (string)$id, 'delete');
if (!$this->memberLogRepository->createLog($user, 2008, $id)) {
throw NEW \Exception("日志记失败!");
}
Report::where('utype', 2)->whereIn('utype_id', [$id])->delete();
return $this->ResumeRepository->delResume($id);
}
}
public function setDef($id, $user)
{
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($id, $array_id)) {
throw new ResponseException('简历不存在');
}
if (empty($id)) {
throw new ResponseException('抱歉,搜索不到简历!', '', 400);
}
$default = $this->ResumeRepository->getPersonInfo($user->id);
$default_id = $default->id;
DB::beginTransaction();//检查数据库事务
try {
$this->ResumeRepository->updateById(['def' => 0], $default_id);
$this->ResumeRepository->updateById(['def' => 1], $id);
DB::commit();
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2009, $id)) {
throw new \Exception("日志记失败!");
}
return ['code' => 1, 'info' => '设置成功'];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage(), 'data' => null];
}
}
public function entrust($id, $user)
{
if (empty($id)) {
throw new ResponseException('抱歉,搜索不到简历!', '', 400);
}
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($id, $array_id)) {
throw new ResponseException('简历不存在');
}
$resume = $this->ResumeEntrustRepository->getEntrustByResumeId($id);
if ($resume) {
if (($resume->entrust_end - time()) > 0) {
$result = $this->ResumeEntrustRepository->getEntrustByResumeId($id);
return ['code' => 1, 'data' => $result];
} else {
return ['code' => 0, 'data' => $this->ResumeRepository->getArrayById($id)];
}
} else {
return ['code' => 0, 'data' => $this->ResumeRepository->getArrayById($id)];
}
}
public function setEntrust($id, $user)
{
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($id, $array_id)) {
throw new ResponseException('简历不存在');
}
$entrust = request()->entrust;
if (empty($entrust)) {
throw new ResponseException('请正确选择委托时间!', '', 400);
}
$resume = $this->ResumeRepository->getArrayById($id);
if (empty($resume)) {
throw new ResponseException('简历不存在!', '', 400);
}
$resume_display = config('aix.personal_set.per_set.show_set.resume_display');
if ($resume_display != 2) {
if ($resume['audit'] != 2) {
throw new ResponseException('审核中或审核未通过的简历无法委托!', '', 400);
}
} else {
if ($resume['audit'] == 0) {
throw new ResponseException('审核未通过的简历无法委托!', '', 400);
}
}
if ($resume['display'] != 1) {
return ['code' => 0, 'info' => '简历已关闭,无法委托!'];
}
$newResume = $this->ResumeEntrustRepository->getEntrustByResumeId($id);
switch ($entrust) {
case '3':
$data['entrust_end'] = strtotime("+3 day");
break;
case '7':
$data['entrust_end'] = strtotime("+7 day");
break;
case '14':
$data['entrust_end'] = strtotime("+14 day");
break;
case '30':
$data['entrust_end'] = strtotime("+30 day");
break;
default:
$data['entrust_end'] = strtotime("+3 day");
break;
}
DB::beginTransaction();//检查数据库事务
try {
$this->ResumeRepository->updateById(['entrust' => $data['entrust_end']], $id);
if ($newResume) {
$data['entrust'] = $entrust;
$data['entrust_start'] = time();
$this->ResumeEntrustRepository->updateEntrust($id, $data);
} else {
$data['resume_id'] = $id;
$data['uid'] = $user->id;
$data['fullname'] = $resume['fullname'];
$data['entrust'] = $entrust;
$data['entrust_start'] = time();
$this->ResumeEntrustRepository->addEnteust($data);
}
event_search_update(Resume::class, (string)$id, 'update');
DB::commit();
if (!$this->memberLogRepository->createLog($user, 2005, $id)) {
throwException("日志失败!");
}
return ['code' => 1, 'info' => '委托成功'];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage(), 'data' => null];
}
}
public function setEntrustDel($id, $user)
{
if (empty($id)) {
throw new ResponseException('抱歉,搜索不到简历!', '', 400);
}
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($id, $array_id)) {
throw new ResponseException('简历不存在');
}
DB::beginTransaction();//检查数据库事务
try {
$this->ResumeRepository->updateWord($id, ['entrust' => 0]);
$this->ResumeEntrustRepository->updateEntrust($id, ['entrust' => 0, 'entrust_end' => 0, 'entrust_start' => 0]);
event_search_update(Resume::class, (string)$id, 'update');
DB::commit();
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2006, $id)) {
throwException("日志失败!");
}
return ['code' => 1, 'info' => '取消委托成功'];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage(), 'data' => null];
}
}
public function attentionMe($user, $all)
{
$param_array = array('resume_id', 'look', 'settr');
$params = array();
if ($all) {
foreach ($all as $k => $v) {
if (in_array($k, $param_array)) {
$params[$k] = $v;
}
}
}
$data = [];
$resume_id = [];
$resume = $this->ResumeRepository->getSuccessResume($user->id, getResumeStatus());
if (!$resume->isEmpty()) {
$resume_id = array_column($resume->toArray(), 'id');
}
if (request()->resume_id) {
$resume_id = explode(',', request()->resume_id);
}
if (request()->settr) {
switch (request()->settr) {
case '3':
$data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-3 day"))];
break;
case '7':
$data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-7 day"))];
break;
case '15':
$data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-15 day"))];
break;
case '30':
$data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-30 day"))];
break;
default:
$data[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-3 day"))];
break;
}
}
$res = $this->ViewResumeRepository->getAttentMe($data, $resume_id);
if ($res->total()) {
foreach ($res as $key => $val) {
$Result = $this->CompanyDownResumeService->getDownResume(['resume_id' => $val->resume_id, 'company_uid' => $val->uid]);
if ($Result) {
$res[$key]['status'] = 1;
} else {
$res[$key]['status'] = 0;
}
}
}
return ['content' => $res, 'params' => $params];
}
public function delAttention($id, $user)
{
if (empty($id)) {
throw new ResponseException('关注企业不存在!', '', 400);
}
$res = ViewResume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
$res_k = string_to_array(',', $id);
foreach ($res_k as $key => $val) {
if (!in_array($val, $array_id)) {
throw new ResponseException('关注企业不存在', '', 400);
}
}
return ViewResume::destroy(explode(',', $id));
}
public function tagCn($user)
{
if (empty(request()->resume_id)) {
return ['code' => 0, 'info' => '简历不存在!'];
}
$res_k = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res_k, 'id');
if (!in_array(request()->resume_id, $array_id)) {
return ['code' => 0, 'info' => '简历不存在!'];
}
$res = $this->ResumeRepository->getArrayById(request()->resume_id);
$resume_display = config('aix.personal_set.per_set.show_set.resume_display');
if ($resume_display != 2) {
if ($res['audit'] != 2) {
return ['code' => 0, 'info' => '审核中或未通过的简历无法标签!'];
}
} else {
if ($res['audit'] == 0) {
return ['code' => 0, 'info' => '审核未通过的简历无法标签!'];
}
}
if ($res['display'] != 1) {
return ['code' => 0, 'info' => '简历已关闭,无法标签!'];
}
$person_tag = $this->CategoryRepository->getCategoryByAlias(['alias' => 'AIX_personaltag']);
$service_tags = PersonalServiceTag::orderBy('list_order', 'desc')->get();
$points = DB::table('members_points')->where(['uid' => auth('web-member')->user()->id, 'utype' => auth('web-member')->user()->utype])->first();
return ['code' => 1, 'person_tag' => $person_tag, 'service_tag' => $service_tags, 'points' => $points, 'resume_id' => request()->resume_id];
}
public function resumeStick($user)
{
if (empty(request()->resume_id)) {
return ['code' => 0, 'info' => '简历不存在!'];
}
$res_k = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res_k, 'id');
if (!in_array(request()->resume_id, $array_id)) {
return ['code' => 0, 'info' => '简历不存在!'];
}
$res = $this->ResumeRepository->getArrayById(request()->resume_id);
$resume_display = config('aix.personal_set.per_set.show_set.resume_display');
if ($resume_display != 2) {
if ($res['audit'] != 2) {
return ['code' => 0, 'info' => '审核中或未通过的简历无法置顶!'];
}
} else {
if ($res['audit'] == 0) {
return ['code' => 0, 'info' => '审核未通过的简历无法置顶!'];
}
}
if ($res['display'] != 1) {
return ['code' => 0, 'info' => '简历已关闭,无法置顶!'];
}
$service_sticks = PersonalServiceStick::orderBy('list_order', 'desc')->get();
$points = DB::table('members_points')->where(['uid' => auth('web-member')->user()->id, 'utype' => auth('web-member')->user()->utype])->first();
return ['code' => 1, 'service_stick' => $service_sticks, 'points' => $points, 'resume_id' => request()->resume_id];
}
public function incrementAddSave($date, $user)
{
$resume_id = array_get($date, 'resume_id');
if (empty($date['tag_id'])) {
throw new ResponseException('请选择标签!', '', 400);
}
if (empty($resume_id)) {
throw new ResponseException('请选择简历!', '', 400);
}
if (empty($date['days'])) {
throw new ResponseException('请选择天数!', '', 400);
}
$res_k = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res_k, 'id');
if (!in_array($resume_id, $array_id)) {
throw new ResponseException('简历不存在!', '', 400);
}
$res = $this->ResumeRepository->getArrayById($resume_id);
$resume_display = config('aix.personal_set.per_set.show_set.resume_display');
if ($resume_display != 2) {
if ($res['audit'] != 2) {
throw new ResponseException('审核中或未通过的简历无法标签!', '', 400);
}
} else {
if ($res['audit'] == 0) {
throw new ResponseException('审核未通过的简历无法标签!', '', 400);
}
}
if ($res['display'] != 1) {
throw new ResponseException('简历已关闭,无法标签!', '', 400);
}
$categorys = Category::where('id', $date['tag_id'])->first();
$personal_service_tags = PersonalServiceTag::where('days', $date['days'])->first();
if (is_null($personal_service_tags)) {
throw new ResponseException('请选择时长!', '', 400);
}
$POINTS = MembersPoint::where(['uid' => $user->id, 'utype' => $user->utype])->first();
if ($POINTS) {
if ($POINTS->points < $personal_service_tags->points) {
throw new ResponseException('积分不足!', '', 400);
}
} else {
throw new ResponseException('积分不存在!', '', 400);
}
DB::beginTransaction();//检查数据库事务
try {
$tag_logs = PersonalServiceTagLog::where(['resume_id' => $date['resume_id'], 'resume_uid' => $user->id])->first();
if ($tag_logs) {
$dat['days'] = $date['days'];
$dat['points'] = $personal_service_tags->points;
$dat['tag_id'] = $date['tag_id'];
$dat['tag_cn'] = $categorys->demand;
$dat['addtime'] = time();
$dat['endtime'] = strtotime("+" . $date['days'] . " day");
PersonalServiceTagLog::where(
['resume_id' => $date['resume_id'], 'resume_uid' => $user->id]
)->update($dat);
} else {
$dat['resume_id'] = $date['resume_id'];
$dat['resume_uid'] = $user->id;
$dat['days'] = $date['days'];
$dat['points'] = $personal_service_tags->points;
$dat['tag_id'] = $date['tag_id'];
$dat['tag_cn'] = $categorys->demand;
$dat['addtime'] = time();
$dat['endtime'] = strtotime("+" . $date['days'] . " day");
PersonalServiceTagLog::create($dat);
}
MembersPoint::where(
['uid' => $user->id, 'utype' => $user->utype]
)->decrement('points', $personal_service_tags->points);
MembersHandsel::create(
['uid' => $user->id, 'utype' => $user->utype, 'htype' => '', 'htype_cn' => $categorys->demand, 'operate' => 2, 'points' => $personal_service_tags->points]
);
$order = new Order();
$order->uid = $user->id;
$order->utype = $user->utype;
$order->order_type = 4;
$order->pay_type = 1;
$order->is_pay = 2;
$order->amount = $personal_service_tags->points / config('aix.system.site_other.site_other.points_match');
$order->pay_points = $personal_service_tags->points;
$order->payment = 'points';
$order->payment_cn = '积分';
$order->discount = $categorys->demand;
$order->payment_time = time();
$order->service_name = "简历标签";
$order->charge = json_encode($date);
$order->save();
$PayService = new PayService();
$order->oid = $PayService->getTradeNo($order->id);
$order->save();
DB::commit();
return ['code' => 1, 'info' => '兑换成功!'];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage()];
}
}
public function incrementStickSave($date, $user)
{
$resume_id = array_get($date, 'resume_id');
if (empty($resume_id)) {
throw new ResponseException('请选择简历!', '', 400);
}
if (empty($date['days'])) {
throw new ResponseException('请选择天数!', '', 400);
}
$res_k = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res_k, 'id');
if (!in_array($resume_id, $array_id)) {
throw new ResponseException('简历不存在!', '', 400);
}
$res = $this->ResumeRepository->getArrayById($resume_id);
$resume_display = config('aix.personal_set.per_set.show_set.resume_display');
if ($resume_display != 2) {
if ($res['audit'] != 2) {
throw new ResponseException('审核中或未通过的简历无法置顶!', '', 400);
}
} else {
if ($res['audit'] == 0) {
throw new ResponseException('审核未通过的简历无法置顶!', '', 400);
}
}
if ($res['display'] != 1) {
throw new ResponseException('简历已关闭,无法置顶!', '', 400);
}
$personal_service_sticks = PersonalServiceStick::where('days', $date['days'])->first();
if (is_null($personal_service_sticks)) {
throw new ResponseException('请选择时长!', '', 400);
}
$POINTS = MembersPoint::where(['uid' => $user->id, 'utype' => $user->utype])->first();
if ($POINTS) {
if ($POINTS->points < $personal_service_sticks->points) {
throw new ResponseException('积分不足!', '', 400);
}
} else {
throw new ResponseException('积分不存在!', '', 400);
}
DB::beginTransaction();//检查数据库事务
try {
$stick_logs = PersonalServiceStickLog::where(
['resume_id' => $date['resume_id'], 'resume_uid' => $user->id]
)->first();
Resume::where('id', $date['resume_id'])->update(['stick' => 1, 'stime' => strtotime("+" . $date['days'] . " day")]);
event_search_update(Resume::class, (string)$date['resume_id'], 'update');
if ($stick_logs) {
$dat['days'] = $date['days'];
$dat['points'] = $personal_service_sticks->points;
$dat['addtime'] = time();
$dat['endtime'] = strtotime("+" . $date['days'] . " day");
PersonalServiceStickLog::where(
['resume_id' => $date['resume_id'], 'resume_uid' => $user->id]
)->update($dat);
} else {
$dat['resume_id'] = $date['resume_id'];
$dat['resume_uid'] = $user->id;
$dat['days'] = $date['days'];
$dat['points'] = $personal_service_sticks->points;
$dat['addtime'] = time();
$dat['endtime'] = strtotime("+" . $date['days'] . " day");
PersonalServiceStickLog::create($dat);
}
MembersPoint::where(
['uid' => $user->id, 'utype' => $user->utype]
)->decrement('points', $personal_service_sticks->points);
MembersHandsel::create(
['uid' => $user->id, 'utype' => $user->utype, 'htype' => '', 'htype_cn' => '简历置顶' . $date['days'] . '天', 'operate' => 2, 'points' => $personal_service_sticks->points]
);
$order = new Order();
$order->uid = $user->id;
$order->utype = $user->utype;
$order->order_type = 3;
$order->pay_type = 1;
$order->is_pay = 2;
$order->amount = $personal_service_sticks->points / config('aix.system.site_other.site_other.points_match');
$order->pay_points = $personal_service_sticks->points;
$order->payment = 'points';
$order->payment_cn = '积分';
$order->payment_time = time();
$order->service_name = "简历置顶";
$order->discount = '置顶' . $date['days'] . '天';
$order->charge = json_encode($date);
$order->save();
$PayService = new PayService();
$order->oid = $PayService->getTradeNo($order->id);
$order->save();
DB::commit();
return ['code' => 1, 'info' => '兑换成功!'];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage()];
}
}
public function autoRefresh($date, $user)
{
$resume_id = $date['resume_id'];
$auto_refresh = $date['auto_refresh'];
$auto_apply = $date['auto_apply'];
if (empty($resume_id)) {
throw new ResponseException('简历不存在!', '', 400);
}
$uid = $user->id;
$utype = $user->utype;
$refreshtime = strtotime("+3 day");
$Queue = QueueAutoRefresh::where(['pid' => $resume_id, 'utype' => 2])->first();
$entrusts = ResumeEntrust::where(['resume_id' => $resume_id, 'uid' => $uid])->first();
$resume = $this->ResumeRepository->getArrayById($resume_id);
DB::beginTransaction();//检查数据库事务
try {
if ($auto_refresh == 1) {
if ($Queue) {
QueueAutoRefresh::where(['pid' => $resume_id, 'utype' => 2])->update(['start_time' => time(), 'refreshtime' => $refreshtime]);
} else {
$order['pid'] = $resume_id;
$order['type'] = 2;
$order['uid'] = $uid;
$order['utype'] = $utype;
$order['start_time'] = time();
$order['refreshtime'] = $refreshtime;
QueueAutoRefresh::create($order);
}
}
if ($auto_apply == 1) {
if ($entrusts) {
ResumeEntrust::where(['resume_id' => $resume_id, 'uid' => $uid])->update(['entrust_start' => time(), 'entrust_end' => $refreshtime, 'entrust' => 3]);
} else {
$ord['resume_id'] = $resume_id;
$ord['uid'] = $uid;
$ord['fullname'] = $resume['fullname'];
$ord['entrust'] = 3;
$ord['entrust_start'] = time();
$ord['entrust_end'] = $refreshtime;
ResumeEntrust::create($ord);
}
$this->ResumeRepository->updateWord($resume_id, ['entrust' => $refreshtime]);
}
DB::commit();
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2027, $resume_id)) {
throw new \Exception("日志记失败!");
}
return ['code' => 1, 'info' => '保存成功!'];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage()];
}
}
public function uploadImages($date, $user)
{
if (empty($date['resume_id'])) {
throw new ResponseException('简历不存在!', '', 400);
}
if (empty($date['img'])) {
throw new ResponseException('图片不存在!', '', 400);
}
$arr['uid'] = $user->id;
$arr['resume_id'] = $date['resume_id'];
$arr['img'] = $date['img'];
$arr['created_at'] = date('Y-m-d H:i:s', time());
$arr['updated_at'] = date('Y-m-d H:i:s', time());
$resume_imgs = DB::table('resume_imgs')->where(['uid' => $user->id, 'resume_id' => $date['resume_id']])->first();
DB::beginTransaction();//检查数据库事务
try {
if (empty($resume_imgs)) {
$resumeArr = $this->ResumeRepository->getResumeById($date['resume_id']);
if ($resumeArr->complete_percent + 5 <= 100) {
if ($resumeArr->complete_percent + 5 >= 70 && $resumeArr->complete_percent + 5 < 90) {
$this->TaskService->doTask(12);
$this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent + 5, 'level' => 2], $date['resume_id']);
} elseif ($resumeArr->complete_percent + 5 >= 90 && $resumeArr->complete_percent + 5 <= 100) {
$this->TaskService->doTask(11);
$this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent + 5, 'level' => 1], $date['resume_id']);
} else {
$this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent + 5, 'level' => 0], $date['resume_id']);
}
}
}
$result = DB::table('resume_imgs')->insert($arr);
if ($result) {
$id = DB::getPdo()->lastInsertId();
$das['audit'] = 1;
$expires = config('aix.personal_set.per_set.per_set.resume_expires');
if ($expires) {
$das['expires'] = strtotime("+{$expires} days");
}
$this->ResumeRepository->updateById($das, $date['resume_id']);
event_search_update(Resume::class, (string)$date['resume_id'], 'update');
}
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2030, $date['resume_id'])) {
throw new \Exception("日志记失败!");
}
DB::commit();
return ['code' => 1, 'info' => $id];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => '上传失败!'];
}
}
public function uploadFiles($date)
{
event_search_update(Resume::class, (string)$date['resume_id'], 'update');
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2030, $date['resume_id'])) {
throw new \Exception("日志记失败!");
}
return $this->ResumeRepository->updateWord(
$date['resume_id'],
[
'word_resume' => $date['files'],
'word_resume_title' => $date['name'],
'word_resume_addtime' => time(),
]
);
}
public function delFile($date)
{
event_search_update(Resume::class, (string)$date['resume_id'], 'update');
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2031, $date['resume_id'])) {
throw new \Exception("日志记失败!");
}
return $this->ResumeRepository->updateWord(
$date['resume_id'],
[
'word_resume' => '',
'word_resume_title' => '',
'word_resume_addtime' => null,
]
);
}
public function del_images($data)
{
if (empty($data['id'])) {
throw new ResponseException('图片不存在!', '', 400);
}
$count = DB::table('resume_imgs')->where(['uid' => auth('web-member')->user()->id, 'resume_id' => $data['resume_id']])->count();
DB::beginTransaction();//检查数据库事务
try {
$res = DB::table('resume_imgs')->where('id', $data['id'])->delete();
if ($count == 1) {
$resumeArr = $this->ResumeRepository->getResumeById($data['resume_id']);
if ($resumeArr->complete_percent - 5 > 0) {
if ($resumeArr->complete_percent - 5 >= 70 && $resumeArr->complete_percent - 5 < 90) {
$this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent - 5, 'level' => 2], $data['resume_id']);
} elseif ($resumeArr->complete_percent - 5 >= 90 && $resumeArr->complete_percent - 15 <= 100) {
$this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent - 5, 'level' => 1], $data['resume_id']);
} else {
$this->ResumeRepository->updateById(['complete_percent' => $resumeArr->complete_percent - 5, 'level' => 0], $data['resume_id']);
}
event_search_update(Resume::class, (string)$data['resume_id'], 'update');
}
}
DB::commit();
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2029, $data['resume_id'])) {
throw new \Exception("日志记失败!");
}
return ['code' => 1, 'info' => $res];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => '上传失败!'];
}
}
/**企业的邀请面试记录
* @param $request
* @return array
*/
public function interviewJobs($request, $user)
{
$jobs_id = isset($request['jobs_id']) ? $request['jobs_id'] : 0;
$stop = isset($request['stop']) ? $request['stop'] : 0;
$look = isset($request['look']) ? $request['look'] : 0;
$settr = isset($request['settr']) ? $request['settr'] : 0;
$page = 10;
$where['company_id'] = $user->id;
$valid = ['1'];
if ($stop) {
$valid = ['1', '0'];
}
if ($jobs_id) {
$where['jobs_id'] = $jobs_id;
}
if ($look) {
$where['personal_look'] = $look;
}
if ($settr) {
$where[] = ['interview_time', '>=', strtotime("-{$settr} day")];
}
// $where['result'] = 0;
$jobs_map['company_id'] = $user->id;
if (!$stop) {
$jobs_map['valid'] = 1;
}
if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
$jobs_map['audit'] = 1;
}
$param_array = array('jobs_id', 'stop', 'look', 'settr');
$params = array();
if ($request) {
foreach ($request as $k => $v) {
if (in_array($k, $param_array)) {
$params[$k] = $v;
}
}
}
$jobs = $this->jobsRepository->jobsList($jobs_map);
if ($jobs) {
$jobs = $jobs->toArray();
$jobsList = array_column($jobs, 'jobs_name', 'id');
}
$result = $this->CompanyInterviewRepository->interviewJobs($page, $where, $valid);
return [
'result' => $result,
'jobsList' => $jobsList,
'params' => $params,
'stop' => $stop,
'jobs_id' => $jobs_id,
];
}
/**
* 面试邀请详情
* @param $request
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
*/
public function interviewDetail($request)
{
if (!$id = $request->id) {
return response()->json(['status' => 0, 'msg' => '请正确选择面试信息']);
}
$interviewInfo = $this->CompanyInterviewRepository->interviewDetail(['id' => $id]);
if (!$interviewInfo) {
return response()->json(['status' => 0, 'msg' => '面试信息不存在']);
}
$is_apply = 0;
if ($this->PersonalJobsApplyRepository->findWhere(['resume_id' => $interviewInfo->resume_id, 'company_id' => auth('web-company')->user()->id])) {
$is_apply = 1;
}
return response()->json(['status' => 1, 'msg' => '面试信息获取成功!', 'data' => view('app.company.ajax.ajax_show_interview', ['interviewInfo' => $interviewInfo, 'is_apply' => $is_apply])->render()]);
}
/**
* 删除面试邀请
* @param $request
* @return array
*/
public function interviewDel($request, $user)
{
$id = isset($request['id']) ? $request['id'] : 0;
if (!$id) {
return ['status' => 0, 'msg' => '请选择要删除的面试邀请!'];
}
$ids = is_array($id) ? $id : explode(',', $id);
if (!$this->CompanyInterviewRepository->delInterview($ids, $user->id)) {
return ['status' => 0, 'msg' => '删除失败!'];
}
if (!$this->memberLogRepository->createLog($user, 1011, $id)) {
throw new \Exception('日志记录失败');
}
return ['status' => 1, 'msg' => '删除成功!'];
}
/**
* 企业下载的简历
* @param $request
* @return array
*/
public function resumeDown($request, $user)
{
$state_arr = array('1' => '可面试', '2' => '未接通', '3' => '不合适');
$state = isset($request['state']) ? $request['state'] : '';
$settr = isset($request['settr']) ? $request['settr'] : 0;
if (isset($request['state'])) {
$where['is_reply'] = $request['state'];
}
$map = [];
if (isset($request['settr'])) {
$map[] = ['down_addtime', '>=', strtotime("-{$request['settr']} day")];
}
$param_array = array('state', 'settr');
$params = array();
if ($request) {
foreach ($request as $k => $v) {
if (in_array($k, $param_array)) {
$params[$k] = $v;
}
}
}
$page = 10;
$where['company_uid'] = $user->id;
$downList = $this->companyDownResumeRepository->downResume($where, $map, $page);
// if ($downList->total()) {
// foreach ($downList as $key => $val) {
// if ($val->resumes) {
// if ($val->resumes->display_name=="2") {
// $val->resumes->fullname="N".str_pad($val['resume_id'], 7, "0", STR_PAD_LEFT);
// } elseif ($val->resumes->display_name=="3") {
// if ($val->resumes->sex==1) {
// $val->resumes->fullname=cut_str($val->resumes->fullname, 1, 0, "先生");
// } elseif ($val->resumes->sex==2) {
// $val->resumes->fullname=cut_str($val->resumes->fullname, 1, 0, "女士");
// }
// }
// }
// }
// }
return $res = [
'downList' => $downList,
'state_arr' => $state_arr,
'state' => $state,
'settr' => $settr,
'params' => $params,
];
}
public function resumeDownDel($request)
{
$user = auth('web-company')->user();
$yid = $request->y_id ? $request->y_id : 0;
if (!$yid) {
return response()->json(['status' => 0, 'msg' => '请选择要删除的简历!']);
}
$ids = is_array($yid) ? $yid : explode(',', $yid);
$where['company_uid'] = $user->id;
if (false == $this->companyDownResumeRepository->resumeDownDel($ids, $where)) {
return response()->json(['status' => 0, 'msg' => '简历删除失败!']);
}
if (!$this->memberLogRepository->createLog($user, 1017, $ids)) {
throw new \Exception("日志记录失败!");
}
return response()->json(['status' => 1, 'msg' => '简历删除成功!']);
}
/**
* 企业收藏的简历
* @param $request
* @return array
*/
public function favoritesResume($request, $user, $type = 0)
{
$where = [];
$map = [];
$hasget = false;
$settr = isset($request['settr']) ? $request['settr'] : 0;
if ($settr) {
$hasget = true;
$where[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
}
if ($type == 1) {
$education = isset($request['education']) ? $request['education'] : 0;
$experience = isset($request['experience']) ? $request['experience'] : 0;
$eduArr = Category::where('alias', 'AIX_education')->pluck('demand', 'id')->toArray();
$expArr = Category::where('alias', 'AIX_experience')->pluck('demand', 'id')->toArray();
$education && $map['education'] = $education;
$experience && $map['experience'] = $experience;
$result['eduArr'] = $eduArr;
$result['expArr'] = $expArr;
$result['experience'] = $experience;
$result['education'] = $education;
}
$page = 10;
$param_array = array('settr', 'education', 'experience');
$params = array();
if ($request) {
foreach ($request as $k => $v) {
if (in_array($k, $param_array)) {
$params[$k] = $v;
}
}
}
$favorityList = $this->companyFavoriteRepository->favorityList($where, $map, $user->id, $page);
if ($favorityList->total()) {
foreach ($favorityList as $key => $val) {
if ($val->resumes) {
if ($val->resumes->display_name == "2") {
$val->resumes->fullname = "N" . str_pad($val['resume_id'], 7, "0", STR_PAD_LEFT);
} elseif ($val->resumes->display_name == "3") {
if ($val->resumes->sex == 1) {
$val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
} elseif ($val->resumes->sex == 2) {
$val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
}
}
}
}
}
$result['favorityList'] = $favorityList;
$result['settr'] = $settr;
$result['params'] = $params;
$result['hasget'] = $hasget;
return $result;
}
/**收藏简历操作
* @param $request
* @return \Illuminate\Http\JsonResponse
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/
public function favoritesResumeSave($request)
{
$resume_id = $request->resume_id;
if (!$resume_id) {
return response()->json(['status' => 0, 'msg' => '请选择要收藏的简历!']);
}
$data['resume_id'] = $resume_id;
$data['company_id'] = auth('web-company')->user()->id;
if ($this->companyFavoriteRepository->findFavorite($resume_id, auth('web-company')->user()->id)) {
return response()->json(['status' => 0, 'msg' => '已收藏该简历,请勿重复收藏!']);
}
if (!$this->companyFavoriteRepository->create($data)) {
return response()->json(['status' => 0, 'msg' => '收藏简历失败!']);
}
return response()->json(['status' => 1, 'msg' => '收藏简历成功!']);
}
/**m删除企业收藏的简历
* @param $ids
* @param $user
* @return \Illuminate\Http\JsonResponse
* @throws \ErrorException
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/
public function favoritesResumeDel($ids, $user)
{
$id = $ids;
if (!$id) {
return response()->json(['status' => 0, 'msg' => '请选择简历!']);
}
$ids = is_array($id) ? $id : explode(',', $id);
if (!$this->companyFavoriteRepository->favoritesResumeDel($ids, $user->id)) {
return response()->json(['status' => 0, 'msg' => '删除失败!']);
}
if (!$this->memberLogRepository->createLog($user, 1019, $ids)) {
throw new \Exception("日志记录失败!");
}
return response()->json(['status' => 1, 'msg' => '删除成功!']);
}
/**浏览过的简历
* @param $request
* @return array
*/
public function browseResume($request)
{
$settr = $request->settr ? $request->settr : 0;
$map = [];
if ($settr) {
$map[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
}
$param_array = array('settr');
$params = array();
if ($request->all()) {
foreach ($request->all() as $k => $v) {
if (in_array($k, $param_array)) {
$params[$k] = $v;
}
}
}
$page = 10;
$browseList = $this->ViewResumeRepository->browseList($map, auth('web-company')->user()->id, $page);
foreach ($browseList as $key => $val) {
if ($val->resumes) {
//查找企业是否收藏对应简历
$val->is_favorite = 0;
if ($this->companyFavoriteRepository->findFavorite($val->resumes->id, auth('web-company')->user()->id)) {
$val->is_favorite = 1;
}
if ($val->resumes->display_name == "2") {
$val->resumes->fullname = "N" . str_pad($val['resume_id'], 7, "0", STR_PAD_LEFT);
} elseif ($val->resumes->display_name == "3") {
if ($val->resumes->sex == 1) {
$val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
} elseif ($val->resumes->sex == 2) {
$val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
}
}
}
}
$result = [
'settr' => $settr,
'browseList' => $browseList,
'params' => $params,
];
return $result;
}
/**删除浏览过的简历
* @param $request
* @return \Illuminate\Http\JsonResponse
*/
public function browseResumeDel($request, $user)
{
$id = $request->y_id;
if (!$id) {
return response()->json(['status' => 0, 'msg' => '请选择简历!']);
}
$ids = is_array($id) ? $id : explode(',', $id);
if (!$this->ViewResumeRepository->browseResumeDel($ids, $user->id)) {
return response()->json(['status' => 0, 'msg' => '删除失败!']);
}
if (!$this->memberLogRepository->createLog($user, 1020, $ids)) {
throw new \Exception("日志记录失败!");
}
return response()->json(['status' => 1, 'msg' => '删除成功!']);
}
/**谁看过我
* @param $request
* @return array
*/
public function browseJobs($request)
{
$settr = $request->settr ? $request->settr : 0;
$map = [];
if ($settr) {
$map[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
}
$map['company_id'] = auth('web-company')->user()->id;
$param_array = array('settr');
$params = array();
if ($request->all()) {
foreach ($request->all() as $k => $v) {
if (in_array($k, $param_array)) {
$params[$k] = $v;
}
}
}
$page = 10;
$result = $this->viewJobRepository->browseJobs($map, $page, $map['company_id']);
foreach ($result as $key => $val) {
if ($val->resumes) {
//查找企业是否收藏对应简历
$val->is_favorite = 0;
if ($this->companyFavoriteRepository->findFavorite($val->resumes->id, auth('web-company')->user()->id)) {
$val->is_favorite = 1;
}
if ($val->resumes->display_name == "2") {
$val->resumes->fullname = "N" . str_pad($val->resumes->id, 7, "0", STR_PAD_LEFT);
} elseif ($val->resumes->display_name == "3") {
if ($val->resumes->sex == 1) {
$val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
} elseif ($val->resumes->sex == 2) {
$val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
}
}
}
}
return $res = [
'result' => $result,
'settr' => $settr,
'params' => $params,
];
}
/**删除谁看过我
* @param $request
* @return \Illuminate\Http\JsonResponse
*/
public function browseJobsDel($request, $user)
{
$id = $request->y_id;
if (!$id) {
return response()->json(['status' => 0, 'msg' => '请选择简历!']);
}
$ids = is_array($id) ? $id : explode(',', $id);
if (!$this->viewJobRepository->browseJobsDel($ids, $user->id)) {
return response()->json(['status' => 0, 'msg' => '删除失败!']);
}
if (!$this->memberLogRepository->createLog($user, 1021, $ids)) {
throw new \Exception("日志记录失败!");
}
return response()->json(['status' => 1, 'msg' => '删除成功!']);
}
/**面试结果反馈
* @param $request
* @return array
*/
public function feedback($request)
{
$feedback = [1 => '面试通过', 2 => '面试未通过', 3 => '未参加面试', 4 => '面试时间变更'];
$user = auth('web-company')->user();
$type = $request->type ? $request->type : '';
$settr = $request->settr ? $request->settr : '';
$jobs_id = $request->jobs_id ? $request->jobs_id : 0;
$is_pass = $request->is_pass ? $request->is_pass : 0;
$where['company_id'] = $user->id;
if ($type) {
$where[] = ['result', '>', 0];
} else {
$where['result'] = 0;
}
$valid = ['1'];
if ($jobs_id) {
$where['jobs_id'] = $jobs_id;
}
if ($settr) {
$where[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
}
if ($is_pass) {
$where['result'] = $is_pass;
}
$jobs_map['company_id'] = $user->id;
$jobs_map['valid'] = 1;
if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
$jobs_map['audit'] = 1;
}
$param_array = array('type', 'jobs_id', 'settr');
$params = array();
if ($request->all()) {
foreach ($request->all() as $k => $v) {
if (in_array($k, $param_array)) {
$params[$k] = $v;
}
}
}
$page = 10;
$jobs = $this->jobsRepository->jobsList($jobs_map)->toArray();
$jobsList = array_column($jobs, 'jobs_name', 'id');
$result = $this->CompanyInterviewRepository->interviewJobs($page, $where, $valid);
return $res = [
'result' => $result,
'type' => $type,
'jobsList' => $jobsList,
'params' => $params,
'jobs_id' => $jobs_id,
'feedback' => $feedback,
'is_pass' => $is_pass,
];
}
/**面试结果反馈操作
* @param $id
* @param $notes
* @param $status
* @return \Illuminate\Http\JsonResponse
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/
public function feedbackModify($id, $notes, $status, $company_id)
{
$data = [
'explan' => $notes,
'result' => $status,
];
$isOk = $this->CompanyInterviewRepository->InterviewUpdate($data, $id, $company_id);
if (!$isOk) {
return response()->json(['status' => 0, 'msg' => "修改反馈结果失败!"]);
}
return response()->json(['status' => 1, 'msg' => "修改反馈结果成功!"]);
}
/**简历回收站
* @return array
*/
public function recycle()
{
$user = auth('web-company')->user();
$page = 10;
$state_arr = ['1' => '合适', '2' => '不合适', '3' => '待定', '4' => '未接通'];
$resumeList = $this->PersonalJobsApplyRepository->recycle($user->id, $page);
return $result = [
'result' => $resumeList,
'state_arr' => $state_arr,
];
}
/**删除收到的简历
* @param $id
* @return \Illuminate\Http\JsonResponse
*/
public function destroyJobsApply($id)
{
if (!$id) {
return response()->json(['status' => 0, 'msg' => '请选择简历!']);
}
$ids = is_array($id) ? $id : explode(',', $id);
if ($this->PersonalJobsApplyRepository->destroyJobsApply($ids)) {
return response()->json(['status' => 1, 'msg' => '简历删除成功!']);
}
return response()->json(['status' => 0, 'msg' => '简历删除失败!']);
}
/**清空回收站
* @return \Illuminate\Http\JsonResponse
*/
public function clearRecycle()
{
$company_id = auth('web-company')->user()->id;
if (!$company_id) {
return response()->json(['status' => 0, 'msg' => '参数错误!']);
}
if ($this->PersonalJobsApplyRepository->clearRecycle($company_id)) {
return response()->json(['status' => 1, 'msg' => '清空回收站成功!']);
}
return response()->json(['status' => 0, 'msg' => '清空回收站失败!']);
}
public function concern($request)
{
$user = auth('web-company')->user();
$where['company_id'] = $user->id;
$settr = $request->settr ? $request->settr : 0;
if ($settr) {
$where[] = ['created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$settr} day"))];
}
$param_array = array('settr');
$params = array();
if ($request->all()) {
foreach ($request->all() as $k => $v) {
if (in_array($k, $param_array)) {
$params[$k] = $v;
}
}
}
$page = 10;
$result = $this->personFocusComRepository->concern($where, $page);
//企业收藏的简历
$favoriteResume = $this->companyFavoriteRepository->findWhere(['company_id' => $user->id], ['resume_id'])->toArray();
$resumeId = array_column($favoriteResume, 'resume_id');
foreach ($result as $key => $val) {
$val->is_favorite = 0;
if ($val->resumes) {
if (in_array($val->resumes->id, $resumeId)) {
$val->is_favorite = 1;
}
if ($val->resumes->display_name == "2") {
$val->resumes->fullname = "N" . str_pad($val->resumes->id, 7, "0", STR_PAD_LEFT);
} elseif ($val->resumes->display_name == "3") {
if ($val->resumes->sex == 1) {
$val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "先生");
} elseif ($val->resumes->sex == 2) {
$val->resumes->fullname = cut_str($val->resumes->fullname, 1, 0, "女士");
}
}
}
}
return $res = [
'params' => $params,
'result' => $result,
];
}
public function concernDel($request, $user)
{
$yid = $request->y_id ? $request->y_id : 0;
if (!$yid) {
return response()->json(['status' => 0, 'msg' => "请选择删除的记录"]);
}
$ids = is_array($yid) ? $yid : explode(',', $yid);
if (false == $this->personFocusComRepository->concernDel($ids, $user->id)) {
return response()->json(['status' => 0, 'msg' => "删除记录失败"]);
}
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2038, $yid)) {
throw new \Exception("日志记失败!");
}
return response()->json(['status' => 1, 'msg' => "删除记录成功"]);
}
//导出Word简历
public function saveDocResume($resume_id, $user = null)
{
if (!$resume_id) {
throw new ResponseException('请选择简历!', '', 404);
}
$id = array($resume_id);
$sqlin = implode(",", $id);
if (!preg_match('/^(\d{1,10},)*(\d{1,10})$/', $sqlin)) {
return false;
}
//获取简历信息
$result = $this->ResumeRepository->getResumeList($id);
if (!$result->toArray()) {
return false;
}
$list = array();
foreach ($result as $k => $n) {
$memberInfo = $this->memberInfoRepository->findMemberInfo(array('uid' => $n->uid));//简历基本信息
$val = $n;
$val->education_list = $this->ResumeEducationRepository->getResumeEducationByResumeId($n->id); //教育经历
$val->work_list = $this->ResumeWorkRepository->getResumeWorkByResumeId($n->id); //工作经历
$val->training_list = $this->ResumeTrainRepository->getResumeTrainByResumeId($n->id); //培训经历
$val->language_list = $this->ResumeLanguageRepository->getResumeLanByResumeId($n->id); //语言能力
$val->credent_list = $this->ResumeCredentRepository->getResumeCredentByResumeId($n->id); //获得证书
$val->age = date("Y") - $memberInfo->birthday;
$val->education_cn = $memberInfo->education_cn; //学历
$val->experience_cn = $memberInfo->experience_cn; //工作经验
$val->sex_cn = $memberInfo->sex_cn; //性别
$val->marriage_cn = $memberInfo->marriage_cn; //婚姻状况
$val->residence_cn = $memberInfo->residence_cn ? $memberInfo->residence_cn : '保密';
$val->householdaddress_cn = $memberInfo->householdaddress_cn ? $memberInfo->householdaddress_cn : '保密';
$val->tagcn = preg_replace("/\d+/", '', $val->tag);
$val->tagcn = preg_replace('/\,/', '', $val->tagcn);
$val->tagcn = preg_replace('/\|/', ' ', $val->tagcn);
$member = $this->memberRepository->getMemberById($n->uid);
$val->last_login_time = date('Y-m-d', $member->last_login_time); // 最近登录时间
//处理联系信息
$val->has_down = false;
$val->is_apply = false;
$val->label_id = 0;
if ($user && $user->utype == 1) {
$user_id = $user->id;
$val->has_down = $this->companyDownResumeRepository->getDownResume(array('resume_id' => $val->id, 'company_uid' => $user_id));
$val->is_apply = $this->PersonalJobsApplyRepository->checkJobsApply($val->id, $user_id);
}
$val->show_contact = $this->getShowContact($val, $val->has_down, $val->is_apply, $user);
if ($val->show_contact === false) {
$val->telephone = contact_hide($memberInfo->phone, 2);
$val->email = contact_hide($memberInfo->email, 3);
$val->qq = contact_hide($memberInfo->qq, 4);
$val->weixin = contact_hide($memberInfo->weixin, 5);
if ($memberInfo->display_name == "2") {
$val->fullname = "N" . str_pad($val->id, 7, "0", STR_PAD_LEFT);
} elseif ($memberInfo->display_name == "3") {
if ($val->sex == 1) {
$val->fullname = cut_str($val->fullname, 1, 0, "先生");
} elseif ($val->sex == 2) {
$val->fullname = cut_str($val->fullname, 1, 0, "女士");
}
}
}
$avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
if ($memberInfo->sex == 1) {
$avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
}
if ($memberInfo->images == '' || $memberInfo->display_images == 2 || $memberInfo->photo_audit == 0 || (config('aix.personal_set.per_set.show_set.resume_img_display') == 1 && $memberInfo->photo_audit != 2)) {
$val->photosrc = public_data_path($avatar_default); //不显示
} else {
$val->photosrc = upload_asset($memberInfo->images); //显示
}
$list[] = $val;
}
//渲染word简历模板
$view_data = array(
'list' => $list
);
$view_html = view('app.content.resume.word_resume', $view_data)->render();
$temp_path = "temp/" . uniqid() . '.doc';
Storage::disk('public')->put($temp_path, $view_html);
$filename = $val->fullname . "的个人简历.doc";
return response()->download(
Storage::disk('public')->path($temp_path),
$filename)->deleteFileAfterSend(true);
}
public function favorResume($resume_id, $user = null)
{
if (!$resume_id) {
throw new ResponseException("请选择简历!");
}
/*$user = auth('web-company')->user();*/
if (strpos($resume_id, ",")) {
$resume_id = explode(",", $resume_id);
}
if (is_array($resume_id)) {
return $this->addFavoritesBatch($resume_id, $user); //批量收藏简历
} else {
return $this->addOneFavor($resume_id, $user); //收藏单个简历
}
}
//批量收藏简历
public function addFavoritesBatch($resume_id, $com_user)
{
$num = 0;
$insert_data = array();
$inser_rid = array();
$stime = date('Y-m-d H:i:s', time());
foreach ($resume_id as $k => $v) {
$v = intval($v);
if (!$this->companyFavoriteRepository->findFavorite($v, $com_user->id)) {
$insert_data[] = array(
'resume_id' => $v,
'company_id' => $com_user->id,
'created_at' => $stime,
'updated_at' => $stime
);
$inser_rid[] = $v;
}
}
if (count($insert_data) == 0) {
return array('status' => 0, 'msg' => '收藏失败!您已收藏选择的简历!');
}
$rst = $this->companyFavoriteRepository->insertData($insert_data);
if ($rst) {
//添加会员日志
$this->memberLogRepository->createLog($com_user, 1018, [implode(',', $inser_rid), '', '']);
return array('status' => 1, 'i' => count($insert_data), 'msg' => '成功收藏' . count($insert_data) . '份简历!');
} else {
return array('status' => 0, 'msg' => '收藏简历失败!');
}
}
//收藏单个简历
public function addOneFavor($resume_id, $com_user)
{
//判断是否收藏过当前简历
$favor_info = $this->companyFavoriteRepository->findFavorite($resume_id, $com_user->id);
if ($favor_info) {
//return array('status'=>0,'msg'=>'收藏失败!您已收藏过该简历');
//取消收藏
$cancel_favor = $this->companyFavoriteRepository->cancelFavor(['resume_id' => $resume_id, 'company_id' => $com_user->id]);
if (!$cancel_favor) {
return array('status' => 0, 'msg' => '取消加入人才库失败!', 'data' => 'has');
} else {
return array('status' => 1, 'i' => 1, 'msg' => '取消加入人才库成功!', 'data' => 'has');
}
} else {
//添加数据
$stime = date('Y-m-d H:i:s', time());
$insert_data = array(
'resume_id' => $resume_id,
'company_id' => $com_user->id,
'created_at' => $stime,
'updated_at' => $stime
);
$rst = $this->companyFavoriteRepository->create($insert_data);
if ($rst === false) {
return array('status' => 0, 'msg' => '加入人才库失败!', 'data' => 'no');
} else {
$this->memberLogRepository->createLog($com_user, 1018, [$resume_id, '', '']);
return array('status' => 1, 'i' => 1, 'msg' => '加入人才库成功!', 'favor_id' => $rst->id, 'data' => 'no');
}
}
}
//获取指定条件的已收藏的简历
public function getFavoritesResumes($where)
{
$rst = $this->companyFavoriteRepository->getFavoritesResumes($where);
$list = array();
if ($rst->toArray()) {
foreach ($rst as $k => $v) {
$list[$v->resume_id] = $v;
}
}
return $list;
}
public function dealResumeAvator($member_info, $resume)
{
$default_avator = public_data_path('/data/upload/resource/no_photo_female.png');
if ($member_info) {
if ($member_info->sex == 1) {
$default_avator = public_data_path('/data/upload/resource/no_photo_male.png');
}
if ($member_info->images == '' || $member_info->display_images == 2 || $member_info->photo_audit == 0 || (config('aix.personal_set.per_set.show_set.resume_img_display') == 1 && $member_info->photo_audit != 2)) {
$resume_avator = $default_avator;
} else {
$resume_avator = upload_asset($member_info->images);
}
} else {
$resume_avator = $default_avator;
}
return $resume_avator;
}
public function dealResumeDisplayName($resume)
{
$member_info = $resume['memberInfos'];
if ($member_info) {
if ($member_info->display_name == '2') {
$fullname = "N" . str_pad($resume->id, 7, "0", STR_PAD_LEFT);
} elseif ($member_info->display_name == '3') {
if ($member_info->sex == 1) {
$fullname = cut_str($resume->fullname, 1, 0, "先生");
} else {
$fullname = cut_str($resume->fullname, 1, 0, "女士");
}
} else {
$fullname = $resume->fullname;
}
} else {
$fullname = $resume->fullname;
}
return $fullname;
}
public function dealResumeFields($list)
{
$favor_resumes = array();
$down_resumes = array();
if (auth('web-company')->check()) {
$favor_resumes = $this->getFavoritesResumes(array('company_id' => auth('web-company')->user()->id));
$down_resumes = $this->companyDownResumeRepository->getDowmResumes(array('company_uid' => auth('web-company')->user()->id));
}
foreach ($list as $k => $v) {
if ($favor_resumes && array_has($favor_resumes, $v->id)) {
$list[$k]->has_favor = 1;
} else {
$list[$k]->has_favor = 0;
}
if ($down_resumes && array_has($down_resumes, $v->id)) {
$list[$k]->has_down = 1;
} else {
$list[$k]->has_down = 0;
}
$resume_fileds = $this->dealResumes($v);
foreach ($resume_fileds as $i => $filed) {
$list[$k]->$i = $filed;
}
}
return $list;
}
public function dealResumes($resume_info)
{
$data['resume_avator'] = $this->dealResumeAvator($resume_info->memberInfos, $resume_info);
$data['resume_display_name'] = $this->dealResumeDisplayName($resume_info);
//薪资待遇
if ($resume_info->wage) {
$wage_categories = $this->CategoryRepository->getCategories();
if ($wage_categories) {
if (config('aix.system.site_other.site_other.site_salary') == 1) {
$data['wage_cn'] = array_has($wage_categories['AIX_wage_k'], [$resume_info['wage']]) ? $wage_categories['AIX_wage_k'][$resume_info['wage']] : '';
} elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
$data['wage_cn'] = array_has($wage_categories['AIX_wage_c'], [$resume_info['wage']]) ? $wage_categories['AIX_wage_c'][$resume_info['wage']] : '';
}
}
} else {
$data['wage_cn'] = $this->dealWage($resume_info->wage, $resume_info->wage_min, $resume_info->wage_max);
}
return $data;
}
public function companyLabelResume($request)
{
$resume_id = $request->input('resume_id', 0);
$label = $request->input('label', 0);
$label_type = $request->input('label_type', 0);
$user = auth('web-company')->user();
$jobs_id = $request->jobs_id;
if ($label_type == 1) { //简历下载
$where = array('resume_id' => $resume_id, 'company_uid' => $user->id);
$data = $this->companyDownResumeRepository->getDownResume($where);
} else {
//职位下载
$where = array('resume_id' => $resume_id, 'jobs_id' => $jobs_id);
$data = $this->PersonalJobsApplyRepository->getOne($where);
}
if ($data) {
return $this->labelResume($data->id, $label_type, $user, $label);
} else {
return array('status' => '0', 'msg' => '参数错误!');
}
}
public function labelResume($id, $label_type, $user, $label)
{
$data['is_reply'] = $label;
$r = false;
if ($label_type == 1) {
$label_arr = $this->companyDownResumeRepository->getStateArr();
$down_where = array('id' => $id, 'company_uid' => $user->id);
$rst = $this->companyDownResumeRepository->updateData($down_where, $data);
$type = '1030';
} else {
$label_arr = $this->PersonalJobsApplyRepository->getStateArr();
$data['personal_look'] = 2;
$data['reply_time'] = time();
$old_apply_info = $this->PersonalJobsApplyRepository->getOne(array('id' => $id, 'is_reply' => 0));
$apply_where = array('id' => $id);
$rst = $this->PersonalJobsApplyRepository->setApply($apply_where, $data);
if ($old_apply_info && ($data['reply_time'] - strtotime($old_apply_info->created_at) <= 3600 * 24 * 3)) {
$r = true;
}
$type = '1029';
}
if ($rst === false) {
return array('status' => 0, 'msg' => '标记失败');
}
$label_text = array_has($label_arr, $label) ? $label_arr[$label] : '';
//添加日志记录
$this->memberLogRepository->createLog($user, $type, [$id, $label_text, '']);
return array('status' => 1, 'msg' => '标记成功', 'task' => $r);
}
public function dealAge($age)
{
$age_arr = array();
$categories = $this->CategoryService->getCategories(array('AIX_age' => 100));
if ($categories && array_has($categories, 'AIX_age')) {
$age_category = $categories['AIX_age'];
if ($age_category && array_get($age_category, $age)) {
$age_info = $age_category[$age]['demand'];
//处理年龄信息,获取最大年龄和最小年龄
if (preg_match_all('(\d+)', $age_info, $reg)) {
$reg = $reg[0];
if (count($reg) > 1) {
$max_age = date('Y', strtotime(' -' . $reg[0] . ' year'));
$min_age = date('Y', strtotime(' -' . $reg[1] . ' year'));
} else {
$min_age = date('Y', strtotime(' -' . $reg[0] . ' year'));
$max_age = '';
}
$age_arr = array('min_age' => $min_age, 'max_age' => $max_age);
}
}
}
return $age_arr;
}
public function getUserInfo($user, $resume_id)
{
$member = $this->memberInfoRepository->getMemberInfo($user->id);
$resume = $this->ResumeRepository->getPersonInfo($user->id);
$sign = $this->TaskLogRepository->getTaskLogCount($user->id, 3, $user->utype);
$applyJobs = $this->PersonalJobsApplyRepository->getApplyJobs($user->id, getJobsStatus());
$interview = $this->CompanyInterviewRepository->getInterview($user->id, getJobsStatus());
$viewResume = $this->ViewResumeRepository->getViewResume($resume_id);
$points = MembersPoint::where(['uid' => $user->id, 'utype' => $user->utype])->first();
if (time() > strtotime(date('Y-m-d 06:00:00')) && time() <= strtotime(date('Y-m-d 12:00:00'))) {
$timeDate = '上午好!';
} elseif (time() > strtotime(date('Y-m-d 12:00:00')) && time() <= strtotime(date('Y-m-d 18:00:00'))) {
$timeDate = '下午好!';
} else {
$timeDate = '晚上好!';
}
return (object)['member' => $member, 'resume' => $resume, 'sign' => $sign, 'points' => $points, 'timeDate' => $timeDate, 'applyJobs' => $applyJobs, 'interview' => $interview, 'viewResume' => $viewResume];
}
public function incrementData($where, $num, $filed)
{
return $this->ResumeRepository->incrementData($where, $num, $filed);
}
public function getResumeInfo($resume_id)
{
return $this->ResumeRepository->getSuccessResumeByid(['id' => $resume_id], getResumeStatus());
}
public function getResumeAllInfo($resume_id)
{
if (!is_array($resume_id)) {
$resume_ids = explode(',', $resume_id);
}
if (count($resume_ids) > 1) {
return $this->ResumeRepository->getResumesWithInfo($resume_ids);
} else {
return $this->ResumeRepository->resumeShow($resume_id);
}
}
public function getPersonApply($where)
{
return $this->PersonalJobsApplyRepository->applyJobs($where);
}
public function clearResumeStick()
{
$PersonalServiceStickLog = PersonalServiceStickLog::where('endtime', '<', time())->get()->toArray();
$resume_id = array_unique(array_column($PersonalServiceStickLog, 'resume_id'));
return $resume_id;
}
public function clearResumeExpires()
{
return $this->ResumeRepository->clearResumeExpires();
}
public function resumeAutoRefresh()
{
$res = $this->queueAutoRefreshRepository->resumeAutoRefresh();
$resume_id = [];
if ($res) {
$resNum = config('aix.personal_set.per_set.per_set.refresh_resume_num');
foreach ($res as $val) {
if ($resNum == 0) {
$resume_id[] = $val['pid'];
} else {
if (Cache::has($val['uid'] . $val['utype'])) {
$value = Cache::get($val['uid'] . $val['utype']);
} else {
$value = 0;
}
if ($value < $resNum) {
$resume_id[] = $val['pid'];
}
}
}
}
return $resume_id;
}
public function resumeEntrust()
{
$res = $this->ResumeEntrustRepository->resumeEntrust();
if ($res) {
$apply_max = intval(config('aix.personal_set.per_set.per_set.apply_jobs_max'));
$apply_space = intval(config('aix.personal_set.per_set.per_set.apply_job_space'));
foreach ($res as $key => $val) {
$num = PersonalJobsApply::where('personal_uid', $val['uid'])->where('created_at', '>=', date('Y-m-d 00:00:00'))->where('created_at', '<=', date('Y-m-d 23:59:59'))->count();
if ($num >= intval($apply_max / 2)) {
continue;
}
$array = string_to_array(['.', ','], $val['resumes']['intention_jobs_id']);
$nuk = 2;
$inter_array = [];
foreach ($array as $k1 => $v1) {
if ($k1 == $nuk && !empty($v1)) {
$inter_array[] = $v1;
$nuk = $nuk + 3;
}
}
$jobs_id = array_unique($inter_array);
if ($jobs_id) {
if ($apply_space > 0) {
$personalJobsApply = PersonalJobsApply::where('resume_id', $val['resume_id'])->where('created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$apply_space} day")))->where('created_at', '<=', date('Y-m-d H:i:s', strtotime("{$apply_space} day")))->get()->toArray();
} else {
$personalJobsApply = PersonalJobsApply::where('resume_id', $val['resume_id'])->get()->toArray();
}
$job_array_id = [];
if (!empty($personalJobsApply)) {
$job_array_id = array_column($personalJobsApply, 'jobs_id');
}
$jobs = Jobs::whereIn('subclass', $jobs_id)->where('valid', 1)
->where('display', 1)->whereIn('audit', getJobsStatus())->whereNotIn('id', $job_array_id)->orderBy('updated_at', 'desc')->get()->toArray();
if ($jobs) {
if ($apply_max > 0) {
foreach ($jobs as $key1 => $val1) {
if ($num >= intval($apply_max / 2)) {
break;
} else {
$num++;
PersonalJobsApply::create([
'resume_id' => $val['resume_id'],
'resume_name' => $val['resumes']['title'],
'personal_uid' => $val['resumes']['uid'],
'jobs_id' => $val1['id'],
'jobs_name' => $val1['jobs_name'],
'company_id' => $val1['company_id'],
'company_name' => $val1['company_name'],
'is_apply' => 2,
]);
}
}
}
}
}
}
}
return true;
}
public function padResumeShow($id, $type = 1, $jobs_id = '', $user)
{
$request_all = \Illuminate\Support\Facades\Request::all();
$utype = 0;
$uid = 0;
$resume = $this->ResumeRepository->getResume($id);
if (!$resume) {
throw new ResponseException('简历不存在!', [], 404);
}
$subsite_type = Cache::get('subsite_type');
if ($subsite_type) {
check_url(Cache::get('subsite_id'), $resume->subsite_id); //判断分站是否可以访问
}
$resume->fullname_ = $resume->fullname;
$memberInfo = DB::table('member_infos')->where('uid', $resume->uid)->first(); //简历基本信息
$resume->education_cn = $memberInfo->education_cn; //学历
$resume->experience_cn = $memberInfo->experience_cn; //工作经验
$resume->sex_cn = $memberInfo->sex_cn;
//教育经历
$education = $this->ResumeEducationRepository->getResumeEducationByResumeId($id);
$education = $this->getDuration($education);
$resume->education_list = $education;
//工作经历
$work = $this->ResumeWorkRepository->getResumeWorkByResumeId($id);
$work = $this->getDuration($work);
$resume->work_list = $work;
$resume->work_count = count($work);
$work_duration = $this->totalWorkDuration($work); //工龄
$resume->work_duration = $work_duration;
//培训经历
$train = $this->ResumeTrainRepository->getResumeTrainByResumeId($id);
$train = $this->getDuration($train);
$resume->training_list = $train;
//语言能力
$language = $this->ResumeLanguageRepository->getResumeLanByResumeId($id);
$resume->language_list = $language;
//证书
$credent = $this->ResumeCredentRepository->getResumeCredentByResumeId($id);
$resume->credent_list = $credent;
//简历照片
$img_map = array(
array('resume_id', '=', $resume->id),
array('uid', '=', $resume->uid)
);
if (config('aix.personal_set.per_set.show_set.resume_img_display') == 1) {
$img_map[] = array('audit', '=', '2');
} else {
$img_map[] = array('audit', '<>', '0');
}
$images = DB::table('resume_imgs')->where($img_map)->get();
$resume->img_list = $images;
$resume->age = date("Y") - $memberInfo->birthday; //年龄
//tag
if ($resume->tag_cn) {
$tag_cn = explode(',', $resume->tag_cn);
$resume->tag_cn = $tag_cn;
} else {
$resume->tag_cn = array();
}
$resume->refreshtime_cn = daterange(time(), strtotime($resume->updated_at), 'Y-m-d', "#FF3300");
//判断手机、微信、邮箱是否验证
$members = DB::table('members')->where('id', $resume->uid)->first();
$resume->is_audit_mobile = $members->mobile_audit;
//处理附件简历链接地址
if ($resume->word_resume) {
$resume->word_resume_url = upload_asset($resume->word_resume);
}
//处理微信二维码
$resume->label_id = 0;
$resume->label_type = 0;
$resume->label_resume = '';
$down_resume = false;
$jobs_apply = false;
if ($user->utype == 1) {
$user_id = $user->id;
$down_resume = $this->companyDownResumeRepository->getDownResume(array('resume_id' => $resume->id, 'company_uid' => $user_id));
if ($jobs_id) {
//$jobs_apply = $this->PersonalJobsApplyRepository->checkJobsApply($resume->id, $user_id, $jobs_id);
$jobs_apply = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user_id, $jobs_id);
} else {
//$jobs_apply = $this->PersonalJobsApplyRepository->checkJobsApply($resume->id, $user_id);
$jobs_apply = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user_id);
}
}
$resume->label_arr = array();
//处理简历预览页面label 信息
if (array_get($request_all, 'from_down') == 1) {
$resume->label_arr = $this->companyDownResumeRepository->getStateArr();
$resume->label_resume = 'down';
$resume->label_type = 1;
$resume->label_id = $down_resume->is_reply;
} elseif (array_get($request_all, 'from_apply') == 1) {
$resume->label_arr = $this->PersonalJobsApplyRepository->getStateArr();
$resume->label_resume = 'apply';
$resume->label_type = 2;
$resume->label_id = $jobs_apply->is_reply;
}
if (!$jobs_id && $resume->label_resume == 'apply') {
$resume->label_resume = '';
}
$resume->show_contact = $this->getShowContact($resume, $down_resume, $jobs_apply, $user);
if ($type == 1) {
if ($resume->show_contact === false) { //处理联系信息
if ($memberInfo->display_name == "2") {
$resume->fullname = "N" . str_pad($resume->id, 7, "0", STR_PAD_LEFT);
} elseif ($memberInfo->display_name == "3") {
if ($resume->sex == 1) {
$resume->fullname = cut_str($resume->fullname, 1, 0, "先生");
} elseif ($resume->sex == 2) {
$resume->fullname = cut_str($resume->fullname, 1, 0, "女士");
}
}
$resume->telephone = contact_hide($memberInfo->phone, 2);
$resume->email = $memberInfo->email ? contact_hide($memberInfo->email, 3) : '';
$resume->qq = contact_hide($memberInfo->qq, 4);
$resume->weixin = contact_hide($memberInfo->weixin, 5);
}
}
$resume->telephone_ = $resume->telephone;
$resume->email_ = $resume->email;
//联系方式展现形式 -图形化
if (config('aix.personal_set.per_set.contact_type_set.contact_img_resume') == 2) {
$pwdhash = config('aix.system.site_other.site_other.pwb_hash');
if ($resume->telephone) {
$resume->telephone = "
encrypt($resume->telephone, $pwdhash), 'type' => 'phone')) . "' />";
}
if ($resume->email) {
$resume->email = "
encrypt($resume->email, $pwdhash), 'type' => 'email')) . "' />";
}
if ($resume->qq) {
$resume->qq = "
encrypt($resume->qq, $pwdhash), 'type' => 'qq')) . "' />";
}
if ($resume->weixin) {
$resume->weixin = "
encrypt($resume->weixin, $pwdhash), 'type' => 'weixin')) . "' />";
}
}
$avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
if ($memberInfo->sex == 1) {
$avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
}
//1.照片为空
//2.照片主动不显示
//3.照片审核不通过
//4.先审核后显示:照片不是审核通过的(不等于1)
if ($memberInfo->images == '' || $memberInfo->display_images == 2 || $memberInfo->photo_audit == 0 || (config('aix.personal_set.per_set.show_set.resume_img_display') == 1 && $memberInfo->photo_audit != 2)) {
//不显示
$resume->photosrc = $avatar_default;
} else {
//显示
$resume->photosrc = upload_asset($memberInfo->images);
}
//期望薪资
$wage_categories = $this->CategoryRepository->getCategories();
if ($wage_categories) {
if (config('aix.system.site_other.site_other.site_salary') == 1) {
$resume->wage_cn = array_has($wage_categories['AIX_wage_k'], [$resume->wage]) ? $wage_categories['AIX_wage_k'][$resume->wage] : $resume->wage_cn;
} elseif (config('aix.system.site_other.site_other.site_salary') == 2) {
$resume->wage_cn = array_has($wage_categories['AIX_wage_c'], [$resume->wage]) ? $wage_categories['AIX_wage_c'][$resume->wage] : $resume->wage_cn;
}
}
//期望职位
if (!$resume->intention_jobs) {
$job_cates = Cache::get('jobs_cate_list');
if (null === $job_cates) {
$job_cates = $this->CategoryJobsRepository->jobsCateInfoCache();
Cache::put('jobs_cate_list', $job_cates, '86400');
}
$i_ids = array();
if ($resume->intention_jobs_id) {
$i_ids = explode(',', $resume->intention_jobs_id);
}
$jobs_names = array();
if (count($i_ids) > 0) {
foreach ($i_ids as $key => $val) {
$intention_jobs_id_arr = explode('.', $val);
$count = count($intention_jobs_id_arr);
if ($count > 0) {
foreach ($intention_jobs_id_arr as $k => $v) {
if ($v && array_get($job_cates['id'], $v)) {
$jobs_names[$key] = $job_cates['id'][$v]['name'];
}
}
}
}
}
$resume->intention_jobs = implode('+', $jobs_names);
}
if (!$resume->trade_cn) {
$resume->trade_cn = '不限';
}
//企业用户 - 处理查看简历记录
if (auth('web-company')->check()) {
$view_where = array(
'uid' => $user->id,
'resume_id' => $resume->id
);
$view_log = $this->ViewResumeRepository->findViewResume($view_where);
$stime = date('Y-m-d H:i:s', time());
if ($view_log) {
$set_data = array(
'created_at' => $stime
);
$this->ViewResumeRepository->update($set_data, $view_log->id);
} else {
$set_data = array(
'uid' => $user->id,
'resume_id' => $resume->id,
'created_at' => $stime,
'updated_at' => $stime
);
$this->ViewResumeRepository->create($set_data);
}
if ($jobs_id) {
$apply_log = $this->PersonalJobsApplyRepository->findJobsApply($resume->id, $user_id, $jobs_id);
if ($apply_log) {
//企业对申请职位的简历设为已看
$set_where = array('id' => $apply_log->id, 'company_id' => $user->id);
$apply_data = array('personal_look' => 2);
$set_rst = $this->PersonalJobsApplyRepository->setApply($set_where, $apply_data);
//添加会员日志
if ($set_rst !== false) {
$user_info = array(
'uid' => $user->id,
'utype' => 1,
'username' => $user->username,
'ip' => ip2long(\Illuminate\Support\Facades\Request::getClientIp()),
'log_address' => '本机地址'
);
$this->feedbackService->addMembersLog($user_info, '', '标记申请职位记录(职位id:' . $apply_log->id . ')');
}
}
}
}
//个人醒目标签
$PersonalServiceStickLog = PersonalServiceTagLog::where(['resume_id' => $resume->id, 'resume_uid' => $resume->uid])->first();
if ($PersonalServiceStickLog) {
if ($PersonalServiceStickLog->endtime - time() > 0) {
$resume->strong_tag = $PersonalServiceStickLog->tag_cn;
}
}
$tag_logs = array();
if (auth('web-member')->user()) {
$uid = auth('web-member')->user()->id;
$utype = 2;
}
if ($user) {
$uid = $user->id;
$utype = 1;
}
$contentStatus = $this->CategoryService->connectStatus($resume->uid, $resume->id);
return ['resume' => $resume, 'member_infos' => $memberInfo, 'members' => $members, 'education' => $education, 'work' => $work, 'train' => $train, 'language' => $language, 'credent' => $credent, 'utype' => $utype, 'uid' => $uid, 'images' => $images, 'contentStatus' => $contentStatus, 'tag_log' => $tag_logs];
}
public function getPersonInfo($id)
{
$member = $this->memberRepository->getMemberById($id);
if (!$member) {
return array('status' => 0, 'error' => '简历不存在');
}
$default_resume = $this->getDefResume($member);
return array(
'user' => $member,
'resume' => $default_resume
);
}
public function getPersonAvator($user = array())
{
$avator = '';
if ($user) {
$memberInfo = $this->memberInfoRepository->getMemberInfo($user->id);
if ($memberInfo) {
$avatar_default = public_data_path('/data/upload/resource/no_photo_female.png');
if ($memberInfo->sex == 1) {
$avatar_default = public_data_path('/data/upload/resource/no_photo_male.png');
}
/*if ($memberInfo->images == '' || $memberInfo->display_images == 2 || $memberInfo->photo_audit == 0 || (config('aix.personal_set.per_set.show_set.resume_img_display') == 1 && $memberInfo->photo_audit != 2)) {
$avator = $avatar_default;
} else {
$avator = upload_asset($memberInfo->images);
}*/
if ($memberInfo->images == '') {
$avator = $avatar_default;
} else {
$avator = upload_asset($memberInfo->images);
}
}
}
return $avator;
}
public function getDefResume($user)
{
return $this->ResumeRepository->getPersonInfo($user->id);
}
public function addPadResume($data)
{
//简历信息
if ($data['wage'] != 0) {
$resume_data['wage_cn'] = get_category($data['wage']);
$wage = explode('~', format_wage(get_category($data['wage'])));
if (isset($wage[1])) {
$resume_data['wage_max'] = intval($wage[1]);
}
$resume_data['wage_min'] = intval($wage[0]);
} else {
$resume_data['wage_cn'] = $data['wage_min'] . '~' . $data['wage_max'] . '/月';
}
if ($data['wage'] != -1) {
$data['wage_cn'] = get_category($data['wage']);
$wage = explode('~', format_wage(get_category($data['wage'])));
if (isset($wage[1])) {
$data['wage_max'] = intval($wage[1]);
}
$data['wage_min'] = intval($wage[0]);
} else {
$data['wage_cn'] = $data['wage_min'] . '~' . $data['wage_max'] . '/月';
}
$resume_data = [
'display' => $data['display'],
'audit' => 2,
'title' => '简历' . date('Ymd'),
'fullname' => $data['fullname'],
'sex' => $data['sex'] == '男' ? 1 : 2,
'sex_cn' => $data['sex'],
'nature' => $data['nature'],
'nature_cn' => get_category($data['nature']),
'trade' => $data['trade'],
'trade_cn' => get_category($data['trade']),
'birthdate' => $data['birthdate'],
'experience' => $data['experience'],
'experience_cn' => get_category($data['experience']),
'education' => $data['education'],
'education_cn' => get_category($data['education']),
'wage' => $data['wage'],
'wage_min' => $data['wage_min'],
'wage_max' => $data['wage_max'],
'wage_cn' => $data['wage_cn'],
'telephone' => $data['telephone'],
'email' => $data['email'],
'intention_jobs_id' => $data['intention_jobs_id'],
'intention_jobs' => get_job_category_cn($data['intention_jobs_id']),
'current' => $data['current'],
'current_cn' => get_category($data['current']),
'idcard' => $data['id_card'],
'level' => 0,
'complete_percent' => 40,
'marriage' => 3,
'marriage_cn' => '保密',
'residence' => get_district_cn($data['residence']),
'district' => $data['district'],
'district_cn' => get_district_cn($data['district']),
'subsite_id' => get_subsite_id(),
];
if (empty($data['uid'])) {
//注册用户
$member_data = [
'mobile' => $data['telephone'],
'password' => substr($data['id_card'], -6),
'utype' => 2,
'reg_type' => 1,
'reg_source' => 1,
'id_card' => $data['id_card'],
];
//用户信息
$member_info_data = [
'realname' => $data['fullname'],
'id_card' => $data['id_card'],
'sex' => $data['sex'] == '男' ? 1 : 2,
'sex_cn' => $data['sex'],
'birthday' => $data['birthdate'],
'email' => $data['email'],
'phone' => $data['telephone'],
'experience' => $data['experience'],
'experience_cn' => get_category($data['experience']),
'education' => $data['education'],
'education_cn' => get_category($data['education']),
'residence' => $data['residence'],
'residence_cn' => get_district_cn($data['residence']),
'card_t_cn' => $data['card_t_cn'],
];
DB::beginTransaction();//检查数据库事务
try {
//注册
$member = $this->registerService->registerPerson($member_data);
$this->memberRepository->updateInfo($member->id, ['email' => $data['email']]);
//新建用户信息
$this->memberInfoRepository->updateInfo($member_info_data, $member->id);
//简历信息
$resume_data['uid'] = $member->id;
$resume = $this->ResumeRepository->resumeAdd($resume_data);
$subsiteDefault = [
'subsite_id' => get_subsite_id(),
'resume_id' => $resume->id
];
SubsiteResume::insert($subsiteDefault);
//创建会员给积分
$reg_point = $this->taskRepository->getPoint(['utype' => 2, 't_alias' => 'reg', 'status' => 1]);
$handsel['uid'] = $member->id;
$handsel['utype'] = 2;
$handsel['htype'] = 'reg';
$handsel['htype_cn'] = '注册账号';
$handsel['operate'] = 1;
$handsel['points'] = $reg_point;
$this->memberHandselRepository->addNew($handsel);
$user_info_point = $this->taskRepository->getPoint(['utype' => 2, 't_alias' => 'user_info', 'status' => 1]);
$handsel['htype'] = 'user_info';
$handsel['htype_cn'] = '完善基本资料';
$handsel['points'] = $user_info_point;
$this->memberHandselRepository->addNew($handsel);
$verified_mobile_point = $this->taskRepository->getPoint(['utype' => 2, 't_alias' => 'verified_mobile', 'status' => 1]);
$handsel['htype'] = 'verified_mobile';
$handsel['htype_cn'] = '验证手机';
$handsel['points'] = $verified_mobile_point;
$this->memberHandselRepository->addNew($handsel);
$points = $verified_mobile_point + $user_info_point + $reg_point;
$this->memberPointRepository->addNew(['uid' => $member->id, 'utype' => 2, 'points' => $points]);
//发送短信
$this->smsService->sendSms(
$data['telephone'],
Smser::TEMPLATE_SMS_QUICK_REGISTER,
[
'sitename' => subsite_config('aix.system.site.site.site_name'),
'username' => $data['telephone'],
'password' => substr($data['id_card'], -6)
]);
DB::commit();
return true;
} catch (\Exception $e) {
DB::rollback();
return false;
}
} else {
$resume_data['uid'] = $data['uid'];
$resume = $this->ResumeRepository->resumeAdd($resume_data);
$subsiteDefault = [
'subsite_id' => get_subsite_id(),
'resume_id' => $resume->id
];
SubsiteResume::insert($subsiteDefault);
//发送短信
$this->smsService->sendSms(
$data['telephone'],
Smser::TEMPLATE_SMS_QUICK_REGISTER,
[
'sitename' => subsite_config('aix.system.site.site.site_name'),
'username' => $data['telephone'],
'password' => substr($data['id_card'], -6)
]);
if ($resume) {
return true;
} else {
return false;
}
}
}
public function resumeTpl($user, $resume_id)
{
if (empty($resume_id)) {
throw new ResponseException('简历不存在!');
}
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($resume_id, $array_id)) {
throw new ResponseException('简历不存在!');
}
$resume = $this->ResumeRepository->find($resume_id);
if (!$resume) {
throw new ResponseException('简历不存在!');
}
$tpl = $this->personTplRepository->getTplByUid(['uid' => $user->id]);
return ['tpl' => $tpl, 'resume_tpl' => $resume->tpl];
}
public function resumeTplUpdate($resume_id, $tpl, $user)
{
if (empty($resume_id)) {
throw new ResponseException('简历不存在!');
}
$res = Resume::where(['uid' => $user->id])->get()->toArray();
$array_id = array_column($res, 'id');
if (!in_array($resume_id, $array_id)) {
throw new ResponseException('简历不存在!');
}
if (empty($tpl)) {
throw new ResponseException('模版不存在!');
}
if (!$this->memberLogRepository->createLog(auth('web-member')->user(), 2007, [$resume_id, $tpl])) {
throw new \Exception("日志记失败!");
}
return $this->ResumeRepository->update(['tpl' => $tpl], $resume_id);
}
public function incrementTplPoints($user, $input)
{
if (empty($input['tplid'])) {
throw new ResponseException('请选择模版!');
}
if (empty($input['payment_name']) || $input['payment_name'] != 'points') {
throw new ResponseException('请选择积分兑换!');
}
$tpl = $this->tplRepository->find($input['tplid']);
if (!$tpl) {
throw new ResponseException('简历模版不存在!');
}
$POINTS = $this->memberPointRepository->getPointsById($user->id, $user->utype);
if ($POINTS) {
if ($POINTS->points < $tpl->price) {
throw new ResponseException('积分不足!', '', 400);
}
} else {
throw new ResponseException('积分不存在!', '', 400);
}
$personTpl = $this->personTplRepository->getTpl(['uid' => $user->id, 'tplid' => $input['tplid']]);
if ($personTpl) {
throw new ResponseException('该模版已经购买!', '', 400);
}
DB::beginTransaction();//检查数据库事务
try {
$this->personTplRepository->create(['uid' => $user->id, 'tplid' => $input['tplid']]);
MembersPoint::where(
['uid' => $user->id, 'utype' => $user->utype]
)->decrement('points', $tpl->price);
MembersHandsel::create(
['uid' => $user->id, 'utype' => $user->utype, 'htype' => '', 'htype_cn' => '简历模版', 'operate' => 2, 'points' => $tpl->price]
);
$order = new Order();
$order->uid = $user->id;
$order->utype = $user->utype;
$order->order_type = 5;
$order->pay_type = 1;
$order->is_pay = 2;
$order->amount = $tpl->points / config('aix.system.site_other.site_other.points_match');
$order->pay_points = $tpl->price;
$order->payment = 'points';
$order->payment_cn = '积分';
$order->discount = '简历模版';
$order->service_name = $tpl->name;
$order->description = '购买服务:简历模板(' . $tpl->name . ')';
$order->payment_time = time();
$input['uid'] = $user->id;
$input['utype'] = $user->utype;
$order->charge = json_encode($input);
$order->save();
$PayService = new PayService();
$order->oid = $PayService->getTradeNo($order->id);
$order->save();
DB::commit();
return ['code' => 1, 'info' => '兑换成功!'];
} catch (\Exception $e) {
DB::rollback();
return ['code' => 0, 'info' => $e->getMessage()];
}
}
public function incrementTplPay($user, $input, $route)
{
$tplid = intval($input['tplid']);
if (empty($tplid)) {
throw new ResponseException('模板文件丢失!');
}
$tpl = $this->tplRepository->find($tplid);
if (!$tpl) {
throw new ResponseException('模板文件丢失!');
}
$personTpl = $this->personTplRepository->getTpl(['uid' => $user->id, 'tplid' => $tplid]);
if ($personTpl) {
throw new ResponseException('该模板已购买过!');
}
$paymenttpye = $this->paymentService->returnPayment($input['payment_name']);
if (!$paymenttpye) {
throw new ResponseException('支付方式错误!');
}
if (is_weixin()) {
$type = 'wap';
} else {
if (strpos($route->uri, 'mobile') !== false) {
$type = 'wap';
} else {
if ($input['payment_name'] == 'wechat') {
$type = 'scan';
} else {
$type = 'web';
}
}
}
$order = new Order();
$order->pay_type = 2;
$order->amount = $input['amount'];
$order->pay_points = 0;
$is_deductible = '支付金额:' . $input['amount'] . '元';
$order->description = '购买服务:简历模板(' . $tpl->name . ')' . $is_deductible;
$order->discount = '简历模板';
$order->service_name = $tpl->name;
$order->order_type = 5;
$order->pay_amount = $input['amount'];
$order->payment = $input['payment_name'];
if ($input['payment_name'] == 'alipay') {
$order->payment_cn = '支付宝';
} elseif ($input['payment_name'] == 'wechat') {
$order->payment_cn = '微信';
} else {
$order->payment_cn = '线下转账';
}
$input['uid'] = $user->id;
$input['utype'] = $user->utype;
$order->charge = json_encode($input);
$order->uid = $user->id;
$order->utype = $user->utype;
$order->save();
$tradeNo = $this->payService->getTradeNo($order->id);
$payOrder = new PayOrder();
$payOrder->trade_no = $tradeNo;
$payOrder->subject = '简历模板';
$payOrder->detail = $order->description;
$payOrder->price = $input['amount'];
$payOrder->callback = "App\Services\Common\OrderService.incrementPersonTplUpdate";
if ($type == 'web') {
$payOrder->return_url = route('person.resume');
}
if ($type == 'wap') {
if ($input['payment_name'] == 'wechat') {
$payOrder->return_url = route('mobile.common.orderWechat', ['oid' => $payOrder->trade_no]);
} else {
$payOrder->return_url = route('mobile.person.resume');
}
}
$result = $this->payService->pay($input['payment_name'], $type, $payOrder);
$order->oid = $payOrder->trade_no;
if ($user->email) {
$this->emailService->sendMail($user->email, EmailService::TEMPLATE_MAIL_ORDER, [], ['oid' => $order->oid, 'paymenttpye' => $order->payment_cn, 'amount' => $order->amount, 'sitedomain' => route('person.index')]);
}
$order->save();
if ($input['payment_name'] == 'wechat') {
if ($type == 'wap') {
return [
'code' => 'wechat',
'tradeCode' => $result,
'type' => $type
];
} else {
return [
'code' => 'wechat',
'tradeCode' => get_qrcode_html($result->code_url),
'tradeNo' => [
'number' => $payOrder->trade_no,
],
'type' => $type
];
}
} elseif ($input['payment_name'] == 'alipay') {
return [
'code' => 'alipay',
'tradeCode' => $result,
];
} else {
return [
'code' => 'offline',
'tradeNo' => $tradeNo
];
}
}
public function resumeDisplay($display, $id, $user)
{
if (empty($display) && $display != 0) {
throw new ResponseException('简历状态错误!');
}
if (empty($id)) {
throw new ResponseException('简历不存在!');
}
self::isOwn($id, $user);
return $this->ResumeRepository->updateById(['display' => $display], $id);
}
public function resumeEntrustByAdmin($company_arr,$ids,$admin_name)
{
$res = $this->ResumeEntrustRepository->resumeEntrust();
if($res){
$apply_max = intval(config('aix.personal_set.per_set.per_set.apply_jobs_max'));
$apply_space = intval(config('aix.personal_set.per_set.per_set.apply_job_space'));
foreach ($res as $key=>$val) {
$num = PersonalJobsApply::where('personal_uid',$val['uid'])->where('created_at','>=',date('Y-m-d 00:00:00'))->where('created_at','<=',date('Y-m-d 23:59:59'))->count();
if($num >= intval($apply_max/2)){
continue;
}
$array = string_to_array(['.',','], $val['resumes']['intention_jobs_id']);
$nuk = 2;
$inter_array = [];
foreach ($array as $k1=>$v1) {
if($k1==$nuk && !empty($v1)){
$inter_array[] = $v1;
$nuk = $nuk+3;
}
}
$jobs_id = array_unique($inter_array);
if($jobs_id){
if($apply_space>0){
$personalJobsApply = PersonalJobsApply::where('resume_id',$val['resume_id'])->where('created_at','>=',date('Y-m-d H:i:s', strtotime("-{$apply_space} day")))->where('created_at','<=',date('Y-m-d H:i:s', strtotime("{$apply_space} day")))->get()->toArray();
}else{
$personalJobsApply = PersonalJobsApply::where('resume_id',$val['resume_id'])->get()->toArray();
}
$job_array_id = [];
if(!empty($personalJobsApply)){
$job_array_id = array_column($personalJobsApply,'jobs_id');
}
$jobs = Jobs::whereIn('subclass', $jobs_id)->where('valid',1)
->where('display',1)->whereIn('audit', getJobsStatus())->whereIn('company_id', $company_arr)->whereNotIn('id', $job_array_id)->orderBy('updated_at', 'desc')->get()->toArray();
if($jobs){
if($apply_max>0){
foreach ($jobs as $key1=>$val1) {
if($num >= intval($apply_max/2)){
break;
}else{
$num++;
PersonalJobsApply::create([
'resume_id'=>$val['resume_id'],
'resume_name'=>$val['resumes']['title'],
'personal_uid'=>$val['resumes']['uid'],
'jobs_id'=>$val1['id'],
'jobs_name'=>$val1['jobs_name'],
'company_id'=>$val1['company_id'],
'company_name'=>$val1['company_name'],
'is_apply'=>2,
]);
$info['talents_id'] = $ids;
$info['log_class'] = 7;//日志类型
$info['content'] = $admin_name . "向‘" . $val1['company_name'] . "’企业推送了此人才简历,推送成功";
$info['log_time'] = time();
$info['auth_man'] = $admin_name;
PersonalTalentsLog::create($info);
}
}
}
}
}
}
}
return true;
}
//验证是否是自己的简历
public function isOwn($resume_id, $user)
{
$resume = $this->ResumeRepository->getOneResume(['id' => $resume_id]);
if (!$resume) {
throw new ResponseException('简历不存在!');
}
if ($resume->uid != $user->id) {
throw new ResponseException('对不起,您只能操作自己的简历!');
}
}
}