mochat/wework-finance-sdk

There is no license information available for the latest version (v1.1.2) of this package.

WeWorkFinanceSDK Of MoChat

v1.1.2 2021-12-01 08:35 UTC

This package is not auto-updated.

Last update: 2022-08-10 12:08:07 UTC


README

要求

配置

  • hyperf框架使用vendor:publish发布资源(publish/wx_finance_sdk.php
  • 非hyperf框架可以在初始化实例时传入配置

使用

## 企业配置
$corpConfig = [
    'corpid'       => 'xxxx',
    'secret'       => 'xxxx',
    'private_keys' => [
        '密钥版本号' => '私钥',
    ],
];
## 包配置
$srcConfig = [
    'default'   => 'php-ext',
    'providers' => [
        'php-ext' => [
            'driver' => \MoChat\WeWorkFinanceSDK\Provider\PHPExtProvider::class,
        ],
        'php-ffi' => [
            'driver' => \MoChat\WeWorkFinanceSDK\Provider\FFIProvider::class,
        ],
    ],
];

## 1、实例化
$sdk = MoChat\WeWorkFinanceSDK\WxFinanceSDK::init($corpConfig, $srcConfig);

## 获取聊天记录
$chatData = $sdk->getDecryptChatData($seq, $limit);

## 解析media
$medium = $sdk->getMediaData($sdkFileId, $ext)

测试

  • cp ./tests/config.php.example ./tests/config.php
  • 修改 ./tests/config.php
  • composer test

FFI 预加载

  • 可自己行修改 php-ffi.driver,独立C的头文件到 opcache.preload