예제 #1
0
<?php

define('ROOT', dirname(__DIR__));
include ROOT . '/include/common.php';
Logger::set_name("cron_start_country");
echo date("Y-m-d H:i:s") . "|cron_start_country start \n";
$server_id = ConfigData::get('app|server_id', 1, TRUE);
$static_country_list = StaticData::read('country_list');
if (!isset($static_country_list[$server_id])) {
    echo "This server_id is no longer war in the country  \n";
    exit;
}
$scountry = array();
foreach ($static_country_list as $ckey => $cval) {
    if ($cval != $static_country_list[$server_id]) {
        continue;
    }
    $scountry[] = $ckey;
}
sort($scountry);
reset($scountry);
/*if(current($scountry) != $server_id){
    echo "This crontab  Return to normal\n";
    exit;
}*/
$uid = 'de721bcef5cba1fc182d186d98afe072';
list($player, $ret) = Player::instance($uid);
$player_country_handle = $player->get_player_class_handle('country');
$player_country_handle->removeprev();
$player_country_handle->initinfo();
echo date("Y-m-d H:i:s") . "|cron_start_country end \n";
예제 #2
0
                continue;
            }
            if ($data['uid']) {
                $suid = explode("_", $data['uid']);
                $suid = end($suid);
                list($player, $ret) = Player::instance($suid);
                if ($player) {
                    $player->to_bonus($bonus);
                    $player->save();
                }
            }
        }
    }
} else {
    //此处将是一个多维数组
    $bonus = StaticData::read('country_rank_bonus');
    $_data = $_country_handle->use_collection(NameMapper::get_country_uid_list_collection_name())->find(array('server_id' => $server_id), array('uid' => true, 'server_id' => true, 'rank' => true));
    if ($_data->count()) {
        foreach ($_data as $data) {
            if ($data['server_id'] != $server_id) {
                continue;
            }
            if ($data['uid']) {
                $suid = explode("_", $data['uid']);
                $suid = end($suid);
                list($player, $ret) = Player::instance($suid);
                $temp_player_tmp_backpack_handle = $player->get_player_class_handle('tmpbackpack');
                if ($player) {
                    $bonus_list = array();
                    if (isset($bonus[$data['rank']])) {
                        foreach ($bonus[$data['rank']]['bonus'] as $bval) {