作者 竞泽

alter:调整

  1 +/vendor/
@@ -6,5 +6,8 @@ return [ @@ -6,5 +6,8 @@ return [
6 'secret_key' => '12345678', 6 'secret_key' => '12345678',
7 'company_cert_sn' => '20200000000652', 7 'company_cert_sn' => '20200000000652',
8 'sender_sn' => 'GEYOUSUOAI', 8 'sender_sn' => 'GEYOUSUOAI',
9 - 'receiver_sn' => 'KJPUBLICPT' 9 + 'receiver_sn' => 'KJPUBLICPT',
  10 + 'client' => [
  11 + 'timeout' => 30
  12 + ]
10 ]; 13 ];
@@ -4,7 +4,6 @@ @@ -4,7 +4,6 @@
4 namespace Lackoxygen\GzCbec\Request; 4 namespace Lackoxygen\GzCbec\Request;
5 5
6 use Lackoxygen\GzCbec\Contract\XMLInterface; 6 use Lackoxygen\GzCbec\Contract\XMLInterface;
7 -use Lackoxygen\GzCbec\Utils\Collection;  
8 7
9 class CEBRequest extends Request implements XMLInterface 8 class CEBRequest extends Request implements XMLInterface
10 { 9 {
@@ -64,7 +64,6 @@ class Packet @@ -64,7 +64,6 @@ class Packet
64 $xmlHead = sprintf(XML::DATA, $firstLabel, $this->request->getGuid(), $this->request->getVersion(), 64 $xmlHead = sprintf(XML::DATA, $firstLabel, $this->request->getGuid(), $this->request->getVersion(),
65 $firstLabel); 65 $firstLabel);
66 $dataXml = $this->request->toXML($xmlHead); 66 $dataXml = $this->request->toXML($xmlHead);
67 - file_put_contents('test.xml', $dataXml);  
68 $data = base64_encode($dataXml); 67 $data = base64_encode($dataXml);
69 $packet->setData($data); 68 $packet->setData($data);
70 } 69 }
@@ -77,7 +76,7 @@ class Packet @@ -77,7 +76,7 @@ class Packet
77 } 76 }
78 77
79 /** 78 /**
80 - * @param $signXml 79 + * @param string $signXml
81 * 80 *
82 * @return string 81 * @return string
83 */ 82 */
@@ -3,8 +3,6 @@ @@ -3,8 +3,6 @@
3 3
4 namespace Lackoxygen\GzCbec\Request\Report; 4 namespace Lackoxygen\GzCbec\Request\Report;
5 5
6 -use Lackoxygen\GzCbec\Contract\RequestInterface;  
7 -use Lackoxygen\GzCbec\Contract\XMLInterface;  
8 use Lackoxygen\GzCbec\Request\CEBRequest; 6 use Lackoxygen\GzCbec\Request\CEBRequest;
9 use Lackoxygen\GzCbec\Request\Report\Node\BaseTransfer; 7 use Lackoxygen\GzCbec\Request\Report\Node\BaseTransfer;
10 use Lackoxygen\GzCbec\Request\Report\Node\Order; 8 use Lackoxygen\GzCbec\Request\Report\Node\Order;
@@ -39,7 +39,6 @@ abstract class Request extends Collection implements RequestInterface @@ -39,7 +39,6 @@ abstract class Request extends Collection implements RequestInterface
39 return \Str::uuid(); 39 return \Str::uuid();
40 } 40 }
41 41
42 -  
43 /** 42 /**
44 * @return Packet 43 * @return Packet
45 */ 44 */
@@ -29,15 +29,15 @@ trait XML @@ -29,15 +29,15 @@ trait XML
29 * @param \SimpleXMLElement $xmlObj 29 * @param \SimpleXMLElement $xmlObj
30 * @param $key 30 * @param $key
31 * @param null $value 31 * @param null $value
  32 + *
  33 + * @return \SimpleXMLElement
32 */ 34 */
33 protected function appendChildToXMl(\SimpleXMLElement $xmlObj, $key, $value = null): \SimpleXMLElement 35 protected function appendChildToXMl(\SimpleXMLElement $xmlObj, $key, $value = null): \SimpleXMLElement
34 { 36 {
35 if ($this instanceof XMLInterface) { 37 if ($this instanceof XMLInterface) {
36 $key = $this->getFirstLabelPrefix() . ':' . $key; 38 $key = $this->getFirstLabelPrefix() . ':' . $key;
37 } 39 }
38 - if (is_null($value)) {  
39 - //$xmlObj->addChild($key);  
40 - } else { 40 + if (!is_null($value)) {
41 $xmlObj->addChild($key, $value); 41 $xmlObj->addChild($key, $value);
42 } 42 }
43 43
@@ -15,6 +15,9 @@ class Signature @@ -15,6 +15,9 @@ class Signature
15 */ 15 */
16 protected $uri; 16 protected $uri;
17 17
  18 + /**
  19 + * @var Client
  20 + */
18 protected $client; 21 protected $client;
19 22
20 /** 23 /**
@@ -24,8 +27,9 @@ class Signature @@ -24,8 +27,9 @@ class Signature
24 */ 27 */
25 public function __construct(string $uri) 28 public function __construct(string $uri)
26 { 29 {
  30 + $clientConfig = config('gz-cbec.client');
27 $this->uri = $uri; 31 $this->uri = $uri;
28 - $this->client = new Client; 32 + $this->client = new Client($clientConfig);
29 } 33 }
30 34
31 /** 35 /**
@@ -61,7 +65,7 @@ class Signature @@ -61,7 +65,7 @@ class Signature
61 } 65 }
62 } catch (\Throwable $throwable) { 66 } catch (\Throwable $throwable) {
63 } 67 }
64 - file_put_contents('tran.xml', $content); 68 +
65 return $content; 69 return $content;
66 } 70 }
67 } 71 }