ShopController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace mall\controllers;
  3. use bizMall\ad\services\AdService;
  4. use bizMall\goods\services\CategoryService;
  5. use bizMall\goods\services\GoodsCategoryService;
  6. use bizMall\invite\services\InviteService;
  7. use bizMall\merchant\services\MerchantService;
  8. use bizMall\merchant\services\ShopService;
  9. use bizMall\user\services\UserService;
  10. use common\components\imgUtil;
  11. use Yii;
  12. use yii\web\Controller;
  13. use common\components\util;
  14. class ShopController extends BaseController
  15. {
  16. //获取商家的默认门店 ssh 2019.12.6
  17. public function actionDetail()
  18. {
  19. $introUserId = Yii::$app->request->get('introUserId');
  20. $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
  21. $ad = [];
  22. if (isset($this->shop->img) && !empty($this->shop->img) && $this->shop->img != '[]') {
  23. $arr = json_decode($this->shop->img, true);
  24. if (!empty($arr)) {
  25. foreach ($arr as $img) {
  26. $imgUrl = imgUtil::groupImg($img);
  27. $ad[] = ['adImgUrl' => $imgUrl];
  28. }
  29. }
  30. }
  31. //新人专享礼物
  32. $newUserGift = [];
  33. if (!empty($introUserId)) {
  34. $userInfo = UserService::getUserInfo($this->userId);
  35. $newUserGift = InviteService::hasNewGift($userInfo);
  36. }
  37. util::success(['ad' => $ad, 'shop' => $shop, 'newUserGift' => $newUserGift]);
  38. }
  39. }