This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<?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()]);