@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | // buffer写入文件 |
| 142 | 142 | $handle = fopen($path, 'ab+'); |
| 143 | - if (! $handle) { |
|
| 143 | + if (!$handle) { |
|
| 144 | 144 | throw new \RuntimeException(sprintf('打开文件失败:%s', $path)); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -167,15 +167,15 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | protected function setFinanceSDK(array $config = []): void |
| 169 | 169 | { |
| 170 | - if (! extension_loaded('ffi')) { |
|
| 170 | + if (!extension_loaded('ffi')) { |
|
| 171 | 171 | throw new FinanceSDKException('缺少ext-ffi扩展'); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | $this->config = array_merge($this->config, $config); |
| 175 | - if (! isset($this->config['corpid'])) { |
|
| 175 | + if (!isset($this->config['corpid'])) { |
|
| 176 | 176 | throw new InvalidArgumentException('缺少配置:corpid'); |
| 177 | 177 | } |
| 178 | - if (! isset($this->config['secret'])) { |
|
| 178 | + if (!isset($this->config['secret'])) { |
|
| 179 | 179 | throw new InvalidArgumentException('缺少配置:secret'); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | isset($this->config['timeout']) || $this->config['timeout'] = ''; |
| 185 | 185 | |
| 186 | 186 | // C包路径 |
| 187 | - if(empty($this->config['includePath'])){ |
|
| 187 | + if (empty($this->config['includePath'])) { |
|
| 188 | 188 | $includePath = dirname(__DIR__, 2) . '/include/'; |
| 189 | - }else{ |
|
| 189 | + }else { |
|
| 190 | 190 | $includePath = $this->config['includePath']; |
| 191 | 191 | } |
| 192 | 192 | $this->cHeader = $includePath . $this->cHeader; |
@@ -186,7 +186,7 @@ |
||
| 186 | 186 | // C包路径 |
| 187 | 187 | if(empty($this->config['includePath'])){ |
| 188 | 188 | $includePath = dirname(__DIR__, 2) . '/include/'; |
| 189 | - }else{ |
|
| 189 | + } else{ |
|
| 190 | 190 | $includePath = $this->config['includePath']; |
| 191 | 191 | } |
| 192 | 192 | $this->cHeader = $includePath . $this->cHeader; |
@@ -23,26 +23,26 @@ |
||
| 23 | 23 | |
| 24 | 24 | ## 包配置 |
| 25 | 25 | $srcConfig = [ |
| 26 | - 'default' => 'php-ext',// 两种方式的切换: php-ext 或 php-ffi |
|
| 26 | + 'default' => 'php-ext', // 两种方式的切换: php-ext 或 php-ffi |
|
| 27 | 27 | ]; |
| 28 | 28 | |
| 29 | -$seq = $_GET['seq']??1; |
|
| 30 | -$limit = $_GET['limit']??10; |
|
| 29 | +$seq = $_GET['seq'] ?? 1; |
|
| 30 | +$limit = $_GET['limit'] ?? 10; |
|
| 31 | 31 | |
| 32 | 32 | try { |
| 33 | - $wxFinanceSDK = WxFinanceSDK::init($corpConfig,$srcConfig); |
|
| 33 | + $wxFinanceSDK = WxFinanceSDK::init($corpConfig, $srcConfig); |
|
| 34 | 34 | // 获取会话记录数据(解密) |
| 35 | - $list = $wxFinanceSDK->getDecryptChatData($seq,$limit); |
|
| 35 | + $list = $wxFinanceSDK->getDecryptChatData($seq, $limit); |
|
| 36 | 36 | |
| 37 | - foreach ($list as $key=>$item){ |
|
| 38 | - if($wxFinanceSDK->isMedia($item['msgtype'])){ |
|
| 37 | + foreach ($list as $key=>$item) { |
|
| 38 | + if ($wxFinanceSDK->isMedia($item['msgtype'])) { |
|
| 39 | 39 | // 下载媒体资源 |
| 40 | - $list[$key]['media_path'] = $wxFinanceSDK->getDownloadMediaData($item[$item['msgtype']],$item['msgtype']); |
|
| 40 | + $list[$key]['media_path'] = $wxFinanceSDK->getDownloadMediaData($item[$item['msgtype']], $item['msgtype']); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | var_dump($list); |
| 44 | 44 | |
| 45 | -}catch (FinanceSDKException $exception){ |
|
| 46 | - echo $exception->getMessage();exit(); |
|
| 45 | +} catch (FinanceSDKException $exception) { |
|
| 46 | + echo $exception->getMessage(); exit(); |
|
| 47 | 47 | } |
| 48 | 48 | |