|
|
@@ -80,7 +80,7 @@ class CgRefundService extends BaseService
|
|
|
$cgRefund = CgRefundClass::add($data, true);
|
|
|
if($ghsItemInfo){
|
|
|
//写入cgRefundItem, 转hdProductId
|
|
|
- $ghsItemInfo = ProductClass::toggleProductList($ghsItemInfo, $cg->shopId, $cg->sjId);
|
|
|
+ $ghsItemInfo = self::toggleProductList($ghsItemInfo, $cg->shopId, $cg->sjId);
|
|
|
//将hdProductId =》productId
|
|
|
foreach ($ghsItemInfo as $k=>$v){
|
|
|
$ghsItemInfo[$k]['productId'] =$v['hdProductId'];
|
|
|
@@ -214,4 +214,27 @@ class CgRefundService extends BaseService
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //供货商productId 转 hdProductId [{productId:1,...}]
|
|
|
+ public static function toggleProductList($ghsItemInfo,$hdShopId,$hdSjId)
|
|
|
+ {
|
|
|
+ $productIds = array_column($ghsItemInfo, "productId");
|
|
|
+ $productData = ProductClass::getProductByIds($productIds);
|
|
|
+ $itemIds = [];
|
|
|
+ $productMap = [];
|
|
|
+ foreach ($productData as $v){
|
|
|
+ $itemIds[] = $v['itemId'];
|
|
|
+ $productMap[$v['id']] = $v['itemId'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $hdProductData = ProductClass::getProductInfoByItemIds($itemIds, $hdShopId);
|
|
|
+ $hdProductData = array_column($hdProductData, null, "itemId");
|
|
|
+
|
|
|
+ foreach ($ghsItemInfo as $k => $v) {
|
|
|
+ $itemId =$productMap[$v['productId']];
|
|
|
+ $hdProductId = $hdProductData[$itemId]['id'];
|
|
|
+ $ghsItemInfo[$k]['hdProductId'] = $hdProductId;
|
|
|
+ }
|
|
|
+ return $ghsItemInfo;
|
|
|
+ }
|
|
|
}
|