Skip to content

Commit 2ef8b18

Browse files
committed
wip
1 parent d2c615c commit 2ef8b18

File tree

7 files changed

+96
-111
lines changed

7 files changed

+96
-111
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/vendor/
22
composer.lock
33
.php-cs-fixer.cache
4-
.idea
4+
.ideacghooks.lock
5+
6+
cghooks.lock

.php-cs-fixer.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

composer.json

Lines changed: 63 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,67 @@
11
{
2-
"name": "overtrue/laravel-wechat",
3-
"description": "微信 SDK for Laravel",
4-
"keywords": ["wechat", "weixin","laravel", "sdk"],
5-
"license": "MIT",
6-
"authors": [
7-
{
8-
"name": "overtrue",
9-
"email": "[email protected]"
10-
}
11-
],
12-
"require": {
13-
"illuminate/container": "^9.0|^10.0",
14-
"w7corp/easywechat": "^6.0.0"
15-
},
16-
"require-dev": {
17-
"laravel/framework": "^9.0|^10.0",
18-
"friendsofphp/php-cs-fixer": "^3.1",
19-
"jetbrains/phpstorm-attributes": "^1.0"
20-
},
21-
"autoload": {
22-
"psr-4": {
23-
"Overtrue\\LaravelWeChat\\": "src/"
24-
}
25-
},
26-
"extra": {
27-
"laravel": {
28-
"providers": [
29-
"Overtrue\\LaravelWeChat\\ServiceProvider"
30-
]
31-
},
32-
"hooks": {
33-
"pre-commit": [
34-
"composer check-style",
35-
"composer test"
36-
],
37-
"pre-push": [
38-
"composer check-style"
39-
]
40-
}
41-
},
42-
"scripts": {
43-
"post-update-cmd": [
44-
"cghooks remove",
45-
"cghooks add --ignore-lock",
46-
"cghooks update"
47-
],
48-
"post-merge": "composer install",
49-
"post-install-cmd": [
50-
"cghooks remove",
51-
"cghooks add --ignore-lock",
52-
"cghooks update"
53-
],
54-
"check-style": "php-cs-fixer fix --using-cache=no --diff --dry-run --allow-risky=yes --ansi",
55-
"fix-style": "php-cs-fixer fix --using-cache=no --allow-risky=yes --ansi",
56-
"test": "phpunit --colors"
2+
"name": "overtrue/laravel-wechat",
3+
"description": "微信 SDK for Laravel",
4+
"keywords": [
5+
"wechat",
6+
"weixin",
7+
"laravel",
8+
"sdk"
9+
],
10+
"license": "MIT",
11+
"authors": [
12+
{
13+
"name": "overtrue",
14+
"email": "[email protected]"
15+
}
16+
],
17+
"require": {
18+
"illuminate/container": "^9.0|^10.0",
19+
"w7corp/easywechat": "^6.0.0"
20+
},
21+
"require-dev": {
22+
"laravel/framework": "^10.0",
23+
"jetbrains/phpstorm-attributes": "^1.0",
24+
"brainmaestro/composer-git-hooks": "dev-master",
25+
"laravel/pint": "^1.5"
26+
},
27+
"autoload": {
28+
"psr-4": {
29+
"Overtrue\\LaravelWeChat\\": "src/"
30+
}
31+
},
32+
"extra": {
33+
"laravel": {
34+
"providers": [
35+
"Overtrue\\LaravelWeChat\\ServiceProvider"
36+
]
5737
},
58-
"config": {
59-
"allow-plugins": {
60-
"easywechat-composer/easywechat-composer": true
61-
}
38+
"hooks": {
39+
"pre-commit": [
40+
"composer check-style"
41+
],
42+
"pre-push": [
43+
"composer check-style"
44+
]
45+
}
46+
},
47+
"scripts": {
48+
"post-update-cmd": [
49+
"cghooks remove",
50+
"cghooks add --ignore-lock",
51+
"cghooks update"
52+
],
53+
"post-merge": "composer install",
54+
"post-install-cmd": [
55+
"cghooks remove",
56+
"cghooks add --ignore-lock",
57+
"cghooks update"
58+
],
59+
"check-style": "vendor/bin/pint --test",
60+
"fix-style": "vendor/bin/pint"
61+
},
62+
"config": {
63+
"allow-plugins": {
64+
"easywechat-composer/easywechat-composer": true
6265
}
66+
}
6367
}

config/easywechat.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/*
55
* 默认配置,将会合并到各模块中
66
*/
7-
'defaults' => [
7+
'defaults' => [
88
'http' => [
99
'timeout' => 5.0,
1010
],
@@ -15,9 +15,9 @@
1515
*/
1616
'official_account' => [
1717
'default' => [
18-
'app_id' => env('WECHAT_OFFICIAL_ACCOUNT_APPID', ''), // AppID
19-
'secret' => env('WECHAT_OFFICIAL_ACCOUNT_SECRET', ''), // AppSecret
20-
'token' => env('WECHAT_OFFICIAL_ACCOUNT_TOKEN', ''), // Token
18+
'app_id' => env('WECHAT_OFFICIAL_ACCOUNT_APPID', ''), // AppID
19+
'secret' => env('WECHAT_OFFICIAL_ACCOUNT_SECRET', ''), // AppSecret
20+
'token' => env('WECHAT_OFFICIAL_ACCOUNT_TOKEN', ''), // Token
2121
'aes_key' => env('WECHAT_OFFICIAL_ACCOUNT_AES_KEY', ''), // EncodingAESKey
2222

2323
/*
@@ -33,10 +33,10 @@
3333
// 'enforce_https' => true,
3434
// ],
3535

36-
/**
37-
* 接口请求相关配置,超时时间等,具体可用参数请参考:
38-
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
39-
*/
36+
/**
37+
* 接口请求相关配置,超时时间等,具体可用参数请参考:
38+
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
39+
*/
4040
//'http' => [
4141
// 'timeout' => 5.0,
4242
// // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri
@@ -55,10 +55,10 @@
5555
// 'token' => env('WECHAT_OPEN_PLATFORM_TOKEN', ''),
5656
// 'aes_key' => env('WECHAT_OPEN_PLATFORM_AES_KEY', ''),
5757

58-
/**
59-
* 接口请求相关配置,超时时间等,具体可用参数请参考:
60-
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
61-
*/
58+
/**
59+
* 接口请求相关配置,超时时间等,具体可用参数请参考:
60+
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
61+
*/
6262
// 'http' => [
6363
// 'timeout' => 5.0,
6464
// // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri
@@ -77,10 +77,10 @@
7777
// 'token' => env('WECHAT_MINI_APP_TOKEN', ''),
7878
// 'aes_key' => env('WECHAT_MINI_APP_AES_KEY', ''),
7979

80-
/**
81-
* 接口请求相关配置,超时时间等,具体可用参数请参考:
82-
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
83-
*/
80+
/**
81+
* 接口请求相关配置,超时时间等,具体可用参数请参考:
82+
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
83+
*/
8484
// 'http' => [
8585
// 'timeout' => 5.0,
8686
// // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri
@@ -114,7 +114,7 @@
114114
//
115115
// // v3 API 秘钥
116116
// //'secret_key' => '43A03299A3C3FED3D8CE7B820Fxxxxx',
117-
//
117+
//
118118
// // 注意 此处为微信支付平台证书 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/wechatpay5_1.shtml
119119
// 'platform_certs' => [
120120
// '/data/private/certs/platform_key.pem',
@@ -132,10 +132,10 @@
132132
// 'token' => env('WECHAT_WORK_TOKEN', ''),
133133
// 'aes_key' => env('WECHAT_WORK_AES_KEY', ''),
134134

135-
/**
136-
* 接口请求相关配置,超时时间等,具体可用参数请参考:
137-
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
138-
*/
135+
/**
136+
* 接口请求相关配置,超时时间等,具体可用参数请参考:
137+
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
138+
*/
139139
// 'http' => [
140140
// 'timeout' => 5.0,
141141
// // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri
@@ -154,10 +154,10 @@
154154
// 'token' => env('WECHAT_OPEN_WORK_TOKEN', ''),
155155
// 'aes_key' => env('WECHAT_OPEN_WORK_AES_KEY', ''),
156156

157-
/**
158-
* 接口请求相关配置,超时时间等,具体可用参数请参考:
159-
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
160-
*/
157+
/**
158+
* 接口请求相关配置,超时时间等,具体可用参数请参考:
159+
* https://github.com/symfony/symfony/blob/6.0/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L26
160+
*/
161161
// 'http' => [
162162
// 'timeout' => 5.0,
163163
// // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri

src/Middleware/OAuthAuthenticate.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,8 @@
2424
*/
2525
class OAuthAuthenticate
2626
{
27-
/**
28-
* @param \Illuminate\Http\Request $request
29-
* @param \Closure $next
30-
* @param string $account
31-
* @param string|null $scope
32-
*
33-
* @return mixed
34-
*/
3527
public function handle(
36-
\Illuminate\Http\Request $request,
28+
Request $request,
3729
Closure $next,
3830
string $account = 'default',
3931
string $scope = null,
@@ -92,7 +84,7 @@ protected function getIntendUrl(Request $request, bool $https = false): string
9284

9385
protected function getRedirectUrl(Request $request, bool $https = false): string
9486
{
95-
if (!$https) {
87+
if (! $https) {
9688
return $request->fullUrl();
9789
}
9890

src/ServiceProvider.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use EasyWeChat\OpenWork\Application as OpenWork;
1818
use EasyWeChat\Pay\Application as Payment;
1919
use EasyWeChat\Work\Application as Work;
20-
use Illuminate\Support\Facades\Route;
2120
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
2221

2322
class ServiceProvider extends LaravelServiceProvider
@@ -51,7 +50,7 @@ public function register()
5150
continue;
5251
}
5352

54-
if (!empty(config('easywechat.'.$name.'.app_id')) || !empty(config('easywechat.'.$name.'.corp_id'))) {
53+
if (! empty(config('easywechat.'.$name.'.app_id')) || ! empty(config('easywechat.'.$name.'.corp_id'))) {
5554
$accounts = [
5655
'default' => config('easywechat.'.$name),
5756
];
@@ -61,7 +60,7 @@ public function register()
6160
}
6261

6362
foreach ($accounts as $account => $config) {
64-
$this->app->bind("easywechat.{$name}.{$account}", function ($laravelApp) use ($name, $account, $config, $class) {
63+
$this->app->bind("easywechat.{$name}.{$account}", function ($laravelApp) use ($config, $class) {
6564
$app = new $class(array_merge(config('easywechat.defaults', []), $config));
6665

6766
if (\is_callable([$app, 'setCache'])) {

src/Traits/HandleOpenPlatformServerEvents.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use EasyWeChat\OpenPlatform\Application;
66
use Overtrue\LaravelWeChat\Events\OpenPlatform\Authorized;
7-
use Overtrue\LaravelWeChat\Events\OpenPlatform\Unauthorized;
87
use Overtrue\LaravelWeChat\Events\OpenPlatform\AuthorizeUpdated;
8+
use Overtrue\LaravelWeChat\Events\OpenPlatform\Unauthorized;
99
use Overtrue\LaravelWeChat\Events\OpenPlatform\VerifyTicketRefreshed;
1010

1111
trait HandleOpenPlatformServerEvents

0 commit comments

Comments
 (0)