|
|
|
@ -67,6 +67,7 @@ use GuzzleHttp\Client; |
|
|
|
|
use Yii; |
|
|
|
|
use yii\data\Pagination; |
|
|
|
|
use yii\db\Exception; |
|
|
|
|
use yii\web\Request; |
|
|
|
|
use yii\web\Response; |
|
|
|
|
|
|
|
|
|
class CarController extends BaseController |
|
|
|
@ -565,6 +566,211 @@ class CarController extends BaseController |
|
|
|
|
return MyLib::error3('车辆信息不存在'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function actionPostPrecisePrice() |
|
|
|
|
{ |
|
|
|
|
Yii::$app->response->format = Response::FORMAT_JSON; |
|
|
|
|
$request = Yii::$app->request; |
|
|
|
|
$url = Yii::$app->params['userPanel']['post-precise-price']; |
|
|
|
|
$token = Yii::$app->params['userPanel']['token']; |
|
|
|
|
$types = $request->post('types'); |
|
|
|
|
$nopays = $request->post('nopays'); |
|
|
|
|
$params = [ |
|
|
|
|
'token' => $token, |
|
|
|
|
'LicenseNo' => $request->post('car_no'), |
|
|
|
|
'CarOwnersName' => $request->post('car_man'), |
|
|
|
|
'IdCard' => strtoupper($request->post('car_man_number')), |
|
|
|
|
'OwnerIdCardType' => $request->post('car_man_type'), // |
|
|
|
|
'QuoteGroup' => $request->post('company_id'), // |
|
|
|
|
'InsuredName' => $request->post('id_man'), |
|
|
|
|
'InsuredIdCard' => strtoupper($request->post('id_man_number')), |
|
|
|
|
'InsuredIdType' => $request->post('id_man_type'), // |
|
|
|
|
'HolderIdCard' => strtoupper($request->post('link_man_number')), |
|
|
|
|
'HolderName' => $request->post('link_man'), |
|
|
|
|
'HolderIdType' => $request->post('link_man_type'), // |
|
|
|
|
'CarUsedType' => $request->post('car_use_id'), |
|
|
|
|
'EngineNo' => strtoupper($request->post('engine_no')), |
|
|
|
|
'CarVin' => strtoupper($request->post('car_frame_no')), |
|
|
|
|
'RegisterDate' => $request->post('register_date'), |
|
|
|
|
'MoldName' => $request->post('factory_model'), |
|
|
|
|
'ForceTax' => 1, |
|
|
|
|
'BizTimeStamp' => $request->post('insurer1_begin_date'), |
|
|
|
|
'ForceTimeStamp' => $request->post('insurer2_begin_date'), |
|
|
|
|
'BoLi' => $types[6] == '否' ? 0 : $types[6] == '国产' ? 1 : 2, |
|
|
|
|
'BuJiMianCheSun' => isset($nopays[1])?1:0, |
|
|
|
|
'BuJiMianDaoQiang' => isset($nopays[3])?1:0, |
|
|
|
|
'BuJiMianSanZhe' => isset($nopays[2])?1:0, |
|
|
|
|
'BuJiMianChengKe' => isset($nopays[5])?1:0, |
|
|
|
|
'BuJiMianSiJi' => isset($nopays[4])?1:0, |
|
|
|
|
'BuJiMianHuaHen' => isset($nopays[7])?1:0, |
|
|
|
|
'BuJiMianSheShui' => isset($nopays[8])?1:0, |
|
|
|
|
'BuJiMianZiRan' => isset($nopays[9])?1:0, |
|
|
|
|
'SheShui' => $types[8]=='是'?1:0, |
|
|
|
|
'HuaHen' => $types[7], |
|
|
|
|
'SiJi' => $types[4], |
|
|
|
|
'ChengKe' => $types[5], |
|
|
|
|
'CheSun' => $types[1], |
|
|
|
|
'DaoQiang' => $types[3]=='是'?1:0, |
|
|
|
|
'SanZhe' => $types[2], |
|
|
|
|
'ZiRan' => $types[9]=='是'?1:0, |
|
|
|
|
'SeatCount' => $request->post('seats'), |
|
|
|
|
'HcSanFangTeYue' => $types[12]=='是'?1:0, |
|
|
|
|
'PurchasePrice' => $request->post('purchase_price'), |
|
|
|
|
'AutoMoldCode' => $request->post('auto_mold_code'), |
|
|
|
|
'VehicleYear' => $request->post('vehicle_year'), |
|
|
|
|
'AutoMoldCodeSource' => 3, |
|
|
|
|
]; |
|
|
|
|
if($params['OwnerIdCardType'] == '身份证') $params['OwnerIdCardType'] = 1; |
|
|
|
|
else $params['OwnerIdCardType'] = 9; |
|
|
|
|
if($params['InsuredIdType'] == '身份证') $params['InsuredIdType'] = 1; |
|
|
|
|
else $params['InsuredIdType'] = 9; |
|
|
|
|
if($params['HolderIdType'] == '身份证') $params['HolderIdType'] = 1; |
|
|
|
|
else $params['HolderIdType'] = 9; |
|
|
|
|
|
|
|
|
|
if($types[1] > 0 && $types[10] == '是' && $types[11] == '是') { |
|
|
|
|
$params['ForceTax'] = 1; |
|
|
|
|
} else if($types[10] == '是' && $types[11] == '是') { |
|
|
|
|
$params['ForceTax'] = 2; |
|
|
|
|
} else if($types[10] > 0) { |
|
|
|
|
$params['ForceTax'] = 0; |
|
|
|
|
} |
|
|
|
|
switch($types[7]) { |
|
|
|
|
case '2000元': |
|
|
|
|
$params['HuaHen'] = 2000; |
|
|
|
|
break; |
|
|
|
|
case '5000元': |
|
|
|
|
$params['HuaHen'] = 5000; |
|
|
|
|
break; |
|
|
|
|
case '10000元': |
|
|
|
|
$params['HuaHen'] = 10000; |
|
|
|
|
break; |
|
|
|
|
case '20000元': |
|
|
|
|
$params['HuaHen'] = 20000; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
$params['HuaHen'] = 0; |
|
|
|
|
} |
|
|
|
|
switch($types[4]) { |
|
|
|
|
case '1万': |
|
|
|
|
$params['SiJi'] = 10000; |
|
|
|
|
break; |
|
|
|
|
case '2万': |
|
|
|
|
$params['SiJi'] = 20000; |
|
|
|
|
break; |
|
|
|
|
case '3万': |
|
|
|
|
$params['SiJi'] = 30000; |
|
|
|
|
break; |
|
|
|
|
case '4万': |
|
|
|
|
$params['SiJi'] = 40000; |
|
|
|
|
break; |
|
|
|
|
case '5万': |
|
|
|
|
$params['SiJi'] = 50000; |
|
|
|
|
break; |
|
|
|
|
case '10万': |
|
|
|
|
$params['SiJi'] = 100000; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
$params['SiJi'] = 0; |
|
|
|
|
} |
|
|
|
|
switch($types[5]) { |
|
|
|
|
case '1万': |
|
|
|
|
$params['ChengKe'] = 10000; |
|
|
|
|
break; |
|
|
|
|
case '2万': |
|
|
|
|
$params['ChengKe'] = 20000; |
|
|
|
|
break; |
|
|
|
|
case '3万': |
|
|
|
|
$params['ChengKe'] = 30000; |
|
|
|
|
break; |
|
|
|
|
case '4万': |
|
|
|
|
$params['ChengKe'] = 40000; |
|
|
|
|
break; |
|
|
|
|
case '5万': |
|
|
|
|
$params['ChengKe'] = 50000; |
|
|
|
|
break; |
|
|
|
|
case '10万': |
|
|
|
|
$params['ChengKe'] = 100000; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
$params['ChengKe'] = 0; |
|
|
|
|
} |
|
|
|
|
switch($types[2]) { |
|
|
|
|
case '5万': |
|
|
|
|
$params['SanZhe'] = 50000; |
|
|
|
|
break; |
|
|
|
|
case '10万': |
|
|
|
|
$params['SanZhe'] = 100000; |
|
|
|
|
break; |
|
|
|
|
case '15万': |
|
|
|
|
$params['SanZhe'] = 150000; |
|
|
|
|
break; |
|
|
|
|
case '20万': |
|
|
|
|
$params['SanZhe'] = 200000; |
|
|
|
|
break; |
|
|
|
|
case '30万': |
|
|
|
|
$params['SanZhe'] = 300000; |
|
|
|
|
break; |
|
|
|
|
case '50万': |
|
|
|
|
$params['SanZhe'] = 500000; |
|
|
|
|
break; |
|
|
|
|
case '100万': |
|
|
|
|
$params['SanZhe'] = 1000000; |
|
|
|
|
break; |
|
|
|
|
case '150万': |
|
|
|
|
$params['SanZhe'] = 1500000; |
|
|
|
|
break; |
|
|
|
|
case '200万': |
|
|
|
|
$params['SanZhe'] = 2000000; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
$params['SanZhe'] = 0; |
|
|
|
|
} |
|
|
|
|
$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()); |
|
|
|
|
if($obj->data && $obj->data->UserInfo && $obj->data->UserInfo->CarUsedType != '') { |
|
|
|
|
$car_user_info = CarUseT::find()->where(['name'=>$obj->data->UserInfo->CarUsedType])->one(); |
|
|
|
|
if($car_user_info) { |
|
|
|
|
$obj->data->UserInfo->CarUsedType = $car_user_info->id; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return MyLib::ok3($obj->data); |
|
|
|
|
} |
|
|
|
|
return MyLib::error3($res->getBody()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function actionGetPrecisePrice() |
|
|
|
|
{ |
|
|
|
|
Yii::$app->response->format = Response::FORMAT_JSON; |
|
|
|
|
$request = Yii::$app->request; |
|
|
|
|
$url = Yii::$app->params['userPanel']['post-precise-price']; |
|
|
|
|
$token = Yii::$app->params['userPanel']['token']; |
|
|
|
|
$params = [ |
|
|
|
|
'token' => $token, |
|
|
|
|
'LicenseNo' => $request->post('car_no'), |
|
|
|
|
'QuoteGroup' => $request->post('company_id'), |
|
|
|
|
]; |
|
|
|
|
$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()); |
|
|
|
|
if($obj->data && $obj->data->UserInfo && $obj->data->UserInfo->CarUsedType != '') { |
|
|
|
|
$car_user_info = CarUseT::find()->where(['name'=>$obj->data->UserInfo->CarUsedType])->one(); |
|
|
|
|
if($car_user_info) { |
|
|
|
|
$obj->data->UserInfo->CarUsedType = $car_user_info->id; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return MyLib::ok3($obj->data); |
|
|
|
|
} |
|
|
|
|
return MyLib::error3($res->getBody()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function actionInfo() |
|
|
|
|
{ |
|
|
|
|
$request = Yii::$app->request; |
|
|
|
|