From 370bef515816998e3d7d773e2926299fc4f010c8 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 15 Nov 2019 10:31:11 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=B8=85=E9=99=A4CarController=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=ADinfo=E5=87=BD=E6=95=B0=E7=9A=84=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/controllers/CarController.php | 51 -------------------------- 1 file changed, 51 deletions(-) diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index 27af841..4143bb9 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -531,62 +531,11 @@ 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(); return $this->render('info',[ '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:[] ]); } /* From b7125c97edec88862fa96ec800b76b6ba63f919a Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 15 Nov 2019 10:32:59 +0800 Subject: [PATCH 2/8] test1 --- frontend/controllers/CarController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index 4143bb9..8a0091f 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -531,10 +531,14 @@ class CarController extends BaseController $order_info->link_phone = $car_info->phone; $order_info->save(); } + $linkMan_items = $car_info->getLinkmen() + ->orderBy('created_at desc') + ->all(); return $this->render('info',[ 'user_id' => $this->my->id, 'car_info' => $car_info, + 'link_men' => $linkMan_items, 'order_info' => $order_info, ]); } From 156178c5030113989db1ce08cc68783e83fd8178 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 15 Nov 2019 10:41:21 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=9C=A8=E8=AF=BB=E5=8F=96=E8=BD=A6?= =?UTF-8?q?=E8=BE=86=E8=AF=A6=E6=83=85=E6=97=B6=EF=BC=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=A3=81=E8=99=8E=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=BD=A6=E8=BE=86=E4=BF=A1=E6=81=AF=E5=92=8C?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E4=BF=9D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/config/params.php | 1 + frontend/controllers/CarController.php | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/frontend/config/params.php b/frontend/config/params.php index acf5d51..3df22ce 100644 --- a/frontend/config/params.php +++ b/frontend/config/params.php @@ -6,5 +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_car_url' => 'http://user.banmacar.com/api/car/search-car', ], ]; diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index 8a0091f..1971654 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -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; @@ -503,6 +504,27 @@ class CarController extends BaseController $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 + ]; + 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()); + } + } $order_info = $car_info->getOrders()->orderBy('id DESC')->one(); if(!$order_info) { $user_id = 0; From 33e2daf40debda1a1276ab881d52427f0ef82e44 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 15 Nov 2019 10:57:53 +0800 Subject: [PATCH 4/8] test1 --- frontend/controllers/CarController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index 1971654..f96e584 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -505,6 +505,7 @@ class CarController extends BaseController $car_info = CarT::findOne(['id'=>$id]); if($car_info) { + $star_time = time(); $url = Yii::$app->params['userPanel']['search_car_url']; $token = Yii::$app->params['userPanel']['token']; $params = [ @@ -524,6 +525,9 @@ class CarController extends BaseController if($res->getStatusCode() == 200) { $obj = json_decode($res->getBody()); } + $time = time() - $star_time; + var_dump($obj); + echo $time; } $order_info = $car_info->getOrders()->orderBy('id DESC')->one(); if(!$order_info) { From 5ee461f1c1d1c1a21eb41eb8e37fea4fcc942f8d Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 15 Nov 2019 10:59:26 +0800 Subject: [PATCH 5/8] test1 --- frontend/controllers/CarController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index f96e584..2015d3b 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -526,8 +526,8 @@ class CarController extends BaseController $obj = json_decode($res->getBody()); } $time = time() - $star_time; - var_dump($obj); - echo $time; +// var_dump($obj); +// echo $time; } $order_info = $car_info->getOrders()->orderBy('id DESC')->one(); if(!$order_info) { From 5f14c354e0bd3157044e15bd34925f7bd19d006e Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 15 Nov 2019 11:29:17 +0800 Subject: [PATCH 6/8] test2 --- frontend/controllers/CarController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index 2015d3b..4f6f100 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -505,6 +505,7 @@ class CarController extends BaseController $car_info = CarT::findOne(['id'=>$id]); if($car_info) { + /* $star_time = time(); $url = Yii::$app->params['userPanel']['search_car_url']; $token = Yii::$app->params['userPanel']['token']; @@ -525,6 +526,7 @@ class CarController extends BaseController if($res->getStatusCode() == 200) { $obj = json_decode($res->getBody()); } + */ $time = time() - $star_time; // var_dump($obj); // echo $time; From fd78bd75506a334087e3a3299c0c32fc8c9a9945 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 15 Nov 2019 11:37:19 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E8=B0=83=E8=AF=95=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E5=A3=81=E8=99=8E=E6=9F=A5=E8=AF=A2=E5=8E=86=E5=8F=B2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/controllers/CarController.php | 23 ++++++++++++++--------- frontend/views/car/info.php | 3 +++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index 4f6f100..7013226 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -497,16 +497,13 @@ class CarController extends BaseController return $result; } - - public function actionInfo() + 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) { - /* - $star_time = time(); $url = Yii::$app->params['userPanel']['search_car_url']; $token = Yii::$app->params['userPanel']['token']; $params = [ @@ -525,12 +522,20 @@ class CarController extends BaseController ]); if($res->getStatusCode() == 200) { $obj = json_decode($res->getBody()); + return MyLib::ok3($obj); } - */ - $time = time() - $star_time; -// var_dump($obj); -// echo $time; + return MyLib::error3($res->getBody()); } + return MyLib::error3('车辆信息不存在'); + } + + public function actionInfo() + { + $request = Yii::$app->request; + $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; diff --git a/frontend/views/car/info.php b/frontend/views/car/info.php index c1802d1..5542cb4 100644 --- a/frontend/views/car/info.php +++ b/frontend/views/car/info.php @@ -250,6 +250,9 @@ use \common\libs\MyLib; $(function() { search(); wsInit(); + $.get('/car/bihu-search?id=id?>',function(obj) { + console.log(obj); + }, 'json'); });