feat: #10000 修改

This commit is contained in:
赵世界 2023-04-21 17:53:35 +08:00
parent 6ad2379046
commit cf3f7fad4d
2 changed files with 2 additions and 14 deletions

View File

@ -28,11 +28,7 @@ class BusinessOrdersUpdate
*/
public function __construct($item, $num)
{
if (is_array($item)) {
$this->businessGoods = $item;
} else {
$this->businessGoods = $item->toArray();
}
$this->businessGoods = $item->toArray();
$this->num = $num;
$this->updateStock();
}
@ -41,10 +37,6 @@ class BusinessOrdersUpdate
{
try {
$this->goodsSku = GoodsSku::query()
->with([
'combinationGoods',
'combinationGoods.goodsSkuItem:id,external_sku_id',
])
->where('external_sku_id', $this->businessGoods['external_sku_id'])
->first();
} catch (\Exception $e) {
@ -54,10 +46,6 @@ class BusinessOrdersUpdate
if ($this->goodsSku) {
$this->goodsSku->stock += $this->num;
$this->goodsSku->save();
foreach ($this->goodsSku->combinationGoods as $item) {
$this->businessGoods['external_sku_id'] = $item['goodsSkuItem']['external_sku_id'];
event(new BusinessOrdersUpdate($this->businessGoods, 0 - $item['item_num']));
}
}
}

View File

@ -53,7 +53,7 @@ class GoodsSkusController extends Controller
}])
->where('is_combination', 0)
->orderByDesc('stock')
->paginate(10);
->paginate($request->get('per_page'));
$fields = implode(',', [
'shop_id',
'external_sku_id',