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\classes\UserClass;
  11. use bizMall\user\services\UserService;
  12. use common\components\imgUtil;
  13. use Yii;
  14. use yii\web\Controller;
  15. use common\components\util;
  16. class ShopController extends BaseController
  17. {
  18. //门店详情 ssh 20220607
  19. public function actionInfo()
  20. {
  21. $shop = $this->shop;
  22. $info = !empty($shop) ? $shop->attributes : [];
  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. } else {
  27. $info['superWx'] = '';
  28. }
  29. util::success(['info' => $info]);
  30. }
  31. //最新店铺 ssh 20220506
  32. public function actionGetNewShop()
  33. {
  34. $respond = UserClass::getRecentShop($this->user);
  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. }