diff --git a/docs/src/6.x/open-work/server.md b/docs/src/6.x/open-work/server.md index e69fea0bf..f55f36293 100755 --- a/docs/src/6.x/open-work/server.md +++ b/docs/src/6.x/open-work/server.md @@ -10,7 +10,7 @@ - 授权成功 `create_auth` - 授权变更 `change_auth` - 授权取消 `cancel_auth` -- 通讯录变更(Event) `change_contact` +- 通讯录变更(InfoType) `change_contact` - ChangeType - 成员变更 - 新增成员 `create_user` @@ -23,6 +23,8 @@ - 标签变更 - 成员标签变更 `update_tag` - 共享应用事件回调 `share_agent_change` +- 重置永久授权码通知 `reset_permanent_code` +- 应用管理员变更通知 `change_app_admin` ## 内置消息处理器 @@ -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 推送事件 diff --git a/src/OpenWork/Message.php b/src/OpenWork/Message.php index 75867af52..837b276d1 100644 --- a/src/OpenWork/Message.php +++ b/src/OpenWork/Message.php @@ -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 { diff --git a/src/OpenWork/Server.php b/src/OpenWork/Server.php index ca1a0fb5e..7f46dae19 100644 --- a/src/OpenWork/Server.php +++ b/src/OpenWork/Server.php @@ -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;