Issues (14)

example/wx.php (1 issue)

Labels
Severity
1
<?php
2
3
use tinymeng\WeWorkFinanceSDK\Exception\FinanceSDKException;
4
use tinymeng\WeWorkFinanceSDK\WxFinanceSDK;
5
6
require_once __DIR__ . '/vendor/autoload.php';
7
8
## 企业配置
9
$corpConfig = [
10
    'corpid'       => '',
11
    'secret'       => '',
12
    'private_keys' => [
13
        1 => '-----BEGIN PRIVATE KEY-----
14
-----END PRIVATE KEY-----',
15
    ],
16
    /**
17
     * includePath(使用php-ffi扩展时)
18
     * 可选 :默认使用组件内SDK(默认SDK只支持Liunx),如果想使用其他版本SDK,请填写对应SDK路径
19
     * 官网下载SDK https://developer.work.weixin.qq.com/document/path/91774
20
     */
21
    'includePath' => '',
22
];
23
24
## 包配置
25
$srcConfig = [
26
    'default'   => 'php-ext',// 两种方式的切换: php-ext 或 php-ffi
27
];
28
29
$seq = $_GET['seq']??1;
30
$limit = $_GET['limit']??10;
31
32
try {
33
    $wxFinanceSDK = WxFinanceSDK::init($corpConfig,$srcConfig);
34
    // 获取会话记录数据(解密)
35
    $list = $wxFinanceSDK->getDecryptChatData($seq,$limit);
0 ignored issues
show
The method getDecryptChatData() does not exist on tinymeng\WeWorkFinanceSDK\WxFinanceSDK. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
    /** @scrutinizer ignore-call */ 
36
    $list = $wxFinanceSDK->getDecryptChatData($seq,$limit);
Loading history...
36
37
    foreach ($list as $key=>$item){
38
        if($wxFinanceSDK->isMedia($item['msgtype'])){
39
            // 下载媒体资源
40
            $list[$key]['media_path'] = $wxFinanceSDK->getDownloadMediaData($item[$item['msgtype']],$item['msgtype']);
41
        }
42
    }
43
    var_dump($list);
44
45
}catch (FinanceSDKException $exception){
46
    echo $exception->getMessage();exit();
47
}
48
49