37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
||
namespace app\process;
|
||
|
||
use support\Log;
|
||
use Workerman\Crontab\Crontab;
|
||
|
||
// 消息推送
|
||
class MessagePushTask
|
||
{
|
||
public function onWorkerStart()
|
||
{
|
||
// 查询短信发送状态
|
||
new Crontab('0 */5 * * * *', function(){
|
||
$command = 'cd ' . BASE_PATH . ' && php webman querysmsstatus';
|
||
// 存储命令输出的数组
|
||
$output = [];
|
||
// 存储命令返回状态码(0为成功,非0为失败)
|
||
$status = 0;
|
||
// 执行命令
|
||
exec($command, $output, $status);
|
||
// 处理执行结果
|
||
Log::info('查询短信发送状态:执行状态'. $status . '/执行结果:' . json_encode($output, JSON_UNESCAPED_UNICODE));
|
||
});
|
||
// 查询模版审核状态
|
||
new Crontab('0 */5 * * * *', function(){
|
||
$command = 'cd ' . BASE_PATH . ' && php webman querysmstempstatus';
|
||
// 存储命令输出的数组
|
||
$output = [];
|
||
// 存储命令返回状态码(0为成功,非0为失败)
|
||
$status = 0;
|
||
// 执行命令
|
||
exec($command, $output, $status);
|
||
// 处理执行结果
|
||
Log::info('查询模版审核状态:执行状态'. $status . '/执行结果:' . json_encode($output, JSON_UNESCAPED_UNICODE));
|
||
});
|
||
}
|
||
} |