shish 8 hónapja
szülő
commit
c87f1bf238
1 módosított fájl, 73 hozzáadás és 70 törlés
  1. 73 70
      biz/ghs/classes/GhsClass.php

+ 73 - 70
biz/ghs/classes/GhsClass.php

@@ -52,9 +52,9 @@ class GhsClass extends BaseClass
         $needCheck = $ghsShop['needCheck'] ?? 0;
         $home = $ghsShop['home'] ?? 0;
         $homeAmount = $ghsShop['homeAmount'] ?? 0;
-        $homeType = $ghsShop['homeType']??0;
+        $homeType = $ghsShop['homeType'] ?? 0;
         $passStatus = $needCheck == 1 ? 0 : 1;
-        $live = isset($ghsShop['live']) ? $ghsShop['live'] : 1;
+        $live = $ghsShop['live'] ?? 1;
         $isHd = $ghsShop['isHd'] ?? 1;
         $showStock = $ghsShop['showStock'] ?? 0;
         $allowDebtAmount = $ghsShop['allowDebtAmount'] ?? 0;
@@ -75,37 +75,39 @@ class GhsClass extends BaseClass
         $hdOwnPtStyle = $hdShopInfo['ptStyle'] ?? 1;
 
         $salt = stringUtil::charsShuffleLowerCase(8);
-
-        $data = [
-            'sjId' => $ghsSjId,
-            'shopId' => $ghsShopId,
-            'mainId' => $ghsMainId,
-            'ownSjId' => $hdSjId,
-            'ownShopId' => $hdShopId,
-            'ownMainId' => $hdMainId,
-            'ownPtStyle' => $hdOwnPtStyle,
-            'name' => $name,
-            'py' => $py,
-            'avatar' => $ghsAvatar,
-            'mobile' => $ghsShop['mobile'] ?? '',
-            'province' => $ghsShop['province'] ?? '',
-            'city' => $ghsShop['city'] ?? '',
-            'dist' => $ghsShop['dist'] ?? '',
-            'address' => $ghsShop['address'] ?? '',
-            'floor' => $ghsShop['floor'] ?? '',
-            'fullAddress' => $ghsShop['fullAddress'] ?? '',
-            'lat' => $ghsShop['lat'] ?? '',
-            'long' => $ghsShop['long'] ?? '',
-            'live' => $live,
-            'giveLevel' => $giveLevel,
-            'showStock' => $showStock,
-            'salt' => $salt,
-            'passStatus' => $passStatus,
-            'home'=>$home,
-            'homeAmount'=>$homeAmount,
-            'homeType'=>$homeType,
-        ];
-        $ghs = self::addGhs($data);
+        $ghs = self::getByCondition(['ownShopId' => $hdShopId, 'shopId' => $ghsShopId]);
+        if (empty($ghs)) {
+            $data = [
+                'sjId' => $ghsSjId,
+                'shopId' => $ghsShopId,
+                'mainId' => $ghsMainId,
+                'ownSjId' => $hdSjId,
+                'ownShopId' => $hdShopId,
+                'ownMainId' => $hdMainId,
+                'ownPtStyle' => $hdOwnPtStyle,
+                'name' => $name,
+                'py' => $py,
+                'avatar' => $ghsAvatar,
+                'mobile' => $ghsShop['mobile'] ?? '',
+                'province' => $ghsShop['province'] ?? '',
+                'city' => $ghsShop['city'] ?? '',
+                'dist' => $ghsShop['dist'] ?? '',
+                'address' => $ghsShop['address'] ?? '',
+                'floor' => $ghsShop['floor'] ?? '',
+                'fullAddress' => $ghsShop['fullAddress'] ?? '',
+                'lat' => $ghsShop['lat'] ?? '',
+                'long' => $ghsShop['long'] ?? '',
+                'live' => $live,
+                'giveLevel' => $giveLevel,
+                'showStock' => $showStock,
+                'salt' => $salt,
+                'passStatus' => $passStatus,
+                'home' => $home,
+                'homeAmount' => $homeAmount,
+                'homeType' => $homeType,
+            ];
+            $ghs = self::addGhs($data);
+        }
         $ghsId = $ghs['id'] ?? 0;
         $shop = ShopClass::getShopInfo($hdShopId);
         $hdAvatar = $shop['shortAvatar'] ?? '';
