|
|
|
@ -82,10 +82,10 @@ class IndexController extends Controller |
|
|
|
} |
|
|
|
|
|
|
|
# 人气爆款
|
|
|
|
$hots = AgentProduct::query() |
|
|
|
$hots = AgentProduct::with('product:id,title,pictures') //必须查询ID才能正常查询
|
|
|
|
->where('agent_id', $this->agent_id) |
|
|
|
->select('id', 'sale', 'product_id', 'price', 'original_price') //必须查询product_id才能with
|
|
|
|
->with('product:id,title,pictures') //必须查询ID才能正常查询
|
|
|
|
->orderBy('sale', 'desc')->orderBy('id', 'desc') |
|
|
|
->limit(6)->get(); |
|
|
|
if (!$hots->isEmpty()) { |
|
|
|
foreach ($hots as &$v) { |
|
|
|
|