| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace mall\controllers;
- use biz\ad\services\AdService;
- use biz\goods\services\CategoryService;
- use biz\goods\services\GoodsCategoryService;
- use Yii;
- use yii\web\Controller;
- use common\components\util;
- class MainController extends BaseController
- {
- //首页 shish 2019.12.2
- public function actionIndex()
- {
- $where = ['merchantId' => $this->merchantId, 'type' => 0, 'status' => 1];
- $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->merchantId);
- $categoryList = !empty($category) ? GoodsCategoryService::getAppointCategoryList($category) : [];
- $data = ['ad' => $ad, 'category' => $categoryList, 'columnStyle' => rand(1, 2)];
- util::success($data);
- }
- }
|