定时任务里面用到了预加载的 product?
CrowdfundingProduct::query()
**->whith(['product'])**
->where('end_at','<=',Carbon::now())
->where('status', CrowdfundingProduct::STATUS_FUNDING)
->get()
->each(function(CrowdfundingProduct $crowdfundingProduct){
if ($crowdfundingProduct->target_amount > $crowdfundingProduct->total_amount){
$this->crowdfundingFailed($crowdfundingProduct);
} else {
$this->crowdfundingSucceed($crowdfundingProduct);
}
});
这里确实不需要加载商品数据,已经调整了