ShopController.php 2.2 KB

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