You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hainan_2024/bot/bot/sot_deleteChangeFile.php

35 lines
747 B
PHP

<?php
namespace Workerman\Lib;
use Workerman\Worker;
$bot_loop = new Worker();
$bot_loop->count = 1;
$bot_loop->name = 'DeleteChangeFile';
function DeleteChangeFileFunc()
{
$db = Db::get();
$table_name = 'bot_task';
$task = $db->getRow("select * from $table_name where status = ? order by id asc", [3]);
if (!!$task) {
Tool::log("检测到删除任务[{$task['id']}]", 2);
if (!!is_file($task['path'])) {
unlink($task['path']);
}
Db2::u($db, $table_name, [
'status' => 5,
], 'where id = ?', [$task['id']]);
} else {
Tool::log('未检测到删除任务');
}
}
$bot_loop->onWorkerStart = function () {
DeleteChangeFileFunc();
Timer::add(10, function () {
DeleteChangeFileFunc();
});
};