| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 | <?phpnamespace app\admin\api;use OneSm\Sm4;class DataApi{    public $guid;    public function __construct()    {        $this->getGuid();    }    protected function getGuid(){        $options = [            'cache_wsdl'     => WSDL_CACHE_NONE,            'trace'          => 1,            'stream_context' => stream_context_create(                [                    'ssl' => [                        'verify_peer'       => false,                        'verify_peer_name'  => false,                        'allow_self_signed' => true                    ]                ]            )        ];        $redis = \app\common\Redis::instance(\think\facade\Config::get("cache.stores.redis.select"));        $guid= $redis->get("jjdata_guid");        if(!$guid || empty($guid)) {            $client = new \SoapClient("http://110.88.153.177:802/ConvergenceServiceBoot/webservice/Authentication?wsdl", $options);            $param = [                'userid' => 'jjswzzb_sbxt',                'password' => 'sbxt@2022'            ];            $rst = $client->loginByAccount($param);            $ret = json_decode($rst->return, true);            if($ret['code'] == '01'){                $this->guid = $ret['data'];                $redis->set("jjdata_guid",$this->guid,1700);            }else{                $this->guid = '';            }        }else{            $this->guid = $guid;        }    }    public function getClient($url){        $this->getGuid();        $options = [            'cache_wsdl'     => WSDL_CACHE_NONE,            'trace'          => 1,            'stream_context' => stream_context_create(                [                    'ssl' => [                        'verify_peer'       => false,                        'verify_peer_name'  => false,                        'allow_self_signed' => true                    ]                ]            )        ];        $client = new \SoapClient($url, $options);        return $client;    }    public function queryUnemploymentInsuranceByIdAndTime($card,$start,$end){        $client = $this->getClient("http://110.88.153.177:802/ConvergenceServiceBoot/webservice/InsuranceRecordSearch?wsdl");        $param = [            'guid' => $this->guid,            'requestid' => 'null_00001',            'id' => $card,            'startTime' => $start,            'endTime' => $end        ];        $rst = $client->queryUnemploymentInsuranceByIdAndTime($param);        $ret = json_decode($rst->return, true);        if($ret['code'] == '01'){            return $ret;        }else{            return false;        }    }    public function IDNumber($realname,$birthday){        $client = $this->getClient("http://110.88.153.177:802/ConvergenceServiceBoot/webservice/InsuranceRecordSearchs?wsdl");        $param = [            'guid' => $this->guid,            'requestid' => 'null_00001',            'aac003' => $realname,            'bac504' => $birthday        ];        $rst = $client->IDNumber($param);        $ret = json_decode($rst->return, true);        if($ret['code'] == '01'){            return $ret;        }else{            return false;        }    }    public function queryOldAgeSecurityInsuranceByIdAndTime($card,$start,$end){        $client = $this->getClient("http://110.88.153.177:802/ConvergenceServiceBoot/webservice/InsuranceRecordSearch?wsdl");        $param = [            'guid' => $this->guid,            'requestid' => 'null_00001',            'id' => $card,            'startTime' => $start,            'endTime' => $end        ];        $rst = $client->queryOldAgeSecurityInsuranceByIdAndTime($param);        $ret = json_decode($rst->return, true);        if($ret['code'] == '01'){            return $ret;        }else{            return false;        }    }    public function queryJfhbxxByYears($card,$name,$years){        $client = $this->getClient("http://110.88.153.177:802/ConvergenceServiceBoot/webservice/CityBrain?wsdl");        $param = [            'guid' => $this->guid,            'requestid' => 'null_00001',            'reason' => "测试",            'optIDCard' => "350582199006028550",            'optName' => "郑明炜",            'optIp' => get_client_ip(),            'optMac' => "00-D8-61-73-14-EC",            'IDCard' => $card,            'name' => $name,            'years' => $years        ];        $rst = $client->queryJfhbxxByYears($param);        $ret = json_decode($rst->return, true);        $ret = json_decode($ret, true);        if($ret['code'] == '01'){            return $ret;        }else{            return false;        }    }    public function untrustworthyPersonnel($card){        $client = $this->getClient("http://110.88.153.177:802/ConvergenceServiceBoot/webservice/CityBrain?wsdl");        $param = [            'guid' => $this->guid,            'requestid' => 'null_00001',            'reason' => "测试",            'optIDCard' => "350582199006028550",            'optName' => "郑明炜",            'optIp' => get_client_ip(),            'optMac' => "00-D8-61-73-14-EC",            'IDCard' => $card        ];        $rst = $client->untrustworthyPersonnel($param);        $ret = json_decode($rst->return, true);        $ret = json_decode($ret, true);        if($ret['code'] == '200'){            return $ret;        }else{            return false;        }    }}
 |