IndexController.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace App\Http\Home\Jimp;
  3. use App\Http\Home\HttpBaseController;
  4. use Illuminate\Support\Facades\DB;
  5. use Illuminate\Support\Facades\Request;
  6. use Illuminate\Support\Facades\View;
  7. class IndexController extends HttpBaseController
  8. {
  9. private $productInfo;
  10. private $windowsVersionInfo;
  11. public function __construct()
  12. {
  13. parent::__construct();
  14. // 获取产品信息
  15. $this->productInfo = $this->getProductInfo('XwByxRJnoPx3');
  16. View::share('productInfo', $this->productInfo);
  17. // 获取当前的Windows下载版本 product_version
  18. $this->windowsVersionInfo = $this->getProductVersion($this->productInfo->id);
  19. View::share('windowsVersionInfo', $this->windowsVersionInfo);
  20. }
  21. /**
  22. * 首页
  23. */
  24. public function index()
  25. {
  26. $title = '星优宝图片处理器-星优宝图片处理器官方正版下载';
  27. $description = '星优宝图片处理器是星优办公软件有限公司开发并发布一款图片处理软件,包含图片格式转换、图片压缩、更改尺寸、美化图片、水印添加、圆角处理、批量命名、批量旋转和图片拼接等九大功能,快速完成图片处理,欢迎大家安装使用。';
  28. $keywords = '星优宝图片处理器,星优宝图片处理器下载,星优宝图片处理器软件';
  29. return view('jimp/index', ['title' => $title, 'description' => $description, 'keywords' => $keywords]);
  30. }
  31. public function help($cid = '')
  32. {
  33. $size = 15;
  34. $page = Request::input('page', 1);
  35. // 获取资讯分类列表
  36. $category = DB::table('news_category')->where('product_id', $this->productInfo->id)->orderBy('id', 'asc')->get();
  37. if (empty($cid) && $category) {
  38. $cid = $category[0]->mid;
  39. }
  40. // 获取资讯列表
  41. $find = DB::table('news')->where('product_id', $this->productInfo->id)
  42. ->offset($size * ($page - 1))
  43. ->orderBy('id', 'desc')
  44. ->limit($size);
  45. if ($cid) {
  46. $info = DB::table('news_category')->select('id')->where('mid', $cid)->first();
  47. if ($info) {
  48. $find->where('category_id', $info->id);
  49. }
  50. }
  51. $list = $find->get();
  52. $title = '帮助中心-星优宝图片处理器';
  53. return view('jimp/help', ['cid' => $cid, 'category' => $category, 'list' => $list, 'title' => $title]);
  54. }
  55. /**
  56. * 资讯详情
  57. */
  58. public function newsDetail($mid)
  59. {
  60. // 获取资讯列表
  61. $info = DB::table('news')->where('mid', $mid)->where('is_delete', 0)->first();
  62. // 热门点击
  63. $hotList = DB::table('news')->where('product_id', $this->productInfo->id)->where('category_id', $info->category_id)
  64. ->offset(mt_rand(7, 10))
  65. ->orderBy('id', 'desc')
  66. ->limit(6)
  67. ->get();
  68. // 最近更新
  69. $recentList = DB::table('news')->where('product_id', $this->productInfo->id)->where('category_id', $info->category_id)
  70. ->orderBy('id', 'desc')
  71. ->limit(6)
  72. ->get();
  73. return view('jimp/news_detail', ['info' => $info, 'hotList' => $hotList, 'recentList' => $recentList, 'title' => $info->title, 'description' => $info->introduction, 'keywords' => $info->title]);
  74. }
  75. public function about()
  76. {
  77. $title = '关于我们-星优宝图片处理器';
  78. return view('jimp/about', ['title' => $title]);
  79. }
  80. public function feedback()
  81. {
  82. return view('jimp/feedback');
  83. }
  84. }