ShopController.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace mall\controllers;
  3. use bizHd\shop\classes\ShopClass;
  4. use bizMall\ad\services\AdService;
  5. use bizMall\goods\services\CategoryService;
  6. use bizMall\goods\services\GoodsCategoryService;
  7. use bizMall\invite\services\InviteService;
  8. use bizMall\merchant\services\MerchantService;
  9. use bizMall\merchant\services\ShopService;
  10. use bizMall\user\services\UserService;
  11. use common\components\imgUtil;
  12. use Yii;
  13. use yii\web\Controller;
  14. use common\components\util;
  15. class ShopController extends BaseController
  16. {
  17. //最新店铺 ssh 20220506
  18. public function actionGetNewShop()
  19. {
  20. $respond = ShopClass::getNewShopList();
  21. //显示国兰的信息 0不是 1是
  22. $showGlInfo = getenv('SHOW_GL_INFO');
  23. $info = $showGlInfo === false ? 1 : $showGlInfo;
  24. $respond['showGlInfo'] = $info;
  25. util::success($respond);
  26. }
  27. //获取商家的默认门店 ssh 2019.12.6
  28. public function actionDetail()
  29. {
  30. $introUserId = Yii::$app->request->get('introUserId');
  31. $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
  32. $ad = [];
  33. if (isset($this->shop->img) && !empty($this->shop->img) && $this->shop->img != '[]') {
  34. $arr = json_decode($this->shop->img, true);
  35. if (!empty($arr)) {
  36. foreach ($arr as $img) {
  37. $imgUrl = imgUtil::groupImg($img);
  38. $ad[] = ['adImgUrl' => $imgUrl];
  39. }
  40. }
  41. }
  42. //新人专享礼物
  43. $newUserGift = [];
  44. if (!empty($introUserId)) {
  45. $userInfo = UserService::getUserInfo($this->userId);
  46. $newUserGift = InviteService::hasNewGift($userInfo);
  47. }
  48. util::success(['ad' => $ad, 'shop' => $shop, 'newUserGift' => $newUserGift]);
  49. }
  50. }