This commit is contained in:
杨建炊 2024-12-12 13:47:22 +08:00
parent 43a1c491c1
commit 0b72923c4e

View File

@ -4,7 +4,9 @@ namespace App\Services\Business\KuaiTuanTuan;
use App\Events\BusinessOrdersUpdate;
use App\Models\BusinessGoodsSku;
use App\Models\GoodsSku;
use App\Services\Business\BusinessFactory;
use Illuminate\Support\Facades\Log;
class Goods
{
@ -43,6 +45,16 @@ class Goods
);
if (empty($businessGoodSku->id)) {
$businessGoodSku->save();
if (!empty($businessGoodSku->external_sku_id)) {
$shop = $businessGoodSku->shop;
$sku = GoodsSku::query()
->where('external_sku_id', $businessGoodSku->external_sku_id)
->first();
Log::info("商品下载新增sku",[$businessGoodSku]);
if(!empty($sku)){
BusinessFactory::init()->make($shop['plat_id'])->setShopWithId($shop['id'])->incrQuantity($businessGoodSku, $sku->sale_stock, false);
}
}
} else {
$businessGoodSku->update($data);
}