|
|
@@ -21,6 +21,7 @@ use bizGhs\order\traits\OrderTrait;
|
|
|
use bizGhs\shop\classes\ShopAdminClass;
|
|
|
use bizGhs\stock\classes\StockRecordClass;
|
|
|
use bizGhs\stock\services\StockRecordService;
|
|
|
+use bizHd\notify\classes\NotifyClass;
|
|
|
use common\components\dict;
|
|
|
use common\components\imgUtil;
|
|
|
use common\components\noticeUtil;
|
|
|
@@ -1660,20 +1661,17 @@ class ProductClass extends BaseClass
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//供货商的productId => 零售端的productId ,不存在的补productId(放在默认分类)
|
|
|
//productList [{"productId":"113","bigNum":1,"smallNum":0,"classId":"-2","itemId":1}]
|
|
|
- public static function toggleProductList($productList, $hdShopId, $hdSjId, $hdMainId)
|
|
|
+ public static function toggleProductList($productList, $hdShopId, $hdSjId, $hdMainId, $ghs)
|
|
|
{
|
|
|
$itemIds = array_column($productList, "itemId");
|
|
|
$hdProductData = self::getProductInfoByItemIds($itemIds, $hdMainId);
|
|
|
$hdProductData = array_column($hdProductData, null, "itemId");
|
|
|
- //获取默认分类ID
|
|
|
$defaultClassId = ItemClassClass::getDefaultClassId($hdMainId);
|
|
|
if (empty($defaultClassId)) {
|
|
|
util::fail('没有找到花材的默认分类');
|
|
|
}
|
|
|
-
|
|
|
foreach ($productList as $k => $v) {
|
|
|
$itemId = $v['itemId'] ?? 0;
|
|
|
$ghsProductId = $v['productId'] ?? 0;
|
|
|
@@ -1690,19 +1688,21 @@ class ProductClass extends BaseClass
|
|
|
$productData['classId'] = $defaultClassId;
|
|
|
unset($productData['id']);
|
|
|
$productData['rank'] = 'A';
|
|
|
- //计算价格
|
|
|
$cost = $v['cost'] ?? 0;
|
|
|
$addPrice = $v['addPrice'] ?? 0;
|
|
|
$productData['price'] = bcadd($cost, $addPrice, 2);
|
|
|
$addProduct = ProductClass::addBaseData($productData);
|
|
|
$hdProductId = $addProduct->id ?? 0;
|
|
|
+
|
|
|
+ //通知新花材需要分类
|
|
|
+ NotifyClass::cgGetNewProduct($addProduct, $hdMainId, $hdShopId, $ghs);
|
|
|
+
|
|
|
} else {
|
|
|
$hdProductId = $hdProductData[$itemId]['id'];
|
|
|
}
|
|
|
$productList[$k]['productId'] = $hdProductId;
|
|
|
$productList[$k]['ghsProductId'] = $ghsProductId;
|
|
|
}
|
|
|
-
|
|
|
return $productList;
|
|
|
}
|
|
|
|