|
@@ -2,10 +2,12 @@
|
|
|
|
|
|
namespace App\Http\Controllers\Web;
|
|
|
|
|
|
+use App\Models\Ad;
|
|
|
use App\Models\Recruit;
|
|
|
use App\Models\Recuperate;
|
|
|
use App\Models\RecuperateCategory;
|
|
|
use App\Models\ShortUrl;
|
|
|
+use App\Models\SubsiteAd;
|
|
|
use App\Services\Content\LinkService;
|
|
|
use App\Services\HomeService;
|
|
|
use App\Services\Company\JobsService;
|
|
@@ -31,8 +33,10 @@ use App\Models\Article;
|
|
|
use App\Repositories\PersonFocusComRepository;
|
|
|
use App\Repositories\MemberSetmealRepository;
|
|
|
use App\Repositories\JobsRepository;
|
|
|
+use App\Repositories\MemberInfoRepository;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\View;
|
|
|
|
|
|
class HomeController extends WebBaseController
|
|
@@ -62,6 +66,7 @@ class HomeController extends WebBaseController
|
|
|
protected $memberSetmealRepository;
|
|
|
protected $jobsRepository;
|
|
|
protected $policyService;
|
|
|
+ protected $memberInfoRepository;
|
|
|
|
|
|
/**
|
|
|
* HomeController constructor.
|
|
@@ -78,7 +83,7 @@ class HomeController extends WebBaseController
|
|
|
* @param $articleService
|
|
|
* @param $subsiteService
|
|
|
*/
|
|
|
- public function __construct(LinkService $LinkService, HomeService $homeService, JobsService $jobsService, CategoryService $categoryService, CompanyDownResumeService $companyDownResumeService, SearchService $searchService, ResumeService $resumeService, CompanyService $companyService, JobfairService $jobfairService, NoticeServer $noticeServer, ArticleService $articleService, SubsiteService $subsiteService, PersonalJobsApplyRepository $personalJobsApplyRepository, ViewJobRepository $viewJobRepository, PmsRepository $pmsRepository, ResumeRepository $resumeRepository, CompanyInterviewRepository $companyInterviewRepository, companyFavoriteRepository $companyFavoriteRepository, ViewResumeRepository $viewResumeRepository, TaskLogRepository $taskLogRepository, PersonFocusComRepository $personFocusComRepository, MemberSetmealRepository $memberSetmealRepository, JobsRepository $jobsRepository, PolicyService $policyService)
|
|
|
+ public function __construct(LinkService $LinkService, HomeService $homeService, JobsService $jobsService, CategoryService $categoryService, CompanyDownResumeService $companyDownResumeService, SearchService $searchService, ResumeService $resumeService, CompanyService $companyService, JobfairService $jobfairService, NoticeServer $noticeServer, ArticleService $articleService, SubsiteService $subsiteService, PersonalJobsApplyRepository $personalJobsApplyRepository, ViewJobRepository $viewJobRepository, PmsRepository $pmsRepository, ResumeRepository $resumeRepository, CompanyInterviewRepository $companyInterviewRepository, companyFavoriteRepository $companyFavoriteRepository, ViewResumeRepository $viewResumeRepository, TaskLogRepository $taskLogRepository, PersonFocusComRepository $personFocusComRepository, MemberSetmealRepository $memberSetmealRepository, JobsRepository $jobsRepository, PolicyService $policyService, MemberInfoRepository $memberInfoRepository)
|
|
|
{
|
|
|
$this->LinkService = $LinkService;
|
|
|
$this->homeService = $homeService;
|
|
@@ -104,6 +109,7 @@ class HomeController extends WebBaseController
|
|
|
$this->memberSetmealRepository = $memberSetmealRepository;
|
|
|
$this->jobsRepository = $jobsRepository;
|
|
|
$this->policyService = $policyService;
|
|
|
+ $this->memberInfoRepository = $memberInfoRepository;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -114,6 +120,12 @@ class HomeController extends WebBaseController
|
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
+ //分站
|
|
|
+ $subsite_id = get_subsite_id();
|
|
|
+ if ($subsite_id > 0) {
|
|
|
+ return $this->subsite();
|
|
|
+ }
|
|
|
+
|
|
|
$filter_data = [
|
|
|
'AIX_indexfocus' => 6, //首页轮播广告
|
|
|
'AIX_indextopimg' => 6, //首页上方横幅
|
|
@@ -312,8 +324,8 @@ class HomeController extends WebBaseController
|
|
|
'recruit' => $recruit,
|
|
|
];
|
|
|
//获取分站模板信息
|
|
|
- if (get_subsite_id() > 0) {
|
|
|
- $tpl_name = $this->subsiteService->getSubsiteTpl(get_subsite_id());
|
|
|
+ if ($subsite_id > 0) {
|
|
|
+ $tpl_name = $this->subsiteService->getSubsiteTpl($subsite_id);
|
|
|
//判断模板是否存在
|
|
|
if (View::exists('home.' . $tpl_name . '.index')) {
|
|
|
return view('company.' . $tpl_name . '.index', $return_data);
|
|
@@ -410,4 +422,77 @@ class HomeController extends WebBaseController
|
|
|
return redirect($short_url['url']);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分站
|
|
|
+ */
|
|
|
+ private function subsite()
|
|
|
+ {
|
|
|
+ //特殊网站
|
|
|
+ $site_module = explode('.', request()->server('HTTP_HOST'))[0];
|
|
|
+ if (method_exists($this, $site_module)) {
|
|
|
+ $this->$site_module();
|
|
|
+ }
|
|
|
+
|
|
|
+ $return_data = [];
|
|
|
+ $subsite_id = get_subsite_id();
|
|
|
+
|
|
|
+ //公司
|
|
|
+ $return_data['seatmeal_companies'] = $this->_dealCompany($subsite_id);
|
|
|
+
|
|
|
+ //个人登录
|
|
|
+ if (auth('web-member')->check()) {
|
|
|
+ $return_data['memberInfo'] = $this->memberInfoRepository->getMemberInfo(auth('web-member')->id());
|
|
|
+ }
|
|
|
+
|
|
|
+ //首页轮播图
|
|
|
+ $return_data['ad_list'] = [];
|
|
|
+ $ad_ids = SubsiteAd::where('subsite_id', $subsite_id)->get(['ad_id'])->pluck('ad_id')->toArray();
|
|
|
+ if (!empty($ad_ids)) {
|
|
|
+ $return_data['ad_list'] = Ad::whereIn('id', $ad_ids)->get();
|
|
|
+ }
|
|
|
+
|
|
|
+ //文章列表
|
|
|
+ $return_data['article_list'] = (new Article())->whereHas('subsites', function ($query) {
|
|
|
+ $query->where('subsite_id', get_subsite_id());
|
|
|
+ })->orderByRaw('list_order desc,created_at desc')->limit(10)->get();
|
|
|
+
|
|
|
+ //办理人数
|
|
|
+ $jkq_order = collect(DB::table('configs')->where('type_id', '=', 73)->get(['alias', 'value']))->keyBy('alias');
|
|
|
+ $return_data['jkq_order'] = $jkq_order;
|
|
|
+
|
|
|
+ return view('subsite.index', $return_data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页公司信息
|
|
|
+ */
|
|
|
+ private function _dealCompany($subsite_id)
|
|
|
+ {
|
|
|
+ $seatmeal_companies = $this->companyService->getCompaniesByConditions(['subsite_id' => $subsite_id], 20);
|
|
|
+ $res = [];
|
|
|
+ foreach ($seatmeal_companies as $v) {
|
|
|
+ $jobs = [];
|
|
|
+ if (!empty($v['jobs'])) {
|
|
|
+ foreach ($v['jobs'] as $k => $job) {
|
|
|
+ if ($k == 4) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $jobs[] = [
|
|
|
+ 'id' => $job['id'],
|
|
|
+ 'jobs_name' => $job['jobs_name'],
|
|
|
+ 'amount' => $job['amount'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $res[] = [
|
|
|
+ 'id' => $v['id'],
|
|
|
+ 'logo' => $v['logo'],
|
|
|
+ 'companyname' => $v['companyname'],
|
|
|
+ 'jobs' => $jobs,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ return json_encode($res, JSON_UNESCAPED_UNICODE + JSON_UNESCAPED_SLASHES);
|
|
|
+ }
|
|
|
}
|