shish il y a 5 ans
Parent
commit
a12c3381ba

+ 15 - 9
app-hd/controllers/MerchantController.php

@@ -2,6 +2,8 @@
 
 namespace hd\controllers;
 
+use biz\shop\classes\ShopAdminClass;
+use biz\sj\classes\MerchantClass;
 use bizHd\auth\services\AuthService;
 use biz\sj\services\MerchantExtendService;
 use biz\sj\services\MerchantService;
@@ -15,7 +17,7 @@ use yii\web\Controller;
 class MerchantController extends BaseController
 {
 
-    public $guestAccessAction = ['detail'];
+    public $guestAccessAction = ['detail', 'introduce-shop'];
 
     //运费设置 shish 2019.12.8
     public function actionFreightSetting()
@@ -105,16 +107,20 @@ class MerchantController extends BaseController
     //商家信息 shish 2020.1.11
     public function actionIntroduceShop()
     {
-        $id = Yii::$app->request->get('id');
-        $merchant = MerchantService::getMerchantById($id);
+        $id = Yii::$app->request->get('shopAdminId');
+        if (empty($id)) {
+            util::success([]);
+        }
+        $relation = ShopAdminClass::getById($id);
+        if (empty($relation)) {
+            util::success([]);
+        }
+        $sjId = $relation['merchantId'];
+        $merchant = MerchantClass::getMerchantById($sjId);
         if (empty($merchant)) {
-            util::fail('没有找到介绍人');
+            util::success([]);
         }
-        $merchantName = isset($merchant['merchantName']) ? $merchant['merchantName'] : '';
-        $smallLogoUrl = isset($merchant['smallLogoUrl']) ? $merchant['smallLogoUrl'] : '';
-        $logoUrl = isset($merchant['logoUrl']) ? $merchant['logoUrl'] : '';
-        $data = ['merchantName' => $merchantName, 'smallLogoUrl' => $smallLogoUrl, 'id' => $id, 'logoUrl' => $logoUrl, 'fullAddress' => '暂无'];
-        util::success($data);
+        util::success(['introduce' => $merchant]);
     }
 
     //当前用户获取门店信息

+ 22 - 31
biz-hd/saas/services/ApplyService.php

@@ -84,7 +84,7 @@ class ApplyService extends BaseService
     }
 
     //新增或修改申请开店 shish 2021.2.27
-    public static function replaceRetail($data, $import = false)
+    public static function replaceRetail($data)
     {
         $mobile = $data['mobile'] ?? 0;
         if (empty($mobile)) {
@@ -108,40 +108,31 @@ class ApplyService extends BaseService
         }
         $licenseNo = $data['licenseNo'] ?? '';
         $mobile = $data['mobile'] ?? '';
-
+        if (empty($licenseNo)) {
+            util::fail('请填写营业执照编号');
+        }
+        //查询客户提交的证件
+        $has = ApplyClass::getByCondition(['licenseNo' => $licenseNo]);
+        if (!empty($has)) {
+            util::fail('营业执照已经使用过了');
+        }
+        $has = ApplyClass::getByCondition(['mobile' => $mobile]);
+        if (!empty($has)) {
+            util::fail('手机号已经使用过了');
+        }
+        $adminId = $data['adminId'];
+        if (empty($adminId)) {
+            util::fail('帐号有问题');
+        }
+        $has = ApplyClass::getByCondition(['adminId' => $adminId]);
+        if (!empty($has)) {
+            util::fail('您的微信已经申请过了');
+        }
         $from = $data['from'] ?? 0;
         if (in_array($from, [ApplyClass::FROM_GHS, ApplyClass::FROM_RETAIL]) == false) {
             util::fail('请填写来源');
         }
-        if ($import == false) {
-            //查询客户提交的证件
-            $has = ApplyClass::getByCondition(['licenseNo' => $licenseNo]);
-            if (!empty($has)) {
-                util::fail('您已申请');
-            }
-            $has = ApplyClass::getByCondition(['mobile' => $mobile]);
-            if (!empty($has)) {
-                $currentSjId = $has['sjId'] ?? 0;
-                $currentCustom = CustomClass::getByCondition(['customSjId' => $currentSjId]);
-                if (!empty($currentCustom)) {
-                    $data['customId'] = $currentCustom['id'] ?? 0;
-                }
-            }
-        } else {
-            //导入纯彩花艺已有客户判断
-            $has = ApplyClass::getByCondition(['mobile' => $mobile]);
-            if (!empty($has)) {
-                noticeUtil::push("客户 $mobile 已经申请", '15280215347');
-                return false;
-            }
-        }
-        $customId = $data['customId'] ?? 0;
-        if (!empty($customId)) {
-            //纯彩花艺客户已经开店但没有提供营业执照,需要重新走申请流程
-            return ApplyClass::updateRetail($data);
-        } else {
-            return ApplyClass::addRetail($data);
-        }
+        return ApplyClass::addRetail($data);
     }
 
     //供货商申请开店 shish 2021.01.28

+ 1 - 1
console/controllers/SjInitController.php

@@ -45,7 +45,7 @@ class SjInitController extends Controller
             $val['name'] = $val['sjName'];
             $val['fullAddress'] = $val['address'];
             $val['nickName'] = $val['adminName'];
-            $respond = ApplyService::replaceRetail($val, true);
+            $respond = ApplyService::replaceRetail($val);
             if (!empty($respond)) {
                 $id = $respond['id'] ?? 0;
                 ApplyService::pass($id);