| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 | <?php/** * Created by PhpStorm. * User: Administrator * Date: 2019/03/14 * Time: 19:02 */namespace App\Http\Controllers\Mobile\Content;use App\Http\Controllers\Mobile\MobileBaseController;use App\Services\Content\NoticeServer;use App\Services\Company\JobsService;use Illuminate\Http\Request;class NoticeController extends MobileBaseController{    protected $noticeService;    protected $jobsService;    /**     * NoticeController constructor.     * @param $noticeService     * @param $jobsService     */    public function __construct(NoticeServer $noticeService, JobsService $jobsService)    {        $this->noticeService = $noticeService;        $this->jobsService   = $jobsService;    }    public function index(Request $request)    {        $size = 5;        $return_data = array();        $where[] = array('is_display','=','1');        $notices = $this->noticeService->getLists($where, $size);        $mobile_dropload = false;        if ($notices->total() > $size) {            $mobile_dropload = true;        }        if ($request->ajax()) {            if ($notices->lastPage() < $notices->currentPage()) {                return response()->json(['status'=>0]);            }            return response()->json(['status'=>1,'data'=>view('mobile.app.content.notice.ajax_notice_list', ['notices'=>$notices])->render()]);        }        $return_data = array(            'notices'         => $notices,            'mobile_dropload' => $mobile_dropload,            'wap_title'       => '公告',        );        return view('mobile.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);        $return_data = array(            'notice'    => $notice_info,            'wap_title' => $notice_info->title,        );        return view('mobile.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);    }}
 |