mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
27 lines
776 B
PHP
27 lines
776 B
PHP
<?php
|
|
|
|
namespace App\Services\Business\MiaoXuan;
|
|
|
|
use App\Models\BusinessOrder;
|
|
|
|
class Order
|
|
{
|
|
// 下载订单事件之后去统计 然后更新库存
|
|
public static function saveOrders(array $orders, $shopId)
|
|
{
|
|
foreach ($orders as $order) {
|
|
$orderRecord = BusinessOrder::updateOrCreate(
|
|
['shop_id' => $shopId, 'order_sn' => $order['order_sn']],
|
|
$order
|
|
);
|
|
foreach ($order['sub_order_list'] as $item) {
|
|
$orderRecord = BusinessOrder::updateOrCreate(
|
|
['shop_id' => $shopId, 'business_order_id' => $orderRecord->id, 'goods_id' => $item['goods_id'], 'sku_id' => $item['sku_id']],
|
|
$item
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|