1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- namespace 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 InsuranceRecordSearch($card,$start,$end){
- $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("http://110.88.153.177:802/ConvergenceServiceBoot/webservice/InsuranceRecordSearch?wsdl", $options);
- $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'){
- dd($ret);
- }else{
- $this->guid = '';
- }
- }
- }
|