|
|
@@ -17,11 +17,18 @@ class GhsClass extends BaseClass
|
|
|
public static $baseFile = '\biz\ghs\models\Ghs';
|
|
|
|
|
|
//新增客户和供货商关系 shish 2021.4.13
|
|
|
- public static function build($ghsShopId, $hdShopId)
|
|
|
+ public static function build($ghsShopId, $hdShopId, $type = 1)
|
|
|
{
|
|
|
- $ghs = self::getByCondition(['ownShopId' => $hdShopId, 'shopId' => $ghsShopId]);
|
|
|
- if (!empty($ghs)) {
|
|
|
- return true;
|
|
|
+ if ($type == 1) {
|
|
|
+ $ghs = self::getByCondition(['ownShopId' => $hdShopId, 'shopId' => $ghsShopId]);
|
|
|
+ if (!empty($ghs)) {
|
|
|
+ return $ghs;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $custom = CustomClass::getByCondition(['ownShopId' => $ghsShopId, 'shopId' => $hdShopId]);
|
|
|
+ if (!empty($custom)) {
|
|
|
+ return $custom;
|
|
|
+ }
|
|
|
}
|
|
|
$ghsShop = ShopClass::getShopInfo($ghsShopId);
|
|
|
$ghsSjId = $ghsShop['merchantId'] ?? 0;
|
|
|
@@ -74,7 +81,10 @@ class GhsClass extends BaseClass
|
|
|
$custom = CustomClass::addCustom($customData);
|
|
|
$customId = $custom['id'] ?? 0;
|
|
|
self::updateById($ghsId, ['customId' => $customId]);
|
|
|
- return $ghs;
|
|
|
+ if ($type == 1) {
|
|
|
+ return $ghs;
|
|
|
+ }
|
|
|
+ return $custom;
|
|
|
}
|
|
|
|
|
|
//增加供货商 shish 2021.3.29
|