| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace mall\controllers;
- use bizMall\ad\services\AdService;
- use bizMall\goods\services\CategoryService;
- use bizMall\goods\services\GoodsCategoryService;
- use common\components\util;
- class MainController extends BaseController
- {
- //首页 ssh 2019.12.2
- public function actionIndex()
- {
- $where = ['mainId' => $this->mainId, 'type' => 0, 'status' => 1, 'delStatus' => 0];
- $adRespond = AdService::getAdList($where);
- $ad = [];
- if (isset($adRespond['list']) && !empty($adRespond['list'])) {
- foreach ($adRespond['list'] as $single) {
- $ad[] = ['adImg' => $single['adImgUrl'], 'url' => ''];
- }
- }
- $shop = $this->shop;
- $category = CategoryService::getTopThreeCategory($this->mainId);
- $categoryList = !empty($category) ? GoodsCategoryService::getAppointCategoryList($category, $shop) : [];
- $sj = isset($this->sj) ? $this->sj->attributes : [];
- $data = [
- 'ad' => $ad,
- 'category' => $categoryList,
- 'columnStyle' => rand(1, 2),
- 'sj' => $sj
- ];
- util::success($data);
- }
- }
|