MainController.php 993 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace mall\controllers;
  3. use biz\ad\services\AdService;
  4. use biz\goods\services\CategoryService;
  5. use biz\goods\services\GoodsCategoryService;
  6. use Yii;
  7. use yii\web\Controller;
  8. use common\components\util;
  9. class MainController extends BaseController
  10. {
  11. //首页 shish 2019.12.2
  12. public function actionIndex()
  13. {
  14. $ad = [
  15. ['adImg' => 'http://img.fjglhs.com/images/glhs/glhs_banner1.jpg', 'url' => ''],
  16. ['adImg' => 'http://img.fjglhs.com/images/glhs/glhs_banner2.jpg', 'url' => ''],
  17. ['adImg' => 'http://img.fjglhs.com/images/glhs/glhs_banner3.jpg', 'url' => ''],
  18. ];
  19. $where = ['merchantId' => $this->merchantId, 'type' => 0, 'status' => 1];
  20. $ad = AdService::getAdList($where);
  21. dd($ad);
  22. $category = CategoryService::getTopThreeCategory($this->merchantId);
  23. $categoryList = !empty($category) ? GoodsCategoryService::getAppointCategoryList($category) : [];
  24. $data = ['ad' => $ad, 'category' => $categoryList, 'columnStyle' => rand(1, 2)];
  25. util::success($data);
  26. }
  27. }