...
|
...
|
@@ -390,9 +390,23 @@ class Car extends Base |
|
|
*/
|
|
|
public function complete_order(){
|
|
|
$id=$this->request->param("id");
|
|
|
$order=Db::name("order_review")->where("id",$id)->find();
|
|
|
$order=Db::name("order")->where("id",$id)->find();
|
|
|
if($order['order_status']==3){
|
|
|
$order=Db::name("order")->where("id",$id)->update(['order_status'=>4]);
|
|
|
if($order){
|
|
|
//给司机加余额
|
|
|
$car=Db::name("car")->where("id",$order['car_id'])->find();
|
|
|
$user=Db::name("user")->where("id",$car['user_id'])->find();
|
|
|
$money=bcadd($user['money'],$order['price'],2);
|
|
|
$addmoney=Db::name("user")->where("id",$id)->update(['money'=>$money]);
|
|
|
$data=[
|
|
|
"money"=>$money,
|
|
|
"type"=>1,
|
|
|
"create_time"=>time(),
|
|
|
"user_id"=>$user['id'],
|
|
|
];
|
|
|
$addmoney_log=Db::name("money_log")->insert($data);
|
|
|
}
|
|
|
return $this->success("请求成功");
|
|
|
}else{
|
|
|
return $this->error("请求失败");
|
...
|
...
|
@@ -619,6 +633,7 @@ class Car extends Base |
|
|
$order=Db::name("order")
|
|
|
->where("create_time",">",$statr_time)
|
|
|
->where("create_time","<",$end_time)
|
|
|
->where('type',1)
|
|
|
->where('car_id',$car_id)
|
|
|
->field("seat_no")
|
|
|
->select();
|
...
|
...
|
@@ -637,4 +652,29 @@ class Car extends Base |
|
|
}
|
|
|
return $this->success("请求成功",$seat);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 支付信息
|
|
|
* @return void
|
|
|
*/
|
|
|
public function order_log(){
|
|
|
$page=$this->request->param("page");
|
|
|
$total=$this->request->param("total");
|
|
|
$res=Db::name("order_log")->where("user_id",$this->auth->id)
|
|
|
->page($page,$total)->select();
|
|
|
return $this->success("请求成功",$res);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 钱包金额
|
|
|
* @return void
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
* @throws \think\exception\DbException
|
|
|
*/
|
|
|
public function mywallet(){
|
|
|
$res=Db::name("user")->where("id",$this->auth->id)->field("money")->find();
|
|
|
return $this->success("请求成功",$res);
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|