bug修复
This commit is contained in:
parent
1bbb0c4c63
commit
0f4d91e939
@ -42,7 +42,13 @@ class DailyStockRecordController extends Controller
|
|||||||
$query->where('external_sku_id', '=', $request->external_sku_id);
|
$query->where('external_sku_id', '=', $request->external_sku_id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$dailyStockRecord = $build->orderByDesc("id")->paginate($request->get('per_page'));
|
$start = $request->get("start_time");
|
||||||
|
$end = $request->get("end_time");
|
||||||
|
$dailyStockRecord = $build->when($start, function ($query) use ($start) {
|
||||||
|
$query->where("created_at", ">=", $start);
|
||||||
|
})->when($end, function ($query) use ($end) {
|
||||||
|
$query->where("created_at", ">=", $end);
|
||||||
|
})->orderByDesc("id")->paginate($request->get('per_page'));
|
||||||
return JsonResource::collection($dailyStockRecord);
|
return JsonResource::collection($dailyStockRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +77,7 @@ class DailyStockRecordController extends Controller
|
|||||||
];
|
];
|
||||||
return response($this->res, $this->res['httpCode']);
|
return response($this->res, $this->res['httpCode']);
|
||||||
}
|
}
|
||||||
$goodsSkuWithInventory = array_merge($goodsSku->toArray(),["inventory"=>$request->inventory]);
|
$goodsSkuWithInventory = array_merge($goodsSku->toArray(), ["inventory" => $request->inventory]);
|
||||||
//同批量逻辑操作
|
//同批量逻辑操作
|
||||||
$goodSkuService = new GoodSkuService();
|
$goodSkuService = new GoodSkuService();
|
||||||
$goodSkuService->inventory([$goodsSkuWithInventory]);
|
$goodSkuService->inventory([$goodsSkuWithInventory]);
|
||||||
@ -94,7 +100,7 @@ class DailyStockRecordController extends Controller
|
|||||||
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
||||||
return response($this->res, $this->res['httpCode']);
|
return response($this->res, $this->res['httpCode']);
|
||||||
}
|
}
|
||||||
$inventoryKeyByExternalSkuIdMap = collect($request->inventoryOrders)->pluck(null,"external_sku_id")->toArray();
|
$inventoryKeyByExternalSkuIdMap = collect($request->inventoryOrders)->pluck(null, "external_sku_id")->toArray();
|
||||||
$goodsSkus = GoodsSku::query()->with("combinationGoods")->whereIn('external_sku_id', array_keys($inventoryKeyByExternalSkuIdMap))
|
$goodsSkus = GoodsSku::query()->with("combinationGoods")->whereIn('external_sku_id', array_keys($inventoryKeyByExternalSkuIdMap))
|
||||||
->get()->toArray();
|
->get()->toArray();
|
||||||
$goodsSkus = collect($goodsSkus)->map(function ($v) use ($inventoryKeyByExternalSkuIdMap) {
|
$goodsSkus = collect($goodsSkus)->map(function ($v) use ($inventoryKeyByExternalSkuIdMap) {
|
||||||
@ -103,7 +109,7 @@ class DailyStockRecordController extends Controller
|
|||||||
return $v;
|
return $v;
|
||||||
}
|
}
|
||||||
})->toArray();
|
})->toArray();
|
||||||
Log::info("goodsSkus",$goodsSkus);
|
Log::info("goodsSkus", $goodsSkus);
|
||||||
$goodSkuService = new GoodSkuService();
|
$goodSkuService = new GoodSkuService();
|
||||||
$goodSkuService->inventory($goodsSkus);
|
$goodSkuService->inventory($goodsSkus);
|
||||||
return response($this->res, $this->res['httpCode']);
|
return response($this->res, $this->res['httpCode']);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user