123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Http\Controllers\Web\Content;
- use App\Http\Controllers\Web\WebBaseController;
- use App\Services\Content\ExplainService;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Cache;
- use App\Services\Content\AdService;
- class ExplainController extends WebBaseController
- {
- protected $explainService;
- protected $adService;
- /**
- * ExplainController constructor.
- * @param $explainService
- */
- public function __construct(ExplainService $explainService, AdService $adService)
- {
- $this->explainService = $explainService;
- $this->adService = $adService;
- }
- public function show($id)
- {
- $where = array('id'=>$id,'is_display'=>'1');
- $info = $this->explainService->getExplainInfo($where);
- if (!$info) {
- $back_url = \Illuminate\Support\Facades\URL::previous();
- return $this->showMessage('说明不存在', $back_url, true, '上一页', '3');
- }
- $this->putSeoData('explain', $info);
- //获取所有说明页并按所属分类分组显示
- $lists = $this->explainService->getMenuExplains(array('is_display'=>'1'));
- $ad_data = array(
- 'theme' => 'default',
- 'org' => 'Home',
- 'alias' => 'AIX_explain_show_top',
- 'num' => '1'
- );
- $ad_infos = $this->adService->getAds($ad_data);
- $return_data = array(
- 'info' => $info,
- 'lists'=>$lists,
- 'ads' => $ad_infos
- );
- return view('app.content.explain.show', $return_data);
- }
- public function click($id)
- {
- $rst = $this->explainService->incrementData(array('id'=>$id), 1, 'click');
- $data = array('status'=>0);
- if ($rst) {
- $data = array('status'=>1);
- }
- return response()->json($data);
- }
- }
|