Пример #1
0
                $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) {
                            $temp_player_tmp_backpack_handle->add_item($bval['id'], $bval['number'], 'country_bonus');
                        }
                    }
                }
                //如果此人第一,将起加入到当天国战中
                if ($data['rank'] == 1) {
                    $player_country_handle = $player->get_player_class_handle('country');
                    $times = date('Ymd', strtotime($player_country_handle->_counrty_week_str[Player_Const::COUNTRY_BATTLE_WEEK], NOWTIME));
                    $userinfo = $player_country_handle->get_country_user_list(array('uid' => $data['uid']));
                    $userinfo = $userinfo[0];
                    $userinfo['player_detail'] = $player_country_handle->player_detail($data['uid']);
                    $country_data = $_country_handle->use_collection(NameMapper::get_country_info_collection_name())->update(array('times' => (string) $times), array('$set' => array('top' => serialize($userinfo), 'status' => 1)));
                    Logger::error('$times:' . $times . 'top:' . serialize($userinfo));
                    echo date('Y-m-d H:i:s'), '$times:' . $times;
                    $lasttimes = date('Ymd', strtotime("last " . $player_country_handle->_counrty_week_str[Player_Const::COUNTRY_BATTLE_WEEK], NOWTIME));
                    $_country_handle->use_collection(NameMapper::get_country_info_collection_name())->update(array('times' => (string) $lasttimes), array('$set' => array('top' => array())));
                    Logger::error('$lasttimes:' . $lasttimes);
                    echo '$lasttimes:' . $lasttimes;
                }
            }
        }
    } else {
        echo 'error 1', PHP_EOL;
    }
}
echo date("Y-m-d H:i:s") . "|cron_country_bonus end \n";