wx-finance-sdk/README.md

91 lines
2.1 KiB
Markdown
Raw Normal View History

2020-02-20 21:25:49 +08:00
# wxwork_finance_sdk_wrapper
2020-02-29 13:26:54 +08:00
2020-03-18 14:04:22 +08:00
企业微信-会话内容存档PHP扩展
2020-02-29 13:26:54 +08:00
## 依赖
企业微信提供的sdk;
PHP VERSION >= 7.0
2020-03-09 10:37:20 +08:00
openssl扩展
2020-02-29 13:26:54 +08:00
## 安装步骤及要求
2020-02-29 13:31:41 +08:00
```
$INSATLL_PATH_PATH/bin/phpize
2020-02-29 13:26:54 +08:00
2020-03-06 16:45:23 +08:00
./configure --with-php-config=$INSTALL_PHP_PATH/php-config --with-wxwork-finance-sdk=$WXWORK_FINANCE_C_SDK_PATH
2020-02-29 13:31:41 +08:00
2020-02-29 13:26:54 +08:00
make && make install
2020-02-29 13:31:41 +08:00
```
2020-02-29 13:26:54 +08:00
php.ini 增加 extension=wxwork_finance_sdk.so
2020-02-29 13:31:41 +08:00
## API
```php
2020-02-29 13:26:54 +08:00
WxworkFinanceSdkExcption::__construct();
```
```php
WxworkFinanceSdk::__construct(string $corpId, string $secret, array $options);
string $corpId 企业号
string $secret 秘钥
array $options = [ // 可选参数
'proxy_host' => string,
'proxy_password' => string,
'timeout' => 10, // 默认超时时间为10s
]
```
```php
string WxworkFinanceSdk::getChatData(int $seq, int $limit);
* 拉取聊天数据
$seq 起始位置
$limit 获取条数
```
```php
2020-07-24 15:14:09 +08:00
bool WxworkFinanceSdk::downloadMedia(string $sdkfileid, string $saveTo)
* 下载资源
$sdkfileid 资源id。来自chat 中的数据sdkfileid
$saveTo 本地保存的路径
2020-02-29 13:26:54 +08:00
```
```php
array WxworkFinanceSdk::getMediaData(string $sdkfileid, string $indexBuf='');
* 拉取静态资源数据,用于可以支持追加模式的三方存储平台
返回的数据结构体
$ret = [
'data' => '' // string 返回的数据
'nextIndex' => 'ddd' // string 获取下一段数据的句柄
2020-12-29 18:13:18 +08:00
'isFinished' => int // 1 数据已拉取完毕
];
2020-12-29 18:13:18 +08:00
```
2020-12-29 18:13:18 +08:00
* 感谢 @zhanzhaopeng1 PR
2020-03-09 10:36:19 +08:00
```php
string WxworkFinanceSdk::decryptData(string $randomKey, string $encryptStr);
2020-07-24 15:14:09 +08:00
* 解密数据
$randomKey 通过openssl解密后的key
$encryptStr chats 的加密数据
2020-03-09 10:36:19 +08:00
```
2020-12-10 09:38:11 +08:00
## 问题
1. free(): invalid pointer
* 暂时定位intl扩展的冲突问题. php -m |grep intl 建议重新编译php 取消intl扩展
2020-02-29 13:26:54 +08:00
## 示例
2020-03-09 10:36:19 +08:00
wxwork_finance_sdk.php
2020-02-29 13:26:54 +08:00
2020-10-10 20:27:41 +08:00
打赏一下的话就更好了~
Alipay
<img src="https://github.com/pangdahua/php7-wxwork-finance-sdk/blob/sponsor/imgs/Alipay.png" width="230" height="230" />