JobfairController.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: wuzhenke
  5. * Date: 2019/1/17
  6. * Time: 16:19
  7. */
  8. namespace App\Http\Controllers\Web\Active;
  9. use App\Exceptions\ResponseException;
  10. use App\Http\Controllers\Web\WebBaseController;
  11. use App\Models\LotteryPrize;
  12. use App\Models\LotteryWin;
  13. use App\Services\Common\CategoryService;
  14. use App\Services\Common\SearchService;
  15. use App\Services\Company\JobsService;
  16. use App\Services\HomeService;
  17. use Illuminate\Http\Request;
  18. use App\Services\Company\CompanyService;
  19. use Illuminate\Support\Facades\Cache;
  20. use Illuminate\Support\Facades\DB;
  21. class JobfairController extends WebBaseController
  22. {
  23. protected $companyService;
  24. protected $jobsService;
  25. protected $categoryService;
  26. protected $searchService;
  27. protected $homeService;
  28. /*
  29. * 企业中心
  30. * */
  31. /**
  32. * JobfairController constructor.
  33. * @param $jobfairJobsService
  34. * @param $jobfairCompanyRepository
  35. * @param $jobfairCompanyService
  36. * @param $jobfairService
  37. * @param $jobfairRepository
  38. * @param $jobfairPersonalJobsApplyRepository
  39. * @param $jobfairPersonalJopApplyService
  40. * @param $resumeService
  41. * @param $jobfairFloorplanStandRepository
  42. * @param $jobfairFloorPlanRepository
  43. * @param $jobfairPutJobRepository
  44. * @param $resumeRepository
  45. * @param $jobfairPutJobService
  46. * @param $companyService
  47. * @param $jobfairJobRepository
  48. * @param $companyDownResumeService
  49. * @param $articleService
  50. * @param $articleRepository
  51. */
  52. public function __construct(
  53. CompanyService $companyService,
  54. JobsService $jobsService,
  55. CategoryService $categoryService,
  56. SearchService $searchService,
  57. HomeService $homeService
  58. )
  59. {
  60. $this->companyService = $companyService;
  61. $this->jobsService = $jobsService;
  62. $this->categoryService = $categoryService;
  63. $this->searchService = $searchService;
  64. $this->homeService = $homeService;
  65. }
  66. /**2020新春线上招聘会
  67. * @param Request $request
  68. * @param int $id
  69. * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
  70. * @throws \Throwable
  71. */
  72. public function online2020(Request $request)
  73. {
  74. $offset = isset($request->page) ? $request->page : 0;
  75. $limit = 20;
  76. $citycategory = $request->input('citycategory');
  77. $trade = $request->input('trade');
  78. $param_array = ['citycategory', 'trade', 'nature'];
  79. $params = [];
  80. if ($request->all()) {
  81. foreach ($request->all() as $k => $v) {
  82. if (in_array($k, $param_array) && $v) {
  83. $params[$k] = $v;
  84. }
  85. }
  86. }
  87. $subsites = Cache::get('subsites_list');
  88. if ($subsites) {
  89. if (!array_has($params, 'citycategory')) {
  90. if (get_subsite_id() > 0) {
  91. $citycategory = $subsites[get_subsite_id()]['district'];
  92. }
  93. }
  94. $is_subsite = 1;
  95. }
  96. $citys = $this->categoryService->getCitys($citycategory);
  97. if (empty($citycategory)) {
  98. $district_str = "(district like ? or district like ? or district like ? or district like ?)";
  99. $district_arr = ["%.623%", "%623.%", "%.245%", "%245.%"];
  100. } else {
  101. $select_id = $citys['select']['id'];
  102. $district_str = "(district like ? or district like ?)";
  103. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  104. }
  105. $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw("jobs.created_at > '2020-01-01 00:00:00'")->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();
  106. // echo '<pre>';
  107. //
  108. // var_dump($companys);die;
  109. $where = [];
  110. //$where[] = array('reg_time', '>', 1577808000);
  111. $where[] = ['user_status', '=', 1];
  112. $where[] = ['subsite_id', '=', get_subsite_id()];
  113. $where[] = ['audit', '=', 1];
  114. $where[] = ['deleted_at', '=', null];
  115. if (!empty($trade)) {
  116. $where[] = ['trade', '=', $trade];
  117. }
  118. //$where[] = array('id','in',$companys);
  119. $order_by = ['id', 'desc'];
  120. //$list = $this->searchService->search('Company', $where, $order_by, '');
  121. $list = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('id', 'desc')->offset($limit * $offset)->limit($limit)->get();
  122. $total = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->count();
  123. $total_person = DB::table('resumes')->whereRaw('created_at > "2019-12-01 00:00:00"')->groupBy('uid')->get();
  124. //$list = DB::table('companys')->where($where)->whereIn('id',$companys)->orderBy('id','desc')->offset($limit*$offset)->limit($limit)->get();
  125. // echo '<pre>';
  126. //
  127. // var_dump($list);die;
  128. $more = count($list) >= $limit ? true : false;
  129. // if ($list->total() >0) {
  130. // //处理企业信息
  131. // $list_items = $this->companyService->dealCompanyFields($list->items());
  132. // } else {
  133. // $list_items = array();
  134. // }
  135. $res = [];
  136. $total_job = 0;
  137. $total_job_num = 0;
  138. foreach ($list as $val) {
  139. $item = [
  140. 'id' => $val->id,
  141. 'companyname' => $val->companyname,
  142. 'jobs' => [],
  143. ];
  144. //在招职位
  145. $jobs_where = [
  146. ['company_id', '=', $val->id],
  147. ['valid', '=', 1],
  148. ['display', '=', 1],
  149. ['audit', '=', 1],
  150. ];
  151. //$jobs = $this->jobsService->getOtherJobs($jobs_where);
  152. $jobs = DB::table('jobs')->where($jobs_where)->get();
  153. if ($jobs) {
  154. foreach ($jobs as $value) {
  155. $job = [
  156. 'id' => $value->id,
  157. 'jobs_name' => $value->jobs_name,
  158. 'amount' => $value->amount,
  159. ];
  160. array_push($item['jobs'], $job);
  161. $total_job_num += $value->amount;
  162. $total_job += 1;
  163. }
  164. }
  165. array_push($res, $item);
  166. }
  167. $filter_where = [
  168. 'AIX_trade' => 100,
  169. 'AIX_company_type' => 100,
  170. ];
  171. $categories = $this->categoryService->getCategories($filter_where);
  172. if ($request->ajax()) {
  173. if (count($res)) {
  174. return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_jobfair_com', [
  175. 'res' => $res,
  176. 'city' => $citys,
  177. 'params' => $params,
  178. 'categories' => $categories,
  179. 'more' => $more,
  180. ])->render()]);
  181. }
  182. return response()->json(['status' => 0]);
  183. }
  184. return view('app.active.online2020', [
  185. 'res' => $res,
  186. 'city' => $citys,
  187. 'params' => $params,
  188. 'categories' => $categories,
  189. 'more' => $more,
  190. 'total' => $total,
  191. 'total_person' => count($total_person),
  192. 'total_job' => $total_job
  193. //'list_items' => $list_items,
  194. //'list' => $list,
  195. ]);
  196. }
  197. public function test(Request $request)
  198. {
  199. $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw("jobs.created_at > '2020-01-01 00:00:00'")->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();
  200. $where = [];
  201. $where[] = ['user_status', '=', 1];
  202. $where[] = ['subsite_id', '=', get_subsite_id()];
  203. $where[] = ['audit', '=', 1];
  204. $where[] = ['deleted_at', '=', null];
  205. $order_by = ['id', 'desc'];
  206. $citycategory = $request->input('citycategory');
  207. $citys = $this->categoryService->getCitys($citycategory);
  208. if (empty($citycategory)) {
  209. $district_str = "(district like ? or district like ? or district like ? or district like ?)";
  210. $district_arr = ["%.623%", "%623.%", "%.245%", "%245.%"];
  211. } else {
  212. $select_id = $citys['select']['id'];
  213. $district_str = "(district like ? or district like ?)";
  214. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  215. }
  216. //$list = DB::table('companys')->where($where)->whereRaw("(district like ? or district like ? or district like ? or district like ?)",["%.{$citys['select']['id']}%","%{$citys['select']['id']}.%","%.245%","%245.%"])->whereIn('id',$companys)->limit(1000)->orderBy('id','desc')->get();
  217. $list = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('id', 'desc')->get();
  218. $total = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->count();
  219. $total_person = DB::table('resumes')->whereRaw('created_at > "2019-12-01 00:00:00"')->groupBy('uid')->get();
  220. $res = [];
  221. $total_job = 0;
  222. $total_job_num = 0;
  223. foreach ($list as $val) {
  224. $item = [
  225. 'id' => $val->id,
  226. 'companyname' => $val->companyname,
  227. 'jobs' => [],
  228. ];
  229. //在招职位
  230. $jobs_where = [
  231. ['company_id', '=', $val->id],
  232. ['valid', '=', 1],
  233. ['display', '=', 1],
  234. ['audit', '=', 1],
  235. ];
  236. //$jobs = $this->jobsService->getOtherJobs($jobs_where);
  237. $jobs = DB::table('jobs')->where($jobs_where)->get();
  238. if ($jobs) {
  239. foreach ($jobs as $value) {
  240. $job = [
  241. 'id' => $value->id,
  242. 'jobs_name' => $value->jobs_name,
  243. 'amount' => $value->amount,
  244. ];
  245. array_push($item['jobs'], $job);
  246. $total_job_num += $value->amount;
  247. $total_job += 1;
  248. }
  249. }
  250. array_push($res, $item);
  251. }
  252. echo "<p>企业数量:" . count($list) . "</p>\r\n";
  253. echo "<p>求职者数量:" . count($total_person) . "</p>\r\n";
  254. echo "<p>总招聘职位数量:" . $total_job . "</p>\r\n";
  255. echo "<p>总需要人员数量:" . $total_job_num . "</p>\r\n";
  256. }
  257. public function data(Request $request)
  258. {
  259. $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw("jobs.created_at > '2020-01-01 00:00:00'")->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();
  260. $where = [];
  261. $where[] = ['user_status', '=', 1];
  262. $where[] = ['subsite_id', '=', get_subsite_id()];
  263. $where[] = ['audit', '=', 1];
  264. $where[] = ['deleted_at', '=', null];
  265. $order_by = ['id', 'desc'];
  266. $citycategory = $request->input('citycategory');
  267. $citys = $this->categoryService->getCitys($citycategory);
  268. if (empty($citycategory)) {
  269. $citys['select']['id'] = 623;
  270. }
  271. $list = DB::table('companys')->where($where)->whereRaw("(district like ? or district like ? or district like ? or district like ?)", ["%.{$citys['select']['id']}%", "%{$citys['select']['id']}.%", "%.245%", "%245.%"])->whereIn('id', $companys)->limit(1000)->orderBy('id', 'desc')->get();
  272. $total_person = DB::table('resumes')->whereRaw('created_at > "2019-12-01 00:00:00"')->groupBy('uid')->get();
  273. $total_job = 0;
  274. $total_job_num = 0;
  275. foreach ($list as $val) {
  276. $item = [
  277. 'id' => $val->id,
  278. 'companyname' => $val->companyname,
  279. 'jobs' => [],
  280. ];
  281. //在招职位
  282. $jobs_where = [
  283. ['company_id', '=', $val->id],
  284. ['valid', '=', 1],
  285. ['display', '=', 1],
  286. ['audit', '=', 1],
  287. ];
  288. //$jobs = $this->jobsService->getOtherJobs($jobs_where);
  289. $jobs = DB::table('jobs')->where($jobs_where)->get();
  290. if ($jobs) {
  291. foreach ($jobs as $value) {
  292. $total_job_num += $value->amount;
  293. $total_job += 1;
  294. }
  295. }
  296. }
  297. $org = DB::table('organization')->whereRaw('id>=10')->get();
  298. $service = DB::table('service')->whereRaw('service_type = 3')->get();
  299. $total_number = 0;
  300. foreach ($service as $k => $v) {
  301. $detail = unserialize($v->detail);
  302. $total_number += intval($detail[0]['number']);
  303. }
  304. $res = [
  305. 'total_enterprise' => count($list),
  306. 'total_job' => $total_job,
  307. 'total_person' => count($total_person),
  308. 'total_number' => $total_number,
  309. 'total_org' => count($org),
  310. ];
  311. echo json_encode($res);
  312. }
  313. /**2021新春线上招聘会
  314. * @param Request $request
  315. * @param int $id
  316. * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
  317. * @throws \Throwable
  318. */
  319. public function online2021(Request $request)
  320. {
  321. $offset = isset($request->page) ? $request->page : 0;
  322. $limit = 18;
  323. $citycategory = $request->input('citycategory');
  324. $trade = $request->input('trade');
  325. $param_array = ['citycategory', 'trade', 'nature'];
  326. $params = [];
  327. if ($request->all()) {
  328. foreach ($request->all() as $k => $v) {
  329. if (in_array($k, $param_array) && $v) {
  330. $params[$k] = $v;
  331. }
  332. }
  333. }
  334. $subsites = Cache::get('subsites_list');
  335. if ($subsites) {
  336. if (!array_has($params, 'citycategory')) {
  337. if (get_subsite_id() > 0) {
  338. $citycategory = $subsites[get_subsite_id()]['district'];
  339. }
  340. }
  341. }
  342. $citys = $this->categoryService->getCitys($citycategory);
  343. if (empty($citycategory)) {
  344. $district_str = "(district like ? or district like ? or district like ? or district like ?)";
  345. $district_arr = ["%.623%", "%623.%", "%.245%", "%245.%"];
  346. } else {
  347. $select_id = $citys['select']['id'];
  348. $district_str = "(district like ? or district like ?)";
  349. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  350. }
  351. $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw("jobs.created_at > '2021-01-01 00:00:00' and jobs.deleted_at is null")->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();
  352. // echo '<pre>';
  353. //
  354. // var_dump($companys);die;
  355. $where = [];
  356. $where[] = ['user_status', '=', 1];
  357. $where[] = ['audit', '=', 1];
  358. $where[] = ['deleted_at', '=', null];
  359. if (!empty($trade)) {
  360. $where[] = ['trade', '=', $trade];
  361. }
  362. //$where[] = array('id','in',$companys);
  363. $order_by = ['id', 'desc'];
  364. //$list = $this->searchService->search('Company', $where, $order_by, '');
  365. $list = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->offset($limit * $offset)->limit($limit)->get();
  366. $total = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->count();
  367. $total_person = DB::table('resumes')->whereRaw('created_at > "2019-12-01 00:00:00"')->groupBy('uid')->get();
  368. //$list = DB::table('companys')->where($where)->whereIn('id',$companys)->orderBy('id','desc')->offset($limit*$offset)->limit($limit)->get();
  369. // echo '<pre>';
  370. //
  371. // var_dump($list);die;
  372. $more = count($list) >= $limit ? true : false;
  373. // if ($list->total() >0) {
  374. // //处理企业信息
  375. // $list_items = $this->companyService->dealCompanyFields($list->items());
  376. // } else {
  377. // $list_items = array();
  378. // }
  379. $res = [];
  380. $total_job = 0;
  381. $total_job_num = 0;
  382. foreach ($list as $val) {
  383. $item = [
  384. 'id' => $val->id,
  385. 'companyname' => $val->companyname,
  386. 'jobs' => [],
  387. 'tag_arr' => [],
  388. ];
  389. //在招职位
  390. $jobs_where = [
  391. ['company_id', '=', $val->id],
  392. ['valid', '=', 1],
  393. ['display', '=', 1],
  394. ['audit', '=', 1],
  395. ['deleted_at', '=', null],
  396. ];
  397. //$jobs = $this->jobsService->getOtherJobs($jobs_where);
  398. $jobs = DB::table('jobs')->where($jobs_where)->get();
  399. if ($jobs) {
  400. foreach ($jobs as $value) {
  401. $job = [
  402. 'id' => $value->id,
  403. 'jobs_name' => $value->jobs_name,
  404. 'amount' => $value->amount,
  405. 'wage' => $value->wage,
  406. 'wage_min' => $value->wage_min,
  407. 'wage_max' => $value->wage_max,
  408. ];
  409. array_push($item['jobs'], $job);
  410. $total_job_num += $value->amount;
  411. $total_job += 1;
  412. }
  413. }
  414. //企业福利
  415. if (!empty($val->tag)) {
  416. $tags = explode(',', $val->tag);
  417. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  418. $item['tag_arr'] = $tag_arr;
  419. }
  420. array_push($res, $item);
  421. }
  422. $filter_where = [
  423. 'AIX_trade' => 100,
  424. 'AIX_company_type' => 100,
  425. ];
  426. $categories = $this->categoryService->getCategories($filter_where);
  427. if ($request->ajax()) {
  428. if (count($res)) {
  429. return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_online2021_special_com', [
  430. 'res' => $res,
  431. 'city' => $citys,
  432. 'params' => $params,
  433. 'categories' => $categories,
  434. 'more' => $more,
  435. ])->render()]);
  436. }
  437. return response()->json(['status' => 0]);
  438. }
  439. return view('app.active.online2021', [
  440. 'res' => $res,
  441. 'city' => $citys,
  442. 'params' => $params,
  443. 'categories' => $categories,
  444. 'more' => $more,
  445. 'total' => $total,
  446. 'total_person' => count($total_person),
  447. 'total_job' => $total_job
  448. //'list_items' => $list_items,
  449. //'list' => $list,
  450. ]);
  451. }
  452. /**
  453. * 智能招聘长廊
  454. */
  455. public function ai_recruit(Request $request)
  456. {
  457. $limit = 40;
  458. $citycategory = 'jjkfq';
  459. $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw("jobs.updated_at > '2021-01-01 00:00:00' and jobs.deleted_at is null")->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();
  460. $citys = $this->categoryService->getCitys($citycategory);
  461. $select_id = $citys['select']['id'];
  462. $district_str = "(district like ? or district like ?)";
  463. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  464. $where = [];
  465. $where[] = ['user_status', '=', 1];
  466. $where[] = ['audit', '=', 1];
  467. $where[] = ['deleted_at', '=', null];
  468. if (!empty($trade)) {
  469. $where[] = ['trade', '=', $trade];
  470. }
  471. $list = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->get();
  472. $res = [];
  473. foreach ($list as $val) {
  474. $item = [
  475. 'id' => $val->id,
  476. 'companyname' => $val->companyname,
  477. 'landline_tel' => $val->landline_tel,
  478. 'mobile' => $val->mobile,
  479. 'reg_address' => $val->reg_address,
  480. 'jobs' => [],
  481. 'tag_arr' => [],
  482. ];
  483. //在招职位
  484. $jobs_where = [
  485. ['company_id', '=', $val->id],
  486. ['valid', '=', 1],
  487. ['display', '=', 1],
  488. ['audit', '=', 1],
  489. ['deleted_at', '=', null],
  490. ];
  491. $jobs = DB::table('jobs')->where($jobs_where)->get();
  492. if (!$jobs->isEmpty()) {
  493. foreach ($jobs as $value) {
  494. $job = [
  495. 'id' => $value->id,
  496. 'jobs_name' => $value->jobs_name,
  497. 'amount' => $value->amount,
  498. 'wage' => $value->wage,
  499. 'wage_min' => $value->wage_min,
  500. 'wage_max' => $value->wage_max,
  501. 'wage_str' => $value->wage_str,
  502. ];
  503. array_push($item['jobs'], $job);
  504. }
  505. }
  506. //企业福利
  507. if (!empty($val->tag)) {
  508. $tags = explode(',', $val->tag);
  509. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  510. $item['tag_arr'] = $tag_arr;
  511. }
  512. array_push($res, $item);
  513. }
  514. $res = $this->_split_arr($res, 4);
  515. return view('app.active.ai_recruit', ['res' => $res]);
  516. }
  517. private function _split_arr($arr, $num)
  518. {
  519. $res = [];
  520. $item = [];
  521. foreach ($arr as $k => $v) {
  522. if ($k % $num == 0 && $k != 0) {
  523. $res[] = $item;
  524. $item = [];
  525. }
  526. $item[] = $v;
  527. }
  528. if (!empty($item)) {
  529. $res[] = $item;
  530. }
  531. return $res;
  532. }
  533. /**2021新春线上招聘会经济开发区
  534. */
  535. public function online2021_jkq(Request $request)
  536. {
  537. if (!$request->ajax()) {
  538. //奖品列表
  539. $prize = LotteryPrize::all();
  540. }
  541. $offset = isset($request->page) ? $request->page : 0;
  542. $limit = 18;
  543. $citycategory = 'jjkfq';
  544. $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw("jobs.updated_at > '2021-01-01 00:00:00' and jobs.deleted_at is null")->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();
  545. $citys = $this->categoryService->getCitys($citycategory);
  546. $select_id = $citys['select']['id'];
  547. $district_str = "(district like ? or district like ?)";
  548. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  549. $where = [];
  550. $where[] = ['user_status', '=', 1];
  551. $where[] = ['audit', '=', 1];
  552. $where[] = ['deleted_at', '=', null];
  553. $list = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->offset($limit * $offset)->limit($limit)->get();
  554. $more = count($list) >= $limit ? true : false;
  555. $res = [];
  556. foreach ($list as $val) {
  557. $item = [
  558. 'id' => $val->id,
  559. 'companyname' => $val->companyname,
  560. 'jobs' => [],
  561. 'tag_arr' => [],
  562. ];
  563. //在招职位
  564. $jobs_where = [
  565. ['company_id', '=', $val->id],
  566. ['valid', '=', 1],
  567. ['display', '=', 1],
  568. ['audit', '=', 1],
  569. ['deleted_at', '=', null],
  570. ];
  571. $jobs = DB::table('jobs')->where($jobs_where)->get();
  572. if (!$jobs->isEmpty()) {
  573. foreach ($jobs as $value) {
  574. $job = [
  575. 'id' => $value->id,
  576. 'jobs_name' => $value->jobs_name,
  577. 'amount' => $value->amount,
  578. 'wage' => $value->wage,
  579. 'wage_min' => $value->wage_min,
  580. 'wage_max' => $value->wage_max,
  581. 'wage_str' => $value->wage_str,
  582. ];
  583. array_push($item['jobs'], $job);
  584. }
  585. }
  586. //企业福利
  587. if (!empty($val->tag)) {
  588. $tags = explode(',', $val->tag);
  589. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  590. $item['tag_arr'] = $tag_arr;
  591. }
  592. array_push($res, $item);
  593. }
  594. if ($request->ajax()) {
  595. if (count($res)) {
  596. return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_online2021_special_com', [
  597. 'res' => $res,
  598. 'city' => $citys,
  599. 'more' => $more,
  600. ])->render()]);
  601. }
  602. return response()->json(['status' => 0]);
  603. }
  604. return view('app.active.online2021_jkq', [
  605. 'params' => ['citycategory' => 'jjkfq'],
  606. 'prize' => $prize,
  607. 'res' => $res,
  608. 'more' => $more,
  609. 'live_list' => $this->homeService->getOnline2021Live(),
  610. ]);
  611. }
  612. /**2021新春线上招聘会经济开发区
  613. */
  614. public function online2021_main()
  615. {
  616. //奖品列表
  617. $prize = LotteryPrize::all();
  618. return view('app.active.online2021_main', [
  619. 'prize' => $prize,
  620. 'live_list' => $this->homeService->getOnline2021Live(),
  621. ]);
  622. }
  623. }