123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- namespace App\Http\Home\Pdf;
- use App\Http\Home\HttpBaseController;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Request;
- use Illuminate\Support\Facades\View;
- class IndexController extends HttpBaseController
- {
- private $productInfo;
- private $windowsVersionInfo;
- public function __construct()
- {
- parent::__construct();
- // 获取产品信息
- $this->productInfo = $this->getProductInfo('LfkbKXGSo9wC');
- View::share('productInfo', $this->productInfo);
- // 获取当前的Windows下载版本 product_version
- $this->windowsVersionInfo = $this->getProductVersion($this->productInfo->id);
- View::share('windowsVersionInfo', $this->windowsVersionInfo);
- }
- /**
- * 首页
- */
- public function index()
- {
- return view('pdf/index');
- }
- public function help($cid = '')
- {
- $size = 15;
- $page = Request::input('page', 1);
- // 获取资讯分类列表
- $category = DB::table('news_category')->where('product_id', $this->productInfo->id)->orderBy('id', 'asc')->get();
- if (empty($cid) && $category) {
- $cid = $category[0]->mid;
- }
- // 获取资讯列表
- $find = DB::table('news')->where('product_id', $this->productInfo->id)
- ->offset($size * ($page - 1))
- ->orderBy('id', 'desc')
- ->limit($size);
- if ($cid) {
- $info = DB::table('news_category')->select('id')->where('mid', $cid)->first();
- if ($info) {
- $find->where('category_id', $info->id);
- }
- }
- $list = $find->get();
- return view('compress/help', ['cid' => $cid, 'category' => $category, 'list' => $list]);
- }
- /**
- * 资讯详情
- */
- public function newsDetail($mid)
- {
- // 获取资讯列表
- $info = DB::table('news')->where('mid', $mid)->where('is_delete', 0)->first();
- // 热门点击
- $hotList = DB::table('news')->where('product_id', $this->productInfo->id)->where('category_id', $info->category_id)
- ->offset(mt_rand(7, 10))
- ->orderBy('id', 'desc')
- ->limit(6)
- ->get();
- // 最近更新
- $recentList = DB::table('news')->where('product_id', $this->productInfo->id)->where('category_id', $info->category_id)
- ->orderBy('id', 'desc')
- ->limit(6)
- ->get();
- return view('compress/news_detail', ['info' => $info, 'hotList' => $hotList, 'recentList' => $recentList]);
- }
- public function about()
- {
- return view('compress/about');
- }
- }
|