正在显示
1 个修改的文件
包含
57 行增加
和
3 行删除
| @@ -293,15 +293,69 @@ class Car extends Base | @@ -293,15 +293,69 @@ class Car extends Base | ||
| 293 | $route=Db::name("route")->where("end_address",$end_address)->where("start_address",$start_address)->find(); | 293 | $route=Db::name("route")->where("end_address",$end_address)->where("start_address",$start_address)->find(); |
| 294 | return $this->success("请求成功",$route); | 294 | return $this->success("请求成功",$route); |
| 295 | } | 295 | } |
| 296 | + | ||
| 297 | + /** | ||
| 298 | + * 开始接送 | ||
| 299 | + * @return void | ||
| 300 | + */ | ||
| 301 | + public function connect_order(){ | ||
| 302 | + $id=$this->request->param("id"); | ||
| 303 | + $order=Db::name("order")->where("id",$id)->find(); | ||
| 304 | + if($order['order_status']==1){ | ||
| 305 | + $order=Db::name("order")->where("id",$id)->update(['order_status'=>2]); | ||
| 306 | + return $this->success("请求成功"); | ||
| 307 | + }else{ | ||
| 308 | + return $this->error("请求失败"); | ||
| 309 | + } | ||
| 310 | + } | ||
| 296 | /** | 311 | /** |
| 297 | - * | 312 | + * 订单进行 |
| 313 | + * @return void | ||
| 314 | + */ | ||
| 315 | + public function have_order(){ | ||
| 316 | + $id=$this->request->param("id"); | ||
| 317 | + $order=Db::name("order")->where("id",$id)->find(); | ||
| 318 | + if($order['order_status']==2){ | ||
| 319 | + $order=Db::name("order")->where("id",$id)->update(['order_status'=>3]); | ||
| 320 | + return $this->success("请求成功"); | ||
| 321 | + }else{ | ||
| 322 | + return $this->error("请求失败"); | ||
| 323 | + } | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + /** | ||
| 327 | + * 订单完成 | ||
| 328 | + * @return void | ||
| 329 | + */ | ||
| 330 | + public function complete_order(){ | ||
| 331 | + $id=$this->request->param("id"); | ||
| 332 | + $order=Db::name("order")->where("id",$id)->find(); | ||
| 333 | + if($order['order_status']==3){ | ||
| 334 | + $order=Db::name("order")->where("id",$id)->update(['order_status'=>4]); | ||
| 335 | + return $this->success("请求成功"); | ||
| 336 | + }else{ | ||
| 337 | + return $this->error("请求失败"); | ||
| 338 | + } | ||
| 339 | + } | ||
| 340 | + /** | ||
| 341 | + *司机查询订单 | ||
| 298 | * @return void | 342 | * @return void |
| 299 | */ | 343 | */ |
| 300 | public function selectbydriver(){ | 344 | public function selectbydriver(){ |
| 301 | - //$driver | 345 | + $order_status=$this->request->param("order_status"); //接送状态:1=未开始,2=接送中,3=进行中,4=已完成 |
| 346 | + $page=$this->request->param("page"); | ||
| 347 | + $total=$this->request->param("total"); | ||
| 348 | + $driver=Db::name("driver")->where("user_id",$this->auth->id)->find(); | ||
| 349 | + | ||
| 302 | $res=Db::name("order") | 350 | $res=Db::name("order") |
| 303 | - ->where("user_id",$this->auth->id) | 351 | + ->where("driver_id",$driver["id"]) |
| 352 | + ->limit($page,$total) | ||
| 304 | ->select(); | 353 | ->select(); |
| 354 | + $amount=Db::name("order") | ||
| 355 | + ->where("driver_id",$driver["id"]) | ||
| 356 | + ->count(); | ||
| 357 | + $data=["data"=>$res,"amount"=>$amount]; | ||
| 358 | + return $this->success("请求成功",$data); | ||
| 305 | } | 359 | } |
| 306 | 360 | ||
| 307 | /** | 361 | /** |
-
请 注册 或 登录 后发表评论