作者 魏强

渲染更新

... ... @@ -9,6 +9,7 @@
namespace app\portal\controller;
use app\portal\model\OrderModel;
use app\portal\model\OrderSonModel;
use cmf\controller\HomeBaseController;
use EasyWeChat\Foundation\Application;
use think\Db;
... ... @@ -44,6 +45,7 @@ class OrderController extends CommentController
$rent = Db::name('Vehicle')->where($where)->find();
// 加入订单主表数据
$add['order_sn'] = $this->getSn();
$add['order_type'] = 1;
$add['user_id'] = Session::get('uid');
$add['start_time'] = Session::get('start_time');
$add['end_time'] = Session::get('end_time');
... ... @@ -56,19 +58,25 @@ class OrderController extends CommentController
$add['status'] = 2;
$res = $model->save($add);
if($res){
echo "<pre/>";
print_r($res->id);
die;
$add_son['order_id'] = $res->id;
$add['rent_money'] = $rent['rend_money'];
$add['money'] = $rent['money'];
$add['all_price'] = $rent['money'] + $rent['rend_money'];
// 增加子表数据
$add_son['order_id'] = $model->getLastInsID();
$add_son['vehicle_id'] = $rent['id'];
$add_son['rent_money'] = $rent['rend_money'];
$add_son['money'] = $rent['money'];
$add_son['all_price'] = $rent['money'] + $rent['rend_money'];
$add_son['number'] = 1;
$add_son['status'] = 2;
$model_son = new OrderSonModel();
$son_res = $model_son->save($add_son);
if($son_res){
Db::commit();
// 跳转支付
echo "<pre/>";
print_r('123');
die;
}else{
Db::rollback();
$this->apiResponse('0','订单创建失败');
}
}else{
Db::rollback();
$this->apiResponse('0','订单创建失败');
... ...