Skip to content

Commit ce4ee74

Browse files
committed
[新增功能](master): init
0 parents  commit ce4ee74

15 files changed

+546
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/tests export-ignore
2+
/.github export-ignore

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor/
2+
composer.lock
3+
*.cache
4+
*.log
5+
.idea

.php_cs

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
3+
$header = <<<'EOF'
4+
This file is part of MoChat.
5+
@link https://mo.chat
6+
@document https://mochat.wiki
7+
@contact group@mo.chat
8+
@license https://github.com/mochat-cloud/mochat/blob/master/LICENSE
9+
EOF;
10+
11+
return PhpCsFixer\Config::create()
12+
->setRiskyAllowed(true)
13+
->setRules([
14+
'@PSR2' => true,
15+
'@Symfony' => true,
16+
'@DoctrineAnnotation' => true,
17+
'@PhpCsFixer' => true,
18+
'header_comment' => [
19+
'commentType' => 'PHPDoc',
20+
'header' => $header,
21+
'separate' => 'none',
22+
'location' => 'after_declare_strict',
23+
],
24+
'array_syntax' => [
25+
'syntax' => 'short',
26+
],
27+
'list_syntax' => [
28+
'syntax' => 'short',
29+
],
30+
'concat_space' => [
31+
'spacing' => 'one',
32+
],
33+
'blank_line_before_statement' => [
34+
'statements' => [
35+
'declare',
36+
],
37+
],
38+
'general_phpdoc_annotation_remove' => [
39+
'annotations' => [
40+
'describe'
41+
],
42+
],
43+
'ordered_imports' => [
44+
'imports_order' => [
45+
'class', 'function', 'const',
46+
],
47+
'sort_algorithm' => 'alpha',
48+
],
49+
'single_line_comment_style' => [
50+
'comment_types' => [
51+
],
52+
],
53+
'yoda_style' => [
54+
'always_move_variable' => false,
55+
'equal' => false,
56+
'identical' => false,
57+
],
58+
'phpdoc_align' => [
59+
'align' => 'left',
60+
],
61+
'multiline_whitespace_before_semicolons' => [
62+
'strategy' => 'no_multi_line',
63+
],
64+
'class_attributes_separation' => true,
65+
'combine_consecutive_unsets' => true,
66+
'declare_strict_types' => true,
67+
'linebreak_after_opening_tag' => true,
68+
'lowercase_constants' => true,
69+
'lowercase_static_reference' => true,
70+
'no_useless_else' => true,
71+
'no_unused_imports' => true,
72+
'not_operator_with_successor_space' => true,
73+
'not_operator_with_space' => false,
74+
'ordered_class_elements' => true,
75+
'php_unit_strict' => false,
76+
'phpdoc_separation' => false,
77+
'single_quote' => true,
78+
'standardize_not_equals' => true,
79+
'multiline_comment_opening_closing' => true,
80+
'binary_operator_spaces' => [
81+
'operators' => [
82+
'=' => 'align_single_space_minimal',
83+
'=>' => 'align_single_space_minimal',
84+
],
85+
]
86+
])
87+
->setFinder(
88+
PhpCsFixer\Finder::create()
89+
->exclude('vendor')
90+
->exclude('runtime')
91+
->exclude('storage/apidoc')
92+
->in(__DIR__)
93+
)
94+
->setUsingCache(false);

LICENSE

Whitespace-only changes.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# wework-finance-sdk
2+
wework finance sdk

composer.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "mochat/wework-finance-sdk",
3+
"type": "library",
4+
"keywords": [
5+
"php",
6+
"hyperf",
7+
"mochat",
8+
"financeSDK"
9+
],
10+
"description": "financeSDK of wechat",
11+
"autoload": {
12+
"psr-4": {
13+
"MoChat\\WeWorkFinanceSDK\\": "src/"
14+
},
15+
"files": [
16+
"src/Functions.php"
17+
]
18+
},
19+
"autoload-dev": {
20+
"psr-4": {
21+
"HyperfTest\\": "tests"
22+
}
23+
},
24+
"require": {
25+
"php": ">=7.2",
26+
"ext-swoole": ">=4.5",
27+
"ext-wxwork_finance_sdk": "*",
28+
"hyperf/di": "^2.0"
29+
},
30+
"require-dev": {
31+
"friendsofphp/php-cs-fixer": "^2.14",
32+
"hyperf/testing": "2.0.*",
33+
"phpstan/phpstan": "^0.12",
34+
"swoole/ide-helper": "dev-master",
35+
"hyperf/guzzle": "^2.0"
36+
},
37+
"config": {
38+
"sort-packages": true
39+
},
40+
"scripts": {
41+
"test": "co-phpunit -c phpunit.xml --colors=always",
42+
"analyse": "phpstan analyse --memory-limit 1024M -l 0 ./src",
43+
"cs-fix": "php-cs-fixer fix $1"
44+
},
45+
"extra": {
46+
"hyperf": {
47+
"config": "MoChat\\WeWorkFinanceSDK\\ConfigProvider"
48+
}
49+
}
50+
}

