|
|
|
@ -25,6 +25,9 @@ class AgentProductController extends Controller |
|
|
|
|
|
|
|
$list = AgentProduct::where($where) |
|
|
|
->with('product:id,title,pictures') |
|
|
|
->whereHas('product', function ($query) { |
|
|
|
return $query->where('status', ProductStatus::ON_SALE); |
|
|
|
}) |
|
|
|
->select('id', 'sale', 'product_id', 'price', 'original_price') |
|
|
|
->orderBy('id', 'DESC') |
|
|
|
->simplePaginate(); |
|
|
|
@ -41,6 +44,9 @@ class AgentProductController extends Controller |
|
|
|
->with('product:id,title,pictures,know,stock,content') |
|
|
|
->with('coupon:tag,agent_product_id') |
|
|
|
->with('fav:agent_product_id') |
|
|
|
->whereHas('product', function ($query) { |
|
|
|
return $query->where('status', ProductStatus::ON_SALE); |
|
|
|
}) |
|
|
|
->firstWhere(['id' => $id, 'agent_id' => $this->agent_id, 'status' => ProductStatus::ON_SALE]); |
|
|
|
|
|
|
|
if (!$agent_product || !$agent_product->product) { |
|
|
|
@ -66,6 +72,9 @@ class AgentProductController extends Controller |
|
|
|
// TODO 此处需要再优化排序规则,并增加广告功能
|
|
|
|
$list = AgentProduct::where('agent_id', $this->agent_id) |
|
|
|
->with('product:id,title,pictures') |
|
|
|
->whereHas('product', function ($query) { |
|
|
|
return $query->where('status', ProductStatus::ON_SALE); |
|
|
|
}) |
|
|
|
->select('id', 'sale', 'product_id', 'price', 'original_price') |
|
|
|
->orderBy('id', 'DESC') |
|
|
|
->simplePaginate(); |
|
|
|
|