commit
072e995b70
@ -119,9 +119,13 @@ class GoodsSkusController extends Controller
|
|||||||
foreach ($ids as $id => $number) {
|
foreach ($ids as $id => $number) {
|
||||||
$finalIds[] = $id;
|
$finalIds[] = $id;
|
||||||
}
|
}
|
||||||
|
if(empty($finalIds)){
|
||||||
|
$goodsSkusBuilder->orderBy("id",$sortValue);
|
||||||
|
}else{
|
||||||
|
$idField = implode(',', $finalIds);
|
||||||
|
$goodsSkusBuilder->orderByRaw("FIELD(id,{$idField}) {$sortValue}");
|
||||||
|
}
|
||||||
|
|
||||||
$idField = implode(',', $finalIds);
|
|
||||||
$goodsSkusBuilder->orderByRaw("FIELD(id,{$idField}) {$sortValue}");
|
|
||||||
} else {
|
} else {
|
||||||
$goodsSkusBuilder->orderBy($sortField, $sortValue);
|
$goodsSkusBuilder->orderBy($sortField, $sortValue);
|
||||||
}
|
}
|
||||||
@ -148,6 +152,8 @@ class GoodsSkusController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$sku['sale_ratio'] = 0;
|
$sku['sale_ratio'] = 0;
|
||||||
}
|
}
|
||||||
|
$sku['yesterday_num'] = bcadd($sku['stock'], $sku['order_goods_num']);
|
||||||
|
|
||||||
}
|
}
|
||||||
$data = ["manage" => ["is_admin" => in_array($rolesName[0], ["运营", "超级管理员", "管理员", "系统管理员", "店铺运营"]) ? 1 : 0]];
|
$data = ["manage" => ["is_admin" => in_array($rolesName[0], ["运营", "超级管理员", "管理员", "系统管理员", "店铺运营"]) ? 1 : 0]];
|
||||||
return GoodsSkuResource::collection($goodsSkus)->additional($data);
|
return GoodsSkuResource::collection($goodsSkus)->additional($data);
|
||||||
|
|||||||
@ -26,9 +26,10 @@ class GoodSkuService
|
|||||||
public function inventory(array $skusWithCombinationGoods)
|
public function inventory(array $skusWithCombinationGoods)
|
||||||
{
|
{
|
||||||
$skusWithCombinationGoods = $this->handleSkusWithCombinationGoods($skusWithCombinationGoods);
|
$skusWithCombinationGoods = $this->handleSkusWithCombinationGoods($skusWithCombinationGoods);
|
||||||
|
|
||||||
//传进来的sku可能包含组合商品 所以这里需要事先计算好数据
|
//传进来的sku可能包含组合商品 所以这里需要事先计算好数据
|
||||||
$inventoryKeyBySkuIdMap = collect($skusWithCombinationGoods)->where('is_combination', "=", 0)
|
$inventoryKeyBySkuIdMap = collect($skusWithCombinationGoods)->where('is_combination', "=", 0)
|
||||||
->pluck("real_stock", "id")->filter()->toArray();
|
->pluck("real_stock", "id")->toArray();
|
||||||
|
|
||||||
Log::info("库存原始操作map", $inventoryKeyBySkuIdMap);
|
Log::info("库存原始操作map", $inventoryKeyBySkuIdMap);
|
||||||
//计算组合商品
|
//计算组合商品
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user