修改plugin.webman.channel.server端口号为2207
This commit is contained in:
@@ -20,6 +20,20 @@ use plugin\saiadmin\exception\ApiException;
|
||||
*/
|
||||
class CrontabLogic extends BaseLogic
|
||||
{
|
||||
/**
|
||||
* 获取 webman channel 服务地址
|
||||
* 需要保证与 server/config/plugin/webman/channel/process.php 的 listen 端口一致
|
||||
*/
|
||||
private function channelConfig(): array
|
||||
{
|
||||
$host = env('WEBMAN_CHANNEL_HOST', '127.0.0.1');
|
||||
$port = filter_var(env('WEBMAN_CHANNEL_PORT'), FILTER_VALIDATE_INT);
|
||||
if ($port === false) {
|
||||
$port = 2207;
|
||||
}
|
||||
return ['host' => $host, 'port' => $port];
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
@@ -67,7 +81,8 @@ class CrontabLogic extends BaseLogic
|
||||
|
||||
$id = $model->getKey();
|
||||
// 连接到Channel服务
|
||||
ChannelClient::connect();
|
||||
$channel = $this->channelConfig();
|
||||
ChannelClient::connect($channel['host'], $channel['port']);
|
||||
ChannelClient::publish('crontab', ['args' => $id]);
|
||||
|
||||
return true;
|
||||
@@ -116,7 +131,8 @@ class CrontabLogic extends BaseLogic
|
||||
]);
|
||||
if ($result) {
|
||||
// 连接到Channel服务
|
||||
ChannelClient::connect();
|
||||
$channel = $this->channelConfig();
|
||||
ChannelClient::connect($channel['host'], $channel['port']);
|
||||
ChannelClient::publish('crontab', ['args' => $id]);
|
||||
}
|
||||
|
||||
@@ -141,7 +157,8 @@ class CrontabLogic extends BaseLogic
|
||||
$result = parent::destroy($ids);
|
||||
if ($result) {
|
||||
// 连接到Channel服务
|
||||
ChannelClient::connect();
|
||||
$channel = $this->channelConfig();
|
||||
ChannelClient::connect($channel['host'], $channel['port']);
|
||||
ChannelClient::publish('crontab', ['args' => $ids]);
|
||||
}
|
||||
return $result;
|
||||
@@ -162,7 +179,8 @@ class CrontabLogic extends BaseLogic
|
||||
$result = $model->save(['status' => $status]);
|
||||
if ($result) {
|
||||
// 连接到Channel服务
|
||||
ChannelClient::connect();
|
||||
$channel = $this->channelConfig();
|
||||
ChannelClient::connect($channel['host'], $channel['port']);
|
||||
ChannelClient::publish('crontab', ['args' => $id]);
|
||||
}
|
||||
return $result;
|
||||
|
||||
Reference in New Issue
Block a user