Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

175 Zeilen
4.7 KiB

  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: fuhc
  5. * Date: 2018-02-27
  6. * Time: 10:57
  7. */
  8. namespace backend\modules\api\controllers;
  9. use common\models\Utils;
  10. use backend\modules\api\logic\Sunshine;
  11. use yii\web\Controller;
  12. use Yii;
  13. //阳光保险
  14. class SunshineInsuranceController extends Controller
  15. {
  16. public $enableCsrfValidation = false;
  17. public $logic = null;
  18. /*
  19. * 支付类型 PAYTYPE
  20. * 易宝:YEEPAY
  21. * 快钱:BILL99PAY
  22. * 财付通:TENPAY
  23. * 建行:CCBPAY
  24. * 支付宝:ALIPAY
  25. * 广东银联:UNIONPAY
  26. * 微信:WEPAY
  27. * 上海银联:CHINAPAY
  28. * 网易宝:EPAY
  29. * */
  30. /*证件类型
  31. * 10: 身份证
  32. 11: 户口薄
  33. 12: 驾驶证
  34. 13: 军官证
  35. 14: 士兵证
  36. 17: 港澳通行证
  37. 18: 台湾通行证
  38. 99: 其他
  39. 51: 护照
  40. 61: 港台同胞证
  41. * */
  42. public function logic(){
  43. if ($this->logic == null) {
  44. $this->logic = new Sunshine();
  45. }
  46. return $this->logic;
  47. }
  48. private $sunshineConfig = null;
  49. private function sunshineConfig()
  50. {
  51. if ($this->sunshineConfig == null) {
  52. $this->sunshineConfig = \Yii::$app->params['sunshine_config'];
  53. }
  54. return $this->sunshineConfig;
  55. }
  56. public function actionIndex(){
  57. return '你好 阳光保险';
  58. }
  59. /**
  60. * Des:接口入口验证 入口指引
  61. * Name: beforeAction
  62. * @param \yii\base\Action $action
  63. * @return bool
  64. * @author fuhc
  65. */
  66. // public function beforeAction($action)
  67. // {
  68. //
  69. //
  70. // $actionName = ucfirst($action->id);
  71. //
  72. //
  73. //
  74. // return parent::beforeAction($action);
  75. // }
  76. /**
  77. * Des: 核保接口 (核对客户信息有效性)
  78. * @author fuhc
  79. */
  80. public function actionVerifyOrder()
  81. {
  82. $par = $this->getPar();
  83. $arr = $this->logic()->VerifyOrder($par);
  84. return json_encode($arr);
  85. }
  86. private function getPar(){
  87. $par=[];
  88. $par['start_date'] = Yii::$app->request->post('start_date', '');
  89. $par['end_date'] = Yii::$app->request->post('end_date', '');
  90. $par['start_time'] = Yii::$app->request->post('start_time', '');
  91. $par['passenger_cardid'] = Yii::$app->request->post('passenger_cardid', '');
  92. $par['passenger_name'] = Yii::$app->request->post('passenger_name', '');
  93. $par['contacts_name'] = Yii::$app->request->post('contacts_name', '');
  94. $par['contacts_phone'] = Yii::$app->request->post('contacts_phone', '');
  95. $par['policy_holder_name'] = Yii::$app->request->post('policy_holder_name', ''); //投保人姓名
  96. $par['policy_holder_cardid'] = Yii::$app->request->post('policy_holder_cardid', ''); //投保人身份证
  97. $par['order_id'] = Yii::$app->request->post('order_id', '');
  98. $par['prod_type'] = Yii::$app->request->post('prod_type', ''); //1乘客意外险 2旅行意外险
  99. return $par;
  100. }
  101. /**
  102. * Des: 承保接口 (接收承保信息进行出单处理)
  103. * @author fuhc
  104. */
  105. public function actionCreateOrder()
  106. {
  107. $par = $this->getPar();
  108. $arr = $this->logic()->CreateOrder($par);
  109. return json_encode($arr);
  110. }
  111. /**
  112. * Des: 退保接口
  113. * @author fuhc
  114. */
  115. public function actionCancelInsurance()
  116. {
  117. $params = [];
  118. $params['POLICYNO']=Yii::$app->request->post('policyno', '');
  119. $arr = $this->logic()->CancelOrder($params);
  120. return json_encode($arr);
  121. }
  122. /**
  123. * Des: 电子保单下载地址
  124. * @author fuhc
  125. */
  126. public function actionEInsuranceForm()
  127. {
  128. $params = [];
  129. $params['POLICYNO']=Yii::$app->request->post('policyno', '');
  130. $arr = $this->logic()->EInsuranceForm($params);
  131. return json_encode($arr);
  132. }
  133. public function actionTest(){
  134. // $r = [
  135. // 'response' => [
  136. // 'return'=>true,
  137. // 'INFO'=>'阳光保险接口返回'
  138. // ]
  139. // ];
  140. /* $return = '<?xml version="1.0" encoding="UTF-8"?>' . Util::arrayToXml($r);*/
  141. // \Yii::$app->response->format = 'xml';
  142. // \Yii::$app->response->content = $return;
  143. // return;
  144. //使用js ajax传入data能成功 周五测试
  145. $data = $_REQUEST;
  146. $AAA=Utils::httpRequest('http://cs1.yii.cn/api/submit-order?XDEBUG_SESSION_START=19189',$data);
  147. return json_encode($AAA);
  148. //下载保单测试
  149. // $data = $_REQUEST;
  150. // $data['policyno'] = 'JSHH1803141612450165';
  151. // $AAA=Utils::httpRequest('http://cs1.zhizhuchuxing.com/api/sunshine-insurance/e-insurance-form',$data);
  152. // return $AAA;
  153. }
  154. }