Bladeren bron

供应商

shish 4 jaren geleden
bovenliggende
commit
feec9e823b
1 gewijzigde bestanden met toevoegingen van 5 en 3 verwijderingen
  1. 5 3
      biz/ghs/classes/GhsClass.php

+ 5 - 3
biz/ghs/classes/GhsClass.php

@@ -82,6 +82,7 @@ class GhsClass extends BaseClass
             'long' => $ghsShop['long'] ?? '',
             'long' => $ghsShop['long'] ?? '',
         ];
         ];
         $ghs = self::addGhs($data);
         $ghs = self::addGhs($data);
+        $ghsId = $ghs['id'] ?? 0;
         $shop = ShopClass::getShopInfo($hdShopId);
         $shop = ShopClass::getShopInfo($hdShopId);
         $default = $shop['default'] ?? 0;
         $default = $shop['default'] ?? 0;
         $name = $default == 1 ? $shop['merchantName'] : $shop['merchantName'] . ' ' . $shop['shopName'];
         $name = $default == 1 ? $shop['merchantName'] : $shop['merchantName'] . ' ' . $shop['shopName'];
@@ -90,12 +91,13 @@ class GhsClass extends BaseClass
 
 
         $uniGhsId = $shop['uniGhsId'] ?? 0;
         $uniGhsId = $shop['uniGhsId'] ?? 0;
         $hasManyGhs = $shop['hasManyGhs'] ?? 0;
         $hasManyGhs = $shop['hasManyGhs'] ?? 0;
-        //从只有一个供应商变成有多个供应商
-        if ($uniGhsId > 0 && $hasManyGhs == 0) {
+        if ($uniGhsId == 0 && $hasManyGhs == 0) {
+            ShopClass::updateById($hdShopId, ['uniGhsId' => $ghsId]);
+        } else {
+            //从只有一个供应商变成有多个供应商
             ShopClass::updateById($hdShopId, ['hasManyGhs' => 1]);
             ShopClass::updateById($hdShopId, ['hasManyGhs' => 1]);
         }
         }
 
 
-        $ghsId = $ghs['id'] ?? 0;
         $debtLimit = 5000;//欠款额度
         $debtLimit = 5000;//欠款额度
         $customData = [
         $customData = [
             'sjId' => $hdSjId,
             'sjId' => $hdSjId,