Exemplo n.º 1
0
        $cc = trim($cc);
        $online_num = (int) $cc;
        #
        $ip = array();
        if ($sessions) {
            foreach ($sessions as $val) {
                $data = $this->redis()->hash_get($val);
                $ip[$data['client_ip']] = 1;
            }
        }
        #上报在线人数
        $arrData = array();
        $arrData['gameid'] = GAME_ID;
        $arrData['type'] = 'online';
        $arrData['appid'] = 3248;
        $arrData['appkey'] = 'd2f83a02a38e0a7c027b8bc7dccf4628';
        $arrData['timeline'] = time();
        $arrData['value'][] = array('opid' => OPERATOR_ID, 'server' => SERVER_ID ? SERVER_ID : 0, 'area' => AREA_ID ? AREA_ID : 0, 'value' => $online_num);
        $url = "http://monitor.uuzuonline.com/onlineReport";
        Com_System::open_url($url, 'post', json_encode(array($arrData)));
        $ip_num = count($ip);
        $now = time();
        $sql = "INSERT INTO `log_online` (`num`, `ip_num`, `add_time`) VALUES ( '{$online_num}', '{$ip_num}', '{$now}')";
        $result = Com_Db::factory('log')->query($sql);
        echo "time:{$now} result:" . var_export($result, true) . "\n";
        Com_DataCenter::getInstance()->publish_data(0, 'ser', array('time' => $now, 'online_num' => $online_num));
    }
}
$obj = new Calc_Online();
Com_Timer::register(array($obj, 'run'), "300");
Com_Timer::start();
Exemplo n.º 2
0
<?php

/**
 * 公会boss分配定时分配宝箱
 * Created by PhpStorm.
 * User: luozj
 * Date: 15/2/27
 * Time: 下午12:01
 */
require dirname(__FILE__) . '/../global.php';
TenYear::getInstance();
ini_set('default_socket_timeout', -1);
Com_AdCache::factory()->set_timeout(0);
//Com_Timer::start();
class CreateLogTable extends Com_Crontab
{
    public function run()
    {
        $log = new Com_GameLog();
        $log->create_table_name();
    }
}
$obj = new CreateLogTable();
#手动创建
if ($argv[1] == 'c') {
    $obj->run();
    exit;
}
Com_Timer::register(array($obj, 'run'), 36000);
Com_Timer::start();
Exemplo n.º 3
0
<?php

/**
 * 定时器脚本 统一处理间隔发送公告
 * @author zhouliting
 * @date 2014-11-14
 */
require dirname(__FILE__) . '/../global.php';
TenYear::getInstance();
ini_set('default_socket_timeout', -1);
Com_AdCache::factory()->set_timeout(0);
//Com_Log::write('xgame.send_system_notice',"crontab_send_system_notice\t");
#清理redis数据
$objSystemNotice = new Game_SystemNotice();
Com_Timer::register(array($objSystemNotice, 'crontab_send_system_notice'), 60);
Com_Timer::start();