1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2018/11/8
- * Time: 10:02
- */
- namespace App\Http\Controllers\Web\Content;
- use App\Http\Controllers\Web\WebBaseController;
- use App\Services\Content\NoticeServer;
- use App\Services\Company\JobsService;
- use App\Services\Common\SearchService;
- use Illuminate\Http\Request;
- class NoticeController extends WebBaseController
- {
- protected $noticeService;
- protected $jobsService;
- protected $searchService;
- /**
- * NoticeController constructor.
- * @param $noticeService
- * @param $jobsService
- * @param $searchService
- */
- public function __construct(NoticeServer $noticeService, JobsService $jobsService, SearchService $searchService)
- {
- $this->noticeService = $noticeService;
- $this->jobsService = $jobsService;
- $this->searchService = $searchService;
- }
- public function index(Request $request)
- {
- $return_data = array();
- $key = $request->input('key');
- $where[] = array('is_display','=','1');
- if ($key) {
- $where[] = array('title','like','%'.$key.'%');
- }
- $notices = $this->noticeService->getLists($where, 10);
- $new_jobs = $this->searchService->searchNewJobs(5); //最新招聘
- $emergency_jobs = $this->searchService->searchEmergencyJobs(5); //紧急招聘
- $return_data = array(
- 'notices' => $notices,
- 'key' => $key,
- 'new_jobs'=> $new_jobs,
- 'emergency_jobs' => $emergency_jobs
- );
- return view('app.content.notice.index', $return_data);
- }
- public function show($id)
- {
- $return_data = array();
- $where = array(
- 'id' => $id,
- 'is_display' => 1
- );
- $notice_info = $this->noticeService->getNotice($where);
- if (!$notice_info) {
- $back_url = \Illuminate\Support\Facades\URL::previous();
- return $this->showMessage('公告不存在', $back_url, true, '上一页', '3');
- }
- $this->putSeoData('notice', $notice_info);
- //$new_jobs = $this->jobsService->getNewJobs(5); //最新职位
- $new_jobs = $this->searchService->searchNewJobs(5);
- $emergency_jobs = $this->searchService->searchEmergencyJobs(5); //紧急招聘
- $return_data = array(
- 'notice' => $notice_info,
- 'new_jobs' => $new_jobs,
- 'emergency_jobs' => $emergency_jobs
- );
- return view('app.content.notice.show', $return_data);
- }
- public function click($id)
- {
- $rst = $this->noticeService->incrementData(array('id'=>$id), 1, 'click');
- $data = array('status'=>0);
- if ($rst) {
- $data = array('status'=>1);
- }
- return response()->json($data);
- }
- }
|