JobsController.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  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. $where[] = ['is_health','=',1];
  174. $size = 20;
  175. $list = $this->searchService->search('Job', $where, $order_by, $search_key, $size);
  176. dd($list);
  177. if ($list->total()>0) {
  178. $list_items = $this->jobsService->dealjobFilelds($list->items(), $map_data);
  179. } else {
  180. $list_items = array();
  181. }
  182. $mobile_dropload = false;
  183. if ($list->total() > $size) {
  184. $mobile_dropload = true;
  185. }
  186. if ($request->ajax()) {
  187. if ($list->lastPage() < $list->currentPage()) {
  188. return response()->json(['status'=>0]);
  189. }
  190. return response()->json(['status'=>1,'data'=>view('mobile.app.content.jobs.ajax_job_list', ['params'=> $params,'list_items'=> $list_items])->render()]);
  191. }
  192. $return_data = array(
  193. 'search_type' => $search_type,
  194. 'city' => $citys,
  195. 'categories' => $categories,
  196. 'params' => $params,
  197. 'district_info' => $district_info,
  198. 'job_category' => $job_category,
  199. 'ad_info' => $ad_infos,
  200. 'hotWords' => $hotWords,
  201. 'job_hotwords' => $job_hotwords,
  202. 'company_hotwords' => $company_hotwords,
  203. 'list' => $list,
  204. 'list_items' => $list_items,
  205. 'show_login_notice' => $show_login_notice,
  206. 'hidden_all_result' => $hidden_all_result,
  207. 'limit' => $list_limit,
  208. 'mobile_dropload' => $mobile_dropload,
  209. 'show_range' => $show_range,
  210. 'current_url' => \Illuminate\Support\Facades\Request::getRequestUri(),
  211. 'wap_title' => '找工作',
  212. 'user' => $this->getUser()
  213. );
  214. return view('mobile.app.content.jobs.index', $return_data);
  215. }
  216. }
  217. public function setWhere($params, $citys, $job_category)
  218. {
  219. $where = array();
  220. //审核状态过滤
  221. if (config('aix.companyset.comset.show_set.jobs_display')==1) {
  222. $where[] = array('audit','=',1);
  223. } else {
  224. $where[] = array('audit','<>',3);
  225. }
  226. $where[] = array('valid','=',1);
  227. $where[] = array('display','=',1);
  228. if ($params) {
  229. foreach ($params as $k => $v) {
  230. if ($k == 'citycategory') {
  231. //地标地段
  232. $where[] = array('district','=',$citys['select']['id']);
  233. } elseif ($k == 'jobcategory') {
  234. //职位分类
  235. if ($job_category && $v && array_get($job_category['spell'], $v)) {
  236. if ($job_category && $v && array_get($job_category['spell'], $v)) {
  237. $where[] = array('intention_jobs_id','=',$job_category['spell'][$v]['id']);
  238. }
  239. }
  240. } elseif ($k=='jobtag') {
  241. //职位亮点
  242. $where[] = array('tag', '=',$v);
  243. } elseif ($k=='search_cont') {
  244. if ($v=='setmeal') {
  245. //名企招聘
  246. $where[] = array('setmeal_id', '>',1);
  247. }
  248. } elseif ($k=='license') {
  249. //营业执照
  250. $where[] = array('company.certificate_img_audit', '=',1);
  251. } elseif ($k =='settr') {
  252. //更新时间
  253. $update_time = date('Y-m-d H:i:s', strtotime(date('Y-m-d', strtotime('-'.$v.' day'))));
  254. $where[] = array('updated_at', '>=',$update_time);
  255. } elseif ($k == 'deliver') {
  256. $where['apply'] = $v;
  257. } elseif ($k =='wa') {
  258. $where[] = array('range', '=',round($params['wa']/1000, 2));
  259. if (!(array_has($params, 'lng')&& array_has($params, 'lat'))) {
  260. $where[] = array('lng', '=', subsite_config('aix.system.map.map.map_x'));
  261. $where[] = array('lat', '=', subsite_config('aix.system.map.map.map_y'));
  262. }
  263. } elseif ($k =='wage') {
  264. //获取薪资最大值和最小值
  265. $filter_where = array( 'AIX_wage'=> 100);
  266. $categories = $this->categoryService->getCategories($filter_where);
  267. if ($categories) {
  268. $wage = $categories['AIX_wage'][$params['wage']]['origin_demand'];
  269. if ($wage) {
  270. $wage = format_wage($wage);
  271. }
  272. $wage_arr = explode_wage($wage);
  273. $where[] = $wage_arr[0];
  274. $where[] = $wage_arr[1];
  275. }
  276. } elseif ($k =='range') {
  277. if (!array_has($params, 'citycategory')) {
  278. if (!(array_has($params, 'lng')&& array_has($params, 'lat'))) {
  279. if (session('range-laction')) {
  280. $where[] = array('range', '=',$params['range']);
  281. $where[] = array('lng', '=', session('range-lng'));
  282. $where[] = array('lat', '=', session('range-lat'));
  283. }
  284. }
  285. }
  286. } elseif ($k !='sort' && $k !='key' && $k !='search_type' && $k !='m_zoom'&& $k !='range-lng'&& $k !='range-lat') {
  287. $where[] = array($k, '=', $v);
  288. }
  289. }
  290. }
  291. $where[] = ['subsite_ids','=', get_subsite_id()];
  292. return $where;
  293. }
  294. public function category()
  295. {
  296. session(['hotword_show_type' => 1]);
  297. $serch_type = null;
  298. $district_info = $this->categoryService->getDefaultDistrictInfo();
  299. //获取职位分类信息
  300. $job_cates = $this->categoryService->getJobsCategories();
  301. $citys = $this->categoryService->getCitys();
  302. $job_hotwords = $this->hotWordService->getHotWords(array('type'=>1), 'list_order desc,w_hot desc', '10');
  303. $company_hotwords = $this->hotWordService->getHotWords(array('type'=>2), 'list_order desc,w_hot desc', '10');
  304. $return_data = array(
  305. 'search_type' => $serch_type,
  306. 'city' => $citys,
  307. 'district_info' => $district_info,
  308. 'job_hotwords' => $job_hotwords,
  309. 'company_hotwords' => $company_hotwords,
  310. 'job_cates' => $job_cates
  311. );
  312. return view('app.content.jobs.category', $return_data);
  313. }
  314. public function hotWord(Request $request)
  315. {
  316. $key = $request->input('query', '');
  317. $key = trim($key);
  318. if (!$key) {
  319. return response()->json(array('status'=>0,'msg'=>'请输入关健字!'));
  320. }
  321. }
  322. public function getUser()
  323. {
  324. $user = array();
  325. if (auth('web-member')->check()) {
  326. $user = auth('web-member')->user();
  327. } elseif (auth('web-company')->check()) {
  328. $user = auth('web-company')->user();
  329. }
  330. return $user;
  331. }
  332. /*public function getCateJobs($job, $limit = '')
  333. {
  334. $cate_jobs = array();
  335. $cate_job_where[] = array('intention_jobs_id','=',$job->jobcategory_id);
  336. $cate_job_where[] = array('id','<>',$job->id);
  337. if (config('aix.companyset.comset.show_set.jobs_display')==1) {
  338. $cate_job_where[] = array('audit','=',1);
  339. } else {
  340. $cate_job_where[] = array('audit','<>',3);
  341. }
  342. $cate_job_where[] = array('display','=',1);
  343. $cate_job_where[] = array('valid','=',1);
  344. $cate_job_where[] = array('subsite_ids','=',get_subsite_id());
  345. $cate_job_list = $this->searchService->search('Job', $cate_job_where, 'stime', '');
  346. if ($cate_job_list->total()>0) {
  347. $cate_jobs = $this->jobsService->dealjobList($cate_job_list->items(), 6);
  348. }
  349. return $cate_jobs;
  350. }*/
  351. public function show(Request $request)
  352. {
  353. $job_id = $request->input('id');
  354. $job_rst = $this->jobsService->getJobInfo(array('id'=>$job_id), $this->getUser()); //获取job信息
  355. if ($job_rst['status'] == 0) {
  356. $back_url = \Illuminate\Support\Facades\URL::previous();
  357. return $this->showMessage($job_rst['error'], $back_url, true, '上一页', '3');
  358. }
  359. $job_info = $job_rst['job'];
  360. $cate_jobs = $this->searchService->searchCateJobs($job_info, 6); //看了此职位的人还会看(同类别6条其它职位)
  361. $this->putSeoData('job', $job_info);
  362. //当前公司的其它职位
  363. $other_where = array(
  364. array('company_id','=',$job_info->company_id),
  365. array('valid','=',1),
  366. array('display','=',1),
  367. array('id','<>',$job_id)
  368. );
  369. if (config('aix.companyset.comset.show_set.jobs_display')==1) {
  370. $other_where[] = array('audit','=',1);
  371. } else {
  372. $other_where[] = array('audit','<>',3);
  373. }
  374. $other_jobs = $this->jobsService->getOtherJobs($other_where, 6);
  375. $return_data = array(
  376. 'info' => $job_info,
  377. 'other_jobs' => $other_jobs,
  378. 'user' => $this->getUser(),
  379. 'wap_title' => $job_info->jobs_name,
  380. 'cate_jobs' => $cate_jobs
  381. );
  382. return view('mobile.app.content.jobs.job_show', $return_data);
  383. }
  384. public function click(Request $request)
  385. {
  386. $id = $request->input('id');
  387. $rst = $this->jobsService->incrementData(array('id'=>$id), 1, 'click');
  388. $data = array('status'=>0);
  389. if ($rst) {
  390. $data = array('status'=>1);
  391. }
  392. return response()->json($data);
  393. }
  394. /*//留言
  395. public function sendMsg(MsgValidatorRequest $request)
  396. {
  397. $form_data = array(
  398. 'parent_id' => $request->input('parent_id', '0'),
  399. 'touid' => $request->input('touid'),
  400. 'message' => $request->input('message'),
  401. 'ip' => ip2long($request->getClientIp()),
  402. 'ip_address' => '本机地址'
  403. );
  404. $rst = $this->feedbackService->sendMsg($form_data, 3);
  405. $data = array('status'=>0);
  406. if ($rst) {
  407. $data = array('status'=>1,'msg'=>'反馈成功,感谢您对本站的关注!','insert_id'=>$rst['data']['id']);
  408. } else {
  409. $data = array('msg'=>'数据保存失败!');
  410. }
  411. return response()->json($data);
  412. }*/
  413. //收藏职位
  414. public function favor(Request $request)
  415. {
  416. $jid = $request->jid;
  417. $reg = $this->jobsService->jobFavor($jid);
  418. $return_data = array('status'=>0,'msg' => '收藏失败!');
  419. if ($reg) {
  420. if ($reg == 1) {
  421. $return_data = array( 'status'=>1, 'msg' => '取消收藏成功!', 'data'=>'cancel');
  422. } else {
  423. $return_data = array( 'status'=>1, 'msg' => '收藏成功!', 'data'=>'');
  424. }
  425. }
  426. return response()->json($return_data);
  427. }
  428. public function loginDig(Request $request)
  429. {
  430. $html = '';
  431. if ($request->input('type')=='per') {
  432. $html = view('app.common.ajax.per_login')->render();
  433. } elseif ($request->input('type')=='com') {
  434. $html = view('app.common.ajax.com_login')->render();
  435. }
  436. $return_data = array( 'status'=>1, 'html' => $html);
  437. return response()->json($return_data);
  438. }
  439. //职位举报
  440. public function report(Request $request)
  441. {
  442. $jobs_id = $request->input('jobs_id');
  443. if (!$jobs_id) {
  444. throw new ResponseException('请选择要举报的职位!');
  445. }
  446. $report_types = $this->reportService->getReportTypes('1');
  447. $taskInfo = $this->taskService->getTask('2', 'report_jobs'); //举报积分信息
  448. $page_data = array('type_arr'=>$report_types,'jobs_id'=>$jobs_id,'taskInfo'=>$taskInfo);
  449. $html = view('app.common.ajax.report_job', $page_data)->render();
  450. $return_data = array( 'status'=>1, 'html' => $html);
  451. return response()->json($return_data);
  452. }
  453. public function reportJobs(ReportValidatorRequest $request)
  454. {
  455. $report_type = $request->input('report_type');
  456. $jobs_id = $request->input('jobs_id');
  457. $telephone = trim($request->input('telephone'));
  458. $content = trim($request->input('content'));
  459. if (!$content) {
  460. throw new ResponseException('请填写备注说明!');
  461. }
  462. if (!$telephone) {
  463. throw new ResponseException('请填写联系电话!');
  464. }
  465. //添加举报信息
  466. $report_data = array(
  467. 'utype' => 1,
  468. 'utype_id' => $jobs_id,
  469. 'type_id' => $report_type,
  470. 'phone' => $telephone,
  471. 'content' => $content,
  472. 'audit' => 1
  473. );
  474. $rst = $this->reportService->addReport($report_data);
  475. if ($rst) {
  476. //添加会员日志
  477. $user_info = array(
  478. 'uid' => auth('web-member')->user()->id,
  479. 'utype' =>2,
  480. 'username' => auth('web-member')->user()->username,
  481. 'ip' => ip2long($request->getClientIp()),
  482. 'log_address'=>'本机地址'
  483. );
  484. $this->feedbackService->addMembersLog($user_info, '2042', '投诉职位(职位id:'.$jobs_id.')');
  485. $return_data = array( 'status'=>1, 'msg' => '投诉成功!请等待管理员核实!');
  486. return response()->json($return_data);
  487. } else {
  488. throw new ResponseException('举报失败!');
  489. }
  490. }
  491. //职位申请
  492. public function apply(Request $request)
  493. {
  494. //判断个人资料是否完善
  495. $jobs_id = $request->input('jobs_id');
  496. $resume_id = $request->input('resume_id');
  497. if (!$jobs_id) {
  498. throw new ResponseException('请选择要投递的职位!');
  499. }
  500. if (!is_array($jobs_id)) {
  501. $jobs_id = explode(',', $jobs_id);
  502. }
  503. if ($resume_id) {
  504. $apply_rst = $this->personalJobsApplyService->mobileApplyJobs($jobs_id, $resume_id, $this->getUser());
  505. return response()->json($apply_rst);
  506. } else {
  507. //未选择投递简历前
  508. $rst = $this->personalJobsApplyService->ifMobileJobApply($jobs_id, $this->getUser());
  509. if (array_get($rst, 'status') == 2) {
  510. $page_data = array('status'=>array_get($rst, 'status'),'resumes'=>array_get($rst, 'resumes'),'def_resume'=>array_get($rst, 'def_resume'));
  511. $html = view('mobile.app.common.ajax.apply_resume', $page_data)->render();
  512. $return_data = array( 'status'=>2, 'html' => $html);
  513. return response()->json($return_data);
  514. } else {
  515. return response()->json($rst);
  516. }
  517. }
  518. }
  519. public function jobMap(Request $request)
  520. {
  521. $params = $request->all();
  522. $param_array = array('key','wage','trade','scale','nature','education','experience','settr','lng','lat','range','wa','m_zoom','search_type','sort','license',"apply",'search_cont');
  523. $params= array();
  524. if ($request->all()) {
  525. foreach ($request->all() as $k => $v) {
  526. if (in_array($k, $param_array) && $v) {
  527. $params[$k] = $v;
  528. }
  529. }
  530. }
  531. $position_search = false;
  532. if ($request->input('search_type')=='position') {
  533. $position_search = true;
  534. }
  535. $filter_array = array('sort', 'search_cont','license','apply','search_type','key','wa','lng','lat','m_zoom');
  536. $show_filter = $this->showFilter($params, $filter_array);
  537. $filter_where = array(
  538. 'AIX_wage' => 100,
  539. 'AIX_jobtag' => 100,
  540. 'AIX_trade' => 100,
  541. 'AIX_scale' => 100,
  542. 'AIX_jobs_nature' => 100,
  543. 'AIX_education' => 100,
  544. 'AIX_experience' => 100
  545. );
  546. $categories = $this->categoryService->getCategories($filter_where);
  547. $where = $this->setWhere($params, array(), array()); //组合where条件
  548. $order_by = 'stime';
  549. $search_key = '';
  550. if ($params) {
  551. if (array_has($params, 'sort')) {
  552. if ($params['sort'] == 'rtime') {
  553. $order_by = 'refresh_time';
  554. } else {
  555. $order_by = $params['sort'];
  556. }
  557. }
  558. if (array_has($params, 'key')) {
  559. $search_key = $params['key']?$params['key']:'';
  560. }
  561. }
  562. $map_data = array();
  563. if (array_has($params, 'lng') && array_has($params, 'lat') && array_has($params, 'wa')) {
  564. $map_data = array('lng'=>$params['lng'],'lat'=>$params['lat'],'map'=>1);
  565. }
  566. $list = $this->searchService->search('Job', $where, $order_by, $search_key);
  567. $list_items = array();
  568. $job_companys = array();
  569. if ($list->total()>0) {
  570. $list_items = $this->jobsService->dealjobFilelds($list->items(), $map_data);
  571. $job_companys = $this->jobsService->dealJobCompanies($list_items);
  572. }
  573. $emergency_jobs = $this->searchService->searchEmergencyJobs(4); //紧急招聘
  574. $recommend_jobs = $this->searchService->searchRecommendJobs(5, $this->getUser()); //推荐职位
  575. $map_info = $this->getMapInfo();
  576. $return_data = array(
  577. 'params' => $params,
  578. 'categories' => $categories,
  579. 'show_filter' => $show_filter,
  580. 'list' => $list,
  581. 'list_items' => $list_items,
  582. 'job_companys' => $job_companys,
  583. 'emergency_jobs' => $emergency_jobs,
  584. 'position_search'=> $position_search,
  585. 'recommend_jobs' => $recommend_jobs,
  586. 'map_info' => $map_info
  587. );
  588. return view('app.content.jobs.map', $return_data);
  589. }
  590. public function getMapInfo()
  591. {
  592. $m_zoom = subsite_config('aix.system.map.map.max_level');
  593. $map_center_x = subsite_config('aix.system.map.map.map_x');
  594. $map_center_y = subsite_config('aix.system.map.map.map_y');
  595. return ['m_zoom'=>$m_zoom,'map_center_x'=>$map_center_x,'map_center_y'=>$map_center_y];
  596. }
  597. public function showFilter($params, $filter_array)
  598. {
  599. $show_filter = false;
  600. if ($params && (count($params) <= count($filter_array))) {
  601. foreach ($params as $k => $v) {
  602. if (!in_array($k, $filter_array)) {
  603. $show_filter = true;
  604. break;
  605. }
  606. }
  607. } elseif (count($params) > count($filter_array)) {
  608. $show_filter = true;
  609. }
  610. return $show_filter;
  611. }
  612. public function msg(Request $request)
  613. {
  614. $company_id = $request->input('id', '');
  615. if (!$company_id) {
  616. $back_url = \Illuminate\Support\Facades\URL::previous();
  617. return $this->showMessage('请选择需要咨询的企业', $back_url, true, '上一页', '3');
  618. }
  619. //获取企业信息
  620. $company_info = $this->companyService->getCompany(['id'=>$company_id]);
  621. if ($company_info->logo) {
  622. $company_info->logo = upload_asset($company_info->logo);
  623. } else {
  624. $company_info->logo = public_data_path('data/upload/no_logo.png');
  625. }
  626. //获取个人用户信息
  627. $member_avator = $this->resumeService->getPersonAvator($this->getUser());
  628. $return_data = array(
  629. 'company' => $company_info,
  630. 'wap_title' => '留言咨询',
  631. 'msg' => null,
  632. 'perosn_images' => $member_avator
  633. );
  634. return view('mobile.app.content.jobs.msg', $return_data);
  635. }
  636. }