shish 4 سال پیش
والد
کامیت
feec9e823b
1فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  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'] ?? '',
         ];
         $ghs = self::addGhs($data);
+        $ghsId = $ghs['id'] ?? 0;
         $shop = ShopClass::getShopInfo($hdShopId);
         $default = $shop['default'] ?? 0;
         $name = $default == 1 ? $shop['merchantName'] : $shop['merchantName'] . ' ' . $shop['shopName'];
@@ -90,12 +91,13 @@ class GhsClass extends BaseClass
 
         $uniGhsId = $shop['uniGhsId'] ?? 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]);
         }
 
-        $ghsId = $ghs['id'] ?? 0;
         $debtLimit = 5000;//欠款额度
         $customData = [
             'sjId' => $hdSjId,