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


PHP Com_AdCache类代码示例

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


在下文中一共展示了Com_AdCache类的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');*/
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:9,代码来源:KFDuel.php

示例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');
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:14,代码来源:KFArena.php

示例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/>";
             }
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:16,代码来源:SyncPlayerBag.php

示例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']);
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:16,代码来源:achieve_repair.php

示例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";
             }
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:39,代码来源:fix_player_fpower.php

示例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";
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:23,代码来源:fix_kfarena.php

示例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);
                 }
             }
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:24,代码来源:test_player_achieve.php

示例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();
开发者ID:bluefan,项目名称:phpsource,代码行数:17,代码来源:GloryShop.php

示例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',
开发者ID:bluefan,项目名称:phpsource,代码行数:31,代码来源:ServerData.php

示例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]=========================");
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:59,代码来源:TaskMain.php

示例11: 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名插入机器人
# ----------------------------------------------------------------------------
开发者ID:bluefan,项目名称:phpsource,代码行数:31,代码来源:ServerDataForgm.php

示例12: batch_sell_prop

 /**
  * 一键出售道具
  * @param $player_id
  * @return array
  * @throws Exception]
  */
 public function batch_sell_prop($player_id)
 {
     $sell_id = array();
     $objPlayerPropData = $this->get_data('PlayerProp');
     $prop_list = $objPlayerPropData->get_player_prop_by_item_position($player_id);
     //冲从包裹取出道具
     if ($prop_list) {
         $props = array();
         foreach ($prop_list as $prop) {
             $props[] = $prop['prop_id'];
         }
         $prop_configs = Cache_Prop::getInstance()->get_prop_info($props);
         foreach ($prop_list as $key => $prop) {
             if ($prop_configs[$prop['prop_id']]['type'] == 3 && $prop_configs[$prop['prop_id']]['sub_type'] == 21 && $prop_configs[$prop['prop_id']]['quality'] <= 4) {
                 $sell_id[$prop['player_prop_id']] = $prop;
             } elseif ($prop_configs[$prop['prop_id']]['type'] == 1 && $prop_configs[$prop['prop_id']]['sub_type'] <= 12 && $prop_configs[$prop['prop_id']]['quality'] <= 2) {
                 $sell_id[$prop['player_prop_id']] = $prop;
             }
         }
     }
     if ($sell_id) {
         $get_silver = 0;
         foreach ($sell_id as $prop) {
             if ($prop_configs[$prop['prop_id']]['sale_price'] > 0) {
                 $get_silver += $prop_configs[$prop['prop_id']]['sale_price'] * $prop['item_num'];
             }
         }
         if ($get_silver) {
             $player_info = $this->get_data('Player')->get_player_info($player_id, array('level', 'vip', 'silver', 'privilege_level'));
             $this->get_data('Player')->check_player_resource($player_id, $player_info, "+", 'silver', $get_silver);
             $result = true;
             $objPlayerPropData->start_watch($player_id);
             $this->start_trans();
             $log_param = array('level' => $player_info['level'], 'vip' => $player_info['vip'], 'cmd_id' => 804);
             foreach ($sell_id as $player_prop_id => $val) {
                 $result = $objPlayerPropData->update_prop_num($player_id, $val, $val['item_num'], "-", $log_param);
                 $sell_id[$player_prop_id] = 0;
                 if (!$result) {
                     $this->throw_error(80003, '10180062601');
                 }
             }
             if ($result) {
                 $result = $this->get_data('Player')->update_player_resource($player_id, $player_info, 804);
             }
             if ($result) {
                 Com_AdCache::set_pipe(false);
                 $this->commit();
                 $out['result'] = 1;
                 $out['item'] = array('pos' => 1, 'index' => array());
                 $asyData = array();
                 foreach ($sell_id as $arr_prop_detail) {
                     $out['item']['index'][] = $arr_prop_detail['grid'];
                 }
                 $out['silver'] = Cache_Currency::getInstance()->get_index('silver') . ":" . $get_silver;
                 Protocol_Prop::prop_806($player_id, $sell_id);
                 return $out;
             }
         }
     }
     return array('result' => 1, array());
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:67,代码来源:PlayerBag.php

示例13: cache_close

 public function cache_close()
 {
     Com_Cache::close();
     Com_AdCache::close();
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:5,代码来源:TenYear.php

示例14: 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);
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:7,代码来源:Server.php

示例15: 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;
开发者ID:bluefan,项目名称:phpsource,代码行数:31,代码来源:Control.php


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