...
|
...
|
@@ -293,15 +293,69 @@ class Car extends Base |
|
|
$route=Db::name("route")->where("end_address",$end_address)->where("start_address",$start_address)->find();
|
|
|
return $this->success("请求成功",$route);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 开始接送
|
|
|
* @return void
|
|
|
*/
|
|
|
public function connect_order(){
|
|
|
$id=$this->request->param("id");
|
|
|
$order=Db::name("order")->where("id",$id)->find();
|
|
|
if($order['order_status']==1){
|
|
|
$order=Db::name("order")->where("id",$id)->update(['order_status'=>2]);
|
|
|
return $this->success("请求成功");
|
|
|
}else{
|
|
|
return $this->error("请求失败");
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
*
|
|
|
* 订单进行
|
|
|
* @return void
|
|
|
*/
|
|
|
public function have_order(){
|
|
|
$id=$this->request->param("id");
|
|
|
$order=Db::name("order")->where("id",$id)->find();
|
|
|
if($order['order_status']==2){
|
|
|
$order=Db::name("order")->where("id",$id)->update(['order_status'=>3]);
|
|
|
return $this->success("请求成功");
|
|
|
}else{
|
|
|
return $this->error("请求失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 订单完成
|
|
|
* @return void
|
|
|
*/
|
|
|
public function complete_order(){
|
|
|
$id=$this->request->param("id");
|
|
|
$order=Db::name("order")->where("id",$id)->find();
|
|
|
if($order['order_status']==3){
|
|
|
$order=Db::name("order")->where("id",$id)->update(['order_status'=>4]);
|
|
|
return $this->success("请求成功");
|
|
|
}else{
|
|
|
return $this->error("请求失败");
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
*司机查询订单
|
|
|
* @return void
|
|
|
*/
|
|
|
public function selectbydriver(){
|
|
|
//$driver
|
|
|
$order_status=$this->request->param("order_status"); //接送状态:1=未开始,2=接送中,3=进行中,4=已完成
|
|
|
$page=$this->request->param("page");
|
|
|
$total=$this->request->param("total");
|
|
|
$driver=Db::name("driver")->where("user_id",$this->auth->id)->find();
|
|
|
|
|
|
$res=Db::name("order")
|
|
|
->where("user_id",$this->auth->id)
|
|
|
->where("driver_id",$driver["id"])
|
|
|
->limit($page,$total)
|
|
|
->select();
|
|
|
$amount=Db::name("order")
|
|
|
->where("driver_id",$driver["id"])
|
|
|
->count();
|
|
|
$data=["data"=>$res,"amount"=>$amount];
|
|
|
return $this->success("请求成功",$data);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|