Merge branch 'dev' into wanfang

# Conflicts:
#	frontend/config/params.php
dev
曾超新 5 years ago
commit 6fb323afa1
  1. 2
      frontend/config/params.php
  2. 81
      frontend/controllers/CarController.php
  3. 3
      frontend/views/car/info.php

@ -6,6 +6,6 @@ return [
'phone_url' => 'http://user.banmacar.com/api/phone/op',
'sms_url' => 'http://user.banmacar.com/api/sms/single-send',
'myinfo_url' => 'http://user.banmacar.com/api/user/myinfo',
'search_url' => 'http://user.banmacar.com/api/car/search-car',
'search_car_url' => 'http://user.banmacar.com/api/car/search-car',
],
];

@ -63,6 +63,7 @@ use common\models\OrderAddress;
use common\models\InvalidNew;
use common\models\InvalidRenewal;
use common\models\ZhongjiGiftT;
use GuzzleHttp\Client;
use Yii;
use yii\data\Pagination;
use yii\db\Exception;
@ -496,6 +497,38 @@ class CarController extends BaseController
return $result;
}
public function actionBihuSearch()
{
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,
'RegisterDate' => $car_info->register_date,
];
if($car_info->car_man_number != '' && substr($car_info->car_man_number, -6) != '') {
$params['SixDigitsAfterIdCard'] = substr($car_info->car_man_number, -6);
}
$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);
}
return MyLib::error3($res->getBody());
}
return MyLib::error3('车辆信息不存在');
}
public function actionInfo()
{
@ -503,6 +536,7 @@ class CarController extends BaseController
$id = $request->get('id',0);
$car_info = CarT::findOne(['id'=>$id]);
$order_info = $car_info->getOrders()->orderBy('id DESC')->one();
if(!$order_info) {
$user_id = 0;
@ -531,35 +565,6 @@ class CarController extends BaseController
$order_info->link_phone = $car_info->phone;
$order_info->save();
}
$insurer_type_items = InsurerTypeT::find()->all();
$insurer_company_items = InsurerCompanyT::find()->all();
$insurer_company2_items = InsurerCompany2T::find()->all();
$pay_type_items = PayTypeT::find()->all();
$car_use_items = CarUseT::find()->all();
$direction_items = DirectionT::find()
->all();
$range_items = RangeT::find()
->all();
$city_items = CityT::find()
->all();
$district_items = DistrictT::find()
->orderBy('order_id ASC')
->all();
$gift_items = GiftT::find()
->where('type_id=1')
->all();
$success_items = InvalidT::getTree(1);
$failure_items = InvalidT::getTreeXinbaoNew(2);
$list = MeetT::getAllData(1);
$order_ad=OrderAddress::findOne(['id'=>$order_info->addr_id]);
$province = Region::find()->asArray()->where(['parent_id'=>0])->andWhere(['level'=>1])->all();
$c=[];
$d=[];
$e=[];
$linkMan_items = $car_info->getLinkmen()
->orderBy('created_at desc')
->all();
@ -568,25 +573,7 @@ class CarController extends BaseController
'user_id' => $this->my->id,
'car_info' => $car_info,
'link_men' => $linkMan_items,
'insurer_type_items' => $insurer_type_items,
'order_info' => $order_info,
'insurer_company_items' => $insurer_company_items,
'insurer_company2_items' => $insurer_company2_items,
'list' => $list,
'pay_type_items' => $pay_type_items,
'car_use_items' => $car_use_items,
'direction_items' => $direction_items,
'range_items' => $range_items,
'city_items' => $city_items,
'district_items' => $district_items,
'gift_items' => $gift_items,
'success_items' => $success_items,
'failure_items' => $failure_items,
'province' => $province,
'city' =>$c,
'district' =>$d,
'twon' =>isset($e)?$e:[],
'order_ad' =>isset($order_ad)?$order_ad:[]
]);
}
/*

@ -250,6 +250,9 @@ use \common\libs\MyLib;
$(function() {
search();
wsInit();
$.get('/car/bihu-search?id=<?=$car_info->id?>',function(obj) {
console.log(obj);
}, 'json');
});
</script>
<script>

Loading…
Cancel
Save