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; + } + /** * 获取微信身份信息 *