本文整理汇总了PHP中Com_AdCache::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Com_AdCache::factory方法的具体用法?PHP Com_AdCache::factory怎么用?PHP Com_AdCache::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Com_AdCache
的用法示例。
在下文中一共展示了Com_AdCache::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redis
protected function redis()
{
return Com_AdCache::factory('game');
/*$settings = TenYear::get_val('redisConfig');
if($settings['cross']['port'] == '6382')
return Com_AdCache::factory('cross');
else
return Com_AdCache::factory('game');*/
}
示例2: redis
protected function redis()
{
if (SERVER_ID == 2052310001) {
#s1端口特殊处理下
return Com_AdCache::factory('cross');
} else {
return Com_AdCache::factory('game');
}
// $settings = TenYear::get_val('redisConfig');
// if($settings['cross']['port'] == '6382')
// return Com_AdCache::factory('cross');
// else
// return Com_AdCache::factory('game');
}
示例3: run
public function run()
{
$keys = Com_AdCache::factory('player')->keys("data|player:*");
$default_bag_num = 42;
if (!empty($keys)) {
foreach ($keys as $key) {
$player_info = Com_AdCache::factory('player')->hash_get($key, array('player_id', 'level', 'bag_num'));
$player_id = intval($player_info['player_id']);
$bag_num = intval($player_info['bag_num']);
if ($bag_num > 0 && intval($bag_num) < $default_bag_num) {
$this->get_data("Player")->update_player_info($player_id, array("bag_num" => $default_bag_num));
echo "add:player_id={$player_id},old_bag_num={$bag_num},bag_num={$default_bag_num}<br/>";
}
}
}
}
示例4: run
public function run()
{
$keys = Com_AdCache::factory('player')->keys("data|player:*");
if (!empty($keys)) {
foreach ($keys as $key) {
$player_info = Com_AdCache::factory('player')->hash_get($key, array('player_id', 'level', 'union_id'));
if (intval($player_info['player_id']) <= 0) {
continue;
}
if (intval($player_info['level']) < 9) {
continue;
}
$this->achieve_repair($player_info['player_id']);
}
}
}
示例5: run
public function run()
{
$player_keys = Com_AdCache::factory('player')->keys("data|player:*");
foreach ($player_keys as $key) {
$player_info = Com_AdCache::factory('player')->hash_get($key);
$player_id = $player_info['player_id'];
$player_detail = $this->get_data('PlayerDetail')->get_player_detail($player_id);
if ($player_id) {
$this->get_game('BuffData')->buff_attr($player_id, false);
$objFpowerCalc = $this->get_game('FpowerCalc');
$objPlayer = $this->get_data('Player');
$objFpowerCalc->set_player_info($player_info);
$objFpowerCalc->set_player_detail($player_detail);
$player_fpower = $this->get_game('FpowerCalc')->calc_player_fpower($player_id);
$player_info['fpower'] = $update_fpower['fpower'] = $player_fpower['fpower'];
$update_fpower['buff_fpower'] = $syn_item['buff_fpower'] = $player_fpower['buff_fpower'];
$update_fpower['equip_fpower'] = $objFpowerCalc->calc_equip_fpower($player_id);
$player_info['equip_fpower'] = $update_fpower['equip_fpower'];
$update_fpower['sq_fpower'] = $objFpowerCalc->calc_sq_fpower($player_id);
$player_info['sq_fpower'] = $update_fpower['sq_fpower'];
$update_fpower['fairy_fpower'] = $objFpowerCalc->calc_fairy_fpower($player_id);
$player_info['fairy_fpower'] = $update_fpower['fairy_fpower'];
$update_fpower['hero_fpower'] = $objFpowerCalc->calc_hero_fpower($player_id);
$player_info['hero_fpower'] = $update_fpower['hero_fpower'];
$update_fpower['skill_fpower'] = $objFpowerCalc->calc_skill_fpower($player_id);
$player_info['skill_fpower'] = $update_fpower['skill_fpower'];
$update_fpower['wing_fpower'] = $objFpowerCalc->calc_wing_fpower($player_id);
$player_info['wing_fpower'] = $update_fpower['wing_fpower'];
$update_fpower['fpower'] = $player_info['fpower'] + $player_info['sq_fpower'] + $player_info['skill_fpower'] + $player_info['equip_fpower'];
$sum_fpower = $update_fpower['fpower'] + $player_info['hero_fpower'] + $player_info['fairy_fpower'] + $player_info['wing_fpower'] + $update_fpower['buff_fpower'];
$update_fpower['sum_fpower'] = $sum_fpower;
$result = $objPlayer->update_player_info($player_id, $update_fpower);
if ($result) {
Protocol_Player::p2c_part_update($player_id, array('attr' => '', 'fairy_info' => '', 'hero_info' => '', 'skill_infos' => '', 'wing' => ''));
echo $player_id . "sync suc \n";
}
}
}
}
示例6: run
public function run()
{
$keys = Com_AdCache::factory('cross')->keys("data|cache_key_arena_rank_user_list_cache:1:*");
foreach ($keys as $key) {
$user_info = $this->redis()->hash_get($key);
$player_info = $this->get_data('Player')->get_player_info($user_info['player_id']);
$rank_data = array();
$rank_data['player_id'] = $user_info['player_id'];
$rank_data['player_name'] = $player_info['name'];
$rank_data['career_type'] = $player_info['career_type'];
$rank_data['player_level'] = $player_info['level'];
$rank_data['union_name'] = $player_info['union_name'];
$rank_data['sum_fpower'] = $player_info['sum_fpower'];
$rank_data['server_id'] = SERVER_ID;
$rank_data['server_name'] = SHOW_TITLE;
$res = Com_AdCache::factory('cross')->hash_set($key, $rank_data);
if ($res == true) {
echo "{$user_info['player_id']} suc\n";
} else {
echo "{$user_info['player_id']} fail\n";
}
}
}
示例7: 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);
}
}
}
}
}
示例8: dirname
<?php
/**
* 异步GloryShop日志备份服务
* @author wanghui@uuzu.com
* @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();
示例9: sleep
sleep(1);
if ($auto_player_id) {
// echo "auto_player_id:".$auto_player_id."\n";
Com_AdCache::factory()->set('auto_player_id', $auto_player_id);
}
if ($auto_player_max_id) {
// echo "auto_player_max_id:".$auto_player_max_id."\n";
Com_AdCache::factory()->set('auto_player_max_id', $auto_player_max_id);
}
if ($auto_union_id) {
// echo "auto_union_id:".$auto_union_id."\n";
Com_AdCache::factory()->set('auto_union_id', $auto_union_id);
}
if ($auto_union_max_id) {
// echo "auto_union_max_id:".$auto_union_max_id."\n";
Com_AdCache::factory()->set('auto_union_max_id', $auto_union_max_id);
}
shell_exec("/etc/init.d/php-fpm restart");
sleep(1);
shell_exec("/etc/init.d/memcached restart");
sleep(1);
Com_Cache::factory('game')->flush();
Com_Cache::factory('setting')->flush();
sleep(1);
shell_exec("sudo -u nobody /usr/local/webserver/php/bin/php " . PROJECT_ROOT . "/crontab/process.php");
sleep(1);
/*
//初始化setting,game,log库
$files = array(
'setting' => dirname(__FILE__).'/tenyear2_settings.sql',
'game' => dirname(__FILE__).'/tenyear2_game.sql',
示例10: reset_task
/**
* 如果玩家没有出序章 在遇到C++服务器重启的时候 重置这写玩家的任务
*/
public function reset_task()
{
Com_Log::write('x_reset', "=============================[start]=========================");
$keys = Com_AdCache::factory('player')->keys("data|player:*");
if (!empty($keys)) {
$syndata['city_id'] = 2100;
$syndata['city_x'] = 3382;
$syndata['city_y'] = 3538;
$role_init_data = array();
foreach ($keys as $key) {
$player_info = Com_AdCache::factory('player')->hash_get($key, array('player_id', 'level', 'vip', 'map_id', 'career_type'));
// if($player_info['player_id'] != 980564) continue;
if ($player_info['level'] >= 10) {
continue;
}
Com_Log::write('x_reset', "player_id:{$player_info['player_id']}");
if (!isset($role_init_data[$player_info['career_type']]) && empty($role_init_data[$player_info['career_type']])) {
$role_init_data[$player_info['career_type']] = Cache_RoleAttrInit::getInstance()->get_role_attr_init($player_info['career_type']);
}
if ($player_info['map_id'] == 2100 && $player_info['level'] < 10) {
$this->init_set_task($player_info['player_id'], explode(":", $role_init_data[$player_info['career_type']]['default_task_id']));
// $this->get_data('PlayerTaskLog')->del_player_task_log($player_info['player_id']);
$syndata['level'] = 1;
$level_exp = Cache_RoleExp::getInstance()->get_role_exp(1);
$syndata['level_exp'] = intval($level_exp['need_exp']);
$syndata['exp'] = 0;
$this->get_data('Player')->update_player_info($player_info['player_id'], $syndata);
$update_fields = $this->get_game('PlayerSkill')->extend_set($player_info['player_id'], $player_info['career_type'], 1, false);
$update_fields['guide'] = '';
try {
$update_fields['wing_info'] = $this->get_game('PlayerWing')->create_player_wing($player_info['player_id'], false);
$update_fields['equip_wing'] = 0;
} catch (Exception $e) {
Com_Log::write('reset_del', "del wing error ##" . var_export($e, true));
}
$this->get_data('PlayerDetail')->update_player_detail($player_info['player_id'], $update_fields);
try {
$this->get_game('Fairy')->set_fairy_state_interface($player_info['player_id']);
} catch (Exception $e) {
Com_Log::write('reset_del', "del fairy error ##" . var_export($e, true));
}
$props = $this->get_data('PlayerProp')->get_player_all_prop($player_info['player_id']);
if ($props) {
foreach ($props as $ppid => $val) {
Com_Log::write('reset_del', "del prop player_id:{$player_info['player_id']} ##" . var_export($val, true));
$result = $this->get_data('PlayerProp')->delete_player_prop($player_info['player_id'], $val, true, array('cmd_id' => 107, 'level' => $player_info['level'], 'vip' => $player_info['vip']));
if (!$result) {
Com_Log::write('reset_del', "del prop error ##" . var_export($val, true));
}
}
}
}
}
}
Com_Log::write('x_reset', "=============================[end]=========================");
}
示例11: setRunStat
public function setRunStat($dateKey, $process_id, $time = null)
{
if ($time == null) {
$time = time();
}
return Com_AdCache::factory()->hset('process_control_' . $dateKey, $process_id, $time);
}
示例12: Player_PlayerNameBase
$objName = new Player_PlayerNameBase();
$objName->start();
//同步黑白名单
$db_global = Com_Db::factory('global_game');
$db_global->query("select * from global_ip where id =1");
$ip_white = "";
$ip_black = "";
if ($db_global->nextrecord()) {
$pData = $db_global->record;
$ip_white = $pData['ip_white'];
$ip_black = $pData['ip_black'];
}
file_put_contents($logFile, "获取黑白名单 white:" . $ip_white . " black:" . $ip_black . "···\n", FILE_APPEND);
Com_AdCache::factory()->hash_set('data|server_status', 'status', "0");
Com_AdCache::factory()->hash_set('data|server_status', 'black_id', $ip_black);
Com_AdCache::factory()->hash_set('data|server_status', 'write_ip', $ip_white);
# ----------------------------------------------------------------------------
# 生成天梯与竞技场假人数据
# ----------------------------------------------------------------------------
file_put_contents($logFile, "生成天梯与竞技场假人数据...\n", FILE_APPEND);
$output = array();
exec("/usr/local/webserver/php/bin/php " . PROJECT_ROOT . "/test/generate_dummy_role.php 0", $output, $return_val);
if ($return_val) {
# return_val不为0表示脚本报异常,执行失败
file_put_contents($logFile, "生成天梯与竞技场假人数据失败...\n", FILE_APPEND);
exit;
}
file_put_contents($logFile, "生成天梯与竞技场假人数据成功...\n", FILE_APPEND);
# ----------------------------------------------------------------------------
# 对空天梯榜前20名插入机器人
# ----------------------------------------------------------------------------
示例13: chdir
chdir(PROCESS_PATH);
//cpunum
$cpuNum = Process_Server::getCpuNum();
//上次检测时间
$lastRunTime = 0;
//当前检测时间
$nowRunTime = time();
//上次domain执行时间
$damonRunTime = 0;
$damonCheckLife = 30;
//进程列表
$processList = array();
$processUpdateTime = 0;
$processUpdateLife = 300;
//每日已经启动进程LIST 避免没有启动
$redis = Com_AdCache::factory();
$dateKey = date('Y-m-d');
$processRunList = array();
$processRunList[$dateKey] = $objProcess->getRunStat($dateKey);
$firstLoop = true;
while (true) {
$restart = false;
if ($restart = Com_Queued::receive_byrpop("process")) {
# 从队列process表尾获取元素,返回nil或者队列名与元素组成的数组
$processList = $objProcess->getProcessList();
foreach ($processList as $process) {
if ($process['process_interval']) {
continue;
}
if (!$mainProcess && $process['process_flag']) {
continue;
示例14: redis
protected function redis()
{
return Com_AdCache::factory('player');
}
示例15: sys_player_sum_fpower
/**
* 同步玩家总战力
*/
public function sys_player_sum_fpower()
{
$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', 'sum_fpower'));
if (intval($player_info['player_id']) <= 0) {
continue;
}
echo "add:player_id={$player_info['player_id']},sum_fpower={$player_info['sum_fpower']}<br/>";
$this->set_player_sum_fpower($player_info['player_id'], $player_info['sum_fpower']);
}
}
}