ShopController.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 20230210
  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. $shortAvatar = $info['avatar']??'';
  30. $avatar = imgUtil::groupImg($shortAvatar). "?x-oss-process=image/resize,m_fill,h_300,w_300";
  31. $info['avatar'] = $avatar;
  32. $info['shortAvatar'] = $shortAvatar;
  33. util::success(['info' => $info]);
  34. }
  35. //获取商家的默认门店 ssh 2019.12.6
  36. public function actionDetail()
  37. {
  38. $introUserId = Yii::$app->request->get('introUserId');
  39. $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
  40. $ad = [];
  41. if (isset($this->shop->img) && !empty($this->shop->img) && $this->shop->img != '[]') {
  42. $arr = json_decode($this->shop->img, true);
  43. if (!empty($arr)) {
  44. foreach ($arr as $img) {
  45. $imgUrl = imgUtil::groupImg($img);
  46. $ad[] = ['adImgUrl' => $imgUrl];
  47. }
  48. }
  49. }
  50. //新人专享礼物
  51. $newUserGift = [];
  52. if (!empty($introUserId)) {
  53. $userInfo = UserService::getUserInfo($this->userId);
  54. $newUserGift = InviteService::hasNewGift($userInfo);
  55. }
  56. util::success(['ad' => $ad, 'shop' => $shop, 'newUserGift' => $newUserGift]);
  57. }
  58. }