Skip to content

Commit 3a7a9f1

Browse files
committed
更新配置文件格式与添加外观
1 parent 4d3cbc2 commit 3a7a9f1

File tree

2 files changed

+45
-4
lines changed

2 files changed

+45
-4
lines changed

src/Facade.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace Overtrue\LaravelWechat;
4+
5+
use Illuminate\Support\Facades\Facade as LaravelFacade;
6+
use Log;
7+
8+
/**
9+
* @see Overtrue\Wechat\Wechat
10+
*/
11+
class Facade extends LaravelFacade
12+
{
13+
/**
14+
* 默认提供服务端
15+
*
16+
* @return string
17+
*/
18+
protected static function getFacadeAccessor()
19+
{
20+
return 'wechat.server';
21+
}
22+
23+
/**
24+
* 魔术方法
25+
*
26+
* @param string $method
27+
* @param array $args
28+
*
29+
* @return mixed
30+
*/
31+
public function __call($method, $args)
32+
{
33+
if (isset(static::$app["wechat.{$method}"])) {
34+
Log::warning("建议不要再统一使用 `Wechat::on()` 等形式使用,overtrue/wechat 2.x 已经改为独立服务类型来使用各模块的功能,更多请参阅文档:https://github.com/overtrue/wechat/wiki");
35+
return static::$app["wechat.{$method}"];
36+
}
37+
38+
parent::__call($method, $args);
39+
}
40+
}

src/config.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22
return [
3-
'appId' => 'Your app id', // 必填
4-
'secret' => 'Your secret', // 必填
5-
'token' => 'Your token', // 必填
6-
'encodingAESKey' => 'Your encoding AES Key' // 加密模式需要,其它模式不需要
3+
'use_alias' => false,
4+
'app_id' => 'YourAppId', // 必填
5+
'secret' => 'YourSecret', // 必填
6+
'token' => 'YourToken', // 必填
7+
'encoding_key' => 'YourEncodingAESKey' // 加密模式需要,其它模式不需要
78
];

0 commit comments

Comments
 (0)