@@ -127,42 +129,43 @@ class GhsClass extends BaseClass
             ShopClass::updateById($hdShopId, ['hasManyGhs' => 1]);
         }
 
-        $debtLimit = 0;//欠款额度
-        $customData = [
-            'sjId' => $hdSjId,
-            'ghsId' => $ghsId,
-            'shopId' => $hdShopId,
-            'mainId' => $hdMainId,
-            'ownSjId' => $ghsSjId,
-            'ownShopId' => $ghsShopId,
-            'ownMainId' => $ghsMainId,
-            'ownPtStyle' => $ghsOwnPtStyle,
-            'name' => $firstName,
-            'originName' => $secondName,
-            'py' => $py,
-            'avatar' => $hdAvatar,
-            'mobile' => $mobile,
-            'province' => $shop['province'] ?? '',
-            'city' => $shop['city'] ?? '',
-            'dist' => $shop['dist'] ?? '',
-            'address' => $shop['address'] ?? '',
-            'fullAddress' => $shop['fullAddress'] ?? '',
-            'showAddress' => $shop['showAddress'] ?? '',
-            'long' => $shop['long'] ?? '',
-            'lat' => $shop['lat'] ?? '',
-            'debtLimit' => $debtLimit,
-            'debt' => $allowDebt,
-            'debtLimit' => $allowDebtAmount,
-            'live' => $live,
-            'level' => $level,
-            'showStock' => $showStock,
-            'salt' => $salt,
-            'passStatus' => $passStatus,
-            'home'=>$home,
-            'homeAmount'=>$homeAmount,
-            'homeType'=>$homeType,
-        ];
-        $custom = CustomClass::addCustom($customData);
+        $custom = CustomClass::getByCondition(['ownShopId' => $ghsShopId, 'shopId' => $hdShopId]);
+        if (empty($custom)) {
+            $customData = [
+                'sjId' => $hdSjId,
+                'ghsId' => $ghsId,
+                'shopId' => $hdShopId,
+                'mainId' => $hdMainId,
+                'ownSjId' => $ghsSjId,
+                'ownShopId' => $ghsShopId,
+                'ownMainId' => $ghsMainId,
+                'ownPtStyle' => $ghsOwnPtStyle,
+                'name' => $firstName,
+                'originName' => $secondName,
+                'py' => $py,
+                'avatar' => $hdAvatar,
+                'mobile' => $mobile,
+                'province' => $shop['province'] ?? '',
+                'city' => $shop['city'] ?? '',
+                'dist' => $shop['dist'] ?? '',
+                'address' => $shop['address'] ?? '',
+                'fullAddress' => $shop['fullAddress'] ?? '',
+                'showAddress' => $shop['showAddress'] ?? '',
+                'long' => $shop['long'] ?? '',
+                'lat' => $shop['lat'] ?? '',
+                'debt' => $allowDebt,
+                'debtLimit' => $allowDebtAmount,
+                'live' => $live,
+                'level' => $level,
+                'showStock' => $showStock,
+                'salt' => $salt,
+                'passStatus' => $passStatus,
+                'home' => $home,
+                'homeAmount' => $homeAmount,
+                'homeType' => $homeType,
+            ];
+            $custom = CustomClass::addCustom($customData);
+        }
         $customId = $custom['id'] ?? 0;
         self::updateById($ghsId, ['customId' => $customId]);
 
@@ -222,7 +225,7 @@ class GhsClass extends BaseClass
             $avatar = $val['avatar'] ?? '';
             $list[$key]['shortAvatar'] = $avatar;
             $list[$key]['avatar'] = imgUtil::groupImg($avatar);
-            $list[$key]['smallAvatar'] = imgUtil::groupImg($avatar). "?x-oss-process=image/resize,m_fill,h_80,w_80";
+            $list[$key]['smallAvatar'] = imgUtil::groupImg($avatar) . "?x-oss-process=image/resize,m_fill,h_80,w_80";
             $currentShopId = $val['shopId'] ?? 0;
 
             $currentShop = $shopInfo[$currentShopId] ?? [];