Browse Source

旅游线路搜索

master
李可松 4 years ago
parent
commit
47cfdd3e74
  1. 22
      app/Http/Controllers/Api/AgentProductController.php
  2. 3
      routes/api.php

22
app/Http/Controllers/Api/AgentProductController.php

@ -53,6 +53,28 @@ class AgentProductController extends Controller
return $this->success($list); return $this->success($list);
} }
//旅游线路搜索
public function travel_search()
{
$formData = request()->only(['departure_place', 'destination']);
if (empty($formData['departure_place']) && empty($formData['destination'])) {
return $this->error('请输入出发地和目的地');
}
$list = AgentProduct::list($this->agent_id)->whereHas('product', function($query) use ($formData) {
if (!empty($formData['departure_place'])) {
$query->whereRaw("extends->'$.field_0_departure_place' LIKE ?", ["%{$formData['departure_place']}%"]);
}
if (!empty($formData['destination'])) {
$query->whereRaw("extends->'$.field_0_destination' LIKE ?", ["%{$formData['destination']}%"]);
}
})->orderBy('id', 'DESC')->simplePaginate();
$list = $this->paginatePicAddHost($list);
return $this->success($list);
}
// 产品详情 // 产品详情
public function show() public function show()
{ {

3
routes/api.php

@ -60,7 +60,8 @@ Route::namespace('App\Http\Controllers\Api')
Route::post('show', 'AgentProductController@show'); //产品详情 Route::post('show', 'AgentProductController@show'); //产品详情
Route::post('recommend', 'AgentProductController@recommendList'); //我的下方推荐 Route::post('recommend', 'AgentProductController@recommendList'); //我的下方推荐
Route::post('hot', 'AgentProductController@hotList'); //人气爆款列表 Route::post('hot', 'AgentProductController@hotList'); //人气爆款列表
Route::post('search', 'AgentProductController@search'); //人气爆款列表
Route::post('search', 'AgentProductController@search'); //首页搜索框
Route::post('travel_search', 'AgentProductController@travel_search'); //旅游线路搜索
}); });
# 产品分类 # 产品分类

Loading…
Cancel
Save