ShopController.php 2.2 KB

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