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.

30 lines
613 B
PHTML

<?php
namespace Admin\Controller;
use Think\Controller;
/**
* 系统任务接口
* @author cz
* TODO: 罚款的游戏没有流水不统计补点为0 无法重算
*/
class CmdTasksController extends Controller {
public function run()
{
$params = D("CmdTasks")->getTask();
if(!$params){
echo('暂无任务');
}
$taskid = $params['id'];
$cmd = $params['params'];
$cmd = str_replace('{$taskid}',$taskid,$cmd);
try {
exec($cmd);
} catch (\Exception $e) {
D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 3, 'end_time' => time(), 'result' => $e->getMessage()]);
}
}
}