入群欢迎语功能提交
This commit is contained in:
42
Server/application/command/WorkbenchGroupWelcomeCommand.php
Normal file
42
Server/application/command/WorkbenchGroupWelcomeCommand.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace app\command;
|
||||
|
||||
use app\job\WorkbenchGroupWelcomeJob;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\facade\Log;
|
||||
|
||||
class WorkbenchGroupWelcomeCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('workbench:groupWelcome')
|
||||
->setDescription('工作台入群欢迎语任务队列');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$output->writeln('开始处理工作台入群欢迎语任务...');
|
||||
|
||||
try {
|
||||
$job = new WorkbenchGroupWelcomeJob();
|
||||
$result = $job->processWelcomeMessage([], 0);
|
||||
|
||||
if ($result) {
|
||||
$output->writeln('入群欢迎语任务处理完成');
|
||||
} else {
|
||||
$output->writeln('入群欢迎语任务处理失败');
|
||||
}
|
||||
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
$errorMsg = '工作台入群欢迎语任务执行失败:' . $e->getMessage();
|
||||
Log::error($errorMsg);
|
||||
$output->writeln($errorMsg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user