categoryService = $categoryService;
$this->resumeService = $resumeService;
$this->feedbackService = $feedbackService;
$this->taskService = $taskService;
$this->commonTaskService = $commonTaskService;
$this->reportService = $reportService;
$this->membersSetmealService = $membersSetmealService;
$this->jobsService = $jobsService;
$this->companyService = $companyService;
$this->companyDownResumeService = $companyDownResumeService;
$this->paymentService = $paymentService;
$this->setmealIncrementsService = $setmealIncrementsService;
$this->memberPointService = $memberPointService;
$this->memberHandselService = $memberHandselService;
$this->serviceService = $serviceService;
$this->orderService = $orderService;
$this->payService = $payService;
$this->hotWordService = $hotWordService;
$this->searchService = $searchService;
$this->memberSetmealRepository=$memberSetmealRepository;
$this->emailService=$emailService;
$this->resumeRepository=$resumeRepository;
}
public function index(Request $request)
{
$search_type = $request->input('search_type', 'resume');
$citycategory = $request->input('citycategory');
$param_array = array('jobcategory','citycategory','resumetag','experience','sex','age','trade','major','education','nature','wage','settr','key', 'sort', 'photo','mobile_audit');
$params= array();
$hidden_all_result = 0;
$show_login_notice = 0;
$where = array();
if ($request->all()) {
foreach ($request->all() as $k => $v) {
if (in_array($k, $param_array) && $v) {
$params[$k] = $v;
}
}
}
$show_filter = false;
$filter_array = array('sort', 'photo','mobile_audit');
if ($params && (count($params) <= count($filter_array))) {
foreach ($params as $k => $v) {
if (!in_array($k, $filter_array)) {
$show_filter = true;
break;
}
}
} elseif (count($params) > count($filter_array)) {
$show_filter = true;
}
session(['hotword_show_type' => 3]);
$hotWords = $this->hotWordService->getHotWords(array(), 'list_order desc,w_hot desc', '27');
$resume_hotwords = array_slice($hotWords->toArray(), 0, 10);
$district_info = $this->categoryService->getDefaultDistrictInfo(); //获取默认地区信息
$citys = $this->categoryService->getCitys($citycategory); //获取地标地区
//获取分类信息
$filter_where = array(
'AIX_resumetag' => 100, //简历标签
'AIX_experience' => 100, //工作经验
'AIX_age' => 100, //年龄
'AIX_trade' => 100, //行业类别
'AIX_education' => 100, //学历
'AIX_jobs_nature' =>100, //工作性质
'AIX_wage' => 100, //薪资
);
$categories = $this->categoryService->getCategories($filter_where);
$major_categories = $this->categoryService->getMajorCategory(); //专业分类
$major_info = null;
if ($request->input('major')) {
$major_info = $this->categoryService->getMajorInfo($request->input('major'));
}
$job_category = $this->categoryService->getJobsCategoryInfo(); //职位分类
//组合查询条件
$order_by = array('stime'=>'desc', 'updated_at'=>'desc');
$search_key = '';
$limit = '';
if ($params) {
foreach ($params as $k => $v) {
if ($k == 'citycategory') {
$where[] = array('district','=',$citys['select']['id']);
} elseif ($k == 'jobcategory') {
if ($job_category && $v && array_get($job_category['spell'], $v)) {
$where[] = array('intention_jobs_id','=',$job_category['spell'][$v]['id']);
}
} elseif ($k == 'resumetag') {
$where[] = array('tag', '=',$v);
} elseif ($k =='age') {
$age_info = $this->resumeService->dealAge($v);
if ($age_info) {
if (array_get($age_info, 'min_age')) {
$where[] = array('birthdate', '>=',$age_info['min_age']);
}
if (array_get($age_info, 'max_age')) {
$where[] = array('birthdate', '<=',$age_info['max_age']);
}
}
} elseif ($k =='wage') {
//获取期望薪资最大值和最小值
if ($categories) {
$wage = $categories['AIX_wage'][$params['wage']]['origin_demand'];
if ($wage) {
$wage = format_wage($wage);
}
$wage_arr = explode_wage($wage);
$where[] = $wage_arr[0];
$where[] = $wage_arr[1];
}
} elseif ($k =='settr') {
$update_time = date('Y-m-d H:i:s', strtotime(date('Y-m-d', strtotime('-'.$v.' day'))));
$where[] = array('updated_at', '>=',$update_time);
} elseif ($k =='photo') {
$where[] = array('photo', '=',$v);
$where[] = array('photo_audit', '=',2);
$where[] = array('member_infos.display_images', '=',1);
} elseif ($k !='sort' && $k !='key') {
$where[] = array($k,'=',$v);
}
}
if (array_has($params, 'sort')) {
if ($params['sort'] == 'rtime') {
$order_by = 'updated_at';
} else {
$order_by = $params['sort'];
}
} else {
$order_by = array('stime'=>'desc', 'updated_at'=>'desc');
}
$search_key = array_has($params, 'key')?$params['key']:'';
}
if (config('aix.personal_set.per_set.show_set.resume_display')=='1') {
$where[] = array('audit','=','2');
} else {
$where[] = array('audit','<>','0');
}
$where[] = array('display','=',1);
$where[] = array('subsite_ids','=',get_subsite_id());
if (config('aix.personal_set.serch_set.search_base_set.resume_search_login')==1 && !auth('web-company')->check() && !auth('web-member')->check()) {
$need_login_params = $param_array;
unset($need_login_params[array_search('key', $need_login_params)]);
foreach ($params as $k => $v) {
if (in_array($k, $need_login_params) && $v) {
//跳转到登录页面
return redirect(route('mobile.login'));
$hidden_all_result = 1;
$where[] = array('id','=',0); //设置该条件使查询结果为空
break;
}
}
$limit = config('aix.personal_set.serch_set.search_base_set.resume_search_num_login');
$show_login_notice = 1;
}
$size = 20;
$list = $this->searchService->search('Resume', $where, $order_by, $search_key, $size);
if ($list->total()>0) {
$list_items = $this->resumeService->dealResumeFields($list->items());
} else {
$list_items = array();
}
$mobile_dropload = false;
if ($list->total() > $size) {
$mobile_dropload = true;
}
if ($request->ajax()) {
if ($list->lastPage() < $list->currentPage()) {
return response()->json(['status'=>0]);
}
return response()->json(['status'=>1,'data'=>view('mobile.app.content.resume.ajax_resume_list', ['params'=> $params,'list_items'=> $list_items])->render()]);
}
$return_data = array(
'search_type' => $search_type,
'city' => $citys,
'params' => $params,
'categories' => $categories,
'district_info' => $district_info,
'major_categories' => $major_categories,
'major_info' => $major_info,
'job_category' => $job_category,
'show_login_notice' => $show_login_notice,
'hidden_all_result' => $hidden_all_result,
'hotWords' => $hotWords,
'resume_hotwords' => $resume_hotwords,
'list_items' => $list_items,
'list' => $list,
'limit' => $limit,
'mobile_dropload' => $mobile_dropload,
'current_url' => \Illuminate\Support\Facades\Request::getRequestUri(),
'wap_title' => '招人才',
'show_filter' => $show_filter
);
return view('mobile.app.content.resume.index', $return_data);
}
public function category()
{
$serch_type = null;
$district_info = $this->categoryService->getDefaultDistrictInfo();
$job_cates = $this->categoryService->getJobsCategories();
$citys = $this->categoryService->getCitys();
session(['hotword_show_type' => 3]);
$resume_hotwords = $this->hotWordService->getHotWords(array('type'=>3), 'list_order desc,w_hot desc', '10');
$return_data = array(
'search_type' => $serch_type,
'city' => $citys,
'district_info' => $district_info,
'job_cates' => $job_cates,
'resume_hotwords' => $resume_hotwords
);
return view('app.content.resume.category', $return_data);
}
//简历预览页面
public function show(Request $request)
{
//招聘会收到简历用到,直接显示,不提示下载
$type = $request->type ? $request->type : 0;
$res = $this->resumeService->resumeShow($request->input('id'), $request->input('jobs_id', ''), $this->getUser(),$type);
if (array_has($res, 'status') && $res['status']==0) {
$back_url = \Illuminate\Support\Facades\URL::previous();
return $this->showMessage($res['msg'], $back_url, true, '上一页', '3');
}
$this->putSeoData('resume', $res['resume']);
return view('mobile.app.content.resume.show', ['content'=>$res,'resume'=>$res['resume'],'user'=> $this->getUser(),'type'=>$type,'wap_title'=>'简历主页']);
}
public function getUser()
{
$user = array();
if (auth('web-member')->check()) {
$user = auth('web-member')->user();
} elseif (auth('web-company')->check()) {
$user = auth('web-company')->user();
}
return $user;
}
//增加简历点击量
public function click(Request $request)
{
$id = $request->input('id');
$rst = $this->resumeService->incrementData(array('id'=>$id), 1, 'click');
$data = array('status'=>0);
if ($rst) {
$data = array('status'=>1);
}
return response()->json($data);
}
//导出word简历
public function docExport(Request $request)
{
if (!auth('web-company')->check() && !auth('web-member')->check()) {
if ($request->ajax()) {
//弹出登陆页面
$data = array('status'=>0,'msg'=>'请登录!');
return response()->json($data);
}
return redirect("/auth/login");
}
$resume_id = $request->input('id');
return $this->resumeService->saveDocResume($resume_id);
}
//收藏简历
public function favorResume(Request $request)
{
$resume_id = $request->input('rid');
$return_data = $this->resumeService->favorResume($resume_id, $this->getUser());
return response()->json($return_data);
}
//举报简历
public function reportResume(Request $request)
{
$resume_id = intval($request->input('resume_id', 0));
if (!$resume_id) {
throw new ResponseException('请选择要投诉的简历!');
}
$taskInfo = $this->taskService->getTask('1', 'report_resume'); //举报积分信息
$report_types = $this->reportService->getReportTypes('2');
$page_data = array('type_arr'=>$report_types,'resume_id'=>$resume_id,'taskInfo'=>$taskInfo);
$html = view('app.common.ajax.report_resume', $page_data)->render();
$return_data = array( 'status'=>1, 'html' => $html);
return response()->json($return_data);
}
public function addReportResume(Request $request)
{
$report_type = intval($request->input('report_type', '1'));
$resume_id = intval($request->input('resume_id', 0));
if (!$resume_id) {
throw new ResponseException('请选择要投诉的简历!');
}
$data['resume_id'] = $resume_id;
$data['report_type'] = $report_type;
$report_data = array(
'utype' => 2,
'utype_id' => $resume_id,
'type_id' => $report_type,
'phone' => '',
'content' => '',
'audit' => 1
);
$rst = $this->reportService->addReport($report_data);
if ($rst) {
//添加会员日志
$user_info = array(
'uid' => auth('web-company')->user()->id,
'utype' =>1,
'username' => auth('web-company')->user()->username,
'ip' => ip2long($request->getClientIp()),
'log_address'=>'本机地址'
);
$this->feedbackService->addMembersLog($user_info, '1032', $resume_id);
$return_data = array( 'status'=>1, 'msg' => '投诉成功!请等待管理员核实!');
return response()->json($return_data);
} else {
throw new ResponseException('投诉失败!');
}
}
//在线支付简历下载
public function payResume(Request $request)
{
$resume_id = $request->input('resume_id');
if (!$resume_id) {
$back_url = \Illuminate\Support\Facades\URL::previous();
return $this->showMessage('请选择简历!', $back_url, true, '上一页', '3');
}
$resume_id = is_array($resume_id)?$resume_id:explode(",", $resume_id);
$resume_num =count($resume_id);
$user = auth('web-company')->user();
//微信、支付宝在线支付,调起支付接口
$is_deductible = 0;
$deductible = 0;
$increment_info['name'] = '简历下载';
$increment_info = (object)$increment_info;
$params['resume_id'] = $resume_id;
$params['type'] = 'resume_download';
//$params = $params;
$member_setmeal = $this->membersSetmealService->getUserSetmeal($user, '1');
$member_point = $this->companyService->getPoint($user->id, 1);
$payment_name = $request->input('payment_name', '');
$need_cash_resume = config('aix.companyset.comsume.comsume_set.download_resume_price')*$resume_num;
return $this->callCashPay($resume_id, $member_setmeal, $member_point, $increment_info, 14, $payment_name, $need_cash_resume, $is_deductible, $deductible, '', $params);
}
//下载简历增值包
public function downloadResume(Request $request)
{
$resume_id = $request->input('rid');
if (!$resume_id) {
return response()->json(['status'=>0, 'msg'=>'请选择简历!']);
}
$rid = is_array($resume_id)?$resume_id:explode(",", $resume_id);
$resume_num =count($rid);
$user = auth('web-company')->user();
$member_setmeal = $this->membersSetmealService->getUserSetmeal($user, '1');
$member_point = $this->companyService->getPoint($user->id, 1); //获取会员积分
if ($request->method() == 'POST') {
$payment_name = $request->input('payment_name', '');
if ($payment_name) {
/*//微信、支付宝在线支付,调起支付接口
$is_deductible = intval($request->input('is_deductible', 0));
$deductible = intval($request->input('deductible', 0));
$increment_info['name'] = '简历下载';
$increment_info = (object)$increment_info;
$params['resume_id'] = $rid;
$params['type'] = 'resume_download';
$params = $params;
$need_cash_resume = config('aix.companyset.comsume.comsume_set.download_resume_price')*$resume_num;
return $this->callCashPay($resume_id, $member_setmeal, $member_point, $increment_info, 14, $payment_name, $need_cash_resume, $is_deductible, $deductible, '', $params);*/
} else {
$addarr['rid'] = $rid;
$isHas=$this->resumeRepository->getAuditCount(['id'=>$rid]);
if (empty($isHas)){
return response()->json(['status'=>0,'msg'=>'请选择简历!']);
}
$rst = $this->companyDownResumeService->addDownResume($addarr, $user, $member_setmeal);
if (array_get($rst, 'status')==1) {
if ($resume_num == 1) {
if ($member_setmeal->download_resume > 0) {
$this->membersSetmealService->actionUserSetmeal($user->id, 'download_resume', 2); //修改会员套餐信息中的下载简历数量
$log_value = '下载简历【'.array_get($rst, 'msg')->resume_name.'】(简历id:'.$addarr['rid'][0].'),消耗简历下载数:1,套餐剩余:'.($member_setmeal->download_resume-1);
} else {
//修改会员积分
$this->memberPointService->reportDeal($user->id, 1, 2, config('aix.companyset.comsume.comsume_set.download_resume_price')*config('aix.companyset.points.points_set.payment_rate')*$resume_num);
//添加积分操作日志
$stime = date('Y-m-d H:i:s', time());
$handsel['uid'] = $user->id;
$handsel['utype'] = 1;
$handsel['htype'] = 'down_resume';
$handsel['htype_cn'] = '下载简历';
$handsel['operate'] = 2;
$handsel['points'] = config('aix.companyset.comsume.comsume_set.download_resume_price')*config('aix.companyset.points.points_set.payment_rate')*$resume_num;
$handsel['created_at'] = $stime;
$handsel['updated_at'] = $stime;
$this->memberHandselService->createLog($handsel);
$log_value = '下载简历【'.array_get($rst, 'msg')->resume_name.'】(简历id:'.$addarr['rid'][0].'),消耗积分:'.$handsel['points'];
}
//添加会员日志
$member_log = array(
'uid' =>$user->id,
'utype' =>1,
'username' => $user->username,
'ip' => ip2long($request->getClientIp()),
'log_address'=>'本机地址'
);
$this->feedbackService->addMembersLog($member_log, '1012', $log_value);
}
}
return response()->json($rst);
}
} else {
//判断是否开通会员服务
if (!$member_setmeal) {
return response()->json(['status'=>0, 'msg'=>'您还没有开通服务,请开通!']);
}
//判断服务是否到期
if ($member_setmeal->expire == 1) {
return response()->json(['status'=>0, 'msg'=>'您的服务已经到期,请重新开通!']);
}
//后台简历下载设置判断
if (config('aix.personal_set.per_set.resume_download_set.down_resume_limit') == 1) {
//判断企业是否有通过审核的职位(已登录且有发布职位的企业)
$jobs_num = $this->jobsService->getAuditJobsNum($user->id);
if ($jobs_num==0) {
return response()->json(['status'=>0, 'msg'=>'你没有发布职位或职位审核未通过导致无法下载简历!']);
}
} elseif (config('aix.personal_set.per_set.resume_download_set.down_resume_limit') == 3) {
//判断是否是认证企业(已认证企业)
$company_info = $this->companyService->companyInfo($user);
if ($company_info['companyInfo'] && $company_info['companyInfo']->audit != 1) {
return response()->json(['status'=>0, 'msg'=>'你的营业执照未通过认证导致无法下载简历!']);
}
}
if ($member_setmeal->download_resume_max > 0) { //判断当天简历下载数量是否已达上限
$downwhere = array(
array('down_addtime','>=',strtotime('today')),
array('down_addtime','<',strtotime('tomorrow')),
array('company_uid','=',$user->id)
);
$downnum = $this->companyDownResumeService->getCompanyDownResumeNum($downwhere); //获取当天企业已下载简历数
if ($resume_num>1 && $resume_num+$downnum > $member_setmeal->download_resume_max && $downnum < $member_setmeal->download_resume_max) {
return response()->json(['status'=>0, 'msg'=>'您今天剩余的下载简历数量不足,请选择单个简历下载!']);
} elseif ($downnum>= $member_setmeal->download_resume_max) {
return response()->json(['status'=>0, 'msg'=>'您今天已下载 '.$downnum.' 份简历,已达到每天下载上限,请先收藏该简历,明天继续下载。']);
}
}
$points = 0;
if ($member_point) {
$points = $member_point->points;
}
$mode = 'setmeal';
if (config('aix.companyset.comsume.comsume_set.resume_download_quick') == 1) { //是否开启简历快捷消费
if ($member_setmeal->download_resume == 0) {
$mode = 'pay';
//判断下载简历是否可使用积分
if (config('aix.companyset.comsume.comsume_set.down_resume_by_points') == 1) {
if ($points >= config('aix.companyset.comsume.comsume_set.download_resume_price')*config('aix.companyset.points.points_set.payment_rate')*$resume_num) { //积分数量不够
$mode = 'points';
}
}
}
} else {
if ($member_setmeal->download_resume == 0) { //套餐中简历下载数已用完
return response()->json(['status'=>0, 'msg'=>'您套餐中剩余的下载简历数量不足,请升级套餐后继续下载!']);
}
}
$free_time = 0;
$need_cash = 0;
$view_data = array();
if ($mode=='setmeal') {
$free_time = $member_setmeal->download_resume;
$view_data['free_time'] = $free_time;
} else if ($mode=='points') {
$need_points = intval(config('aix.companyset.points.points_set.payment_rate')*config('aix.companyset.comsume.comsume_set.download_resume_price'))*$resume_num;
$view_data['need_points'] = $need_points;
} else {
$need_cash = config("aix.companyset.comsume.comsume_set.download_resume_price")*$resume_num;
$view_data['need_cash'] = $need_cash;
}
$view_data['mypoints'] = $points;
$view_data['resume_num'] = $resume_num;
$view_data['resume_id'] = implode(",", $rid);
$view_data['uid'] = $user->id;
$view_data['is_free'] = $member_setmeal->is_free;
$view_data['my_setmeal'] = $member_setmeal;
$view_data['to_detail'] = $request->input('to_detail', '');
$max_discount = $this->setmealIncrementsService->getMaxDiscount('download_resume');
$view_data['max_discount'] = $max_discount?$max_discount:0;
$view_data['mode'] = $mode;
$html = view('mobile.app.content.resume.ajax_resume_download', $view_data)->render();
$return_data = array( 'status'=>1, 'html' => $html,'params'=>$view_data);
return response()->json($return_data);
}
}
//简历下载增值包信息
public function incrementAdd($member_setmeal, $cat = 'download_resume')
{
$where_in = array('alipay', 'wechat');
$payment = $this->paymentService->getPayment($where_in);
if ($payment->toArray()) {
$return_data['payment'] = $payment;
} else {
$return_data['payment'] = array();
}
$return_data['cat'] = $cat;
//企业信息
$max_discount = $this->setmealIncrementsService->getMaxDiscount($cat);
$return_data['max_discount'] = $max_discount?$max_discount:0;
//简历下载增值包:处理增值包不同会员的价格显示(普通会员、VIP会员 按照会员最低折扣率计算)
$increment_arr = $this->setmealIncrementsService->getIncrementArr($member_setmeal, $cat);
$return_data['increment_arr'] = $increment_arr;
$return_data['buy'] = $cat;
$return_data['buy_cn'] = '';
$return_data['payment_rate'] = config('aix.companyset.points.points_set.payment_rate'); //充值比例
return $return_data;
}
//积分兑换简历增值包(添加增值包订单)
public function incrementSave(Request $request)
{
$cat = $request->input('service_type', 'download_resume');
$order_pay_type = 6;
$payment_name = $request->input('payment_name', '');
$pay_type = $request->input('pay_type', 'points');
$project_id = $request->input('project_id', 0);
$is_deductible = $request->input('is_deductible', 0);
$resume_id = $request->input('resume_id', 0);
if ($is_deductible==0) {
$deductible = 0;
} else {
$deductible = floatval($request->input('deductible', ''));
}
$amount = floatval($request->input('amount', ''));
if ($amount==0) {
$pay_type = 'points';
}
if ($project_id==0) {
$return_data = array( 'status'=>0, 'msg' => '请选择增值包套餐!');
return response()->json($return_data);
}
$user = auth('web-company')->user();
$my_setmeal = $this->membersSetmealService->getUserSetmeal($user, '1'); //会员套餐信息
$my_point = $this->companyService->getPoint($user->id, 1); //获取会员积分信息
$increment_info = $this->setmealIncrementsService->getIncrement($project_id); //获取所选简历增值包信息
$my_discount = $this->setmealIncrementsService->getIncrementDiscountByArray($cat, $my_setmeal); //套餐折扣
$service_need_cash = $my_discount > 0 ?round($increment_info->price*$my_discount/10, 2):$increment_info->price; //增值包套餐金额
if ($pay_type=='points') { //积分支付
$service_need_points = round($service_need_cash*config('aix.companyset.points.points_set.payment_rate')); //增值包套餐所需积分
if ($my_point->points < $service_need_points) {
return array( 'status'=>0, 'msg' => '积分不足,请使用其他方式支付!');
}
//操作事务开始
DB::beginTransaction();//检查数据库事务
try {
//会员套餐添加增值包数量
$setmeal_rst = $this->membersSetmealService->actionUserSetmeal(array('uid'=>$user->id, 'utype'=>1), $cat, 1, $increment_info->value);
if (!$setmeal_rst) {
throw new \Exception('修改会员套餐失败!');
}
$description1 = '购买服务:'.$increment_info->name.';积分支付:'.$service_need_points.'积分';
$stime = time();
//添加订单信息
$order = $this->orderService->addOrder($user, $order_pay_type, $service_need_cash, 0, $service_need_points, $increment_info->name, $payment_name, '积分支付', $description1, 2, 0, $project_id, $stime, '', '专享'.$my_discount.'折优惠');
if (!$order) {
throw new \Exception('生成订单失败!');
}
$oid = $this->payService->getTradeNo($order->id);//订单号
if (!$this->serviceService->updateOid($order->id, $oid)) {
throw new \Exception('生成订单号失败!');
}
//会员日志:添加创建增值服务订单日志
$log_rst1 = $this->serviceService->writeMembersLog($user, '9001', array($oid,'积分兑换',''));
//修改会员积分
$p_rst = $this->memberPointService->reportDeal($user->id, 1, 2, $service_need_points);
if ($p_rst === false) {
throw new \Exception('修改会员积分失败!');
}
//会员日志 - 添加支付订单日志、添加开通增值服务日志
$log_rst2 = $this->serviceService->writeMembersLog($user, '9001', array($oid,'积分兑换',''));
$log_rst3 = $this->serviceService->writeMembersLog($user, '9002', array($increment_info->name,'积分兑换',''));
//添加会员积分日志
$stime = date('Y-m-d H:i:s', $stime);
$handsel['uid'] = $user->id;
$handsel['utype'] = 1;
$handsel['htype'] = 'down_resume';
$handsel['htype_cn'] = '下载简历';
$handsel['operate'] = 2;
$handsel['points'] = $service_need_points;
$handsel['created_at'] = $stime;
$handsel['updated_at'] = $stime;
$point_rst = $this->serviceService->writeMemberHandselLog($handsel);
DB::commit();
} catch (\Exception $e) {
DB::rollback();
return array( 'status'=>0, 'msg' => $e->getMessage());
}
return array( 'status'=>1, 'msg' => '积分兑换成功!','data'=>array('oid'=>$oid,'order_id'=>$order->id));
} else {
if ($is_deductible==1 && $my_point->points<$deductible) {
return array( 'status'=>0, 'msg' => '积分不足,请使用其他方式支付!');
}
return $this->callCashPay($resume_id, $my_setmeal, $my_point, $increment_info, $order_pay_type, $payment_name, $service_need_cash, $is_deductible, $deductible, '', '', 0, $project_id, '专享'.$my_discount.'折优惠');
}
}
//现金支付
public function callCashPay($resume_id, $my_setmeal, $my_point, $increment_info, $order_pay_type, $payment_name = '', $amount = '0.0', $is_deductible, $deductible = 0, $description = '', $params = '', $points = 0, $stemeal = 0, $discount = '')
{
$is_weixin = false;
if ($payment_name == 'wechat_official') {
$is_weixin = true;
$payment_name = 'wechat';
}
//获取支付方式
$paymenttpye = $this->paymentService->returnPayment($payment_name);
if (!$paymenttpye) {
return array( 'status'=>0, 'msg' => '支付方式错误!');
}
if ($my_point->points < $deductible) {
return array( 'status'=>0, 'msg' => '积分不足,请使用其他方式支付!');
}
if ($is_deductible==0) {
$deductible = 0;
}
if ($deductible>0) {
$m_amount = $amount- floatval($deductible/config('aix.companyset.points.points_set.payment_rate'));
} else {
$m_amount = $amount;
}
$paysetarr['ordtotal_fee']=$m_amount;
if ($description=='') {
$description = '购买服务:'.$increment_info->name;
}
$description .= ';'.$paymenttpye->name.$paysetarr['ordtotal_fee'].'元';
if ($deductible>0) {
$description .= ';积分支付:'.$deductible.'积分';
}
$stime = time();
$user = auth('web-company')->user();
//生成订单
$order = $this->orderService->addOrder($user, $order_pay_type, $amount, $paysetarr['ordtotal_fee'], $deductible, $increment_info->name, $payment_name, $paymenttpye->name, $description, 1, $deductible, $stemeal, 0, serialize($params), $discount);
$tradeNo = $this->payService->getTradeNo($order->id);
if (!$this->serviceService->updateOid($order->id, $tradeNo)) {
throw new ResponseException('生成订单号失败!');
}
if($user->email){
$this->emailService->sendMail($user->email, EmailService::TEMPLATE_MAIL_ORDER, [], ['oid'=>$tradeNo,'paymenttpye'=>$paymenttpye->name,'amount'=>$amount,'sitedomain'=>route('com.index')]);
}
$type = 'wap';
if ($is_weixin) {
$type = 'official';
}
//跳转路由
$load_url = 'mobile.resumes';
$url_param = array();
$rid = '';
if (is_array($resume_id)) {
if (count($resume_id) == 1) {
$rid = implode(',', $resume_id);
if ($rid) {
$load_url = "mobile.resumes.show";
$url_param = ['id' => $rid];
}
}
}
$payOrder = new PayOrder();
$payOrder->trade_no = $tradeNo;
$payOrder->subject = '购买' . $increment_info->name;
$payOrder->detail = $description;
$payOrder->price = round($m_amount, 2);
$payOrder->callback = "App\Services\Common\OrderService.orderPaid";
if ($is_weixin) {
$payOrder->openid = $this->payService->getPayOpenid();
$payment_name = 'wechat';
$result = $this->payService->pay($payment_name, $type, $payOrder);
return response()->json($result);
} else {
if ($payment_name == 'wechat') {
$payOrder->return_url = route('mobile.common.orderWechat', ['oid'=>$payOrder->trade_no,'type'=>'download_resume','rid'=>$rid]);
} else {
$payOrder->return_url= route($load_url, $url_param);
}
return $this->payService->pay($payment_name, $type, $payOrder);
}
}
//标记简历
public function resumeLabel(Request $request)
{
$rst = $this->resumeService->companyLabelResume($request);
if (array_get($rst, 'status') == 1) {
if (array_get($rst, 'task')) {
//添加任务记录
$user = auth('web-company')->user();
$user->uid = $user->id;
$r = $this->commonTaskService->doUserTask($user, 28);
}
}
return $rst;
}
//面试邀请
public function interview(Request $request)
{
$resume_id = $request->input('id', '');
$back_url = \Illuminate\Support\Facades\URL::previous();
if (!$resume_id) {
return $this->showMessage('请选择简历!', $back_url, true, '上一页', '3');
}
$user = $this->getUser();
if (!$user) {
return redirect()->route('mobile.login.company');
}
//判断是否需要下载简历(已下载或者简历公开)
if (config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') ==1) {
if (!$user) {
return redirect()->route('mobile.login.company');
}
} elseif (config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') ==2) {
//判断是否有下载记录
$down_where = array(
'resume_id' => $resume_id,
'company_uid' => $user->id
);
$down_info = $this->companyDownResumeService->getDownResume($down_where);
$mySetmeal=$this->memberSetmealRepository->getSetmealByUid($user->id,$user->utype);
//没下载过,并且我的套餐没有免费查看收到的简历
if (!$down_info && $mySetmeal->show_apply_contact==0) {
return $this->showMessage('请先下载简历!', $back_url, true, '上一页', '3');
}
}
//判断当前用户是否有在招职位
//$company = $this->companyService->companyInfo($user);
//获取企业在招职位
$job_where = array(
array('valid','=',1),
array('display','=',1),
array('company_id','=',$user->id),
);
if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
$job_where[] = array('audit','=',1);
} else {
$job_where[] = array('audit','<>',3);
}
$jobs = $this->jobsService->getAuditJobs($user->id);
if ($jobs->isEmpty()) {
return $this->showMessage('您还没有发布招职位(没有发布职位或者职位未通过审核)!', $back_url, true, '上一页', '3');
}
//获取简历信息
$resume_info = $this->resumeService->getResumeAllInfo($resume_id);
//获取申请记录
$apply = $this->resumeService->getPersonApply(['resume_id'=>$resume_id,'company_id'=>$user->id]);
$is_apply = 0;
$default_jobs = array();
if ($apply->isNotEmpty()) {
$is_apply = 1;
$apply_info = $apply[0];
$default_jobs = array(
'jobs_id' => $apply_info->jobs_id,
'jobs_name' => $apply_info->jobs_name
);
}
$return_data = array(
'resume' => $resume_info,
'jobs' => $jobs,
'company' => $user,
'is_apply' => $is_apply,
'default_jobs' => $default_jobs,
'wap_title' => '发送面试邀请',
);
return view('mobile.app.content.resume.interview', $return_data);
}
}