瀏覽代碼

商城用户

shish 4 年之前
父節點
當前提交
f8dd1dfaf9

+ 8 - 29
app-mall/controllers/BaseController.php

@@ -28,9 +28,8 @@ class BaseController extends PublicController
 
     public function beforeAction($action)
     {
-        //定义平台类型 1花店 2供应商 3商城
         Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'mall');
-
+        $this->isWx = util::isWx();
         $shopId = Yii::$app->request->get('account', 0);
         $this->shopId = $shopId;
         if (!empty($shopId)) {
@@ -45,42 +44,22 @@ class BaseController extends PublicController
                 $this->sjId = $sjId;
                 $sj = SjClass::getById($this->sjId, true);
                 if (empty($sj)) {
-                    util::fail('没有找到商家信息');
+                    util::fail('没有商家信息');
                 }
                 $this->sj = $sj;
+                $this->sjExtend = MerchantExtendService::getBySjId($this->sjId);
             }
         }
-
         if (httpUtil::isMiniProgram()) {
             $userId = jwt::getLoginId();
-            if (empty($userId)) {
-                util::notLogin('您还没有登陆');
-            }
-            $this->userId = $userId;
-            $user = UserClass::getById($userId, true);
-            if (empty($user)) {
-                util::fail('没有找到客户信息');
-            }
-            $this->user = $user;
-            $this->isWx = util::isWx();
-            if (!empty($shop)) {
-                $this->sjExtend = MerchantExtendService::getBySjId($this->sjId);
-                $userInfo = isset($user->attributes) ? $user->attributes : [];
-                $custom = CustomClass::replaceCustom($this->sjId, $userInfo, $shopId);
-                if (!empty($custom)) {
-                    $this->custom = $custom;
-                    $customId = $custom['id'] ?? 0;
-                    $this->customId = $customId;
-                } else {
-                    if (in_array($action->id, $this->guestAccess) == false) {
-                        util::fail('没有找到客户信息哦');
-                    }
+            if (!empty($userId)) {
+                $this->userId = $userId;
+                $user = UserClass::getById($userId, true);
+                if (!empty($user)) {
+                    $this->user = $user;
                 }
             }
-        } else {
-            //非登陆情况的请求,支付宝扫码付款需要用到
         }
-
         return parent::beforeAction($action);
     }
 

+ 12 - 0
app-mall/controllers/ShopController.php

@@ -2,6 +2,7 @@
 
 namespace mall\controllers;
 
+use bizHd\shop\classes\ShopClass;
 use bizMall\ad\services\AdService;
 use bizMall\goods\services\CategoryService;
 use bizMall\goods\services\GoodsCategoryService;
@@ -17,6 +18,17 @@ use common\components\util;
 class ShopController extends BaseController
 {
 
+    //最新店铺 ssh 20220506
+    public function actionGetNewShop()
+    {
+        $respond = ShopClass::getNewShopList();
+        //显示国兰的信息 0不是 1是
+        $showGlInfo = getenv('SHOW_GL_INFO');
+        $info = $showGlInfo === false ? 1 : $showGlInfo;
+        $respond['showGlInfo'] = $info;
+        util::success($respond);
+    }
+
     //获取商家的默认门店 ssh 2019.12.6
     public function actionDetail()
     {

+ 1 - 0
app-mall/controllers/UserController.php

@@ -3,6 +3,7 @@
 namespace mall\controllers;
 
 use bizHd\custom\classes\CustomClass;
+use bizHd\shop\classes\ShopClass;
 use bizMall\merchant\services\MerchantExtendService;
 use bizMall\message\services\SmsService;
 use bizMall\user\classes\UserClass;

+ 23 - 0
biz-hd/shop/classes/ShopClass.php

@@ -8,6 +8,7 @@ use bizHd\admin\classes\AdminClass;
 use bizHd\goods\classes\CategoryClass;
 use bizHd\goods\classes\GoodsSettingClass;
 use bizHd\saas\classes\ApplyClass;
+use common\components\dict;
 use common\components\imgUtil;
 use common\components\stringUtil;
 use common\components\util;
@@ -19,6 +20,28 @@ class ShopClass extends BaseClass
 
     public static $baseFile = '\bizHd\shop\models\Shop';
 
+    public static function getNewShopList()
+    {
+        $where = ['ptStyle' => dict::getDict('ptStyle', 'hd')];
+        $respond = self::getList('*', $where, 'addTime DESC');
+        $list = $respond['list'] ?? [];
+        if (!empty($list)) {
+            foreach ($list as $key => $val) {
+                $shopName = $val['shopName'] ?? '';
+                $sjName = $val['merchantName'] ?? '';
+                $default = $val['default'] ?? 0;
+                $showName = $sjName . ' ' . $shopName;
+                if ($default == 1) {
+                    $showName = $sjName;
+                }
+                $list[$key]['showName'] = $showName;
+                $list[$key]['cover'] = imgUtil::groupImg('');
+            }
+            $respond['list'] = $list;
+        }
+        return $respond;
+    }
+
     public static function getShopList($where)
     {
         $list = self::getList('*', $where, 'addTime DESC');