|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <?php
- /**
- * Created by PhpStorm.
- * User: fuhc
- * Date: 2018-02-27
- * Time: 10:57
- */
-
- namespace backend\modules\api\controllers;
-
- use common\models\Utils;
- use backend\modules\api\logic\Sunshine;
- use yii\web\Controller;
- use Yii;
- //阳光保险
- class SunshineInsuranceController extends Controller
- {
- public $enableCsrfValidation = false;
-
- public $logic = null;
-
- /*
- * 支付类型 PAYTYPE
- * 易宝:YEEPAY
- * 快钱:BILL99PAY
- * 财付通:TENPAY
- * 建行:CCBPAY
- * 支付宝:ALIPAY
- * 广东银联:UNIONPAY
- * 微信:WEPAY
- * 上海银联:CHINAPAY
- * 网易宝:EPAY
- * */
-
- /*证件类型
- * 10: 身份证
- 11: 户口薄
- 12: 驾驶证
- 13: 军官证
- 14: 士兵证
- 17: 港澳通行证
- 18: 台湾通行证
- 99: 其他
- 51: 护照
- 61: 港台同胞证
- * */
-
- public function logic(){
- if ($this->logic == null) {
- $this->logic = new Sunshine();
- }
- return $this->logic;
- }
- private $sunshineConfig = null;
-
- private function sunshineConfig()
- {
- if ($this->sunshineConfig == null) {
- $this->sunshineConfig = \Yii::$app->params['sunshine_config'];
- }
- return $this->sunshineConfig;
- }
-
-
- public function actionIndex(){
- return '你好 阳光保险';
- }
- /**
- * Des:接口入口验证 入口指引
- * Name: beforeAction
- * @param \yii\base\Action $action
- * @return bool
- * @author fuhc
- */
- // public function beforeAction($action)
- // {
- //
- //
- // $actionName = ucfirst($action->id);
- //
- //
- //
- // return parent::beforeAction($action);
- // }
-
-
- /**
- * Des: 核保接口 (核对客户信息有效性)
- * @author fuhc
- */
- public function actionVerifyOrder()
- {
- $par = $this->getPar();
- $arr = $this->logic()->VerifyOrder($par);
- return json_encode($arr);
- }
- private function getPar(){
- $par=[];
- $par['start_date'] = Yii::$app->request->post('start_date', '');
- $par['end_date'] = Yii::$app->request->post('end_date', '');
- $par['start_time'] = Yii::$app->request->post('start_time', '');
- $par['passenger_cardid'] = Yii::$app->request->post('passenger_cardid', '');
- $par['passenger_name'] = Yii::$app->request->post('passenger_name', '');
- $par['contacts_name'] = Yii::$app->request->post('contacts_name', '');
- $par['contacts_phone'] = Yii::$app->request->post('contacts_phone', '');
- $par['policy_holder_name'] = Yii::$app->request->post('policy_holder_name', ''); //投保人姓名
- $par['policy_holder_cardid'] = Yii::$app->request->post('policy_holder_cardid', ''); //投保人身份证
- $par['order_id'] = Yii::$app->request->post('order_id', '');
- $par['prod_type'] = Yii::$app->request->post('prod_type', ''); //1乘客意外险 2旅行意外险
- return $par;
- }
-
- /**
- * Des: 承保接口 (接收承保信息进行出单处理)
- * @author fuhc
- */
- public function actionCreateOrder()
- {
- $par = $this->getPar();
- $arr = $this->logic()->CreateOrder($par);
- return json_encode($arr);
- }
-
- /**
- * Des: 退保接口
- * @author fuhc
- */
- public function actionCancelInsurance()
- {
- $params = [];
- $params['POLICYNO']=Yii::$app->request->post('policyno', '');
- $arr = $this->logic()->CancelOrder($params);
- return json_encode($arr);
- }
- /**
- * Des: 电子保单下载地址
- * @author fuhc
- */
- public function actionEInsuranceForm()
- {
- $params = [];
- $params['POLICYNO']=Yii::$app->request->post('policyno', '');
- $arr = $this->logic()->EInsuranceForm($params);
- return json_encode($arr);
- }
-
- public function actionTest(){
-
- // $r = [
- // 'response' => [
- // 'return'=>true,
- // 'INFO'=>'阳光保险接口返回'
- // ]
- // ];
- /* $return = '<?xml version="1.0" encoding="UTF-8"?>' . Util::arrayToXml($r);*/
- // \Yii::$app->response->format = 'xml';
- // \Yii::$app->response->content = $return;
- // return;
- //使用js ajax传入data能成功 周五测试
- $data = $_REQUEST;
- $AAA=Utils::httpRequest('http://cs1.yii.cn/api/submit-order?XDEBUG_SESSION_START=19189',$data);
- return json_encode($AAA);
-
- //下载保单测试
- // $data = $_REQUEST;
- // $data['policyno'] = 'JSHH1803141612450165';
- // $AAA=Utils::httpRequest('http://cs1.zhizhuchuxing.com/api/sunshine-insurance/e-insurance-form',$data);
- // return $AAA;
-
-
- }
-
-
-
- }
|