JobsController.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. <?php
  2. namespace App\Http\Controllers\Mobile\Content;
  3. use App\Http\Controllers\Mobile\MobileBaseController;
  4. use App\Services\Common\CategoryService;
  5. use App\Services\Company\JobsService;
  6. use App\Services\Person\ResumeService;
  7. use App\Services\Content\FeedbackService;
  8. use Illuminate\Http\Request;
  9. use App\Exceptions\ResponseException;
  10. use App\Services\Content\ReportService;
  11. use App\Services\Content\TaskService;
  12. use App\Services\Company\PersonalJobsApplyService;
  13. use App\Services\Company\CompanyService;
  14. use App\Services\Person\PersonFavoriteService;
  15. use App\Services\Content\AdService;
  16. use App\Services\Common\SearchService;
  17. use App\Services\Common\HotWordService;
  18. use App\Validators\Content\ReportValidatorRequest;
  19. use Illuminate\Support\Facades\Cache;
  20. class JobsController extends MobileBaseController
  21. {
  22. protected $jobsService;
  23. protected $resumeService;
  24. protected $categoryService;
  25. protected $feedbackService;
  26. protected $reportService;
  27. protected $taskService;
  28. protected $personalJobsApplyService;
  29. protected $companyService;
  30. protected $personFavoriteService;
  31. protected $adService;
  32. protected $searchService;
  33. protected $hotWordService;
  34. /**
  35. * JobsController constructor.
  36. * @param $JobsService
  37. * @param $resumeService
  38. * @param $categoryService
  39. * @param $feedbackService
  40. * @param $reportService
  41. * @param $taskService
  42. * @param $personalJobsApplyService
  43. * @param $companyService
  44. * @param $personFavoriteService
  45. * @param $adService
  46. * @param $searchService
  47. * @param $hotWordService
  48. */
  49. public function __construct(JobsService $jobsService, ResumeService $resumeService, CategoryService $categoryService, FeedbackService $feedbackService, ReportService $reportService, TaskService $taskService, PersonalJobsApplyService $personalJobsApplyService, CompanyService $companyService, PersonFavoriteService $personFavoriteService, AdService $adService, SearchService $searchService, HotWordService $hotWordService)
  50. {
  51. $this->jobsService = $jobsService;
  52. $this->resumeService = $resumeService;
  53. $this->categoryService = $categoryService;
  54. $this->feedbackService = $feedbackService;
  55. $this->reportService = $reportService;
  56. $this->taskService = $taskService;
  57. $this->personalJobsApplyService = $personalJobsApplyService;
  58. $this->companyService = $companyService;
  59. $this->personFavoriteService = $personFavoriteService;
  60. $this->adService = $adService;
  61. $this->searchService = $searchService;
  62. $this->hotWordService = $hotWordService;
  63. }
  64. public function index(Request $request)
  65. {
  66. if ($request->input('range-lng')!='' &&$request->input('range-lat')!='') {
  67. $request->session()->put('range-lng', $request->input('range-lng'));
  68. $request->session()->put('range-lat', $request->input('range-lat'));
  69. $request->session()->put('range-laction', 1);
  70. };
  71. //查询条件
  72. $citycategory = $request->input('citycategory');
  73. $search_type = $request->input('search_type', 'jobs');
  74. if ($search_type == 'company') {
  75. return redirect(route('jobs.companyList', array('list_type'=>'AIX_companylist')));
  76. } else {
  77. session(['hotword_show_type' => 1]);
  78. //职位搜索
  79. $job_category = $this->categoryService->getJobsCategoryInfo(); //获取职位分类信息
  80. $filter_where = array(
  81. 'AIX_wage' => 100,
  82. 'AIX_jobtag' => 100,
  83. 'AIX_trade' => 100,
  84. 'AIX_scale' => 100,
  85. 'AIX_jobs_nature' => 100,
  86. 'AIX_education' => 100,
  87. 'AIX_experience' => 100
  88. );
  89. $categories = $this->categoryService->getCategories($filter_where); //过滤条件信息
  90. //广告位
  91. $subsite_id = Cache::has('subsite_id')?Cache::get('subsite_id'):0;
  92. $ad_where = array(
  93. 'theme' => 'default',
  94. 'org' => 'Home',
  95. 'alias' => 'AIX_jobs_list_right',
  96. 'num' => '1'
  97. );
  98. $ad_infos = $this->adService->getAds($ad_where);
  99. $hotWords = $this->hotWordService->getHotWords(array('type'=>1), 'list_order desc,w_hot desc', '21'); //热门关键词
  100. $job_hotwords = array_slice($hotWords->toArray(), 0, 10);
  101. $company_hotwords = $this->hotWordService->getHotWords(array('type'=>2), 'list_order desc,w_hot desc', '10');
  102. $param_array = array('citycategory','wage','jobtag','trade','scale','nature','education','experience','settr','jobcategory','key','sort', 'search_cont','license','deliver','search_type','lng','lat','range','wa','range-lng','range-lat');
  103. $params= array();
  104. if ($request->all()) {
  105. foreach ($request->all() as $k => $v) {
  106. if (in_array($k, $param_array) && $v) {
  107. $params[$k] = $v;
  108. }
  109. }
  110. }
  111. $map_data = array();
  112. if (array_has($params, 'lng') && array_has($params, 'lat') && (array_has($params, 'range') || array_has($params, 'wa'))) {
  113. if (array_has($params, 'range')) {
  114. $map_data = array('lng'=>$params['lng'],'lat'=>$params['lat'],'range'=>$params['range']);
  115. } elseif (array_has($params, 'wa')) {
  116. $map_data = array('lng'=>$params['lng'],'lat'=>$params['lat'],'range'=>round($params['wa']/1000, 2));
  117. } else {
  118. $map_data = array('lng'=>$params['lng'],'lat'=>$params['lat'],'range'=>config('aix.system.map.map.map_range'));
  119. }
  120. } elseif (array_has($params, 'range') && !array_has($params, 'citycategory') && session("range-laction")) {
  121. $map_data = array('lng'=>session("range-lng"),'lat'=>session("range-lat"),'range'=>$params['range']);
  122. }
  123. $show_range = false;
  124. if ($map_data) {
  125. $show_range = true;
  126. }
  127. $hidden_all_result = 0;
  128. $show_login_notice = 0;
  129. $list_limit = '';
  130. $order_by = array('stime'=>'desc', 'refresh_time'=>'desc');
  131. $search_key = '';
  132. $where = array();
  133. if ($params) {
  134. $search_key = array_has($params, 'key')?$params['key']:'';
  135. if (array_has($params, 'sort')) {
  136. if ($params['sort'] == 'rtime') {
  137. $order_by = 'refresh_time';
  138. } else {
  139. $order_by = $params['sort'];
  140. }
  141. } else {
  142. $order_by = array('stime'=>'desc', 'refresh_time'=>'desc');
  143. }
  144. }
  145. $is_subsite = 0;
  146. $subsites = Cache::get('subsites_list');
  147. if ($subsites) {
  148. if (!array_has($params, 'citycategory')) {
  149. if (get_subsite_id() > 0) {
  150. $citycategory = $subsites[get_subsite_id()]['district'];
  151. }
  152. }
  153. $is_subsite = 1;
  154. }
  155. $citys = $this->categoryService->getCitys($citycategory); //获取地标地段
  156. $district_info = $this->categoryService->getDefaultDistrictInfo(); //获取默认地区信息
  157. $where = $this->setWhere($params, $citys, $job_category); //组合where条件
  158. if (config('aix.companyset.search_com.search_basic.jobs_search_login')==1 && !auth('web-company')->check() && !auth('web-member')->check()) {
  159. $need_login_params = $param_array;
  160. if ($is_subsite ==1) {
  161. unset($need_login_params[array_search('citycategory', $need_login_params)]);
  162. };
  163. foreach ($params as $k => $v) {
  164. if (in_array($k, $need_login_params) && $v) {
  165. $hidden_all_result = 1;
  166. $where[] = array('id','=',0); //设置该条件使查询结果为空
  167. break;
  168. }
  169. }
  170. $show_login_notice = 1;
  171. $list_limit = config('aix.companyset.search_com.search_basic.jobs_search_num_login');
  172. }
  173. $size = 20;
  174. $list = $this->searchService->search('Job', $where, $order_by, $search_key, $size);
  175. if ($list->total()>0) {
  176. $list_items = $this->jobsService->dealjobFilelds($list->items(), $map_data);
  177. } else {
  178. $list_items = array();
  179. }
  180. $mobile_dropload = false;
  181. if ($list->total() > $size) {
  182. $mobile_dropload = true;
  183. }
  184. if ($request->ajax()) {
  185. if ($list->lastPage() < $list->currentPage()) {
  186. return response()->json(['status'=>0]);
  187. }
  188. return response()->json(['status'=>1,'data'=>view('mobile.app.content.jobs.ajax_job_list', ['params'=> $params,'list_items'=> $list_items])->render()]);
  189. }
  190. $return_data = array(
  191. 'search_type' => $search_type,
  192. 'city' => $citys,
  193. 'categories' => $categories,
  194. 'params' => $params,
  195. 'district_info' => $district_info,
  196. 'job_category' => $job_category,
  197. 'ad_info' => $ad_infos,
  198. 'hotWords' => $hotWords,
  199. 'job_hotwords' => $job_hotwords,
  200. 'company_hotwords' => $company_hotwords,
  201. 'list' => $list,
  202. 'list_items' => $list_items,
  203. 'show_login_notice' => $show_login_notice,
  204. 'hidden_all_result' => $hidden_all_result,
  205. 'limit' => $list_limit,
  206. 'mobile_dropload' => $mobile_dropload,
  207. 'show_range' => $show_range,
  208. 'current_url' => \Illuminate\Support\Facades\Request::getRequestUri(),
  209. 'wap_title' => '找工作',
  210. 'user' => $this->getUser()
  211. );
  212. return view('mobile.app.content.jobs.index', $return_data);
  213. }
  214. }
  215. public function setWhere($params, $citys, $job_category)
  216. {
  217. $where = array();
  218. //审核状态过滤
  219. if (config('aix.companyset.comset.show_set.jobs_display')==1) {
  220. $where[] = array('audit','=',1);
  221. } else {
  222. $where[] = array('audit','<>',3);
  223. }
  224. $where[] = array('valid','=',1);
  225. $where[] = array('display','=',1);
  226. if ($params) {
  227. foreach ($params as $k => $v) {
  228. if ($k == 'citycategory') {
  229. //地标地段
  230. $where[] = array('district','=',$citys['select']['id']);
  231. } elseif ($k == 'jobcategory') {
  232. //职位分类
  233. if ($job_category && $v && array_get($job_category['spell'], $v)) {
  234. if ($job_category && $v && array_get($job_category['spell'], $v)) {
  235. $where[] = array('intention_jobs_id','=',$job_category['spell'][$v]['id']);
  236. }
  237. }
  238. } elseif ($k=='jobtag') {
  239. //职位亮点
  240. $where[] = array('tag', '=',$v);
  241. } elseif ($k=='search_cont') {
  242. if ($v=='setmeal') {
  243. //名企招聘
  244. $where[] = array('setmeal_id', '>',1);
  245. }
  246. } elseif ($k=='license') {
  247. //营业执照
  248. $where[] = array('company.certificate_img_audit', '=',1);
  249. } elseif ($k =='settr') {
  250. //更新时间
  251. $update_time = date('Y-m-d H:i:s', strtotime(date('Y-m-d', strtotime('-'.$v.' day'))));
  252. $where[] = array('updated_at', '>=',$update_time);
  253. } elseif ($k == 'deliver') {
  254. $where['apply'] = $v;
  255. } elseif ($k =='wa') {
  256. $where[] = array('range', '=',round($params['wa']/1000, 2));
  257. if (!(array_has($params, 'lng')&& array_has($params, 'lat'))) {
  258. $where[] = array('lng', '=', subsite_config('aix.system.map.map.map_x'));
  259. $where[] = array('lat', '=', subsite_config('aix.system.map.map.map_y'));
  260. }
  261. } elseif ($k =='wage') {
  262. //获取薪资最大值和最小值
  263. $filter_where = array( 'AIX_wage'=> 100);
  264. $categories = $this->categoryService->getCategories($filter_where);
  265. if ($categories) {
  266. $wage = $categories['AIX_wage'][$params['wage']]['origin_demand'];
  267. if ($wage) {
  268. $wage = format_wage($wage);
  269. }
  270. $wage_arr = explode_wage($wage);
  271. $where[] = $wage_arr[0];
  272. $where[] = $wage_arr[1];
  273. }
  274. } elseif ($k =='range') {
  275. if (!array_has($params, 'citycategory')) {
  276. if (!(array_has($params, 'lng')&& array_has($params, 'lat'))) {
  277. if (session('range-laction')) {
  278. $where[] = array('range', '=',$params['range']);
  279. $where[] = array('lng', '=', session('range-lng'));
  280. $where[] = array('lat', '=', session('range-lat'));
  281. }
  282. }
  283. }
  284. } elseif ($k !='sort' && $k !='key' && $k !='search_type' && $k !='m_zoom'&& $k !='range-lng'&& $k !='range-lat') {
  285. $where[] = array($k, '=', $v);
  286. }
  287. }
  288. }
  289. $where[] = ['subsite_ids','=', get_subsite_id()];
  290. return $where;
  291. }
  292. public function category()
  293. {
  294. session(['hotword_show_type' => 1]);
  295. $serch_type = null;
  296. $district_info = $this->categoryService->getDefaultDistrictInfo();
  297. //获取职位分类信息
  298. $job_cates = $this->categoryService->getJobsCategories();
  299. $citys = $this->categoryService->getCitys();
  300. $job_hotwords = $this->hotWordService->getHotWords(array('type'=>1), 'list_order desc,w_hot desc', '10');
  301. $company_hotwords = $this->hotWordService->getHotWords(array('type'=>2), 'list_order desc,w_hot desc', '10');
  302. $return_data = array(
  303. 'search_type' => $serch_type,
  304. 'city' => $citys,
  305. 'district_info' => $district_info,
  306. 'job_hotwords' => $job_hotwords,
  307. 'company_hotwords' => $company_hotwords,
  308. 'job_cates' => $job_cates
  309. );
  310. return view('app.content.jobs.category', $return_data);
  311. }
  312. public function hotWord(Request $request)
  313. {
  314. $key = $request->input('query', '');
  315. $key = trim($key);
  316. if (!$key) {
  317. return response()->json(array('status'=>0,'msg'=>'请输入关健字!'));
  318. }
  319. }
  320. public function getUser()
  321. {
  322. $user = array();
  323. if (auth('web-member')->check()) {
  324. $user = auth('web-member')->user();
  325. } elseif (auth('web-company')->check()) {
  326. $user = auth('web-company')->user();
  327. }
  328. return $user;
  329. }
  330. /*public function getCateJobs($job, $limit = '')
  331. {
  332. $cate_jobs = array();
  333. $cate_job_where[] = array('intention_jobs_id','=',$job->jobcategory_id);
  334. $cate_job_where[] = array('id','<>',$job->id);
  335. if (config('aix.companyset.comset.show_set.jobs_display')==1) {
  336. $cate_job_where[] = array('audit','=',1);
  337. } else {
  338. $cate_job_where[] = array('audit','<>',3);
  339. }
  340. $cate_job_where[] = array('display','=',1);
  341. $cate_job_where[] = array('valid','=',1);
  342. $cate_job_where[] = array('subsite_ids','=',get_subsite_id());
  343. $cate_job_list = $this->searchService->search('Job', $cate_job_where, 'stime', '');
  344. if ($cate_job_list->total()>0) {
  345. $cate_jobs = $this->jobsService->dealjobList($cate_job_list->items(), 6);
  346. }
  347. return $cate_jobs;
  348. }*/
  349. public function show(Request $request)
  350. {
  351. $job_id = $request->input('id');
  352. $job_rst = $this->jobsService->getJobInfo(array('id'=>$job_id), $this->getUser()); //获取job信息
  353. if ($job_rst['status'] == 0) {
  354. $back_url = \Illuminate\Support\Facades\URL::previous();
  355. return $this->showMessage($job_rst['error'], $back_url, true, '上一页', '3');
  356. }
  357. $job_info = $job_rst['job'];
  358. $cate_jobs = $this->searchService->searchCateJobs($job_info, 6); //看了此职位的人还会看(同类别6条其它职位)
  359. $this->putSeoData('job', $job_info);
  360. //当前公司的其它职位
  361. $other_where = array(
  362. array('company_id','=',$job_info->company_id),
  363. array('valid','=',1),
  364. array('display','=',1),
  365. array('id','<>',$job_id)
  366. );
  367. if (config('aix.companyset.comset.show_set.jobs_display')==1) {
  368. $other_where[] = array('audit','=',1);
  369. } else {
  370. $other_where[] = array('audit','<>',3);
  371. }
  372. $other_jobs = $this->jobsService->getOtherJobs($other_where, 6);
  373. $return_data = array(
  374. 'info' => $job_info,
  375. 'other_jobs' => $other_jobs,
  376. 'user' => $this->getUser(),
  377. 'wap_title' => $job_info->jobs_name,
  378. 'cate_jobs' => $cate_jobs
  379. );
  380. return view('mobile.app.content.jobs.job_show', $return_data);
  381. }
  382. public function click(Request $request)
  383. {
  384. $id = $request->input('id');
  385. $rst = $this->jobsService->incrementData(array('id'=>$id), 1, 'click');
  386. $data = array('status'=>0);
  387. if ($rst) {
  388. $data = array('status'=>1);
  389. }
  390. return response()->json($data);
  391. }
  392. /*//留言
  393. public function sendMsg(MsgValidatorRequest $request)
  394. {
  395. $form_data = array(
  396. 'parent_id' => $request->input('parent_id', '0'),
  397. 'touid' => $request->input('touid'),
  398. 'message' => $request->input('message'),
  399. 'ip' => ip2long($request->getClientIp()),
  400. 'ip_address' => '本机地址'
  401. );
  402. $rst = $this->feedbackService->sendMsg($form_data, 3);
  403. $data = array('status'=>0);
  404. if ($rst) {
  405. $data = array('status'=>1,'msg'=>'反馈成功,感谢您对本站的关注!','insert_id'=>$rst['data']['id']);
  406. } else {
  407. $data = array('msg'=>'数据保存失败!');
  408. }
  409. return response()->json($data);
  410. }*/
  411. //收藏职位
  412. public function favor(Request $request)
  413. {
  414. $jid = $request->jid;
  415. $reg = $this->jobsService->jobFavor($jid);
  416. $return_data = array('status'=>0,'msg' => '收藏失败!');
  417. if ($reg) {
  418. if ($reg == 1) {
  419. $return_data = array( 'status'=>1, 'msg' => '取消收藏成功!', 'data'=>'cancel');
  420. } else {
  421. $return_data = array( 'status'=>1, 'msg' => '收藏成功!', 'data'=>'');
  422. }
  423. }
  424. return response()->json($return_data);
  425. }
  426. public function loginDig(Request $request)
  427. {
  428. $html = '';
  429. if ($request->input('type')=='per') {
  430. $html = view('app.common.ajax.per_login')->render();
  431. } elseif ($request->input('type')=='com') {
  432. $html = view('app.common.ajax.com_login')->render();
  433. }
  434. $return_data = array( 'status'=>1, 'html' => $html);
  435. return response()->json($return_data);
  436. }
  437. //职位举报
  438. public function report(Request $request)
  439. {
  440. $jobs_id = $request->input('jobs_id');
  441. if (!$jobs_id) {
  442. throw new ResponseException('请选择要举报的职位!');
  443. }
  444. $report_types = $this->reportService->getReportTypes('1');
  445. $taskInfo = $this->taskService->getTask('2', 'report_jobs'); //举报积分信息
  446. $page_data = array('type_arr'=>$report_types,'jobs_id'=>$jobs_id,'taskInfo'=>$taskInfo);
  447. $html = view('app.common.ajax.report_job', $page_data)->render();
  448. $return_data = array( 'status'=>1, 'html' => $html);
  449. return response()->json($return_data);
  450. }
  451. public function reportJobs(ReportValidatorRequest $request)
  452. {
  453. $report_type = $request->input('report_type');
  454. $jobs_id = $request->input('jobs_id');
  455. $telephone = trim($request->input('telephone'));
  456. $content = trim($request->input('content'));
  457. if (!$content) {
  458. throw new ResponseException('请填写备注说明!');
  459. }
  460. if (!$telephone) {
  461. throw new ResponseException('请填写联系电话!');
  462. }
  463. //添加举报信息
  464. $report_data = array(
  465. 'utype' => 1,
  466. 'utype_id' => $jobs_id,
  467. 'type_id' => $report_type,
  468. 'phone' => $telephone,
  469. 'content' => $content,
  470. 'audit' => 1
  471. );
  472. $rst = $this->reportService->addReport($report_data);
  473. if ($rst) {
  474. //添加会员日志
  475. $user_info = array(
  476. 'uid' => auth('web-member')->user()->id,
  477. 'utype' =>2,
  478. 'username' => auth('web-member')->user()->username,
  479. 'ip' => ip2long($request->getClientIp()),
  480. 'log_address'=>'本机地址'
  481. );
  482. $this->feedbackService->addMembersLog($user_info, '2042', '投诉职位(职位id:'.$jobs_id.')');
  483. $return_data = array( 'status'=>1, 'msg' => '投诉成功!请等待管理员核实!');
  484. return response()->json($return_data);
  485. } else {
  486. throw new ResponseException('举报失败!');
  487. }
  488. }
  489. //职位申请
  490. public function apply(Request $request)
  491. {
  492. //判断个人资料是否完善
  493. $jobs_id = $request->input('jobs_id');
  494. $resume_id = $request->input('resume_id');
  495. if (!$jobs_id) {
  496. throw new ResponseException('请选择要投递的职位!');
  497. }
  498. if (!is_array($jobs_id)) {
  499. $jobs_id = explode(',', $jobs_id);
  500. }
  501. if ($resume_id) {
  502. $apply_rst = $this->personalJobsApplyService->mobileApplyJobs($jobs_id, $resume_id, $this->getUser());
  503. return response()->json($apply_rst);
  504. } else {
  505. //未选择投递简历前
  506. $rst = $this->personalJobsApplyService->ifMobileJobApply($jobs_id, $this->getUser());
  507. if (array_get($rst, 'status') == 2) {
  508. $page_data = array('status'=>array_get($rst, 'status'),'resumes'=>array_get($rst, 'resumes'),'def_resume'=>array_get($rst, 'def_resume'));
  509. $html = view('mobile.app.common.ajax.apply_resume', $page_data)->render();
  510. $return_data = array( 'status'=>2, 'html' => $html);
  511. return response()->json($return_data);
  512. } else {
  513. return response()->json($rst);
  514. }
  515. }
  516. }
  517. public function jobMap(Request $request)
  518. {
  519. $params = $request->all();
  520. $param_array = array('key','wage','trade','scale','nature','education','experience','settr','lng','lat','range','wa','m_zoom','search_type','sort','license',"apply",'search_cont');
  521. $params= array();
  522. if ($request->all()) {
  523. foreach ($request->all() as $k => $v) {
  524. if (in_array($k, $param_array) && $v) {
  525. $params[$k] = $v;
  526. }
  527. }
  528. }
  529. $position_search = false;
  530. if ($request->input('search_type')=='position') {
  531. $position_search = true;
  532. }
  533. $filter_array = array('sort', 'search_cont','license','apply','search_type','key','wa','lng','lat','m_zoom');
  534. $show_filter = $this->showFilter($params, $filter_array);
  535. $filter_where = array(
  536. 'AIX_wage' => 100,
  537. 'AIX_jobtag' => 100,
  538. 'AIX_trade' => 100,
  539. 'AIX_scale' => 100,
  540. 'AIX_jobs_nature' => 100,
  541. 'AIX_education' => 100,
  542. 'AIX_experience' => 100
  543. );
  544. $categories = $this->categoryService->getCategories($filter_where);
  545. $where = $this->setWhere($params, array(), array()); //组合where条件
  546. $order_by = 'stime';
  547. $search_key = '';
  548. if ($params) {
  549. if (array_has($params, 'sort')) {
  550. if ($params['sort'] == 'rtime') {
  551. $order_by = 'refresh_time';
  552. } else {
  553. $order_by = $params['sort'];
  554. }
  555. }
  556. if (array_has($params, 'key')) {
  557. $search_key = $params['key']?$params['key']:'';
  558. }
  559. }
  560. $map_data = array();
  561. if (array_has($params, 'lng') && array_has($params, 'lat') && array_has($params, 'wa')) {
  562. $map_data = array('lng'=>$params['lng'],'lat'=>$params['lat'],'map'=>1);
  563. }
  564. $list = $this->searchService->search('Job', $where, $order_by, $search_key);
  565. $list_items = array();
  566. $job_companys = array();
  567. if ($list->total()>0) {
  568. $list_items = $this->jobsService->dealjobFilelds($list->items(), $map_data);
  569. $job_companys = $this->jobsService->dealJobCompanies($list_items);
  570. }
  571. $emergency_jobs = $this->searchService->searchEmergencyJobs(4); //紧急招聘
  572. $recommend_jobs = $this->searchService->searchRecommendJobs(5, $this->getUser()); //推荐职位
  573. $map_info = $this->getMapInfo();
  574. $return_data = array(
  575. 'params' => $params,
  576. 'categories' => $categories,
  577. 'show_filter' => $show_filter,
  578. 'list' => $list,
  579. 'list_items' => $list_items,
  580. 'job_companys' => $job_companys,
  581. 'emergency_jobs' => $emergency_jobs,
  582. 'position_search'=> $position_search,
  583. 'recommend_jobs' => $recommend_jobs,
  584. 'map_info' => $map_info
  585. );
  586. return view('app.content.jobs.map', $return_data);
  587. }
  588. public function getMapInfo()
  589. {
  590. $m_zoom = subsite_config('aix.system.map.map.max_level');
  591. $map_center_x = subsite_config('aix.system.map.map.map_x');
  592. $map_center_y = subsite_config('aix.system.map.map.map_y');
  593. return ['m_zoom'=>$m_zoom,'map_center_x'=>$map_center_x,'map_center_y'=>$map_center_y];
  594. }
  595. public function showFilter($params, $filter_array)
  596. {
  597. $show_filter = false;
  598. if ($params && (count($params) <= count($filter_array))) {
  599. foreach ($params as $k => $v) {
  600. if (!in_array($k, $filter_array)) {
  601. $show_filter = true;
  602. break;
  603. }
  604. }
  605. } elseif (count($params) > count($filter_array)) {
  606. $show_filter = true;
  607. }
  608. return $show_filter;
  609. }
  610. public function msg(Request $request)
  611. {
  612. $company_id = $request->input('id', '');
  613. if (!$company_id) {
  614. $back_url = \Illuminate\Support\Facades\URL::previous();
  615. return $this->showMessage('请选择需要咨询的企业', $back_url, true, '上一页', '3');
  616. }
  617. //获取企业信息
  618. $company_info = $this->companyService->getCompany(['id'=>$company_id]);
  619. if ($company_info->logo) {
  620. $company_info->logo = upload_asset($company_info->logo);
  621. } else {
  622. $company_info->logo = public_data_path('data/upload/no_logo.png');
  623. }
  624. //获取个人用户信息
  625. $member_avator = $this->resumeService->getPersonAvator($this->getUser());
  626. $return_data = array(
  627. 'company' => $company_info,
  628. 'wap_title' => '留言咨询',
  629. 'msg' => null,
  630. 'perosn_images' => $member_avator
  631. );
  632. return view('mobile.app.content.jobs.msg', $return_data);
  633. }
  634. }