diff --git a/app/controller/api/Test.php b/app/controller/api/Test.php index 168d0d4..36cc387 100644 --- a/app/controller/api/Test.php +++ b/app/controller/api/Test.php @@ -11,15 +11,16 @@ class Test extends Base public function index() { - $FeeService = new ChinaTaxes(); -// try { -// -// $ChinaTaxes = new ChinaTaxes(); -// -// die; -// } catch (\Exception $e) { -// dump($e);die; -// } + try { + + $ChinaTaxes = new ChinaTaxes(); + + $result = $ChinaTaxes->savingDetailedData(); + dump($result); + die; + } catch (\Exception $e) { + dump($e);die; + } } } diff --git a/app/service/webService/ChinaTaxes.php b/app/service/webService/ChinaTaxes.php index b4e3edb..87f6834 100644 --- a/app/service/webService/ChinaTaxes.php +++ b/app/service/webService/ChinaTaxes.php @@ -21,7 +21,7 @@ class ChinaTaxes { $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->channelSecret = env('taxes.channel_secret'); // 平台为接入渠道统一分配的密码,只有身份验证接口需要 @@ -44,7 +44,7 @@ class ChinaTaxes 'channelSecret' => $this->channelSecret, // 平台为接入渠道统一分配的密码,只有身份验证接口需要 'timestamp' => time(), // unix 时间戳 'data' => [ - 'flag' => '499' + 'flag' => '大工业区生活垃圾处理费征收及开票需要' ] // 身份验证数据,默认为空 ]; @@ -69,14 +69,15 @@ class ChinaTaxes protected function getParamData($sid, $body): array { return [ - 'reqId' => $this->reqId, + 'reqId' => md5(time() . rand(0,9)), 'sid' => $sid, 'channelId' => $this->channelId, 'accessToken' => $this->accessToken, 'timestamp' => time(), 'data' => [ - 'bizXml' => $this->bizXml($body) - ] + 'flag' => '大工业区生活垃圾处理费征收及开票需要' + ], + 'bizXml' => $this->bizXml($body) ]; } @@ -106,7 +107,7 @@ class ChinaTaxes $param = $this->getParamData('SSGZ_GZPT_SZQKL_WTDZDRJK', $body); - $result = $this->json_curl(json_encode($param)); + return $this->json_curl(json_encode($param)); } /**