Эх сурвалжийг харах

人社局加密接口对接

sandm 2 жил өмнө
parent
commit
d8d231ff29

+ 106 - 0
app/admin/api/RsApi.php

@@ -0,0 +1,106 @@
+<?php
+
+namespace app\admin\api;
+
+use OneSm\Sm4;
+
+class RsApi {
+
+    private $key;
+
+    private $iv;
+
+    private $clientId;
+
+    private $sjhjLog;
+
+    private $sm4;
+
+    public function __construct()
+    {
+        $this->key = 'b123d075924b4224';
+        $this->iv = '8a003e84b5be7b6e';
+        $this->clientId = 'jjrzzb';
+        $this->sjhjLog = [
+            'requestIpAddr' => '10.41.18.18',
+            'requestMacAddr' => '28:6e:d4:88:cb:98',
+            'requestReason' => '申报系统审核',
+            'operaterName' => '系统',
+            'operaterIdcard' => '系统'
+        ];
+        $this->sm4 = new Sm4($this->key);
+
+    }
+
+    protected function check(){
+        $deny_list = ["jjrcw.test", "jjrcw.test:8080","report.com","report.jinjianghc.com"]; //拒绝短信名单
+        if (in_array($_SERVER["HTTP_HOST"], $deny_list))
+            return false; //测试不请求数据
+    }
+
+    protected function getInfo($url,$data){
+        $encrypt_str = date("YmdHis",time()) . json_encode($data,JSON_UNESCAPED_UNICODE);
+        $encrypt_data = $this->sm4->enDataCbc($encrypt_str, $this->iv);
+        $res = $this->RsCurl('http://172.29.133.70:58080/service-proxy/proxy/'.$url,base64_encode($encrypt_data));
+        $decrypt_data = $this->sm4->deDataCbc(base64_decode($res), $this->iv);
+        $decrypt_data = mb_substr($decrypt_data, 14, strlen($decrypt_data), 'UTF-8');
+        return $decrypt_data;
+    }
+
+    private function RsCurl($url, $postFields){
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+                'Content-Type: application/json; charset=utf-8',   //json版本需要填写  Content-Type: application/json;
+                'clientId: jjrzzb',
+                'sysClientCache: false',
+                'serviceProxyCache: false',
+                'resultCache: false'
+            )
+        );
+        curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); //若果报错 name lookup timed out 报错时添加这一行代码
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($ch, CURLOPT_POST, 1);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
+        curl_setopt($ch, CURLOPT_TIMEOUT, 60);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
+        $ret = curl_exec($ch);
+        if (false == $ret) {
+            $result = curl_error($ch);
+        } else {
+            $rsp = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+            if (200 != $rsp) {
+                $result = "请求状态 " . $rsp . " " . curl_error($ch);
+            } else {
+                $result = $ret;
+            }
+        }
+        curl_close($ch);
+        return $result;
+    }
+
+    /**
+     * 根据身份证号码查询身份证信息
+     * @param $card
+     */
+    public function I010902($card){
+        $check_res = $this->check();
+        if(!$check_res) return ['code' => '403','message' => '测试环境'];
+        $param = [
+            'userIDCard' => '聚才网',
+            'queryCause' => '聚才网人员信息核查',
+            'reqIp' => '10.41.18.18',
+            'QQF_MAC' => '28:6e:d4:88:cb:98',
+            'userName' => '聚才网',
+            'approvePhone' => '18060002035',
+            'BHCR_SFZH' => $card,
+            'sjhjLog' => $this->sjhjLog
+        ];
+
+        $res = $this->getInfo('I010902',$param);
+
+        return json_decode($res,true);
+
+    }
+}

+ 6 - 0
app/admin/controller/Talent.php

@@ -19,6 +19,7 @@ use app\admin\model\Menu;
 use app\admin\model\SysRelation;
 use app\common\api\CompanyApi;
 use app\common\state\ProjectState;
+use app\admin\api\RsApi;
 
 /**
  * Description of Talent
@@ -32,6 +33,11 @@ class Talent extends AdminController {
         $params = $request->param();
         $id = $params["id"];
         $info = VerifyApi::getTalentInfoById($id, true);
+        $rsapi = new RsApi();
+        if($info['card_type'] == 1){
+            $info['rs']['I010902'] = $rsapi->I010902($info['card_number']);
+
+        }
         if (in_array($info["checkState"], [TalentState::BASE_VERIFY_FAIL, TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_REJECT, TalentState::BASE_REVERIFY_FAIL])) {
             return view("talentInfo_base_check", ["info" => $info]);
         } else {

+ 11 - 1
app/admin/view/talent/talentInfo_common_check.html

@@ -96,7 +96,17 @@
                                             <tr>
                                                 <td>
                                                     <div class="rowGroup">
-                                                        <label class="control-label spacing td-label"><span style="color: red">*</span>姓名</label>
+                                                        <label class="control-label spacing td-label"><span style="color: red">*</span>
+                                                            姓名
+                                                            {eq name="info.rs.I010902.code" value="403"}<i class="fa fa-times" style="color: red" data-msg="{$info.rs.I010902.message}"></i>{/eq}
+                                                            {eq name="info.rs.I010902.code" value="200"}
+                                                                {eq name="info.rs.I010902.data.list.0.NAME" value="info.name"}
+                                                                    <i class="fa fa-check" data-msg="信息正确"></i>
+                                                                {else /}
+                                                                    <i class="fa fa-times" style="color: red" data-msg="填写姓名与人社数据有误"></i>
+                                                                {/eq}
+                                                            {/eq}
+                                                            </label>
                                                         <input type="text" class="form-control" id="name" value="{$info.name}"/>
                                                     </div>
                                                 </td>

+ 5 - 0
public/static/modular/talentIdentify/talentInfo/talentInfo_common_check.js

@@ -841,6 +841,11 @@ $(function () {
         TalentInfoInfoDlg.initFileTable();
     }
 
+    $(".fa").bind("mouseover", function () {
+        var htm = $(this).data('msg');
+        $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
+    });
+
     /*var source = $("#source").val();
      var columns = 3;
      if (source == 1 || source == 2) {