shish hace 5 años
padre
commit
dbf27548d6
Se han modificado 1 ficheros con 20 adiciones y 11 borrados
  1. 20 11
      app-ghs/controllers/MerchantController.php

+ 20 - 11
app-ghs/controllers/MerchantController.php

@@ -2,18 +2,18 @@
 
 namespace ghs\controllers;
 
-use bizHd\auth\services\AuthService;
+use biz\shop\classes\ShopAdminClass;
+use biz\sj\classes\MerchantClass;
 use biz\sj\services\MerchantExtendService;
 use biz\sj\services\MerchantService;
 use bizHd\saas\services\SetAuthService;
-use common\components\imgUtil;
 use Yii;
 use common\components\util;
 
 class MerchantController extends BaseController
 {
 
-    public $guestAccess = ['detail'];
+    public $guestAccess = ['detail', 'introduce-shop'];
 
     //运费设置 ssh 2019.12.8
     public function actionFreightSetting()
@@ -103,16 +103,25 @@ class MerchantController extends BaseController
     //商家信息 ssh 2020.1.11
     public function actionIntroduceShop()
     {
-        $id = Yii::$app->request->get('id');
-        $merchant = MerchantService::getMerchantById($id);
+        $ghsShopAdminId = Yii::$app->request->get('ghsShopAdminId');
+        $hdShopAdminId = Yii::$app->request->get('hdShopAdminId');
+        if (!empty($ghsShopAdminId)) {
+            $relation = ShopAdminClass::getById($ghsShopAdminId);
+        } else {
+            if (empty($hdShopAdminId)) {
+                util::success([]);
+            }
+            $relation = ShopAdminClass::getById($hdShopAdminId);
+        }
+        if (empty($relation)) {
+            util::success([]);
+        }
+        $sjId = $relation['merchantId'];
+        $merchant = MerchantClass::getMerchantById($sjId);
         if (empty($merchant)) {
-            util::fail('没有找到介绍人');
+            util::success([]);
         }
-        $name = isset($merchant['name']) ? $merchant['name'] : '';
-        $logoUrl = isset($merchant['smallLogoUrl']) && !empty($merchant['smallLogoUrl']) ? $merchant['smallLogoUrl'] : imgUtil::getPrefix() . '/hhb_small.png';
-        $address = $merchant['address'] ?? '';
-        $data = ['name' => $name, 'smallLogoUrl' => $logoUrl, 'id' => $id, 'fullAddress' => $address];
-        util::success($data);
+        util::success(['introduce' => $merchant]);
     }
 
 }