JobfairController.php 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  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. /**新春线上招聘会
  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 spring(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. $whereRaw = "jobs.updated_at > '2024-01-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1";
  352. $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw($whereRaw)->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();
  353. $where = [];
  354. $where[] = ['user_status', '=', 1];
  355. $where[] = ['audit', '=', 1];
  356. $where[] = ['deleted_at', '=', null];
  357. if (!empty($trade)) {
  358. $where[] = ['trade', '=', $trade];
  359. }
  360. $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();
  361. $total = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->count();
  362. $total_person = DB::table('resumes')->whereRaw('created_at > "2019-12-01 00:00:00"')->groupBy('uid')->get();
  363. $more = count($list) >= $limit ? true : false;
  364. $res = [];
  365. $total_job = 0;
  366. $total_job_num = 0;
  367. foreach ($list as $val) {
  368. $item = [
  369. 'id' => $val->id,
  370. 'companyname' => $val->companyname,
  371. 'jobs' => [],
  372. 'tag_arr' => [],
  373. ];
  374. //在招职位
  375. $jobs_where = [
  376. ['company_id', '=', $val->id],
  377. ['valid', '=', 1],
  378. ['display', '=', 1],
  379. ['audit', '=', 1],
  380. ['deleted_at', '=', null],
  381. ];
  382. $jobs = DB::table('jobs')->where($jobs_where)->get();
  383. if ($jobs) {
  384. foreach ($jobs as $value) {
  385. $job = [
  386. 'id' => $value->id,
  387. 'jobs_name' => $value->jobs_name,
  388. 'amount' => $value->amount,
  389. 'wage' => $value->wage,
  390. 'wage_min' => $value->wage_min,
  391. 'wage_max' => $value->wage_max,
  392. ];
  393. array_push($item['jobs'], $job);
  394. $total_job_num += $value->amount;
  395. $total_job += 1;
  396. }
  397. }
  398. //企业福利
  399. if (!empty($val->tag)) {
  400. $tags = explode(',', $val->tag);
  401. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  402. $item['tag_arr'] = $tag_arr;
  403. }
  404. array_push($res, $item);
  405. }
  406. $filter_where = [
  407. 'AIX_trade' => 100,
  408. 'AIX_company_type' => 100,
  409. ];
  410. $categories = $this->categoryService->getCategories($filter_where);
  411. if ($request->ajax()) {
  412. if (count($res)) {
  413. return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_spring_special_com', [
  414. 'res' => $res,
  415. 'city' => $citys,
  416. 'params' => $params,
  417. 'categories' => $categories,
  418. 'more' => $more,
  419. ])->render()]);
  420. }
  421. return response()->json(['status' => 0]);
  422. }
  423. return view('app.active.spring', [
  424. 'res' => $res,
  425. 'city' => $citys,
  426. 'params' => $params,
  427. 'categories' => $categories,
  428. 'more' => $more,
  429. 'total' => $total,
  430. 'total_person' => count($total_person),
  431. 'total_job' => $total_job,
  432. ]);
  433. }
  434. /**
  435. * 智能招聘长廊
  436. */
  437. public function ai_recruit(Request $request)
  438. {
  439. $citycategory = 'jjkfq';
  440. $whereRaw = "jobs.updated_at > '2024-01-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1";
  441. $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw($whereRaw)->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();
  442. $citys = $this->categoryService->getCitys($citycategory);
  443. $select_id = $citys['select']['id'];
  444. $district_str = "(district like ? or district like ?)";
  445. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  446. $where = [];
  447. $where[] = ['user_status', '=', 1];
  448. $where[] = ['audit', '=', 1];
  449. $where[] = ['deleted_at', '=', null];
  450. if (!empty($trade)) {
  451. $where[] = ['trade', '=', $trade];
  452. }
  453. $list = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->get();
  454. $res = [];
  455. foreach ($list as $val) {
  456. $item = [
  457. 'id' => $val->id,
  458. 'companyname' => $val->companyname,
  459. 'landline_tel' => $val->landline_tel,
  460. 'mobile' => $val->mobile,
  461. 'reg_address' => $val->reg_address,
  462. 'jobs' => [],
  463. 'tag_arr' => [],
  464. ];
  465. //在招职位
  466. $jobs_where = [
  467. ['company_id', '=', $val->id],
  468. ['valid', '=', 1],
  469. ['display', '=', 1],
  470. ['audit', '=', 1],
  471. ['deleted_at', '=', null],
  472. ];
  473. $jobs = DB::table('jobs')->where($jobs_where)->get();
  474. if (!$jobs->isEmpty()) {
  475. foreach ($jobs as $value) {
  476. $job = [
  477. 'id' => $value->id,
  478. 'jobs_name' => $value->jobs_name,
  479. 'amount' => $value->amount,
  480. 'wage' => $value->wage,
  481. 'wage_min' => $value->wage_min,
  482. 'wage_max' => $value->wage_max,
  483. 'wage_str' => $value->wage_str,
  484. ];
  485. array_push($item['jobs'], $job);
  486. }
  487. }
  488. //企业福利
  489. if (!empty($val->tag)) {
  490. $tags = explode(',', $val->tag);
  491. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  492. $item['tag_arr'] = $tag_arr;
  493. }
  494. array_push($res, $item);
  495. }
  496. $res = $this->_split_arr($res, 4);
  497. return view('app.active.ai_recruit', ['res' => $res]);
  498. }
  499. private function _split_arr($arr, $num)
  500. {
  501. $res = [];
  502. $item = [];
  503. foreach ($arr as $k => $v) {
  504. if ($k % $num == 0 && $k != 0) {
  505. $res[] = $item;
  506. $item = [];
  507. }
  508. $item[] = $v;
  509. }
  510. if (!empty($item)) {
  511. $res[] = $item;
  512. }
  513. return $res;
  514. }
  515. /**新春线上招聘会经济开发区
  516. */
  517. public function spring_jkq(Request $request)
  518. {
  519. if (!$request->ajax()) {
  520. //奖品列表
  521. $prize = LotteryPrize::all();
  522. }
  523. $offset = isset($request->page) ? $request->page : 0;
  524. $limit = 18;
  525. $citycategory = 'jjkfq';
  526. $whereRaw = "jobs.updated_at > '2024-01-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1";
  527. $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw($whereRaw)->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();
  528. $citys = $this->categoryService->getCitys($citycategory);
  529. $select_id = $citys['select']['id'];
  530. $district_str = "(district like ? or district like ?)";
  531. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  532. $where = [];
  533. $where[] = ['user_status', '=', 1];
  534. $where[] = ['audit', '=', 1];
  535. $where[] = ['deleted_at', '=', null];
  536. $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();
  537. $more = count($list) >= $limit ? true : false;
  538. $res = [];
  539. foreach ($list as $val) {
  540. $item = [
  541. 'id' => $val->id,
  542. 'companyname' => $val->companyname,
  543. 'jobs' => [],
  544. 'tag_arr' => [],
  545. ];
  546. //在招职位
  547. $jobs_where = [
  548. ['company_id', '=', $val->id],
  549. ['valid', '=', 1],
  550. ['display', '=', 1],
  551. ['audit', '=', 1],
  552. ['deleted_at', '=', null],
  553. ];
  554. $jobs = DB::table('jobs')->where($jobs_where)->get();
  555. if (!$jobs->isEmpty()) {
  556. foreach ($jobs as $value) {
  557. $job = [
  558. 'id' => $value->id,
  559. 'jobs_name' => $value->jobs_name,
  560. 'amount' => $value->amount,
  561. 'wage' => $value->wage,
  562. 'wage_min' => $value->wage_min,
  563. 'wage_max' => $value->wage_max,
  564. 'wage_str' => $value->wage_str,
  565. ];
  566. array_push($item['jobs'], $job);
  567. }
  568. }
  569. //企业福利
  570. if (!empty($val->tag)) {
  571. $tags = explode(',', $val->tag);
  572. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  573. $item['tag_arr'] = $tag_arr;
  574. }
  575. array_push($res, $item);
  576. }
  577. if ($request->ajax()) {
  578. if (count($res)) {
  579. return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_spring_special_com', [
  580. 'res' => $res,
  581. 'city' => $citys,
  582. 'more' => $more,
  583. ])->render()]);
  584. }
  585. return response()->json(['status' => 0]);
  586. }
  587. return view('app.active.spring_jkq', [
  588. 'params' => ['citycategory' => 'jjkfq'],
  589. 'prize' => $prize,
  590. 'res' => $res,
  591. 'more' => $more,
  592. 'live_list' => $this->homeService->getSpringLive(),
  593. ]);
  594. }
  595. /**新春线上招聘会经济开发区
  596. */
  597. public function spring_main()
  598. {
  599. //奖品列表
  600. $prize = LotteryPrize::all();
  601. return view('app.active.spring_main', [
  602. 'prize' => $prize,
  603. 'live_list' => $this->homeService->getSpringLive(),
  604. ]);
  605. }
  606. /**
  607. * 海灵线上招聘会
  608. */
  609. public function online_recruit(Request $request)
  610. {
  611. $offset = isset($request->page) ? $request->page : 0;
  612. $limit = 18;
  613. $trade = $request->input('trade');
  614. $param_array = ['trade', 'nature'];
  615. $params = [];
  616. if ($request->all()) {
  617. foreach ($request->all() as $k => $v) {
  618. if (in_array($k, $param_array) && $v) {
  619. $params[$k] = $v;
  620. }
  621. }
  622. }
  623. $params['citycategory'] = 'jjkfq';
  624. $citycategory = 'jjkfq';
  625. $whereRaw = "jobs.updated_at > '2022-06-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1 and education > 68";
  626. $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw($whereRaw)->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();
  627. $citys = $this->categoryService->getCitys($citycategory);
  628. $select_id = $citys['select']['id'];
  629. $district_str = "(district like ? or district like ?)";
  630. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  631. $where = [];
  632. $where[] = ['user_status', '=', 1];
  633. $where[] = ['audit', '=', 1];
  634. $where[] = ['deleted_at', '=', null];
  635. if (!empty($trade)) {
  636. $where[] = ['trade', '=', $trade];
  637. }
  638. $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();
  639. $more = count($list) >= $limit ? true : false;
  640. $res = [];
  641. foreach ($list as $val) {
  642. $item = [
  643. 'id' => $val->id,
  644. 'companyname' => $val->companyname,
  645. 'jobs' => [],
  646. 'tag_arr' => [],
  647. ];
  648. //在招职位
  649. $jobs_where = [
  650. ['company_id', '=', $val->id],
  651. ['valid', '=', 1],
  652. ['display', '=', 1],
  653. ['audit', '=', 1],
  654. ['deleted_at', '=', null],
  655. ['education', '>', 68],
  656. ];
  657. $jobs = DB::table('jobs')->where($jobs_where)->get();
  658. if (!$jobs->isEmpty()) {
  659. foreach ($jobs as $value) {
  660. $job = [
  661. 'id' => $value->id,
  662. 'jobs_name' => $value->jobs_name,
  663. 'amount' => $value->amount,
  664. 'wage' => $value->wage,
  665. 'wage_min' => $value->wage_min,
  666. 'wage_max' => $value->wage_max,
  667. 'wage_str' => $value->wage_str,
  668. ];
  669. array_push($item['jobs'], $job);
  670. }
  671. }
  672. //企业福利
  673. if (!empty($val->tag)) {
  674. $tags = explode(',', $val->tag);
  675. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  676. $item['tag_arr'] = $tag_arr;
  677. }
  678. array_push($res, $item);
  679. }
  680. $filter_where = [
  681. 'AIX_trade' => 100,
  682. 'AIX_company_type' => 100,
  683. ];
  684. $categories = $this->categoryService->getCategories($filter_where);
  685. if ($request->ajax()) {
  686. if (count($res)) {
  687. return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_spring_recruit', [
  688. 'categories' => $categories,
  689. 'res' => $res,
  690. 'city' => $citys,
  691. 'more' => $more,
  692. 'params' => $params,
  693. ])->render()]);
  694. }
  695. return response()->json(['status' => 0]);
  696. }
  697. return view('app.active.online_recruit', [
  698. 'categories' => $categories,
  699. 'res' => $res,
  700. 'more' => $more,
  701. 'params' => $params,
  702. ]);
  703. }
  704. /**薪动餐饮
  705. * @param Request $request
  706. * @param int $id
  707. * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
  708. * @throws \Throwable
  709. */
  710. public function restaurant(Request $request)
  711. {
  712. $offset = isset($request->page) ? $request->page : 0;
  713. $limit = 18;
  714. $where = [];
  715. $where[] = ['user_status', '=', 1];
  716. $where[] = ['audit', '=', 1];
  717. $where[] = ['is_restaurant', '=', 1];
  718. $where[] = ['deleted_at', '=', null];
  719. $list = DB::table('companys')->where($where)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->offset($limit * $offset)->limit($limit)->get();
  720. $total = DB::table('companys')->where($where)->count();
  721. $more = count($list) >= $limit ? true : false;
  722. $res = [];
  723. $total_job = 0;
  724. $total_job_num = 0;
  725. foreach ($list as $val) {
  726. $item = [
  727. 'id' => $val->id,
  728. 'companyname' => $val->companyname,
  729. 'jobs' => [],
  730. 'tag_arr' => [],
  731. ];
  732. //在招职位
  733. $jobs_where = [
  734. ['company_id', '=', $val->id],
  735. ['valid', '=', 1],
  736. ['display', '=', 1],
  737. ['audit', '=', 1],
  738. ['deleted_at', '=', null],
  739. ];
  740. $jobs = DB::table('jobs')->where($jobs_where)->get();
  741. if ($jobs) {
  742. foreach ($jobs as $value) {
  743. $job = [
  744. 'id' => $value->id,
  745. 'jobs_name' => $value->jobs_name,
  746. 'amount' => $value->amount,
  747. 'wage' => $value->wage,
  748. 'wage_min' => $value->wage_min,
  749. 'wage_max' => $value->wage_max,
  750. ];
  751. array_push($item['jobs'], $job);
  752. $total_job_num += $value->amount;
  753. $total_job += 1;
  754. }
  755. }
  756. //企业福利
  757. if (!empty($val->tag)) {
  758. $tags = explode(',', $val->tag);
  759. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  760. $item['tag_arr'] = $tag_arr;
  761. }
  762. array_push($res, $item);
  763. }
  764. if ($request->ajax()) {
  765. if (count($res)) {
  766. return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_restaurant', [
  767. 'res' => $res,
  768. 'more' => $more,
  769. ])->render()]);
  770. }
  771. return response()->json(['status' => 0]);
  772. }
  773. return view('app.active.restaurant', [
  774. 'res' => $res,
  775. 'more' => $more,
  776. 'total' => $total,
  777. 'total_job' => $total_job,
  778. ]);
  779. }
  780. }