添加获取去年险种按钮

dev
曾超新 5 years ago
parent 6fb323afa1
commit e068fccbb9
  1. 1
      frontend/config/params.php
  2. 29
      frontend/controllers/CarController.php
  3. 11
      frontend/views/car/order-add.php

@ -7,5 +7,6 @@ return [
'sms_url' => 'http://user.banmacar.com/api/sms/single-send', 'sms_url' => 'http://user.banmacar.com/api/sms/single-send',
'myinfo_url' => 'http://user.banmacar.com/api/user/myinfo', 'myinfo_url' => 'http://user.banmacar.com/api/user/myinfo',
'search_car_url' => 'http://user.banmacar.com/api/car/search-car', 'search_car_url' => 'http://user.banmacar.com/api/car/search-car',
'car_info_url' => 'http://user.banmacar.com/api/car/car-info'
], ],
]; ];

@ -530,6 +530,35 @@ class CarController extends BaseController
return MyLib::error3('车辆信息不存在'); return MyLib::error3('车辆信息不存在');
} }
public function actionBihuCarinfo()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$id = $request->get('id',0);
$car_info = CarT::findOne(['id'=>$id]);
if($car_info) {
$url = Yii::$app->params['userPanel']['search_car_url'];
$token = Yii::$app->params['userPanel']['token'];
$params = [
'token' => $token,
'LicenseNo' => $car_info->car_no,
'EngineNo' => $car_info->engine_no,
'CarVin' => $car_info->car_frame_no,
];
$client = new Client(['timeout'=> 120]);
$res = $client->request('POST', $url, [
'form_params' => $params,
'http_errors' => false,
]);
if($res->getStatusCode() == 200) {
$obj = json_decode($res->getBody());
return MyLib::ok3($obj->data);
}
return MyLib::error3($res->getBody());
}
return MyLib::error3('车辆信息不存在');
}
public function actionInfo() public function actionInfo()
{ {
$request = Yii::$app->request; $request = Yii::$app->request;

@ -128,6 +128,11 @@ use common\models\PriceT;
<div class="ibox float-e-margins"> <div class="ibox float-e-margins">
<div class="ibox-title"> <div class="ibox-title">
<h5>险种</h5> <h5>险种</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs" data-id="0" href="javascript:void(0);" onclick="getCarInfo();">
<i class="fa fa-gift"></i> 获取去年险种信息
</a>
</div>
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<table class="table table-bordered"> <table class="table table-bordered">
@ -339,6 +344,12 @@ use common\models\PriceT;
<script> <script>
var o = {}; var o = {};
var fanxian_rate = 0, max_fanxian = 0; var fanxian_rate = 0, max_fanxian = 0;
//获取险种信息
function getCarInfo() {
$.get('/car/bihu-carinfo?id=<?=$car_info->id?>',function(obj) {
console.log(obj);
}, 'json');
}
//获取策略 //获取策略
function getYingXiao() { function getYingXiao() {
var params = $('#orderFrm').serialize(); var params = $('#orderFrm').serialize();

Loading…
Cancel
Save