IndexController.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace App\Http\Controllers\Mobile\Ic;
  3. use App\Http\Controllers\Mobile\MobileBaseController;
  4. use App\Models\Article;
  5. use App\Models\Jobs;
  6. use App\Services\Company\JobsService;
  7. use Illuminate\Support\Facades\DB;
  8. class IndexController extends MobileBaseController
  9. {
  10. protected $jobsService;
  11. /**
  12. * JobsController constructor.
  13. * @param $categoryService
  14. */
  15. public function __construct(JobsService $jobsService)
  16. {
  17. $this->jobsService = $jobsService;
  18. }
  19. public function index()
  20. {
  21. //引才动态
  22. $attract_list = Article::where('type_id', 67)
  23. ->where('is_display', 1)
  24. ->orderBy('list_order', 'desc')
  25. ->orderBy('id', 'desc')
  26. ->limit(5)
  27. ->get();
  28. //招聘列表
  29. $size = 10;
  30. $sql = "select id from jobs where is_ic = 1 and valid = 1 and audit = 1 and display = 1 and deleted_at is null ORDER BY updated_at desc";
  31. $list = DB::table($sql . 'as job')->groupBy('company_id')->limit(5)->get();
  32. // $list = Jobs::whereIn('id', DB::raw("select id from jobs where is_ic = 1 and valid = 1 and audit = 1 and display = 1 ORDER BY updated_at desc"))->groupBy('company_id')->limit(5)->get();
  33. if ($list->isEmpty()) {
  34. $recruit_list = [];
  35. } else {
  36. $recruit_list = $this->jobsService->dealjobFilelds($list);
  37. }
  38. return view('mobile.app.ic.index', [
  39. 'attract_list' => $attract_list,
  40. 'recruit_list' => $recruit_list,
  41. ]);
  42. }
  43. public function jinjiang()
  44. {
  45. return view('mobile.app.ic.jinjiang');
  46. }
  47. public function policy()
  48. {
  49. return view('mobile.app.ic.policy');
  50. }
  51. }