当前位置: 首页>>代码示例>>PHP>>正文


PHP TenYear::get_val方法代码示例

本文整理汇总了PHP中TenYear::get_val方法的典型用法代码示例。如果您正苦于以下问题:PHP TenYear::get_val方法的具体用法?PHP TenYear::get_val怎么用?PHP TenYear::get_val使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TenYear的用法示例。


在下文中一共展示了TenYear::get_val方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: clear_challenge

 public function clear_challenge()
 {
     $settings = TenYear::get_val('redisConfig');
     if (!empty($settings['game']['host']) && !empty($settings['game']['port'])) {
         # 虚拟玩家存在game库的缓存域空间中
         $cmd1 = "redis-cli -h {$settings['game']['host']} keys 'data|player_challenge_*' | xargs redis-cli -h {$settings['game']['host']} del";
         $cmd2 = "redis-cli -h {$settings['game']['host']} set auto_challenge_rank 0";
         $cmd3 = "redis-cli -h {$settings['game']['host']} set auto_challenge_battle_seq 0";
         $cmd4 = "redis-cli -h {$settings['game']['host']} hset daily_time:global challenge_monster_flush_seq 0";
         echo "{$cmd1} ...\n";
         echo "{$cmd2} ...\n";
         echo "{$cmd3} ...\n";
         echo "{$cmd4} ...\n";
         $last_line = system($cmd1, $retval1);
         $last_line = system($cmd2, $retval2);
         $last_line = system($cmd3, $retval3);
         $last_line = system($cmd4, $retval4);
         if ($retval1 !== 0 || $retval2 !== 0 || $retval3 !== 0 || $retval4 !== 0) {
             $this->throw_exception(array('message' => 'Failed to clear challenge...', 'code' => 3));
         }
     } else {
         $this->throw_exception(array('message' => 'Failed to get redis configuration ...', 'code' => 4));
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:24,代码来源:fill_up_ladder.php

示例8: fscanf

}
echo "游戏数据库:{$dbConfig['game']['name']}, 服务器id:" . SERVER_ID . ", 当前玩家数量:{$playerNum}, 确认清档请输入yes | no退出\n";
fscanf(STDIN, "%s", $input);
if ($input != 'yes') {
    exit;
}
$dataFiles = array(DATA_PATH . '/cache', DATA_PATH . '/fightreport', DATA_PATH . '/logs', DATA_PATH . '/logsdata', DATA_PATH . '/replicationdata');
foreach ($dataFiles as $file) {
    if (!is_dir($file)) {
        mkdir($file, 755);
    }
    shell_exec("chown -R nobody:nobody {$file}");
    sleep(1);
}
sleep(1);
$dbConfig = TenYear::get_val('dbConfig');
$truncate_file = dirname(__FILE__) . '/../Server/truncate.sql';
if (is_file($truncate_file)) {
    echo "mysql -hlocalhost -u{$dbConfig['game']['user']} -p{$dbConfig['game']['pass']} -e \" use {$dbConfig['game']['name']}; source {$truncate_file};\"";
    shell_exec("mysql -hlocalhost -u{$dbConfig['game']['user']} -p{$dbConfig['game']['pass']} -e \" use {$dbConfig['game']['name']}; source {$truncate_file};\"");
}
ini_set('default_socket_timeout', -1);
Com_AdCache::factory()->set_timeout(0);
$auto_player_id = Com_AdCache::factory()->get('auto_player_id');
$auto_player_max_id = Com_AdCache::factory()->get('auto_player_max_id');
$auto_union_id = Com_AdCache::factory()->get('auto_union_id');
$auto_union_max_id = Com_AdCache::factory()->get('auto_union_max_id');
Com_AdCache::factory()->flushAll();
Com_AdCache::factory('queue')->flushAll();
sleep(1);
if ($auto_player_id) {
开发者ID:bluefan,项目名称:phpsource,代码行数:31,代码来源:ServerData.php

示例9: get_userInfo


//.........这里部分代码省略.........
     }
     if (is_numeric($gm)) {
         $condition .= " gm =" . $gm . " AND";
     }
     if ($name) {
         $condition .= " name like '%" . $name . "%' AND";
     }
     if ($created_at[0]) {
         $condition .= " reg_time >= " . strtotime($created_at[0]) . " AND";
     }
     if ($created_at[1]) {
         $condition .= " reg_time <= " . strtotime($created_at[1]) . " AND";
     }
     if ($level[0]) {
         $condition .= " level >= " . $level[0] . " AND";
     }
     if ($level[1]) {
         $condition .= " level <= " . $level[1] . " AND";
     }
     if ($vip[0]) {
         $condition .= " vip >= " . $vip[0] . " AND";
     }
     if ($vip[1]) {
         $condition .= " vip <= " . $vip[1] . " AND";
     }
     if ($condition) {
         $condition = 'where ' . $condition;
         $condition = substr($condition, 0, -3);
     }
     $page_total_num_sql = 'select count(`player_id`) as total from player ' . $condition;
     $page_total_num = $this->get_one($page_total_num_sql, null);
     $page_num = ceil($page_total_num['total'] / $page_size);
     $page_num_sql = 'select * from player ' . $condition . ' limit ' . ($page * $page_size - $page_size) . ',' . $page_size;
     $userInfoData = $this->select_all($page_num_sql);
     foreach ($userInfoData as $k => $v) {
         $data_player = $this->get_data('Player');
         $player_info = $data_player->get_player_info($v['player_id']);
         if (!$player_info) {
             continue;
         }
         foreach ($player_info as $field => $val) {
             if (!array_key_exists($field, $v)) {
                 continue;
             }
             if ($field == "reg_time") {
                 $userInfoData[$k]['reg_time'] = date('Y-m-d H:i:s', $player_info['reg_time']);
             } elseif ($field == "login_time") {
                 $userInfoData[$k]['login_time'] = date('Y-m-d H:i:s', $player_info['login_time']);
             } else {
                 $userInfoData[$k][$field] = $val;
             }
         }
         /*
         $userInfoData[$k]['reg_time'] = date('Y-m-d H:i:s',$player_info['reg_time']);
         $userInfoData[$k]['login_time'] = date('Y-m-d H:i:s',$player_info['login_time']);
         unset($player_info['reg_time'],$player_info['login_time']);
         $userInfoData[$k] = $userInfoData[$k] + $player_info;
         */
         //获取声望等级
         if (isset($v['fame_level'])) {
             $fame_level = isset($player_info['fame_level']) ? $player_info['fame_level'] : $v['fame_level'];
             $fameInfo = Cache_PlayerFame::getInstance()->get_player_fame_info($fame_level);
             if (!empty($fameInfo)) {
                 $userInfoData[$k]['fame_level'] = $fameInfo['title'];
             } else {
                 $userInfoData[$k]['fame_level'] = '无名';
             }
         }
         //VIP特权
         $vip_special_info = $this->get_data('VipSpecial')->get_vip_special_info($v['player_id']);
         $privilege_left_date = 0;
         $privilege_level = 0;
         if (!empty($vip_special_info)) {
             $privilege_level = $vip_special_info['vip_special_level'];
             $privilege_left_date = $vip_special_info['left_date'];
         }
         $userInfoData[$k]['privilege_level'] = $privilege_level;
         $userInfoData[$k]['privilege_left_date'] = $privilege_left_date;
         //获取公会贡献值
         if (!empty($player_info['union_id'])) {
             $gh_con = $this->get_data('UnionPlayer')->get_union_player_info($player_info['union_id'], $v['player_id']);
             $userInfoData[$k]['gh_con'] = $gh_con['total_dedicate'];
         } else {
             $userInfoData[$k]['gh_con'] = 0;
         }
     }
     $dbConfig = TenYear::get_val("dbConfig");
     $tableFieldsSql = "SELECT COLUMN_NAME as `field`, COLUMN_COMMENT as `comment` FROM INFORMATION_SCHEMA.COLUMNS  WHERE TABLE_NAME = 'player' AND TABLE_SCHEMA = '" . $dbConfig["game"]["name"] . "'";
     $tableFields = $this->get_list($tableFieldsSql);
     $fields = array();
     if (!empty($tableFields)) {
         foreach ($tableFields as $comments) {
             $fields[$comments['field']] = $comments['comment'];
         }
         $fields['gh_con'] = "公会贡献值";
     }
     $userInfoData['all_page'] = $page_total_num['total'];
     $userInfoData['fields'] = $fields;
     return $userInfoData;
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:101,代码来源:GetUserInfoGM.php

示例10: __construct

 public function __construct()
 {
     $this->_settings = TenYear::get_val('remote_server');
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:4,代码来源:Base.php


注:本文中的TenYear::get_val方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。