ShopController.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 20220607
  18. public function actionInfo()
  19. {
  20. $shop = $this->shop;
  21. $info = $shop->attributes;
  22. $superWx = $info['superWx'] ?? '';
  23. $info['superWx'] = imgUtil::groupImg($superWx) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
  24. util::success(['info' => $info]);
  25. }
  26. //最新店铺 ssh 20220506
  27. public function actionGetNewShop()
  28. {
  29. $respond = ShopClass::getNewShopList();
  30. //显示国兰的信息 0不是 1是
  31. $showGlInfo = getenv('SHOW_GL_INFO');
  32. $info = $showGlInfo === false ? 1 : $showGlInfo;
  33. $respond['showGlInfo'] = $info;
  34. util::success($respond);
  35. }
  36. //获取商家的默认门店 ssh 2019.12.6
  37. public function actionDetail()
  38. {
  39. $introUserId = Yii::$app->request->get('introUserId');
  40. $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
  41. $ad = [];
  42. if (isset($this->shop->img) && !empty($this->shop->img) && $this->shop->img != '[]') {
  43. $arr = json_decode($this->shop->img, true);
  44. if (!empty($arr)) {
  45. foreach ($arr as $img) {
  46. $imgUrl = imgUtil::groupImg($img);
  47. $ad[] = ['adImgUrl' => $imgUrl];
  48. }
  49. }
  50. }
  51. //新人专享礼物
  52. $newUserGift = [];
  53. if (!empty($introUserId)) {
  54. $userInfo = UserService::getUserInfo($this->userId);
  55. $newUserGift = InviteService::hasNewGift($userInfo);
  56. }
  57. util::success(['ad' => $ad, 'shop' => $shop, 'newUserGift' => $newUserGift]);
  58. }
  59. }