You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
712 B
28 lines
712 B
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\AgentProduct;
|
|
use App\Models\Special;
|
|
use Illuminate\Http\Request;
|
|
|
|
class SpecialController extends Controller
|
|
{
|
|
//专题产品列表
|
|
public function show()
|
|
{
|
|
$id = (int)request()->input('id');
|
|
$detail = Special::query()
|
|
->select(['id', 'picture', 'picture_ad', 'updated_at', 'agent_product_id'])
|
|
->find($id);
|
|
|
|
$detail->product = AgentProduct::query()
|
|
->whereIn('id', $detail->agent_product_id)
|
|
->select('id', 'sale', 'product_id', 'price', 'original_price')
|
|
->with('product:id,title,pictures')
|
|
->limit(6)->get();
|
|
unset($detail->agent_product_id);
|
|
|
|
return $this->success($detail);
|
|
}
|
|
}
|