| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace mall\controllers;
- use bizHd\custom\classes\CustomClass;
- use bizHd\custom\classes\HdClass;
- use bizHd\shop\classes\ShopClass;
- use bizMall\ad\services\AdService;
- use bizMall\goods\services\CategoryService;
- use bizMall\goods\services\GoodsCategoryService;
- use bizMall\invite\services\InviteService;
- use bizMall\merchant\services\MerchantService;
- use bizMall\merchant\services\ShopService;
- use bizMall\user\classes\UserClass;
- use bizMall\user\services\UserService;
- use common\components\imgUtil;
- use Yii;
- use yii\web\Controller;
- use common\components\util;
- class ShopController extends BaseController
- {
- //门店详情 ssh 20230210
- public function actionInfo()
- {
- $get = Yii::$app->request->get();
- $hdId = $get['hdId'] ?? 0;
- $shop = $this->shop;
- $info = !empty($shop) ? $shop->attributes : [];
- if (isset($info['superWx'])) {
- $superWx = $info['superWx'];
- $info['superWx'] = imgUtil::groupImg($superWx) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
- } else {
- $info['superWx'] = '';
- }
- $shortAvatar = $info['avatar']??'';
- $avatar = imgUtil::groupImg($shortAvatar). "?x-oss-process=image/resize,m_fill,h_300,w_300";
- $info['avatar'] = $avatar;
- $info['shortAvatar'] = $shortAvatar;
- if (empty($hdId)) {
- $user = $this->user;
- $shop = $this->shop;
- $respond = CustomClass::buildRelation($shop, $user);
- $hd = $respond['hd'];
- $custom = $respond['custom'];
- }else{
- $hd = HdClass::getById($hdId, true);
- $customId = $hd->customId;
- $custom = CustomClass::getById($customId, true);
- }
- util::success(['info' => $info, 'hd' => $hd, 'custom' => $custom]);
- }
- //获取商家的默认门店 ssh 2019.12.6
- public function actionDetail()
- {
- $introUserId = Yii::$app->request->get('introUserId');
- $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
- $ad = [];
- if (isset($this->shop->img) && !empty($this->shop->img) && $this->shop->img != '[]') {
- $arr = json_decode($this->shop->img, true);
- if (!empty($arr)) {
- foreach ($arr as $img) {
- $imgUrl = imgUtil::groupImg($img);
- $ad[] = ['adImgUrl' => $imgUrl];
- }
- }
- }
- //新人专享礼物
- $newUserGift = [];
- if (!empty($introUserId)) {
- $userInfo = UserService::getUserInfo($this->userId);
- $newUserGift = InviteService::hasNewGift($userInfo);
- }
- util::success(['ad' => $ad, 'shop' => $shop, 'newUserGift' => $newUserGift]);
- }
- }
|