JobsController.php 28 KB

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