From 766e93df99a0e422ca9bd3fe3225075dd036180b Mon Sep 17 00:00:00 2001 From: jianyan74 Date: Wed, 28 Nov 2018 15:20:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BC=81=E4=B8=9A=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=BC=80=E6=94=BE=E5=B9=B3=E5=8F=B0=E5=AE=9E=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 +++++++++++- src/Wechat.php | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cca12a2..6ca5f7b 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,9 @@ composer require jianyan74/yii2-easy-wechat // 微信企业微信配置 具体可参考EasyWechat 'wechatWorkConfig' => [], + +// 微信企业微信开放平台 具体可参考EasyWechat +'wechatOpenWorkConfig' => [], ``` 配置文档 @@ -58,7 +61,8 @@ composer require jianyan74/yii2-easy-wechat [微信支付配置说明文档.](https://www.easywechat.com/docs/master/payment/jssdk) [微信小程序配置说明文档.](https://www.easywechat.com/docs/master/mini-program/index) [微信开放平台第三方平台](https://www.easywechat.com/docs/master/open-platform/index) -[企业微信](https://www.easywechat.com/docs/master/wework/index) +[企业微信](https://www.easywechat.com/docs/master/wework/index) +[企业微信开放平台](https://www.easywechat.com/docs/master/open-work/index) ## 使用例子 @@ -106,6 +110,12 @@ $openPlatform = Yii::$app->wechat->openPlatform; $work = Yii::$app->wechat->work; ``` +获取微信企业微信开放平台 + +```php +$work = Yii::$app->wechat->openWork; +``` + 微信支付(JsApi): diff --git a/src/Wechat.php b/src/Wechat.php index d2ebb04..00ede5e 100644 --- a/src/Wechat.php +++ b/src/Wechat.php @@ -15,6 +15,7 @@ * @property \EasyWeChat\MiniProgram\Application $miniProgram 微信小程序实例 * @property \EasyWeChat\OpenPlatform\Application $openPlatform 微信开放平台(第三方平台)实例 * @property \EasyWeChat\Work\Application $work 企业微信实例 + * @property \EasyWeChat\OpenWork\Application $openWork 企业微信开放平台实例 */ class Wechat extends Component { @@ -71,6 +72,13 @@ class Wechat extends Component */ private static $_work; + /** + * 企业微信开放平台 SKD + * + * @var Factory + */ + private static $_openWork; + /** * @var WechatUser */ @@ -221,6 +229,21 @@ public function getWork() return self::$_work; } + /** + * 获取 EasyWeChat 企业微信开放平台实例 + * + * @return Factory + */ + public function getOpenWork() + { + if (!self::$_openWork instanceof Factory) + { + self::$_openWork = Factory::openWork(Yii::$app->params['wechatOpenWorkConfig']); + } + + return self::$_work; + } + /** * 获取微信身份信息 *