正在显示
1 个修改的文件
包含
41 行增加
和
1 行删除
@@ -390,9 +390,23 @@ class Car extends Base | @@ -390,9 +390,23 @@ class Car extends Base | ||
390 | */ | 390 | */ |
391 | public function complete_order(){ | 391 | public function complete_order(){ |
392 | $id=$this->request->param("id"); | 392 | $id=$this->request->param("id"); |
393 | - $order=Db::name("order_review")->where("id",$id)->find(); | 393 | + $order=Db::name("order")->where("id",$id)->find(); |
394 | if($order['order_status']==3){ | 394 | if($order['order_status']==3){ |
395 | $order=Db::name("order")->where("id",$id)->update(['order_status'=>4]); | 395 | $order=Db::name("order")->where("id",$id)->update(['order_status'=>4]); |
396 | + if($order){ | ||
397 | + //给司机加余额 | ||
398 | + $car=Db::name("car")->where("id",$order['car_id'])->find(); | ||
399 | + $user=Db::name("user")->where("id",$car['user_id'])->find(); | ||
400 | + $money=bcadd($user['money'],$order['price'],2); | ||
401 | + $addmoney=Db::name("user")->where("id",$id)->update(['money'=>$money]); | ||
402 | + $data=[ | ||
403 | + "money"=>$money, | ||
404 | + "type"=>1, | ||
405 | + "create_time"=>time(), | ||
406 | + "user_id"=>$user['id'], | ||
407 | + ]; | ||
408 | + $addmoney_log=Db::name("money_log")->insert($data); | ||
409 | + } | ||
396 | return $this->success("请求成功"); | 410 | return $this->success("请求成功"); |
397 | }else{ | 411 | }else{ |
398 | return $this->error("请求失败"); | 412 | return $this->error("请求失败"); |
@@ -619,6 +633,7 @@ class Car extends Base | @@ -619,6 +633,7 @@ class Car extends Base | ||
619 | $order=Db::name("order") | 633 | $order=Db::name("order") |
620 | ->where("create_time",">",$statr_time) | 634 | ->where("create_time",">",$statr_time) |
621 | ->where("create_time","<",$end_time) | 635 | ->where("create_time","<",$end_time) |
636 | + ->where('type',1) | ||
622 | ->where('car_id',$car_id) | 637 | ->where('car_id',$car_id) |
623 | ->field("seat_no") | 638 | ->field("seat_no") |
624 | ->select(); | 639 | ->select(); |
@@ -637,4 +652,29 @@ class Car extends Base | @@ -637,4 +652,29 @@ class Car extends Base | ||
637 | } | 652 | } |
638 | return $this->success("请求成功",$seat); | 653 | return $this->success("请求成功",$seat); |
639 | } | 654 | } |
655 | + | ||
656 | + /** | ||
657 | + * 支付信息 | ||
658 | + * @return void | ||
659 | + */ | ||
660 | + public function order_log(){ | ||
661 | + $page=$this->request->param("page"); | ||
662 | + $total=$this->request->param("total"); | ||
663 | + $res=Db::name("order_log")->where("user_id",$this->auth->id) | ||
664 | + ->page($page,$total)->select(); | ||
665 | + return $this->success("请求成功",$res); | ||
666 | + } | ||
667 | + | ||
668 | + | ||
669 | + /** | ||
670 | + * 钱包金额 | ||
671 | + * @return void | ||
672 | + * @throws \think\db\exception\DataNotFoundException | ||
673 | + * @throws \think\db\exception\ModelNotFoundException | ||
674 | + * @throws \think\exception\DbException | ||
675 | + */ | ||
676 | + public function mywallet(){ | ||
677 | + $res=Db::name("user")->where("id",$this->auth->id)->field("money")->find(); | ||
678 | + return $this->success("请求成功",$res); | ||
679 | + } | ||
640 | } | 680 | } |
-
请 注册 或 登录 后发表评论