| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876 | 
							- <?php
 
- namespace App\Http\Controllers\Mobile\Content;
 
- use Aix\Pay\Data\PayOrder;
 
- use App\Models\Resume;
 
- use App\Repositories\MemberSetmealRepository;
 
- use App\Repositories\ResumeRepository;
 
- use App\Services\Common\EmailService;
 
- use SimpleSoftwareIO\QrCode\Facades\QrCode;
 
- use App\Http\Controllers\Mobile\MobileBaseController;
 
- use App\Services\Common\CategoryService;
 
- use App\Services\Person\ResumeService;
 
- use App\Services\Content\FeedbackService;
 
- use App\Services\Content\TaskService;
 
- use App\Services\Common\TaskService as CommonTaskService;
 
- use App\Services\Content\ReportService;
 
- use App\Services\Common\MembersSetmealService;
 
- use App\Services\Company\JobsService;
 
- use App\Services\Company\CompanyService;
 
- use App\Services\Company\CompanyDownResumeService;
 
- use App\Services\Common\PaymentService;
 
- use App\Services\Common\SetmealIncrementsService;
 
- use App\Services\Person\MemberPointService;
 
- use App\Services\Person\MemberHandselService;
 
- use App\Services\Company\ServiceService;
 
- use App\Services\Common\OrderService;
 
- use App\Services\Common\PayService;
 
- use App\Services\Common\HotWordService;
 
- use App\Services\Common\SearchService;
 
- use Illuminate\Http\Request;
 
- use App\Exceptions\ResponseException;
 
- use Illuminate\Support\Facades\DB;
 
- class ResumeController extends MobileBaseController
 
- {
 
-     protected $categoryService;
 
-     protected $resumeService;
 
-     protected $feedbackService;
 
-     protected $taskService;
 
-     protected $commonTaskService;
 
-     protected $reportService;
 
-     protected $membersSetmealService;
 
-     protected $jobsService;
 
-     protected $companyService;
 
-     protected $companyDownResumeService;
 
-     protected $paymentService;
 
-     protected $setmealIncrementsService;
 
-     protected $memberPointService;
 
-     protected $memberHandselService;
 
-     protected $serviceService;
 
-     protected $orderService;
 
-     protected $payService;
 
-     protected $hotWordService;
 
-     protected $searchService;
 
-     protected $memberSetmealRepository;
 
-     protected $emailService;
 
-     private $resumeRepository;
 
-     
 
-     public function __construct(ResumeRepository $resumeRepository,MemberSetmealRepository $memberSetmealRepository,CategoryService $categoryService, ResumeService $resumeService, FeedbackService $feedbackService, TaskService $taskService, CommonTaskService $commonTaskService, ReportService $reportService, MembersSetmealService $membersSetmealService, JobsService $jobsService, CompanyService $companyService, CompanyDownResumeService $companyDownResumeService, PaymentService $paymentService, SetmealIncrementsService $setmealIncrementsService, MemberPointService $memberPointService, MemberHandselService $memberHandselService, ServiceService $serviceService,OrderService $orderService, PayService $payService, HotWordService $hotWordService, SearchService $searchService, EmailService $emailService)
 
-     {
 
-         $this->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);
 
-     }
 
-     
 
-     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';
 
-         
 
-         $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) {
 
-                 
 
-             } 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'=>'您还没有开通服务,请<a target="_blank" href="'.route('mobile.firm.service.setmeal.add').'">开通</a>!']);
 
-             }
 
-             
 
-             if ($member_setmeal->expire == 1) {
 
-                 return response()->json(['status'=>0, 'msg'=>'您的服务已经到期,请<a target="_blank" href="'.route('mobile.firm.service.setmeal.add').'">重新开通</a>!']);
 
-             }
 
-             
 
-             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'=>'您今天已下载 <span class="txt_highlight">'.$downnum.'</span> 份简历,已达到每天下载上限,请先收藏该简历,明天继续下载。']);
 
-                 }
 
-             }
 
-             $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;
 
-         
 
-         $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');
 
-             }
 
-         }
 
-         
 
-         
 
-         
 
-         $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);
 
-     }
 
- }
 
 
  |