<?php

namespace web\admin;

class welcome {
    public static function json_init() {
        global $db;
        $rsuser = verifyfast();
        $works = array();

        // $csql = new \ciy\sql('zc_risk');
        // $csql->where("bread=2");
        // $cnt = toint($db->get1($csql));
        // if ($cnt > 0)
        //     $works[] = array('title' => '风险待处置 ' . $cnt . '条', 'url' => 'risk.html?liid=1', 'tab' => '风险处置');

        // $takarr = getstrparam(file_get_contents(PATH_ROOT . 'log/fork_apinotify.tak'), ',');
        // if ($takarr['curr'] > $takarr['max'] / 2)
        //     $works[] = array('title' => 'apinotify任务排队过长。' . $takarr['curr'] . '/max' . $takarr['max'] . '，' . (time() - $takarr['time']) . '秒前');

        $errlog = file_get_contents(PATH_ROOT . 'log/err_db.log');
        if (!empty($errlog))
            $works[] = array('title' => '发现异常db数据 ' . count(explode("\n", $errlog)) . ' 条', 'url' => 'rigger/logfile.html?file=err_db');

        $ret['works'] = $works;

        return succjson($ret);
    }
}