publish/wx_finance_sdk.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of MoChat.
6+
* @link https://mo.chat
7+
* @document https://mochat.wiki
8+
* @contact group@mo.chat
9+
* @license https://github.com/mochat-cloud/mochat/blob/master/LICENSE
10+
*/
11+
return [
12+
'default' => 'php-ext',
13+
'providers' => [
14+
'php-ext' => [
15+
'driver' => \MoChat\WeWorkFinanceSDK\Provider\PHPExtProvider::class,
16+
],
17+
'php-ffi' => [
18+
'driver' => '',
19+
],
20+
],
21+
];

src/ConfigProvider.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of MoChat.
6+
* @link https://mo.chat
7+
* @document https://mochat.wiki
8+
* @contact group@mo.chat
9+
* @license https://github.com/mochat-cloud/mochat/blob/master/LICENSE
10+
*/
11+
namespace MoChat\WeWorkFinanceSDK;
12+
13+
class ConfigProvider
14+
{
15+
public function __invoke(): array
16+
{
17+
return [
18+
'annotations' => [
19+
'scan' => [
20+
'paths' => [
21+
__DIR__,
22+
],
23+
],
24+
],
25+
'dependencies' => [
26+
],
27+
'commands' => [
28+
],
29+
'publish' => [
30+
[
31+
'id' => 'wx_finance_sdk',
32+
'description' => '企业微信会话内容存档',
33+
'source' => __DIR__ . '/../publish/wx_finance_sdk.php',
34+
'destination' => BASE_PATH . '/config/autoload/wx_finance_sdk.php',
35+
],
36+
],
37+
];
38+
}
39+
}

src/Contract/ProviderInterface.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of MoChat.
6+
* @link https://mo.chat
7+
* @document https://mochat.wiki
8+
* @contact group@mo.chat
9+
* @license https://github.com/mochat-cloud/mochat/blob/master/LICENSE
10+
*/
11+
namespace MoChat\WeWorkFinanceSDK\Contract;
12+
13+
interface ProviderInterface
14+
{
15+
/**
16+
* 设置配置.
17+
* @param array $config 企业微信配置
18+
* @return $this ...
19+
*/
20+
public function setConfig(array $config): ProviderInterface;
21+
22+
/**
23+
* 获取配置.
24+
* @return array ...
25+
*/
26+
public function getConfig(): array;
27+
28+
/**
29+
* 获取会话记录数据.
30+
* @param int $seq 起始位置
31+
* @param int $limit 限制条数
32+
* @return string ...
33+
*/
34+
public function getChatData(int $seq, int $limit): string;
35+
36+
/**
37+
* 解密数据.
38+
* @param string $randomKey 通过openssl解密后的key
39+
* @param string $encryptStr chats 的加密数据
40+
* @return string ...
41+
*/
42+
public function decryptData(string $randomKey, string $encryptStr): string;
43+
44+
/**
45+
* 获取媒体资源.
46+
* @param string $sdkFileId 资源id
47+
* @param string $ext 格式
48+
* @return \SplFileInfo ...
49+
*/
50+
public function getMediaData(string $sdkFileId, string $ext): \SplFileInfo;
51+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of MoChat.
6+
* @link https://mo.chat
7+
* @document https://mochat.wiki
8+
* @contact group@mo.chat
9+
* @license https://github.com/mochat-cloud/mochat/blob/master/LICENSE
10+
*/
11+
namespace MoChat\WeWorkFinanceSDK\Exception;
12+
13+
use Exception;
14+
15+
class FinanceSDKException extends Exception
16+
{
17+
}

0 commit comments

Comments
 (0)