| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 | 
							- <?php
 
- namespace App\Http\Controllers\Web\Hardware\Aio;
 
- use App\Http\Controllers\Web\WebBaseController;
 
- use App\Services\Company\JobsService;
 
- use Illuminate\Http\Request;
 
- use App\Services\Common\CategoryService;
 
- use App\Services\Common\SearchService;
 
- use App\Services\Company\PersonalJobsApplyService;
 
- use App\Services\Person\ResumeService;
 
- class JobController extends WebBaseController
 
- {
 
-     protected $categoryService;
 
-     protected $jobsService;
 
-     protected $searchService;
 
-     protected $personalJobsApplyService;
 
-     protected $resumeService;
 
-     
 
-     public function __construct(CategoryService $categoryService, JobsService $jobsService, SearchService $searchService, PersonalJobsApplyService $personalJobsApplyService,ResumeService $resumeService)
 
-     {
 
-         $this->categoryService = $categoryService;
 
-         $this->jobsService = $jobsService;
 
-         $this->searchService = $searchService;
 
-         $this->personalJobsApplyService = $personalJobsApplyService;
 
-         $this->resumeService = $resumeService;
 
-     }
 
-     public function index(Request $request)
 
-     {
 
-         $params = array();
 
-         $param_array = array('citycategory','wage','trade','education','key');
 
-         if ($request->all()) {
 
-             foreach ($request->all() as $k => $v) {
 
-                 if (in_array($k, $param_array) && $v) {
 
-                     $params[$k] = $v;
 
-                 }
 
-             }
 
-         }
 
-         
 
-         $filter_where = array(
 
-             'AIX_wage'         => 100,      
 
-             'AIX_trade'        => 100,      
 
-             'AIX_education'    => 100       
 
-         );
 
-         $categories = $this->categoryService->getCategories($filter_where);     
 
-         
 
-         $citycategory = $request->input('citycategory', '');
 
-         $citys = $this->categoryService->getCitys($citycategory);
 
-         
 
-         $where = $this->setWhere($params, $citys);
 
-         $order_by = array('stime'=>'desc', 'refresh_time'=>'desc');
 
-         $search_key = '';
 
-         if ($params) {
 
-             $search_key = array_has($params, 'key')?$params['key']:'';
 
-         }
 
-         $list = $this->searchService->search('Job', $where, $order_by, $search_key, 6);
 
-         if ($list->total()>0) {
 
-             $list_items = $this->jobsService->dealjobFilelds($list->items());
 
-         } else {
 
-             $list_items = array();
 
-         }
 
-         $return_data = array(
 
-             'categories' => $categories,
 
-             'params'     => $params,
 
-             'arealist'   => $citys,
 
-             'list'       => $list,
 
-             'list_items' => $list_items,
 
-             'user'       => $this->getUser()
 
-         );
 
-         return view('app.hardware.aio.jobs.index', $return_data);
 
-     }
 
-     public function jobDetail($id)
 
-     {
 
-         
 
-         $job_rst = $this->jobsService->getJobInfo(array('id'=>$id), $this->getUser());
 
-         if ($job_rst['status'] == 0) {
 
-             $back_url = \Illuminate\Support\Facades\URL::previous();
 
-             return $this->showMessage($job_rst['error'], $back_url, true, '上一页', '3');
 
-         }
 
-         $job_info = $job_rst['job'];
 
-         $return_data = array(
 
-             'info' => $job_info,
 
-             'user' => $this->getUser()
 
-         );
 
-         return view('app.hardware.aio.jobs.detail', $return_data);
 
-     }
 
-     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 jobApply(Request $request)
 
-     {
 
-         
 
-         $jobs_id = $request->input('jobs_id');
 
-         $resume_id = $request->input('resume_id');
 
-         $user = $this->getUser();
 
-         if (!$jobs_id) {
 
-             $return_data = array(
 
-                 'status' => 0,
 
-                 'html'   => '请选择要投递的职位!'
 
-             );
 
-             return response()->json($return_data);
 
-         }
 
-         if (!is_array($jobs_id)) {
 
-             $jobs_id = explode(',', $jobs_id);
 
-         }
 
-         if ($resume_id) {
 
-             $this->resumeService->isOwn($resume_id,$user);
 
-             $apply_rst = $this->personalJobsApplyService->applyJobs($jobs_id, $resume_id, $this->getUser());
 
-             if (array_get($apply_rst, 'status') == 0) {
 
-                 $return_data = array(
 
-                     'status'    => array_get($apply_rst, 'status'),
 
-                     'html'      => array_get($apply_rst, 'error')
 
-                 );
 
-                 return response()->json($return_data);
 
-             } else {
 
-                 $html = '投递成功!';
 
-                 if (array_get($apply_rst, 'status') == 1 && count($jobs_id) ==1) {
 
-                     $html = $apply_rst['data']['list'][$jobs_id[0]]['tip'];
 
-                 }
 
-                 $return_data = array(
 
-                     'status'    => array_get($apply_rst, 'status'),
 
-                     'html'      => $html
 
-                 );
 
-                 return response()->json($return_data);
 
-             }
 
-         } else {
 
-             
 
-             $rst = $this->personalJobsApplyService->ifJobApply($jobs_id, $this->getUser());
 
-             
 
-             if (array_get($rst, 'status') == 2) {
 
-                 $page_data = array('status'=>array_get($rst, 'status'),'resumes'=>array_get($rst, 'resumes'),'def_resume'=>array_get($rst, 'def_resume'),'jobs_id'=>implode(',', $jobs_id));
 
-                 $html = view('app.hardware.aio.jobs.ajax_apply', $page_data)->render();
 
-                 $return_data = array( 'status'=>2, 'html' => $html);
 
-                 return response()->json($return_data);
 
-             } else {
 
-                 $return_data = array();
 
-                 if (array_get($rst, 'status') == 0) {
 
-                     $return_data = array(
 
-                         'status'    => array_get($rst, 'status'),
 
-                         'html'      => array_get($rst, 'error')
 
-                     );
 
-                     return response()->json($return_data);
 
-                 } else {
 
-                     $html = '投递成功!';
 
-                     if (array_get($rst, 'status') == 1 && count($jobs_id) ==1) {
 
-                         $html = $rst['data']['list'][$jobs_id[0]]['tip'];
 
-                     }
 
-                     $return_data = array(
 
-                         'status'    => array_get($rst, 'status'),
 
-                         'html'      => $html
 
-                     );
 
-                     return response()->json($return_data);
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     public function setWhere($params, $citys)
 
-     {
 
-         $where = array(
 
-             array('valid','=',1),
 
-             array('display','=',1)
 
-         );
 
-         if (config('aix.companyset.comset.show_set.jobs_display')==1) {
 
-             $where[] = array('audit','=',1);
 
-         } else {
 
-             $where[] = array('audit','<>',3);
 
-         }
 
-         if ($params) {
 
-             foreach ($params as $k => $v) {
 
-                 if ($k == 'citycategory') {
 
-                     
 
-                     $where[] = array('district','=',$citys['select']['id']);
 
-                 } elseif ($k =='wage') {
 
-                     
 
-                     $filter_where = array( 'AIX_wage'=> 100);
 
-                     $categories = $this->categoryService->getCategories($filter_where);
 
-                     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 !='sort' && $k !='key' && $k !='search_type' && $k !='m_zoom') {
 
-                     $where[] = array($k, '=', $v);
 
-                 }
 
-             }
 
-         }
 
-         $where[] = ['subsite_ids','=', get_subsite_id()];
 
-         return $where;
 
-     }
 
- }
 
 
  |