|
@@ -32,19 +32,26 @@ class Hotel extends Api
|
|
|
public function list()
|
|
|
{
|
|
|
$params = $this->request->param();
|
|
|
- $params['sort_type'] = !empty($params['sort_type']) ? $params['sort_type'] : 1;
|
|
|
+ $params['sort_distance'] = !empty($params['sort_distance']) ? $params['sort_distance'] : 1;
|
|
|
+ $params['sort_price'] = !empty($params['sort_price']) ? $params['sort_price'] : 1;
|
|
|
$field = ['id','name','image','price','original_price','tags','lat','lng'];
|
|
|
if (!empty($params['lng']) && !empty($params['lng'])){
|
|
|
$field[] = "(st_distance(point ({$params['lng']}, {$params['lat']}),point(lng,lat))*111195) as distance";
|
|
|
}
|
|
|
$query = HotelModel::field($field);
|
|
|
|
|
|
- if (!empty($params['lng']) && !empty($params['lng']) && $params['sort_type'] == 1){
|
|
|
- $query->order('distance asc');
|
|
|
+ if (!empty($params['lng']) && !empty($params['lng'])){
|
|
|
+ if ($params['sort_distance'] == 1){
|
|
|
+ $query->order('distance asc');
|
|
|
+ }else{
|
|
|
+ $query->order('distance desc');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if ($params['sort_type'] == 2){
|
|
|
+ if ($params['sort_type'] == 1){
|
|
|
$query->order('price asc');
|
|
|
+ }else{
|
|
|
+ $query->order('price desc');
|
|
|
}
|
|
|
|
|
|
$list = $query->where('status', 1)
|
|
@@ -186,7 +193,7 @@ class Hotel extends Api
|
|
|
return $this->success('获取成功',$list);
|
|
|
}
|
|
|
|
|
|
- // 订单取消
|
|
|
+ // 订单取消 2:79 - 10 = 69 4:65 - 10 = 55 6:50 - 10 = 40
|
|
|
public function applyCancel()
|
|
|
{
|
|
|
$params = $this->request->param();
|