本文整理汇总了PHP中TenYear类的典型用法代码示例。如果您正苦于以下问题:PHP TenYear类的具体用法?PHP TenYear怎么用?PHP TenYear使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TenYear类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: factory
public static function factory($db = 'game', $reload = false, $remote_settings = array())
{
if (!isset(self::$_dbs[$db]) || $reload) {
$dbConfig = TenYear::get_val('dbConfig');
switch ($db) {
case 'setting':
self::$_dbs[$db] = new DbClient($dbConfig['setting']['host'], $dbConfig['setting']['user'], $dbConfig['setting']['pass'], $dbConfig['setting']['name'], $dbConfig['pconnect']);
break;
case 'game':
self::$_dbs[$db] = new DbClient($dbConfig['game']['host'], $dbConfig['game']['user'], $dbConfig['game']['pass'], $dbConfig['game']['name'], $dbConfig['pconnect']);
break;
case 'log':
self::$_dbs[$db] = new DbClient($dbConfig['log']['host'], $dbConfig['log']['user'], $dbConfig['log']['pass'], $dbConfig['log']['name'], $dbConfig['pconnect']);
break;
case 'cross':
// 跨服配置
self::$_dbs[$db] = new DbClient($dbConfig['cross']['host'], $dbConfig['cross']['user'], $dbConfig['cross']['pass'], $dbConfig['cross']['name'], $dbConfig['pconnect']);
break;
case 'global_game':
#全局playerid
self::$_dbs[$db] = new DbClient($dbConfig['global_game']['host'], $dbConfig['global_game']['user'], $dbConfig['global_game']['pass'], $dbConfig['global_game']['name'], $dbConfig['pconnect']);
break;
default:
return false;
}
}
return self::$_dbs[$db];
}
开发者ID:bluefan,项目名称:phpsource,代码行数:28,代码来源:Db.php
示例2: run
public function run()
{
$objAccount = TenYear::getInstance('Data_Account');
$objPlayerInitGame = TenYear::getInstance('Game_PlayerInit');
for ($i = 1; $i <= 10; $i++) {
$strUserAccount = "ggmmhg100" . $i;
$playerid = $objAccount->get_pid_byaccount($strUserAccount);
$player_character = Cache_PlayerRole::getInstance()->get_player_role();
if (!$playerid) {
$name = $strUserAccount;
$playerid = $objAccount->add_account($strUserAccount, $name);
// $character = ($i%4)+1;
$character = rand(3, 4);
$arrCharacter = $player_character[$character];
$arrData = array();
$arrData['player_id'] = $playerid;
$arrData['user_account'] = $strUserAccount;
$arrData['name'] = $name;
$arrData['career_type'] = $arrCharacter['career_type'];
$arrData['avatar'] = $arrCharacter['avatar'];
$arrData['sex'] = $arrCharacter['sex'];
$arrData['ad_info'] = '';
$arrData['client_ip'] = '127.0.0.1';
$arrData['exec'] = 1;
$affectedRows = $objPlayerInitGame->active($arrData);
if ($affectedRows) {
$sql = "replace into test_account (player_id,user_account,career_type) values ('{$playerid}','{$strUserAccount}','{$arrCharacter['career_type']}')";
$result = $this->query($sql);
if ($result) {
echo "{$strUserAccount}\n";
}
}
}
}
}
开发者ID:bluefan,项目名称:phpsource,代码行数:35,代码来源:test_player.php
示例3: achieve_repair
public function achieve_repair($player_id)
{
# 修复一下符文成就相关的数据[NOTE:刷新成就相关脏数据用]
TenYear::getInstance(TenYear::game_name('PlayerSkill'))->handle_rune_refer_achieve($player_id);
# 修复一下天赋成就相关的数据[NOTE:刷新成就相关脏数据用]
TenYear::getInstance(TenYear::game_name('PlayerSkill'))->handle_dower_refer_achieve($player_id);
echo $player_id . "sync suc \n";
}
开发者ID:bluefan,项目名称:phpsource,代码行数:8,代码来源:achieve_repair.php
示例4: getMongoUtilObject
public static function getMongoUtilObject()
{
$mongoConfig = TenYear::get_val('mongoConfig');
$config = array('host' => $mongoConfig['host'], 'port' => $mongoConfig['port'], 'option' => array('connect' => true), 'db_name' => $mongoConfig['db'], 'username' => $mongoConfig['user'], 'password' => $mongoConfig['pass']);
$mongoUtilObj = new MongoUtil();
$mongoUtilObj->init($config);
$mongoUtilObj->selectCollection($mongoConfig['collection']);
return $mongoUtilObj;
}
开发者ID:bluefan,项目名称:phpsource,代码行数:9,代码来源:Mongo.php
示例5: get_cross
protected function get_cross($name, $isOne = false)
{
$className = TenYear::cross_name($name);
if ($isOne) {
return new $className();
}
$this->_objData[$className]++;
return TenYear::getInstance($className);
}
开发者ID:bluefan,项目名称:phpsource,代码行数:9,代码来源:Data.php
示例6: doAction
public function doAction()
{
$userInfo_json = base64_decode($_POST['data']);
$userInfo_array = json_decode($userInfo_json, true);
$state = isset($userInfo_array['state']) ? $userInfo_array['state'] : "";
$ips = isset($userInfo_array['ips']) ? $userInfo_array['ips'] : "";
$data = array();
$res = array();
if (!empty($state) && !in_array($state, $this->state)) {
$data['status'] = 8;
exit;
} else {
$data['status'] = 0;
}
if ($state == 'open') {
#开服
#Protocol::input(0, 7, 4, 514, array('type_id'=>1,'role_id'=>0));
#Protocol::out();
$res['status'] = 1;
if ($this->get_data('Online')->set_server_state($res)) {
$data['status'] = 1;
} else {
$data['status'] = 0;
}
} elseif ($state == 'close') {
#关服维护
Protocol::input(0, 7, 4, 514, array('type_id' => 1, 'role_id' => 0));
Protocol::out();
$res['status'] = 0;
if ($this->get_data('Online')->set_server_state($res)) {
$data['status'] = 1;
TenYear::getInstance();
$objSession = TenYear::getInstance('session');
$objSession->del_all_session();
} else {
$data['status'] = 0;
}
} elseif ('write_ip' == $state) {
#白名单
$res['write_ip'] = $ips;
if ($this->get_data('Online')->set_server_state($res)) {
$data['status'] = 1;
} else {
$data['status'] = 0;
}
} elseif ('black_id' == $state) {
#黑名单
$res['black_id'] = $ips;
if ($this->get_data('Online')->set_server_state($res)) {
$data['status'] = 1;
} else {
$data['status'] = 0;
}
}
echo json_encode($data);
return;
}
开发者ID:bluefan,项目名称:phpsource,代码行数:57,代码来源:ServerStateAction.php
示例7: flush_obj
/**
* 删除对象
*/
protected function flush_obj()
{
foreach ($this->_objGame as $className => $count) {
TenYear::delInstance($className);
}
foreach ($this->_objData as $className => $count) {
TenYear::delInstance($className);
}
}
开发者ID:bluefan,项目名称:phpsource,代码行数:12,代码来源:Crontab.php
示例8: handle_dirty_data
public function handle_dirty_data()
{
$player_id_list = $this->get_whole_player_list();
if (empty($player_id_list)) {
return false;
}
foreach ($player_id_list as $player_id) {
$player_info = TenYear::getInstance('Data_Player')->get_player_info($player_id);
$arr_player_detail = TenYear::getInstance('Data_PlayerDetail')->get_player_detail($player_id, array('skill_info', 'skill_rune_info'));
$skill_list_all = Cache_Skill::getInstance()->get_skill_list($player_info['career_type']);
$skill_list_distinct = Cache_Skill::getInstance()->get_distinct_skill_list($player_info['career_type']);
if (empty($skill_list_distinct)) {
echo "Warning: player_id={$player_id}|career_type=" . $player_info['career_type'] . "\n";
continue;
#$this->throw_error('60022'); # 没有符合玩家职业的技能配置信息
}
# 该步操作除了获取hash结构外,重置了每个技能的max_level为有效信息
$skill_hash_all = TenYear::getInstance('Game_PlayerSkill')->convert_skill_list_to_hash($skill_list_all);
$exception_flag = 0;
# 0无异常 >1异常
foreach ($skill_list_distinct as $val) {
if ($val['display'] == 0) {
continue;
}
$skill_id = $val['sid'];
# 问题玩家
if (isset($arr_player_detail['skill_info'][$skill_id]) && $arr_player_detail['skill_info'][$skill_id]['level'] > $skill_hash_all[$skill_id][1]['max_level']) {
echo "Warning: player_id={$player_id}|skill_id={$skill_id}|origin_level=" . $arr_player_detail['skill_info'][$skill_id]['level'] . "|max_level=" . $skill_hash_all[$skill_id][1]['max_level'] . "\n";
$arr_player_detail['skill_info'][$skill_id]['level'] = $skill_hash_all[$skill_id][1]['max_level'];
$exception_flag += 1;
}
if (isset($arr_player_detail['skill_rune_info'][$skill_id])) {
# 重置每个技能的符文为最大等级的激活状态
$rune_list_all = Cache_SkillRune::getInstance()->get_skill_rune_list_by_skill_id($skill_id);
$rune_hash_all = TenYear::getInstance('Game_PlayerSkill')->convert_rune_list_to_hash($rune_list_all);
foreach ($rune_hash_all as $rune_id => $rune_lv_info) {
if (isset($arr_player_detail['skill_rune_info'][$skill_id][$rune_id]) && $arr_player_detail['skill_rune_info'][$skill_id][$rune_id]['level'] > $rune_lv_info[1]['max_level']) {
echo "Warning: player_id={$player_id}|skill_id={$skill_id}|rune_id={$rune_id}|origin_level=" . $arr_player_detail['skill_rune_info'][$skill_id][$rune_id]['level'] . "|max_level=" . $rune_lv_info[1]['max_level'] . "\n";
$arr_player_detail['skill_rune_info'][$skill_id][$rune_id]['level'] = $rune_lv_info[1]['max_level'];
$exception_flag += 1;
}
}
}
}
if (!empty($exception_flag)) {
# 修正等级
/**
TenYear::getInstance('Data_PlayerDetail')->update_player_detail(
$player_id,
array('skill_info'=>$arr_player_detail['skill_info'], 'skill_rune_info' => $arr_player_detail['skill_rune_info'])
);
**/
}
}
echo "End ...\n";
}
开发者ID:bluefan,项目名称:phpsource,代码行数:56,代码来源:check_dirty_data.php
示例9: add_unions
public function add_unions($player_id, $friend_id)
{
try {
$objdata = TenYear::getInstance(TenYear::game_name('PlayerFriend'));
$objdata->add_unions($player_id, $friend_id);
echo "send success {$player_id}";
} catch (Exception $e) {
$error = "Exception: " . $e->getFile() . " line:" . $e->getLine() . " " . $e->getMessage();
echo $error;
}
}
开发者ID:bluefan,项目名称:phpsource,代码行数:11,代码来源:friend.php
示例10: factory
public static function factory($group = 'game', $reload = false)
{
if (!REDIS_CLUSTER) {
$group = 'game';
}
if (!isset(self::$_cache[$group]) || $reload) {
$settings = TenYear::get_val('redisConfig');
if (empty($settings) || !isset($settings[$group])) {
return false;
}
self::$_cache[$group] = new RedisClient($settings[$group]);
}
return self::$_cache[$group];
}
开发者ID:bluefan,项目名称:phpsource,代码行数:14,代码来源:AdCache.php
示例11: factory
public static function factory($group = 'setting', $reload = false)
{
if (!isset(self::$_mems[$group]) || $reload) {
if (isset(self::$_mems[$group])) {
unset(self::$_mems[$group]);
}
$settings = TenYear::get_val('memcachedConfig');
if (!isset($settings[$group])) {
//
return false;
}
self::$_mems[$group] = new MMemcached($settings, $group);
}
return self::$_mems[$group];
}
开发者ID:bluefan,项目名称:phpsource,代码行数:15,代码来源:Cache.php
示例12: flush_memcache
public function flush_memcache()
{
$settings = TenYear::get_val('memcachedConfig');
#var_export($settings);
if (!empty($settings['game']['host']) && !empty($settings['game']['port'])) {
$cmd = "echo 'flush_all' | nc {$settings['game']['host']} {$settings['game']['port']}";
echo "{$cmd} ...\n";
$last_line = system($cmd, $retval);
if ($retval !== 0) {
$this->throw_exception(array('message' => 'Failed to flush memcache ...', 'code' => 3));
}
} else {
$this->throw_exception(array('message' => 'Failed to get memcache configuration ...', 'code' => 4));
}
}
开发者ID:bluefan,项目名称:phpsource,代码行数:15,代码来源:generate_cond_func.php
示例13: get_search_list
public static function get_search_list($data)
{
$ret = array();
if ($data) {
foreach ($data as $key => $val) {
$is_hidden_vip = 0;
if (intval($val['vip']) > 0) {
$vip_info = TenYear::getInstance('Data_VipReward')->get_reward_log(intval($val['player_id']));
$is_hidden_vip = intval($vip_info['is_hidden_vip']);
}
$ret[$key] = array(0 => intval($val['player_id']), 1 => $val['name'], 2 => intval($val['level']), 3 => intval($val['sum_fpower']), 4 => $val['avatar'], 5 => intval($val['vip']), 6 => intval($val['is_friend']), 7 => intval($val['type']), 8 => $is_hidden_vip);
}
}
return $ret;
}
开发者ID:bluefan,项目名称:phpsource,代码行数:15,代码来源:Friend.php
示例14: fb
public function fb()
{
$sql = "select * from test_account";
$this->query($sql);
$arr_player = array();
while ($this->next_record()) {
$player_id = $this->get_field('player_id');
$arr_player[] = $player_id;
}
foreach ($arr_player as $player_id) {
$obj = TenYear::getInstance(TenYear::game_name('PlayerFB'));
$obj->get_chapter_fb_info($player_id, 0, 0);
echo "player:{$player_id} suc\n";
}
}
开发者ID:bluefan,项目名称:phpsource,代码行数:15,代码来源:clear_robot_bag.php
示例15: update_day
public function update_day()
{
if (!Com_Db::factory($this->db)->ping()) {
echo "ping log db fail\n";
return false;
}
$time = time();
$logsDir = DATA_PATH . "/logsdata";
$logsBackupDir = DATA_PATH . "/logsbackup";
$dbConfig = TenYear::get_val('dbConfig');
$dirhandle = opendir($logsDir);
if ($dirhandle) {
while (($file = readdir($dirhandle)) !== false) {
if ($file != '.' && $file != '..') {
$backfile = $logsBackupDir . '/' . $file;
$file = $logsDir . '/' . $file;
if (filemtime($file) < strtotime(date('Y-m-d 04:00:00', $time))) {
$status = 0;
$shell = "/data/mysql/bin/mysql -h{$dbConfig['log']['host']} -u{$dbConfig['log']['user']} -p{$dbConfig['log']['pass']} -e \"use {$dbConfig['log']['name']}; source {$file};\"";
echo $shell . "\n";
passthru($shell, $status);
if ($status == 0) {
echo "source sucess\n";
unlink($file);
} else {
echo "source fail status {$status}\n";
if (!is_dir($logsBackupDir)) {
mkdir($logsBackupDir);
}
shell_exec("mv {$file} {$backfile}");
echo "mv {$file} {$backfile}\n";
}
}
}
}
}
}
开发者ID:bluefan,项目名称:phpsource,代码行数:37,代码来源:Update.php
示例16: run
public function run()
{
$keys = Com_AdCache::factory('player')->keys("data|player:*");
if (!empty($keys)) {
foreach ($keys as $key) {
$player_info = $this->redis()->hash_get($key, array('player_id', 'level', 'union_id'));
if (intval($player_info['player_id']) <= 0) {
continue;
}
if (intval($player_info['level']) < 20) {
continue;
}
$objPlayerProp = TenYear::getInstance(TenYear::data_name('PlayerProp'));
$player_props = $objPlayerProp->get_player_all_prop($player_info['player_id']);
foreach ($player_props as $prop) {
if (isset($prop['intensive_level'])) {
echo "player_id={$player_info['player_id']}|player_prop_id={$prop['player_prop_id']}\n";
$objPlayerAchieve = TenYear::getInstance(TenYear::game_name('PlayerAchieve'));
$objPlayerAchieve->async_trigger_achieve_target($player_info['player_id'], 6, "1:" . $prop['quality'] . ":" . $prop['star_level'] . ":" . intval($prop['intensive_level']) . ":{$prop['player_prop_id']}", 4);
}
}
}
}
}
开发者ID:bluefan,项目名称:phpsource,代码行数:24,代码来源:test_player_achieve.php
示例17: getInstance
public static function getInstance()
{
return TenYear::getInstance(__CLASS__);
}
开发者ID:bluefan,项目名称:phpsource,代码行数:4,代码来源:Fairy.php
示例18: __construct
public function __construct()
{
parent::__construct();
TenYear::setInstance('TenYear', $this);
}
开发者ID:bluefan,项目名称:phpsource,代码行数:5,代码来源:clearTask.php
示例19: dirname
<?php
/**
* 异步GloryShop日志备份服务
* @author [email protected]
* @date 2015-4-20
*/
require dirname(__FILE__) . '/../global.php';
TenYear::getInstance();
ini_set('default_socket_timeout', -1);
Com_AdCache::factory()->set_timeout(0);
Com_Replication::set_interval_time(300);
//注册player_detail同步方法
$objPlayerDetail = new Data_GloryShop();
Com_Replication::register('player_glory_shop', array($objPlayerDetail, 'get_player_log'), array($objPlayerDetail, 'replace_to_mysql'));
//开始执行同步
Com_Replication::start();
开发者ID:bluefan,项目名称:phpsource,代码行数:17,代码来源:GloryShop.php
示例20: get_vip_special_reward_add_coeff
public static function get_vip_special_reward_add_coeff($func_id, $player_vip, $player_privilege_level, $player_id)
{
$vip_limit_type = Cache_VipLevelLimit::getInstance()->get_limit_info_func_id($func_id);
if ($vip_limit_type['fun_type'] == 1 && !empty($player_vip)) {
$vip_limit_info = Cache_VipLevelLimit::getInstance()->get_limit_info($player_vip, $func_id);
} elseif ($vip_limit_type['fun_type'] == 2 && !empty($player_privilege_level)) {
$left_time = TenYear::getInstance('Game_VipSpecial')->get_left_time($player_id);
if ($left_time > 0) {
$vip_limit_info = Cache_VipLevelLimit::getInstance()->get_limit_info($player_privilege_level, $func_id);
}
}
$vip_add_coeff = !empty($vip_limit_info) ? $vip_limit_info['max_times'] / 10000 : 0;
return $vip_add_coeff;
}
开发者ID:bluefan,项目名称:phpsource,代码行数:14,代码来源:Util.php
注:本文中的TenYear类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论