| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 | <?phpnamespace App\Http\Controllers\Mobile;use App\Models\Member;use App\Services\Auth\AuthService;use App\Services\Auth\RegisterService;use App\Services\Common\CurlService;use App\Services\Content\LinkService;use App\Services\HomeService;use App\Services\Company\JobsService;use App\Services\Common\CategoryService;use App\Services\Company\CompanyDownResumeService;use App\Services\Common\SearchService;use App\Services\Person\ResumeService;use App\Services\Company\CompanyService;use App\Services\Jobfair\JobfairService;use App\Services\Content\NoticeServer;use App\Services\Content\ArticleService;use App\Services\Common\HotWordService;use App\Wechat\WechatParam;use Illuminate\Http\Request;use Illuminate\Support\Facades\Cookie;class HomeController extends MobileBaseController{    protected $LinkService;    protected $subsite_id;    protected $homeService;    protected $jobsService;    protected $categoryService;    protected $companyDownResumeService;    protected $searchService;    protected $resumeService;    protected $companyService;    protected $jobfairService;    protected $noticeServer;    protected $articleService;    protected $hotWordService;    /**     * HomeController constructor.     * @param $LinkService     * @param $homeService     * @param $jobsService     * @param $categoryService     * @param $companyDownResumeService     * @param $searchService     * @param $resumeService     * @param $companyService     * @param $jobfairService     * @param $noticeServer     * @param $articleService     * @param $hotWordService     */    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, HotWordService $hotWordService)    {        $this->LinkService              = $LinkService;        $this->homeService              = $homeService;        $this->jobsService              = $jobsService;        $this->categoryService          = $categoryService;        $this->companyDownResumeService = $companyDownResumeService;        $this->searchService            = $searchService;        $this->resumeService            = $resumeService;        $this->companyService           = $companyService;        $this->jobfairService           = $jobfairService;        $this->noticeServer             = $noticeServer;        $this->articleService           = $articleService;        $this->hotWordService           = $hotWordService;    }    /**     * Show the application dashboard.     *     * @return \Illuminate\Http\Response     */    public function index(Request $request, AuthService $authService, RegisterService $registerService)    {        if ($user = auth('web-member')->user()) {            $userInfo = $this->homeService->getUserInfo($user);        } elseif ($user = auth('web-company')->user()) {            $userInfo = $this->homeService->getUserInfo($user);        } else {            $userInfo = [];        }        //闽政通        $is_mzt     = 0;        $user_token = $request->get('USER_TOKEN');        $user_id    = $request->get('USER_ID');        if (!empty($user_token) && !empty($user_id)) {            //闽政通隐藏头部            $is_mzt = 1;            //默认注册用户            if (empty($userInfo)) {                $arrContextOptions = [                    'ssl' => [                        'verify_peer'      => false,                        'verify_peer_name' => false,                    ],                ];                $minJson           = file_get_contents("https://192.168.71.209/userinfo.aspx?USER_TOKEN={$user_token}&USER_ID={$user_id}", false, stream_context_create($arrContextOptions));                if ($minJson) {                    $minJson     = json_decode($minJson, true);                    $user_mobile = $minJson['data']['USER_MOBILE'];                    $member      = Member::where('mobile', '=', $user_mobile)->orderBy('id', 'desc')->first();                    if ($member) {                        //登录                        $authService->login($member, 1);                    } else {                        // 注册                        $member           = $registerService->registerPerson([                            'reg_type'      => 1,                            'mobile'        => $user_mobile,                            'password'      => '000000',                            'utype'         => 2,                            'reg_source'    => 2,                            'member_status' => 0,                        ]);                        $member->email    = $minJson['data']['USER_EMAIL'];                        $member->username = $minJson['data']['USER_NAME'];                        $member->save();                        $authService->login($member, 1);                    }                }                $user     = auth('web-member')->user();                $userInfo = $this->homeService->getUserInfo($user);            }        }        $time = $this->homeService->getTime();        //公告公示        $notice_filter = [            'titlelen' => 14,            'dot'      => '...',            'size'     => 9,            'type_id'  => 1,        ];        $notices       = $this->noticeServer->getNotices($notice_filter);        //聚才动态        $articles1_map = [            'type_id'  => [3],            'limit'    => 8,            'titlelen' => 15,            'dot'      => '...',        ];        $articles1     = $this->articleService->getArticleCache($articles1_map, 'home');        //工作动态        $articles2_map = [            'type_id'  => [2],            'limit'    => 8,            'titlelen' => 25,            'dot'      => '...',        ];        $articles2     = $this->articleService->getArticleCache($articles2_map, 'home');        //知名企业        $seatmeal_filter    = [            'jobs_num'       => 2,            'companynamelen' => 8,            'dot'            => '...',            'size'           => 9,            'seatmeal'       => 1,        ];        $seatmeal_companies = $this->searchService->searchSeatmealCompanies($seatmeal_filter);        $emergency_jobs     = $this->searchService->searchEmergencyJobs(5);  //紧急招聘        $recommend_jobs     = $this->searchService->searchRecommendJobs(5, $this->getUser(), 'show_other');  //推荐职位        $newJobs  = $this->searchService->searchNewJobs(5);   //最新招聘        $hotWords = $this->hotWordService->getHotWords(['type' => 1], 'list_order desc,w_hot desc', '12');        $return_data = [            'userInfo'           => $userInfo,            'time'               => $time,            'notices'            => $notices,            'articles1'          => $articles1,            'articles2'          => $articles2,            'seatmeal_companies' => $seatmeal_companies,            'newJobs'            => $newJobs,            'emergency_jobs'     => $emergency_jobs,            'recommend_jobs'     => $recommend_jobs,            'user'               => $this->getUser(),            'params'             => [],            'hotWords'           => $hotWords,            'search_type'        => 'jobs_commpany',            'is_mzt'             => $is_mzt,        ];        if (get_subsite_id() > 0) {            return view('mobile.app.jkq.index', $return_data);        }        return view('mobile.app.index', $return_data);    }    public function getUser()    {        $user = [];        if (auth('web-member')->check()) {            $user = auth('web-member')->user();        } elseif (auth('web-company')->check()) {            $user = auth('web-company')->user();        }        return $user;    }    /*//推荐职位    public function getRecommendJobs($limit = 10)    {        $recommend_job_items = array();        $recommend_where = $this->jobsService->getRecommendWhere();        $recommend_order = $this->jobsService->getRecommendOrder($this->getUser());        $recommend_job_lists = $this->searchService->search('Job', $recommend_where, $recommend_order, '', $limit);        if ($recommend_job_lists->total()>0) {            $recommend_job_items = $this->jobsService->dealjobFilelds($recommend_job_lists->items(), array(), $limit);        }        return $recommend_job_items;    }*/    /*//最新招聘    public function getNewJobs($limit, $page = '')    {        $where[] = array('valid','=',1);        $where[] = array('display','=',1);        if (config('aix.companyset.comset.show_set.jobs_display')==1) {            $where[] = array('audit','=',1);        } else {            $where[] = array('audit','<>',3);        }        $where[] = array('subsite_ids','=',get_subsite_id());        $order = array('refresh_time'=>'desc');        $new_job_lists = $this->searchService->search('Job', $where, $order, '', $limit, $page);        $list = array();        if ($new_job_lists->total()>0) {            $list = $this->jobsService->dealjobFilelds($new_job_lists->items(), array(), $limit);        }        return $list;    }*/}
 |