Browse Source

测试深圳税务接口2

master
wanghongjun 1 year ago
parent
commit
cea385d16d
  1. 19
      app/controller/api/Test.php
  2. 13
      app/service/webService/ChinaTaxes.php

19
app/controller/api/Test.php

@ -11,15 +11,16 @@ class Test extends Base
public function index() public function index()
{ {
$FeeService = new ChinaTaxes(); try {
// try {
// $ChinaTaxes = new ChinaTaxes();
// $ChinaTaxes = new ChinaTaxes();
// $result = $ChinaTaxes->savingDetailedData();
// die; dump($result);
// } catch (\Exception $e) { die;
// dump($e);die; } catch (\Exception $e) {
// } dump($e);die;
}
} }
} }

13
app/service/webService/ChinaTaxes.php

@ -21,7 +21,7 @@ class ChinaTaxes
{ {
$this->apiUrl = env('taxes.api_url'); $this->apiUrl = env('taxes.api_url');
$this->reqId = env('taxes.req_id'); // 接入端交易请求唯一标识,长度 32 位,5 秒内不得重复,否则抛出异常:交易请求唯一标识重复。 $this->reqId = md5(time());//env('taxes.req_id'); // 接入端交易请求唯一标识,长度 32 位,5 秒内不得重复,否则抛出异常:交易请求唯一标识重复。
$this->channelId = env('taxes.channel_id'); // 接入渠道标识(ID) $this->channelId = env('taxes.channel_id'); // 接入渠道标识(ID)
$this->channelSecret = env('taxes.channel_secret'); // 平台为接入渠道统一分配的密码,只有身份验证接口需要 $this->channelSecret = env('taxes.channel_secret'); // 平台为接入渠道统一分配的密码,只有身份验证接口需要
@ -44,7 +44,7 @@ class ChinaTaxes
'channelSecret' => $this->channelSecret, // 平台为接入渠道统一分配的密码,只有身份验证接口需要 'channelSecret' => $this->channelSecret, // 平台为接入渠道统一分配的密码,只有身份验证接口需要
'timestamp' => time(), // unix 时间戳 'timestamp' => time(), // unix 时间戳
'data' => [ 'data' => [
'flag' => '499' 'flag' => '大工业区生活垃圾处理费征收及开票需要'
] // 身份验证数据,默认为空 ] // 身份验证数据,默认为空
]; ];
@ -69,14 +69,15 @@ class ChinaTaxes
protected function getParamData($sid, $body): array protected function getParamData($sid, $body): array
{ {
return [ return [
'reqId' => $this->reqId, 'reqId' => md5(time() . rand(0,9)),
'sid' => $sid, 'sid' => $sid,
'channelId' => $this->channelId, 'channelId' => $this->channelId,
'accessToken' => $this->accessToken, 'accessToken' => $this->accessToken,
'timestamp' => time(), 'timestamp' => time(),
'data' => [ 'data' => [
'bizXml' => $this->bizXml($body) 'flag' => '大工业区生活垃圾处理费征收及开票需要'
] ],
'bizXml' => $this->bizXml($body)
]; ];
} }
@ -106,7 +107,7 @@ class ChinaTaxes
$param = $this->getParamData('SSGZ_GZPT_SZQKL_WTDZDRJK', $body); $param = $this->getParamData('SSGZ_GZPT_SZQKL_WTDZDRJK', $body);
$result = $this->json_curl(json_encode($param)); return $this->json_curl(json_encode($param));
} }
/** /**

Loading…
Cancel
Save