Skip to content

Commit

Permalink
增加企业微信开放平台实例
Browse files Browse the repository at this point in the history
  • Loading branch information
jianyan74 committed Nov 28, 2018
1 parent c53494e commit 766e93d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ composer require jianyan74/yii2-easy-wechat

// 微信企业微信配置 具体可参考EasyWechat
'wechatWorkConfig' => [],

// 微信企业微信开放平台 具体可参考EasyWechat
'wechatOpenWorkConfig' => [],
```

配置文档
Expand All @@ -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)

## 使用例子

Expand Down Expand Up @@ -106,6 +110,12 @@ $openPlatform = Yii::$app->wechat->openPlatform;
$work = Yii::$app->wechat->work;
```

获取微信企业微信开放平台

```php
$work = Yii::$app->wechat->openWork;
```


微信支付(JsApi):

Expand Down
23 changes: 23 additions & 0 deletions src/Wechat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -71,6 +72,13 @@ class Wechat extends Component
*/
private static $_work;

/**
* 企业微信开放平台 SKD
*
* @var Factory
*/
private static $_openWork;

/**
* @var WechatUser
*/
Expand Down Expand Up @@ -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;
}

/**
* 获取微信身份信息
*
Expand Down

0 comments on commit 766e93d

Please sign in to comment.