正在显示
1 个修改的文件
包含
86 行增加
和
5 行删除
| @@ -125,7 +125,6 @@ class Car extends Base | @@ -125,7 +125,6 @@ class Car extends Base | ||
| 125 | "order_status"=>1, | 125 | "order_status"=>1, |
| 126 | "createtime"=>time() | 126 | "createtime"=>time() |
| 127 | ]); | 127 | ]); |
| 128 | - | ||
| 129 | }else{ | 128 | }else{ |
| 130 | $order_review_id=$order_review['id']; | 129 | $order_review_id=$order_review['id']; |
| 131 | } | 130 | } |
| @@ -135,12 +134,9 @@ class Car extends Base | @@ -135,12 +134,9 @@ class Car extends Base | ||
| 135 | $seat_no_array = explode(",", $seat_no); | 134 | $seat_no_array = explode(",", $seat_no); |
| 136 | $seat=json_decode($seatres['seat'],true); | 135 | $seat=json_decode($seatres['seat'],true); |
| 137 | $newseat=[]; | 136 | $newseat=[]; |
| 138 | - | ||
| 139 | foreach ($seat as $k=>$v){ | 137 | foreach ($seat as $k=>$v){ |
| 140 | - | ||
| 141 | if( in_array($seat[$k]['seat_no'],$seat_no_array)){ | 138 | if( in_array($seat[$k]['seat_no'],$seat_no_array)){ |
| 142 | $newseat[$k]=$seat[$k]; | 139 | $newseat[$k]=$seat[$k]; |
| 143 | - | ||
| 144 | } | 140 | } |
| 145 | } | 141 | } |
| 146 | $price=0; | 142 | $price=0; |
| @@ -822,7 +818,7 @@ class Car extends Base | @@ -822,7 +818,7 @@ class Car extends Base | ||
| 822 | 818 | ||
| 823 | 819 | ||
| 824 | /** | 820 | /** |
| 825 | - * 创建订单 | 821 | + * 创建包车订单 |
| 826 | * @return void | 822 | * @return void |
| 827 | */ | 823 | */ |
| 828 | public function createcharterorder(){ | 824 | public function createcharterorder(){ |
| @@ -830,7 +826,92 @@ class Car extends Base | @@ -830,7 +826,92 @@ class Car extends Base | ||
| 830 | $number = $this->request->param("number");//乘车人数 | 826 | $number = $this->request->param("number");//乘车人数 |
| 831 | $reservation_time = $this->request->param("reservation_time");//预约时间 | 827 | $reservation_time = $this->request->param("reservation_time");//预约时间 |
| 832 | $phone = $this->request->param("phone");//联系电话 | 828 | $phone = $this->request->param("phone");//联系电话 |
| 829 | + $carmodel_id = $this->request->param("carmodel_id");//车型id | ||
| 830 | + $charter_num = $this->request->param("charter_num");//包车数量 | ||
| 831 | + $intended_driver_id = $this->request->param("intended_driver_id");//意向司机 | ||
| 832 | + $remarks = $this->request->param("remarks");//备注 | ||
| 833 | + $carmodel=Db::name("carmodel")->where("id",$carmodel_id)->find(); | ||
| 834 | + $price=bcmul($charter_num,$carmodel['price'],2); | ||
| 835 | + $data=[ | ||
| 836 | + "order_no"=>getOrderSn(), | ||
| 837 | + "price"=>$price, | ||
| 838 | + "reservation_time"=>$reservation_time, | ||
| 839 | + "is_pay"=>"2",//未支付 | ||
| 840 | + "route_id"=>$route_id, | ||
| 841 | + "user_id"=>$this->auth->id, | ||
| 842 | + "phone"=>$phone, | ||
| 843 | + "create_time"=>time(), | ||
| 844 | + "reservation_time"=>time(), | ||
| 845 | + "type"=>3, | ||
| 846 | + "number"=>$number, | ||
| 847 | + "remarks"=>$remarks, | ||
| 848 | + "intended_driver_id"=>$intended_driver_id, | ||
| 849 | + ]; | ||
| 850 | + $res=Db::name("order")->insertGetId($data); | ||
| 851 | + $userinfo = Db::name('user') | ||
| 852 | + ->where(['id' => $this->auth->id]) | ||
| 853 | + ->field('id,wx_xcx_openid') | ||
| 854 | + ->find(); | ||
| 855 | + $notifyURI = $this->doman . '/addons/epay/api/OrderPayNtf'; | ||
| 856 | + $params = [ | ||
| 857 | + 'amount' => $data['price'], | ||
| 858 | + 'orderid' => $data['order_no'], | ||
| 859 | + 'type' => 'wechat', | ||
| 860 | + 'notifyurl' => $notifyURI, | ||
| 861 | + 'method' => 'miniapp', | ||
| 862 | + 'openid' => $userinfo['wx_xcx_openid'], | ||
| 863 | + ]; | ||
| 864 | + $f = \addons\epay\library\Service::submitOrder($params); | ||
| 865 | + $this->success("请求成功"); | ||
| 866 | + | ||
| 867 | + | ||
| 868 | + } | ||
| 833 | 869 | ||
| 870 | + /** | ||
| 871 | + * 创建包车订单 | ||
| 872 | + * @return void | ||
| 873 | + */ | ||
| 874 | + public function createcharterorder(){ | ||
| 875 | + $route_id = $this->request->param("route_id");//线路 | ||
| 876 | + $number = $this->request->param("number");//乘车人数 | ||
| 877 | + $reservation_time = $this->request->param("reservation_time");//预约时间 | ||
| 878 | + $phone = $this->request->param("phone");//联系电话 | ||
| 879 | + $carmodel_id = $this->request->param("carmodel_id");//车型id | ||
| 880 | + $charter_num = $this->request->param("charter_num");//包车数量 | ||
| 881 | + $intended_driver_id = $this->request->param("intended_driver_id");//意向司机 | ||
| 882 | + $remarks = $this->request->param("remarks");//备注 | ||
| 883 | + $carmodel=Db::name("carmodel")->where("id",$carmodel_id)->find(); | ||
| 884 | + $price=bcmul($charter_num,$carmodel['price'],2); | ||
| 885 | + $data=[ | ||
| 886 | + "order_no"=>getOrderSn(), | ||
| 887 | + "price"=>$price, | ||
| 888 | + "reservation_time"=>$reservation_time, | ||
| 889 | + "is_pay"=>"2",//未支付 | ||
| 890 | + "route_id"=>$route_id, | ||
| 891 | + "user_id"=>$this->auth->id, | ||
| 892 | + "phone"=>$phone, | ||
| 893 | + "create_time"=>time(), | ||
| 894 | + "reservation_time"=>time(), | ||
| 895 | + "type"=>2, | ||
| 896 | + "number"=>$number, | ||
| 897 | + "remarks"=>$remarks, | ||
| 898 | + "intended_driver_id"=>$intended_driver_id, | ||
| 899 | + ]; | ||
| 900 | + $res=Db::name("order")->insertGetId($data); | ||
| 901 | + $userinfo = Db::name('user') | ||
| 902 | + ->where(['id' => $this->auth->id]) | ||
| 903 | + ->field('id,wx_xcx_openid') | ||
| 904 | + ->find(); | ||
| 905 | + $notifyURI = $this->doman . '/addons/epay/api/OrderPayNtf'; | ||
| 906 | + $params = [ | ||
| 907 | + 'amount' => $data['price'], | ||
| 908 | + 'orderid' => $data['order_no'], | ||
| 909 | + 'type' => 'wechat', | ||
| 910 | + 'notifyurl' => $notifyURI, | ||
| 911 | + 'method' => 'miniapp', | ||
| 912 | + 'openid' => $userinfo['wx_xcx_openid'], | ||
| 913 | + ]; | ||
| 914 | + $f = \addons\epay\library\Service::submitOrder($params); | ||
| 834 | $this->success("请求成功"); | 915 | $this->success("请求成功"); |
| 835 | 916 | ||
| 836 | 917 |
-
请 注册 或 登录 后发表评论