Skip to content

Commit d125c62

Browse files
authored
Merge pull request Hanson#188 from HanSon/dev
修复扩展状态互相影响
2 parents bca5c87 + 89c6559 commit d125c62

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/Extension/AbstractMessageHandler.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ abstract class AbstractMessageHandler
1616

1717
public $zhName;
1818

19-
public static $status = true;
19+
public $status = true;
2020

2121
public static $admin;
2222

@@ -84,16 +84,16 @@ final public function messageHandler(Collection $collection)
8484
}
8585
}
8686

87-
if (!static::$status) {
87+
if (!$this->status) {
8888
return;
8989
}
9090

91-
$this->handler($collection);
91+
return $this->handler($collection);
9292
}
9393

9494
final public function applicationInfo($collection)
9595
{
96-
$status = static::$status ? '' : '';
96+
$status = $this->status ? '' : '';
9797

9898
$admin = static::$admin;
9999

@@ -108,9 +108,9 @@ final public function applicationInfo($collection)
108108
*/
109109
final public function setStatus(bool $boolean, $collection)
110110
{
111-
static::$status = $boolean;
111+
$this->status = $boolean;
112112

113-
$status = static::$status ? '' : '';
113+
$status = $this->status ? '' : '';
114114

115115
Text::send($collection['from']['UserName'], "应用:{$this->zhName} 状态已更改为:{$status}");
116116
}

src/Extension/MessageExtension.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ private function initBaseExtensions()
9494
public function exec($collection)
9595
{
9696
foreach ($this->serviceExtensions as $extension) {
97-
$extension->messageHandler($collection);
97+
if ($extension->messageHandler($collection)) {
98+
return;
99+
}
98100
}
99101
}
100102

0 commit comments

Comments
 (0)