|
@@ -8,14 +8,15 @@ use think\Hook;
|
|
use addons\shop\model\Navigation;
|
|
use addons\shop\model\Navigation;
|
|
use addons\shop\model\Area;
|
|
use addons\shop\model\Area;
|
|
use addons\shop\model\Block;
|
|
use addons\shop\model\Block;
|
|
|
|
+use addons\shop\model\Category;
|
|
use addons\shop\model\SearchLog;
|
|
use addons\shop\model\SearchLog;
|
|
-
|
|
|
|
|
|
+use app\common\Enum\StatusEnum;
|
|
/**
|
|
/**
|
|
* 公共
|
|
* 公共
|
|
*/
|
|
*/
|
|
class Common extends Base
|
|
class Common extends Base
|
|
{
|
|
{
|
|
- protected $noNeedLogin = ['init', 'area', 'getBannerList','getBannerListByIndex'];
|
|
|
|
|
|
+ protected $noNeedLogin = ['init', 'area', 'getBannerList','getDataByIndex'];
|
|
|
|
|
|
/**
|
|
/**
|
|
* 初始化
|
|
* 初始化
|
|
@@ -131,7 +132,7 @@ class Common extends Base
|
|
$this->success('', $list);
|
|
$this->success('', $list);
|
|
}
|
|
}
|
|
|
|
|
|
- public function getBannerListByIndex()
|
|
|
|
|
|
+ public function getDataByIndex()
|
|
{
|
|
{
|
|
// 固定
|
|
// 固定
|
|
$type = ['首页BANNER', '首页LOTTERY','首页ARTICE','首页MEASURE'];
|
|
$type = ['首页BANNER', '首页LOTTERY','首页ARTICE','首页MEASURE'];
|
|
@@ -145,10 +146,6 @@ class Common extends Base
|
|
'article' => [],
|
|
'article' => [],
|
|
'measure' => [],
|
|
'measure' => [],
|
|
];
|
|
];
|
|
- $bannerList = [];
|
|
|
|
- $lotteryList = [];
|
|
|
|
- $articleList = [];
|
|
|
|
- $measureList = [];
|
|
|
|
foreach ($list as $item) {
|
|
foreach ($list as $item) {
|
|
if ($item['type'] == '首页BANNER') {
|
|
if ($item['type'] == '首页BANNER') {
|
|
$bannerList[] = $item;
|
|
$bannerList[] = $item;
|
|
@@ -167,6 +164,23 @@ class Common extends Base
|
|
$newList['lottery'] = $lotteryList;
|
|
$newList['lottery'] = $lotteryList;
|
|
$newList['article'] = $articleList;
|
|
$newList['article'] = $articleList;
|
|
$newList['measure'] = $measureList;
|
|
$newList['measure'] = $measureList;
|
|
|
|
+ // todo 查询活动商品
|
|
|
|
+ // 首页推荐的分类
|
|
|
|
+ $indexCategoryList = Category::where('status', StatusEnum::NORMAL)
|
|
|
|
+ ->field('id,name,image')
|
|
|
|
+ ->where("FIND_IN_SET('index',`flag`)")
|
|
|
|
+ ->order('weigh desc')
|
|
|
|
+ ->limit(8)
|
|
|
|
+ ->select();
|
|
|
|
+ //热门分类
|
|
|
|
+ $indexHotCategoryList = Category::where('status', StatusEnum::NORMAL)
|
|
|
|
+ ->field('id,name,image')
|
|
|
|
+ ->where("FIND_IN_SET('hot',`flag`)")
|
|
|
|
+ ->order('weigh desc')
|
|
|
|
+ ->limit(4)
|
|
|
|
+ ->select();
|
|
|
|
+ $newList['indexCategoryList'] = $indexCategoryList;
|
|
|
|
+ $newList['indexHotCategoryList'] = $indexHotCategoryList;
|
|
$this->success('', $newList);
|
|
$this->success('', $newList);
|
|
}
|
|
}
|
|
}
|
|
}
|