正在显示
1 个修改的文件
包含
23 行增加
和
1 行删除
@@ -200,6 +200,15 @@ class Car extends Base | @@ -200,6 +200,15 @@ class Car extends Base | ||
200 | */ | 200 | */ |
201 | public function switching_driver(){ | 201 | public function switching_driver(){ |
202 | $res=Db::name("driver")->where("user_id",$this->auth->id)->find(); | 202 | $res=Db::name("driver")->where("user_id",$this->auth->id)->find(); |
203 | + $car=Db::name("car")->where("driver_id",$res['id'])->find(); | ||
204 | + if($car){ | ||
205 | + $res['license_plate']=$car['license_plate']; | ||
206 | + $res['car_model']=$car['car_model']; | ||
207 | + $res['car_fleet']=$car['car_fleet']; | ||
208 | + }else{ | ||
209 | + return $this->error("请求失败"); | ||
210 | + } | ||
211 | + | ||
203 | if($res){ | 212 | if($res){ |
204 | return $this->success("请求成功",$res); | 213 | return $this->success("请求成功",$res); |
205 | }else{ | 214 | }else{ |
@@ -218,6 +227,20 @@ class Car extends Base | @@ -218,6 +227,20 @@ class Car extends Base | ||
218 | return $this->error("请求失败"); | 227 | return $this->error("请求失败"); |
219 | } | 228 | } |
220 | } | 229 | } |
230 | + | ||
231 | + /** | ||
232 | + * 通过位置查询线路 | ||
233 | + * @return void | ||
234 | + * @throws \think\db\exception\DataNotFoundException | ||
235 | + * @throws \think\db\exception\ModelNotFoundException | ||
236 | + * @throws \think\exception\DbException | ||
237 | + */ | ||
238 | + public function selectroutebyname(){ | ||
239 | + $start_address=$this->request->param("start_address"); | ||
240 | + $end_address=$this->request->param("end_address"); | ||
241 | + $route=Db::name("route")->where("end_address",$end_address)->where("start_address",$start_address)->find(); | ||
242 | + return $this->success("请求成功",$route); | ||
243 | + } | ||
221 | /** | 244 | /** |
222 | * | 245 | * |
223 | * @return void | 246 | * @return void |
@@ -238,5 +261,4 @@ class Car extends Base | @@ -238,5 +261,4 @@ class Car extends Base | ||
238 | return $this->success($content); | 261 | return $this->success($content); |
239 | } | 262 | } |
240 | 263 | ||
241 | - | ||
242 | } | 264 | } |
-
请 注册 或 登录 后发表评论