Skip to content

Commit

Permalink
修复应用管理员变更通知判断 (#2617)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjfz committed Nov 3, 2022
1 parent e28124a commit 8c6da8c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
20 changes: 19 additions & 1 deletion docs/src/6.x/open-work/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- 授权成功 `create_auth`
- 授权变更 `change_auth`
- 授权取消 `cancel_auth`
- 通讯录变更(Event`change_contact`
- 通讯录变更(InfoType`change_contact`
- ChangeType
- 成员变更
- 新增成员 `create_user`
Expand All @@ -23,6 +23,8 @@
- 标签变更
- 成员标签变更 `update_tag`
- 共享应用事件回调 `share_agent_change`
- 重置永久授权码通知 `reset_permanent_code`
- 应用管理员变更通知 `change_app_admin`

## 内置消息处理器

Expand Down Expand Up @@ -125,6 +127,22 @@ $server->handleShareAgentChanged(function($message, \Closure $next) {
return $next($message);
});
```
### 重置永久授权码通知

```php
$server->handleResetPermanentCode(function($message, \Closure $next) {
// ...
return $next($message);
});
```
### 应用管理员变更通知

```php
$server->handleChangeAppAdmin(function($message, \Closure $next) {
// ...
return $next($message);
});
```

### suite_ticket 推送事件

Expand Down
2 changes: 2 additions & 0 deletions src/OpenWork/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* @property string $ChangeType
* @property string $SuiteTicket
* @property string $SuiteId
* @property string $MsgType
* @property string $Event
*/
class Message extends \EasyWeChat\Kernel\Message
{
Expand Down
5 changes: 4 additions & 1 deletion src/OpenWork/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ public function handleResetPermanentCode(callable $handler): static
public function handleChangeAppAdmin(callable $handler): static
{
$this->with(function (Message $message, Closure $next) use ($handler): mixed {
return $message->InfoType === 'change_app_admin' ? $handler($message, $next) : $next($message);
return $message->MsgType === 'event' && $message->Event === 'change_app_admin' ? $handler(
$message,
$next
) : $next($message);
});

return $this;
Expand Down

0 comments on commit 8c6da8c

Please sign in to comment.