调试调用壁虎查询历史接口方式

dev
曾超新 5 years ago
parent 5f14c354e0
commit fd78bd7550
  1. 23
      frontend/controllers/CarController.php
  2. 3
      frontend/views/car/info.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;

@ -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