| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 | 
							- <?php
 
- namespace App\Http\Controllers\Jkq;
 
- use App\Models\Ad;
 
- use App\Models\Article;
 
- use App\Models\SubsiteAd;
 
- use App\Repositories\MemberInfoRepository;
 
- use App\Services\Company\CompanyService;
 
- use App\Services\Company\JobsService;
 
- use Illuminate\Support\Facades\DB;
 
- class HomeController extends JkqBaseController
 
- {
 
-     private $memberInfoRepository;
 
-     private $companyService;
 
-     private $jobsService;
 
-     public function __construct(MemberInfoRepository $memberInfoRepository, CompanyService $companyService, JobsService $jobsService)
 
-     {
 
-         $this->memberInfoRepository = $memberInfoRepository;
 
-         $this->companyService       = $companyService;
 
-         $this->jobsService          = $jobsService;
 
-     }
 
-     /**
 
-      * 首页
 
-      */
 
-     public function index()
 
-     {
 
-         $return_data = [];
 
-         $subsite_id  = get_subsite_id();
 
-         //公司
 
-         $return_data['seatmeal_companies'] = $this->_dealCompany();
 
-         //个人登录
 
-         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('jkq.index', $return_data);
 
-     }
 
-     /**
 
-      * 首页公司信息
 
-      */
 
-     private function _dealCompany()
 
-     {
 
-         //公司信息
 
-         $seatmeal_companies = [];
 
-         $seatmeal_arr       = ['14', '11', '26,27,28', '13,35,153', '25', '3,4,6,9,10,16,17,20,21,25,28,30,31,34,36,37,40,41,44,45,151,165,213,314'];
 
-         $company_ids        = [];
 
-         foreach ($seatmeal_arr as $key => $val) {
 
-             $temp_company = [];
 
-             $seat_company = $this->companyService->getSetmailCompanies(['trade' => $val], 4);
 
-             if (!empty($seat_company)) {
 
-                 foreach ($seat_company as $v) {
 
-                     $temp_company[] = [
 
-                         'id'          => $v->id,
 
-                         'logo'        => $v->logo,
 
-                         'companyname' => $v->companyname,
 
-                     ];
 
-                     $company_ids[] = $v->id;
 
-                 }
 
-             }
 
-             $seatmeal_companies[] = $temp_company;
 
-         }
 
-         //处理公司职位
 
-         if (!empty($company_ids)) {
 
-             //获取职位
 
-             $jobs_where   = [
 
-                 ['valid', '=', 1],
 
-                 ['display', '=', 1],
 
-             ];
 
-             $jobs_where[] = [function ($query) use ($company_ids) {
 
-                 $query->whereIn('company_id', $company_ids);
 
-             }];
 
-             $jobs_display = config('aix.companyset.comset.show_set.jobs_display');
 
-             if ($jobs_display == 1) {
 
-                 $jobs_where[] = ['audit', '=', '1'];
 
-             } else {
 
-                 $jobs_where[] = ['audit', '<>', '3'];
 
-             }
 
-             $jobs = $this->jobsService->getOtherJobs($jobs_where, 4);
 
-             //组装数据
 
-             if (!empty($jobs)) {
 
-                 $job_list = [];
 
-                 foreach ($jobs as $v) {
 
-                     $job_list[$v['company_id']][] = [
 
-                         'id'        => $v->id,
 
-                         'jobs_name' => $v->jobs_name,
 
-                         'amount'    => $v->amount,
 
-                     ];
 
-                 }
 
-                 foreach ($seatmeal_companies as $k => $company_list) {
 
-                     foreach ($company_list as $key => $company) {
 
-                         if (!empty($job_list[$company['id']])) {
 
-                             $seatmeal_companies[$k][$key]['jobs'] = $job_list[$company['id']];
 
-                         } else {
 
-                             $seatmeal_companies[$k][$key]['jobs'] = [];
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         return json_encode($seatmeal_companies,JSON_UNESCAPED_UNICODE+JSON_UNESCAPED_SLASHES);
 
-     }
 
- }
 
 
  |