| 123456789101112131415161718192021222324252627282930313233343536 |
- <?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 = ['merchantId' => $this->sjId, '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' => ''];
- }
- }
- $category = CategoryService::getTopThreeCategory($this->sjId);
- $categoryList = !empty($category) ? GoodsCategoryService::getAppointCategoryList($category) : [];
- $sj = $this->sj;
- $data = [
- 'ad' => $ad,
- 'category' => $categoryList,
- 'columnStyle' => rand(1, 2),
- 'sj' => $sj
- ];
- util::success($data);
- }
- }
|