|
|
|
@ -40,8 +40,18 @@ class ProductServiceProvider extends ServiceProvider |
|
|
|
{ |
|
|
|
Product::updated(function ($product) { |
|
|
|
if ($product->isDirty('status') && $product->status == ProductStatus::ON_SALE) { |
|
|
|
//自动上架
|
|
|
|
/** 同步信息到代理商产品 START */ |
|
|
|
AgentProduct::query() |
|
|
|
->where(['type' => 0, 'product_id' => $product->id]) |
|
|
|
->update([ |
|
|
|
'title' => $product->title, |
|
|
|
'know' => $product->know, |
|
|
|
'content' => $product->content, |
|
|
|
'pictures' => $product->pictures, |
|
|
|
]); |
|
|
|
/** 同步信息到代理商产品 END */ |
|
|
|
|
|
|
|
/** 自动上架 START */ |
|
|
|
$agentIds = AgentProductItem::query() |
|
|
|
->withoutGlobalScope('orderById') |
|
|
|
->where('supplier_id', $product->supplier_id) |
|
|
|
@ -125,6 +135,7 @@ class ProductServiceProvider extends ServiceProvider |
|
|
|
throw new \Exception('自动上架失败::' . $e->getTraceAsString()); |
|
|
|
} |
|
|
|
} |
|
|
|
/** 自动上架 END */ |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|