54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
|
declare (strict_types = 1);
|
|
|
|
namespace app\index\controller;
|
|
|
|
use think\facade\Lang;
|
|
use think\facade\View;
|
|
use app\index\model\Index as IndexModel;
|
|
|
|
/**
|
|
* 首页控制器
|
|
*/
|
|
class Index extends Base
|
|
{
|
|
|
|
public function initialize()
|
|
{
|
|
$this->model = new IndexModel();
|
|
parent::initialize();
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function index():string
|
|
{
|
|
$inputData = $this->request->param();
|
|
// banner
|
|
$bannerList = $this->model->getIndexBanner($this->languageId,$inputData);
|
|
// 商品banner
|
|
$goodsBanner = $this->model->getGoodsBanner($this->languageId,$inputData);
|
|
// 获取推荐商品
|
|
$bannerListMobile = $this->model->getIndexBannerMobile($this->languageId,$inputData);
|
|
// 商品分类
|
|
$goodsCategoryList = $this->model->getIndexGoodsCategoryList($this->languageId,$inputData);
|
|
// 推荐商品
|
|
$goodsCommandList = $this->model->getIndexGoodsRecommandList($this->languageId,$inputData);
|
|
// 增加标签显示
|
|
$metaTitle = $this->model->getMetaTitle($this->languageId,'index');
|
|
// 首页4张图
|
|
$forthImg = $this->model->getGoodsBanner($this->languageId);
|
|
|
|
View::assign('meta',$metaTitle);
|
|
View::assign('f_image',$forthImg);
|
|
View::assign('banner_list',$bannerList);
|
|
View::assign('banner_list_mobile',$bannerListMobile);
|
|
View::assign('goods_category',$goodsCategoryList);
|
|
View::assign('goods_is_new',$goodsCommandList);
|
|
View::assign('goods_banner',$goodsBanner);
|
|
|
|
return View::fetch(Lang::getLangSet().DIRECTORY_SEPARATOR.'index/index');
|
|
}
|
|
}
|