Browse Source

新建花材

shish 2 years ago
parent
commit
62dbfcc6ae
1 changed files with 4 additions and 3 deletions
  1. 4 3
      biz-ghs/product/classes/ProductClass.php

+ 4 - 3
biz-ghs/product/classes/ProductClass.php

@@ -2178,7 +2178,7 @@ class ProductClass extends BaseClass
                     $cpName = $currentCp['name'] ?? '';
                     $ptCpId = $currentCp['ptCpId'] ?? 0;
                     $cpPy = $currentCp['py'] ?? '';
-                    $name = $update['name'] ?? '';
+                    $name = $data['name'] ?? '';
                     $py = stringUtil::py($name);
                     $hasCp = CpItemClass::getByCondition(['cpId' => $cpId, 'productId' => $respondId], true);
                     if (empty($hasCp)) {
@@ -2266,7 +2266,8 @@ class ProductClass extends BaseClass
 
             //在首店添加,则找到父级sj下的所有直营和加盟店,都进行同步
             if (isset($currentShop->default) && $currentShop->default == 1) {
-                $shopList = ShopClass::getAllByCondition(['sjId' => $data['sjId']], null, '*', null, true);
+                $sjId = $currentShop->sjId ?? 0;
+                $shopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
                 foreach ($shopList as $shop) {
                     $shopId = $shop->id ?? 0;
                     if ($shopId == $currentShop->id) {
@@ -2366,7 +2367,7 @@ class ProductClass extends BaseClass
                                     'py' => $py,
                                     'cpName' => $cpName,
                                     'cpPy' => $cpPy,
-                                    'mainId' => $mainId,
+                                    'mainId' => $thisMainId,
                                 ];
                                 CpItemClass::add($addCp);
                             }