SpringController.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. <?php
  2. namespace App\Http\Controllers\Mobile\Active;
  3. use App\Http\Controllers\Mobile\MobileBaseController;
  4. use App\Models\LotteryLog;
  5. use App\Models\LotteryPrize;
  6. use App\Models\LotteryWin;
  7. use App\Models\Thirdlogin;
  8. use App\Services\Common\CategoryService;
  9. use App\Services\Common\WechatService;
  10. use App\Services\Auth\AuthService;
  11. use App\Services\HomeService;
  12. use Illuminate\Http\Request;
  13. use Illuminate\Support\Facades\Cache;
  14. use Illuminate\Support\Facades\DB;
  15. use Illuminate\Support\Facades\Session;
  16. class SpringController extends MobileBaseController
  17. {
  18. private $wechatService;
  19. protected $categoryService;
  20. protected $authService;
  21. protected $homeService;
  22. public function __construct(WechatService $wechatService, CategoryService $categoryService, authService $authService, HomeService $homeService)
  23. {
  24. $this->wechatService = $wechatService;
  25. $this->categoryService = $categoryService;
  26. $this->authService = $authService;
  27. $this->homeService = $homeService;
  28. }
  29. /**
  30. * 专题页
  31. */
  32. public function index(Request $request)
  33. {
  34. //是否登录
  35. $user = auth('web-member')->user();
  36. if (empty($user)) {
  37. $open_id = Session::get('open_id');
  38. if (empty($open_id)) {
  39. return redirect(route('mobile.lottery.login'));
  40. }
  41. } else {
  42. $third = Thirdlogin::where('uid', $user->id)->first();
  43. $open_id = $third['openid'];
  44. }
  45. // $open_id = '11';
  46. //抽奖次数
  47. $type = $request->input('type', 1);
  48. $date = date('Y-m-d');
  49. $log = LotteryLog::where([
  50. ['create_time', '=', $date],
  51. ['type', '=', $type],
  52. ['open_id', '=', $open_id],
  53. ])->first();
  54. $number = 1;
  55. if (!empty($log)) {
  56. $number = 0;
  57. }
  58. //奖品列表
  59. $prize = LotteryPrize::all();
  60. $ids = [];
  61. $restaraunts = [];
  62. $colors = [];
  63. $images = [];
  64. foreach ($prize as $v) {
  65. $ids[] = $v->id;
  66. $restaraunts[] = $v->prize_name;
  67. $colors[] = $v->prize_bg;
  68. $images[] = upload_asset($v->prize_image);
  69. }
  70. //中奖记录
  71. $win = [];
  72. $user = auth('web-member')->user();
  73. if (!empty($user)) {
  74. $win = LotteryWin::with('prize')->where('member_id', $user->id)->orderBy('status', 'asc')->orderBy('created_at', 'desc')->limit(8)->get();
  75. }
  76. $return_data = [
  77. 'open_id' => $open_id,
  78. 'current_url' => \Illuminate\Support\Facades\Request::getRequestUri(),
  79. 'user' => $user,
  80. 'number' => $number,
  81. 'type' => $type,
  82. 'prize' => $prize,
  83. 'win' => $win,
  84. 'ids' => $ids,
  85. 'restaraunts' => $restaraunts,
  86. 'colors' => $colors,
  87. 'images' => $images,
  88. 'wap_title' => '抽奖',
  89. 'share_title' => '【福利通知】免费找工作,抽大奖拿好礼',
  90. 'share_desc' => '晋江好福利!免费找工作、找人才,还能抽奖,100%中奖,万份好礼免费拿!',
  91. 'share_link' => route('mobile.lottery.login'),
  92. 'share_image_url' => theme_asset('mobile/images/online2021/share_logo.jpg'),
  93. 'live_list' => $this->homeService->getSpringLive(),
  94. ];
  95. return view('mobile.app.active.spring', $return_data);
  96. }
  97. /**
  98. * 专区页
  99. */
  100. public function special(Request $request)
  101. {
  102. $offset = isset($request->page) ? $request->page : 0;
  103. $limit = 8;
  104. $citycategory = $request->input('citycategory', '');
  105. $trade = $request->input('trade', '');
  106. $param_array = ['citycategory', 'trade', 'nature'];
  107. $params = [];
  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. $filter_where = [
  116. 'AIX_trade' => 100,
  117. 'AIX_company_type' => 100,
  118. ];
  119. $categories = $this->categoryService->getCategories($filter_where);
  120. $subsites = Cache::get('subsites_list');
  121. if ($subsites) {
  122. if (!array_has($params, 'citycategory')) {
  123. if (get_subsite_id() > 0) {
  124. $citycategory = $subsites[get_subsite_id()]['district'];
  125. }
  126. }
  127. }
  128. $title = '晋江市新春招聘会';
  129. $citys = $this->categoryService->getCitys($citycategory);
  130. if (empty($citycategory)) {
  131. $district_str = "(district like ? or district like ?)";
  132. $district_arr = ["%.623%", "%623.%"];
  133. } else {
  134. $select_id = $citys['select']['id'];
  135. $district_str = "(district like ? or district like ?)";
  136. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  137. $title = $citys['select']['name'] . '专区';
  138. }
  139. $whereRaw = "jobs.updated_at > '2023-01-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1";
  140. $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();
  141. $where = [];
  142. $where[] = ['user_status', '=', 1];
  143. $where[] = ['audit', '=', 1];
  144. $where[] = ['deleted_at', '=', null];
  145. if (!empty($trade)) {
  146. $where[] = ['trade', '=', $trade];
  147. }
  148. $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();
  149. $more = count($list) >= $limit ? true : false;
  150. $res = [];
  151. foreach ($list as $val) {
  152. $item = [
  153. 'id' => $val->id,
  154. 'companyname' => $val->companyname,
  155. 'jobs' => [],
  156. 'tag_arr' => [],
  157. ];
  158. //在招职位
  159. $jobs_where = [
  160. ['company_id', '=', $val->id],
  161. ['valid', '=', 1],
  162. ['display', '=', 1],
  163. ['audit', '=', 1],
  164. ['deleted_at', '=', null],
  165. ];
  166. $jobs = DB::table('jobs')->where($jobs_where)->get();
  167. if (!$jobs->isEmpty()) {
  168. foreach ($jobs as $value) {
  169. $job = [
  170. 'id' => $value->id,
  171. 'jobs_name' => $value->jobs_name,
  172. 'amount' => $value->amount,
  173. 'wage' => $value->wage,
  174. 'wage_min' => $value->wage_min,
  175. 'wage_max' => $value->wage_max,
  176. ];
  177. array_push($item['jobs'], $job);
  178. }
  179. }
  180. //企业福利
  181. if (!empty($val->tag)) {
  182. $tags = explode(',', $val->tag);
  183. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  184. $item['tag_arr'] = $tag_arr;
  185. }
  186. array_push($res, $item);
  187. }
  188. if ($request->ajax()) {
  189. if (count($res)) {
  190. return response()->json(['status' => 1, 'data' => view('mobile.app.active.ajax.ajax_spring_special_com', [
  191. 'res' => $res,
  192. 'city' => $citys,
  193. 'params' => $params,
  194. 'categories' => $categories,
  195. 'more' => $more,
  196. ])->render()]);
  197. }
  198. return response()->json(['status' => 0]);
  199. }
  200. return view('mobile.app.active.spring_special', [
  201. 'title' => $title,
  202. 'res' => $res,
  203. 'city' => $citys,
  204. 'params' => $params,
  205. 'categories' => $categories,
  206. 'more' => $more,
  207. 'share_title' => "【{$title}】免费找工作",
  208. 'share_desc' => '晋江好福利!免费找工作、找人才,还能抽奖,100%中奖,万份好礼免费拿!',
  209. 'share_image_url' => theme_asset('mobile/images/online2021/share_logo.jpg'),
  210. 'share_link' => route('mobile.active.spring_special') . '?citycategory=' . $citycategory,
  211. ]);
  212. }
  213. /**
  214. * 经开区专区页
  215. */
  216. public function special_jkq(Request $request)
  217. {
  218. $source = $request->input('source', 0);
  219. $type = $request->input('type', 1);
  220. if (!$request->ajax()) {
  221. //是否登录
  222. $user = auth('web-member')->user();
  223. if (empty($user)) {
  224. $open_id = Session::get('open_id');
  225. if (empty($open_id)) {
  226. return redirect(route('mobile.active.spring_jkq_login', ['type' => $type, 'source' => $source]));
  227. }
  228. } else {
  229. $third = Thirdlogin::where('uid', $user->id)->first();
  230. $open_id = $third['openid'];
  231. }
  232. // $open_id = '11';
  233. //抽奖次数
  234. $date = date('Y-m-d');
  235. $log = LotteryLog::where([
  236. ['create_time', '=', $date],
  237. ['type', '=', $type],
  238. ['open_id', '=', $open_id],
  239. ])->first();
  240. $number = 1;
  241. if (!empty($log)) {
  242. $number = 0;
  243. }
  244. //奖品列表
  245. $prize = LotteryPrize::all();
  246. $ids = [];
  247. $restaraunts = [];
  248. $colors = [];
  249. $images = [];
  250. foreach ($prize as $v) {
  251. $ids[] = $v->id;
  252. $restaraunts[] = $v->prize_name;
  253. $colors[] = $v->prize_bg;
  254. $images[] = upload_asset($v->prize_image);
  255. }
  256. //中奖记录
  257. $win = [];
  258. $user = auth('web-member')->user();
  259. if (!empty($user)) {
  260. $win = LotteryWin::with('prize')->where('member_id', $user->id)->orderBy('status', 'asc')->orderBy('created_at', 'desc')->limit(8)->get();
  261. }
  262. }
  263. $offset = isset($request->page) ? $request->page : 0;
  264. $limit = 8;
  265. $citycategory = 'jjkfq';
  266. $whereRaw = "jobs.updated_at > '2023-01-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1";
  267. $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();
  268. $citys = $this->categoryService->getCitys($citycategory);
  269. $select_id = $citys['select']['id'];
  270. $district_str = "(district like ? or district like ?)";
  271. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  272. $where = [];
  273. $where[] = ['user_status', '=', 1];
  274. $where[] = ['audit', '=', 1];
  275. $where[] = ['deleted_at', '=', null];
  276. $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();
  277. $more = count($list) >= $limit ? true : false;
  278. $res = [];
  279. foreach ($list as $val) {
  280. $item = [
  281. 'id' => $val->id,
  282. 'companyname' => $val->companyname,
  283. 'jobs' => [],
  284. 'tag_arr' => [],
  285. ];
  286. //在招职位
  287. $jobs_where = [
  288. ['company_id', '=', $val->id],
  289. ['valid', '=', 1],
  290. ['display', '=', 1],
  291. ['audit', '=', 1],
  292. ['deleted_at', '=', null],
  293. ];
  294. $jobs = DB::table('jobs')->where($jobs_where)->get();
  295. if (!$jobs->isEmpty()) {
  296. foreach ($jobs as $value) {
  297. $job = [
  298. 'id' => $value->id,
  299. 'jobs_name' => $value->jobs_name,
  300. 'amount' => $value->amount,
  301. 'wage' => $value->wage,
  302. 'wage_min' => $value->wage_min,
  303. 'wage_max' => $value->wage_max,
  304. 'wage_str' => $value->wage_str,
  305. ];
  306. array_push($item['jobs'], $job);
  307. }
  308. }
  309. //企业福利
  310. if (!empty($val->tag)) {
  311. $tags = explode(',', $val->tag);
  312. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  313. $item['tag_arr'] = $tag_arr;
  314. }
  315. array_push($res, $item);
  316. }
  317. if ($request->ajax()) {
  318. if (count($res)) {
  319. return response()->json(['status' => 1, 'data' => view('mobile.app.active.ajax.ajax_spring_special_com', [
  320. 'res' => $res,
  321. 'more' => $more,
  322. ])->render()]);
  323. }
  324. return response()->json(['status' => 0]);
  325. }
  326. return view('mobile.app.active.spring_special_jkq', [
  327. 'source' => $source,
  328. 'params' => ['citycategory' => 'jjkfq'],
  329. 'open_id' => $open_id,
  330. 'current_url' => \Illuminate\Support\Facades\Request::getRequestUri(),
  331. 'user' => $user,
  332. 'number' => $number,
  333. 'type' => $type,
  334. 'prize' => $prize,
  335. 'win' => $win,
  336. 'ids' => $ids,
  337. 'restaraunts' => $restaraunts,
  338. 'colors' => $colors,
  339. 'images' => $images,
  340. 'res' => $res,
  341. 'more' => $more,
  342. 'share_title' => '【福利通知】免费找工作,抽大奖拿好礼',
  343. 'share_desc' => '晋江好福利!免费找工作、找人才,还能抽奖,100%中奖,万份好礼免费拿!',
  344. 'share_image_url' => theme_asset('mobile/images/online2021/share_logo.jpg'),
  345. 'live_list' => $this->homeService->getSpringLive(),
  346. ]);
  347. }
  348. /**
  349. * 微信登录
  350. */
  351. public function jkq_login(Request $request)
  352. {
  353. //type:web-电脑端,mobile-手机端,
  354. $app_id = subsite_config('aix.system.oauth.wechat_official.app_id');
  355. $redirect_uri = urlencode(route('mobile.active.spring_jkq_wechat_back'));
  356. $type = $request->input('type', 1);
  357. $source = $request->input('source', 0);
  358. $wechat_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$app_id}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_userinfo&state={$type}_{$source}#wechat_redirect";
  359. return redirect($wechat_url);
  360. }
  361. /**
  362. * 微信回调
  363. */
  364. public function jkq_wechat_back(Request $request)
  365. {
  366. //微信登录
  367. $officialAccount = $this->wechatService->getOfficialAccount();
  368. $wechatUser = $officialAccount->oauth->user()->getOriginal();
  369. $thirdlogin = Thirdlogin::where('openid', $wechatUser['openid'])->first();
  370. if (!$thirdlogin && $wechatUser['unionid']) {
  371. $thirdlogin = Thirdlogin::where('unionid', $wechatUser['unionid'])->first();
  372. }
  373. if ($thirdlogin) {
  374. $member = $thirdlogin->member()->withTrashed()->first();
  375. $this->authService->login($member, 1);
  376. } else {
  377. Session::put('open_id', $wechatUser['openid']);
  378. Session::put('union_id', $wechatUser['unionid'] ?: '');
  379. Session::save();
  380. }
  381. $state = $request->input('state', '');
  382. $state = explode('_', $state);
  383. $url = route('mobile.active.spring_special_jkq', ['type' => $state[0], 'source' => $state[1]]);
  384. return redirect($url);
  385. }
  386. /**
  387. * 直播专用页
  388. */
  389. public function special_live(Request $request)
  390. {
  391. if (!$request->ajax()) {
  392. //奖品列表
  393. $prize = LotteryPrize::all();
  394. }
  395. $offset = isset($request->page) ? $request->page : 0;
  396. $limit = 8;
  397. $citycategory = 'jjkfq';
  398. $whereRaw = "jobs.updated_at > '2023-01-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1";
  399. $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();
  400. $citys = $this->categoryService->getCitys($citycategory);
  401. $select_id = $citys['select']['id'];
  402. $district_str = "(district like ? or district like ?)";
  403. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  404. $where = [];
  405. $where[] = ['user_status', '=', 1];
  406. $where[] = ['audit', '=', 1];
  407. $where[] = ['deleted_at', '=', null];
  408. $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();
  409. $more = count($list) >= $limit ? true : false;
  410. $res = [];
  411. foreach ($list as $val) {
  412. $item = [
  413. 'id' => $val->id,
  414. 'companyname' => $val->companyname,
  415. 'jobs' => [],
  416. 'tag_arr' => [],
  417. ];
  418. //在招职位
  419. $jobs_where = [
  420. ['company_id', '=', $val->id],
  421. ['valid', '=', 1],
  422. ['display', '=', 1],
  423. ['audit', '=', 1],
  424. ['deleted_at', '=', null],
  425. ];
  426. $jobs = DB::table('jobs')->where($jobs_where)->get();
  427. if (!$jobs->isEmpty()) {
  428. foreach ($jobs as $value) {
  429. $job = [
  430. 'id' => $value->id,
  431. 'jobs_name' => $value->jobs_name,
  432. 'amount' => $value->amount,
  433. 'wage' => $value->wage,
  434. 'wage_min' => $value->wage_min,
  435. 'wage_max' => $value->wage_max,
  436. 'wage_str' => $value->wage_str,
  437. ];
  438. array_push($item['jobs'], $job);
  439. }
  440. }
  441. //企业福利
  442. if (!empty($val->tag)) {
  443. $tags = explode(',', $val->tag);
  444. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  445. $item['tag_arr'] = $tag_arr;
  446. }
  447. array_push($res, $item);
  448. }
  449. if ($request->ajax()) {
  450. if (count($res)) {
  451. return response()->json(['status' => 1, 'data' => view('mobile.app.active.ajax.ajax_spring_special_com', [
  452. 'res' => $res,
  453. 'more' => $more,
  454. ])->render()]);
  455. }
  456. return response()->json(['status' => 0]);
  457. }
  458. return view('mobile.app.active.spring_special_live', [
  459. 'params' => ['citycategory' => 'jjkfq'],
  460. 'current_url' => \Illuminate\Support\Facades\Request::getRequestUri(),
  461. 'res' => $res,
  462. 'more' => $more,
  463. 'prize' => $prize,
  464. 'share_title' => '【福利通知】免费找工作,抽大奖拿好礼',
  465. 'share_desc' => '晋江好福利!免费找工作、找人才,还能抽奖,100%中奖,万份好礼免费拿!',
  466. 'share_image_url' => theme_asset('mobile/images/online2021/share_logo.jpg'),
  467. 'live_list' => $this->homeService->getSpringLive(),
  468. ]);
  469. }
  470. /**
  471. * 线上招聘
  472. */
  473. public function recruit(Request $request)
  474. {
  475. $offset = isset($request->page) ? $request->page : 0;
  476. $limit = 8;
  477. $citycategory = $request->input('citycategory', '');
  478. $trade = $request->input('trade', '');
  479. $param_array = ['citycategory', 'trade', 'nature'];
  480. $params = [];
  481. if ($request->all()) {
  482. foreach ($request->all() as $k => $v) {
  483. if (in_array($k, $param_array) && $v) {
  484. $params[$k] = $v;
  485. }
  486. }
  487. }
  488. $filter_where = [
  489. 'AIX_trade' => 100,
  490. 'AIX_company_type' => 100,
  491. ];
  492. $categories = $this->categoryService->getCategories($filter_where);
  493. $subsites = Cache::get('subsites_list');
  494. if ($subsites) {
  495. if (!array_has($params, 'citycategory')) {
  496. if (get_subsite_id() > 0) {
  497. $citycategory = $subsites[get_subsite_id()]['district'];
  498. }
  499. }
  500. }
  501. $title = '晋江市新春招聘会';
  502. $citys = $this->categoryService->getCitys($citycategory);
  503. if (empty($citycategory)) {
  504. $district_str = "(district like ? or district like ?)";
  505. $district_arr = ["%.623%", "%623.%"];
  506. } else {
  507. $select_id = $citys['select']['id'];
  508. $district_str = "(district like ? or district like ?)";
  509. $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];
  510. $title = $citys['select']['name'] . '专区';
  511. }
  512. $whereRaw = "jobs.updated_at > '2023-01-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1";
  513. $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();
  514. $where = [];
  515. $where[] = ['user_status', '=', 1];
  516. $where[] = ['audit', '=', 1];
  517. $where[] = ['deleted_at', '=', null];
  518. if (!empty($trade)) {
  519. $where[] = ['trade', '=', $trade];
  520. }
  521. $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();
  522. $more = count($list) >= $limit ? true : false;
  523. $res = [];
  524. foreach ($list as $val) {
  525. $item = [
  526. 'id' => $val->id,
  527. 'companyname' => $val->companyname,
  528. 'jobs' => [],
  529. 'tag_arr' => [],
  530. ];
  531. //在招职位
  532. $jobs_where = [
  533. ['company_id', '=', $val->id],
  534. ['valid', '=', 1],
  535. ['display', '=', 1],
  536. ['audit', '=', 1],
  537. ['deleted_at', '=', null],
  538. ];
  539. $jobs = DB::table('jobs')->where($jobs_where)->get();
  540. if (!$jobs->isEmpty()) {
  541. foreach ($jobs as $value) {
  542. $job = [
  543. 'id' => $value->id,
  544. 'jobs_name' => $value->jobs_name,
  545. 'amount' => $value->amount,
  546. 'wage' => $value->wage,
  547. 'wage_min' => $value->wage_min,
  548. 'wage_max' => $value->wage_max,
  549. ];
  550. array_push($item['jobs'], $job);
  551. }
  552. }
  553. //企业福利
  554. if (!empty($val->tag)) {
  555. $tags = explode(',', $val->tag);
  556. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  557. $item['tag_arr'] = $tag_arr;
  558. }
  559. array_push($res, $item);
  560. }
  561. if ($request->ajax()) {
  562. if (count($res)) {
  563. return response()->json(['status' => 1, 'data' => view('mobile.app.active.ajax.ajax_spring_special_com', [
  564. 'res' => $res,
  565. 'city' => $citys,
  566. 'params' => $params,
  567. 'categories' => $categories,
  568. 'more' => $more,
  569. ])->render()]);
  570. }
  571. return response()->json(['status' => 0]);
  572. }
  573. return view('mobile.app.active.spring_special', [
  574. 'title' => $title,
  575. 'res' => $res,
  576. 'city' => $citys,
  577. 'params' => $params,
  578. 'categories' => $categories,
  579. 'more' => $more,
  580. 'share_title' => "【{$title}】免费找工作",
  581. 'share_desc' => '晋江好福利!免费找工作、找人才,还能抽奖,100%中奖,万份好礼免费拿!',
  582. 'share_image_url' => theme_asset('mobile/images/online2021/share_logo.jpg'),
  583. 'share_link' => route('mobile.active.spring_special') . '?citycategory=' . $citycategory,
  584. ]);
  585. }
  586. /**
  587. * 薪动餐饮
  588. */
  589. public function restaurant(Request $request)
  590. {
  591. $offset = isset($request->page) ? $request->page : 0;
  592. $limit = 8;
  593. $title = '薪动餐饮 职在晋江';
  594. $where = [];
  595. $where[] = ['user_status', '=', 1];
  596. $where[] = ['audit', '=', 1];
  597. $where[] = ['is_restaurant', '=', 1];
  598. $where[] = ['deleted_at', '=', null];
  599. $list = DB::table('companys')->where($where)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->offset($limit * $offset)->limit($limit)->get();
  600. $more = count($list) >= $limit ? true : false;
  601. $res = [];
  602. foreach ($list as $val) {
  603. $item = [
  604. 'id' => $val->id,
  605. 'companyname' => $val->companyname,
  606. 'jobs' => [],
  607. 'tag_arr' => [],
  608. ];
  609. //在招职位
  610. $jobs_where = [
  611. ['company_id', '=', $val->id],
  612. ['valid', '=', 1],
  613. ['display', '=', 1],
  614. ['audit', '=', 1],
  615. ['deleted_at', '=', null],
  616. ];
  617. $jobs = DB::table('jobs')->where($jobs_where)->get();
  618. if (!$jobs->isEmpty()) {
  619. foreach ($jobs as $value) {
  620. $job = [
  621. 'id' => $value->id,
  622. 'jobs_name' => $value->jobs_name,
  623. 'amount' => $value->amount,
  624. 'wage' => $value->wage,
  625. 'wage_min' => $value->wage_min,
  626. 'wage_max' => $value->wage_max,
  627. ];
  628. array_push($item['jobs'], $job);
  629. }
  630. }
  631. //企业福利
  632. if (!empty($val->tag)) {
  633. $tags = explode(',', $val->tag);
  634. $tag_arr = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();
  635. $item['tag_arr'] = $tag_arr;
  636. }
  637. array_push($res, $item);
  638. }
  639. if ($request->ajax()) {
  640. if (count($res)) {
  641. return response()->json(['status' => 1, 'data' => view('mobile.app.active.ajax.ajax_restaurant', [
  642. 'res' => $res,
  643. 'more' => $more,
  644. ])->render()]);
  645. }
  646. return response()->json(['status' => 0]);
  647. }
  648. return view('mobile.app.active.restaurant', [
  649. 'title' => $title,
  650. 'res' => $res,
  651. 'more' => $more,
  652. 'share_title' => $title,
  653. 'share_desc' => '2023年晋江市餐饮住宿行业网络招聘会',
  654. 'share_image_url' => theme_asset('mobile/images/online2021/share_logo.jpg'),
  655. 'share_link' => route('mobile.active.restaurant'),
  656. ]);
  657. }
  658. }