//开放性测试奖励 if (1 == OPERATOR_ID && '2052310001' == SERVER_ID) { TenYear::getInstance('Game_BetaTestReward')->sync($arrData); } $ad_info = $strAdInfo > 0 ? 1 : 0; Com_DataCenter::getInstance()->publish_data($player_id, 'est', array('ad_info' => $ad_info, 'step' => 'create', 'time' => time())); $log_data = array('player_id' => $player_id, 'channel' => 1, 'client_ip' => $strIp, 'game_client_ip' => $client_ip, 'reg_time' => time(), 'ad_info' => $strAdInfo, 'player_level' => 1); #Log_Login::getInstance()->add_log($log_data); Log_Common::getInstance()->add_log($log_data, 'day'); $arr_cache = array('player_id' => $player_id, 'name' => $arrData["name"], 'user_account' => $strUserAccount, 'ad_info' => $arrData['ad_Info'], 'reg_time' => time(), 'career_type' => $arrData['career_type'], 'first_load' => 0); $objPlayer = TenYear::getInstance('Data_Player'); $objPlayer->set_rookie_loading_cache($player_id, $arr_cache); #广告系统用户推送激活 $activelog = Com_System::send_request(array('user_account' => $arrData['user_account']), 'active'); #广告系统用户推送每天首次登陆 $activelog = Com_System::send_request(array('user_account' => $arrData['user_account']), 'login'); #记录登陆登出信息 TenYear::getInstance('Data_Online')->set_online_list($player_id, array('login_time' => time(), 'logout_time' => time())); Com_DataCenter::getInstance()->publish_data($player_id, 'login', array('ad_info' => $ad_info, 'status' => 'on', 'keep_time' => 0, 'time' => time())); TenYear::getInstance('Game_DailySign')->init_daily_sign_info($player_id); #TenYear::getInstance('Game_PackageCode')->async_send_old_account_login_reward($player_id, $arrData['user_account'], $_SESSION['sid']); $rurl = $webUrl . '/index.php'; if ($bAjax) { echo "result=1&msg=" . urlencode($rurl); } else { echo "<meta http-equiv=refresh content='0; url=" . $rurl . "'>"; } } else { //激活用户失败 if ($bAjax) { echo "result=0&msg=" . $arrLanguage["10218"]['content'];
/** * 心跳同步 更新session expires * * @return unknown */ public function heart_sync($player_id) { $player_info = $this->get_data('Player')->get_player_info($player_id, array('silver', 'crystal', 'fame_level', 'career_type', 'gold', 'player_id', 'user_account', 'reg_time', 'ad_Info', 'level', 'vip', 'privilege_level', 'session_id', 'adult_flag', 'login_time', 'heart_time')); if (empty($player_info)) { return false; } $sessID = $player_info['session_id']; if (empty($sessID)) { return false; } $objSession = TenYear::getInstance('session'); $objSession->set_expire($sessID); $this->online_time($player_id, $player_info); //计算在线时长 if (OPERATOR_ID == 82) { $objT = $this->get_game('Tencent'); $seesion_info = $objT->get_param($player_id); $objT->isLogin(); } $data = $this->get_game('PlayerFunc')->red_icon($player_id, $player_info); Protocol::input($player_id, 8, 70, 7002, array(0 => $data, 1 => 1)); $time = date('H:i'); if ($time < '00:20') { $log_data = array('player_id' => $player_info["player_id"], 'channel' => 1, 'client_ip' => Com_System::get_client_ip(), 'game_client_ip' => Com_System::get_client_ip(), 'reg_time' => $player_info['reg_time'], 'ad_info' => $player_info['ad_Info'], 'player_level' => $player_info['level'], 'vip_level' => $player_info['vip'], 'vip_special_level' => $player_info['privilege_level']); Log_Common::getInstance()->add_log($log_data, 'day'); if ($player_info['ad_Info']) { Com_System::send_request(array('user_account' => $player_info['user_account']), 'login'); } } if ($time >= '05:05' && $time <= '05:15') { Com_Log::write("heart_sync." . $player_id, "start"); $syn_item['count_boss_oakland'] = 0; $syn_item['count_monsters_oakland'] = 0; $syn_item['count_chest_oakland'] = 0; SynPlayer::set_syn_data($syn_item); $data = SynPlayer::get_data(); Protocol::input($player_id, 7, 4, 417, array(0 => $data['m'], 1 => $data['u'])); } if ($player_info['level'] > 9) { $data = $this->get_game('Quit')->get_close_info($player_id); Protocol::input($player_id, 8, 7, 792, $data); $data = $this->get_game('Strengthen')->get_guide_list($player_id); Protocol::input($player_id, 8, 18, 1808, $data); } return true; }
public function player_upgrade($data) { if (empty($data)) { return false; } // Com_Log::write('xgame.upgrade', "player_upgrade:\t".$data); $data = json_decode($data, true); $player_id = $data['player_id']; $exp = intval($data['exp']); // Com_Log::write("player_upgrade.".$player_id,"param".var_export($data,true)); if ($exp == 0) { return false; } #经验是0不处理 $old_level = intval($data['level']); if ($old_level <= 0) { return false; } $level_exp = $data['level_exp']; $vip_level = $data['vip']; $name = $data['name']; $privilege_level = $data['privilege_level']; $career_type = $data['career_type']; $after_hero_hole = $data['after_hero_hole']; $gateway = $data['gateway']; //测试环境 推送到不同的gateway $union_id = $data['union_id']; $update = array(); $logs = array(); $level_config_array = array(); $level = $this->get_update_level($old_level, $exp, $logs, $level_config_array); // Com_Log::write('xgame.upgrade', "player_upgrade:$player_id\t".json_encode($level)); $update['exp'] = $level['exp'] < 0 ? 0 : $level['exp']; $update['level'] = $level['level']; $update['level_exp'] = $level['level_exp']; $update['upgrade_time'] = time(); //获取英雄后补孔开启数量 if ($update['level'] > 16) { $hole_num = $this->get_hero_after_hole_num($update['level']); if ($hole_num > 0 && $hole_num > $after_hero_hole) { $update['after_hero_hole'] = $hole_num; } } $result = $this->get_data('Player')->update_player_info($player_id, $update); if ($result) { // $logs[] = array('type'=>2,'item_id'=>1,'item_num'=>0,'amount'=>$arr_player['exp'],'front_attr'=>$arr_player['level'],'after_attr'=>$arr_player['level']); #为了升级不同步到上一次经验加个空日志 if ($logs) { Log_Common::getInstance()->add_multi_resource_log($player_id, $old_level, $vip_level, $privilege_level, 103, $logs); } $arr_player['exp'] = $update['exp']; $arr_player['level'] = $update['level']; $arr_player['level_exp'] = $update['level_exp']; #因为分了两个进程 所以这个地方属性和固定值要分开 Protocol_Player::p2c_part_update($player_id, $arr_player); // $arr_player['attr'] = array(); // $arr_player['skill_infos'] = array(); Protocol_Player::p2c_part_update($player_id, array('attr' => '', 'skill_infos' => '')); # 条件问卷查询推送 if ($arr_player['level'] > 8) { $this->get_game('ActivityQuestions')->get_cond_ids($player_id, 0, array('level' => $arr_player['level'], 'vip' => $vip_level)); } #功能开启 // Com_Log::write("player_upgrade.".$player_id,"old_level:{$old_level} level:{$arr_player['level']}"); $set_reward = Cache_NewServerActivity::getInstance()->get_level_reward(1); //新服活动,蛋疼的数字埋点 $ns = 0; for ($i = $old_level + 1; $i <= $arr_player['level']; $i++) { $this->get_game('FuncOpen')->do_func_open($player_id, 2, $i, array('level' => $arr_player['level'], 'vip' => $vip_level)); #玩家等级推送 if ($i == 8) { #获取玩家信息 $player_info = $this->get_data('Player')->get_player_info($player_id, array('user_account', 'ad_info')); if (!empty($player_info['ad_info'])) { $activelog = Com_System::send_request(array('user_account' => $player_info['user_account'], 'level' => $i), 'level'); } } if ($i > 20) { // Com_Log::write("player_upgrade.".$player_id,"old_level:{$old_level} i: {$i} level:{$arr_player['level']}"); $this->get_game('TaskMain')->check_level_task($player_id, $i); #检查任务状态 } if ($set_reward) { // 新服活动,蛋疼的数字埋点 foreach ($set_reward as $reward) { if (!$ns && $i == $reward['value']) { $this->get_game('PlayerFunc')->sync_func_tips($player_id, 1250); $ns = 1; break; } } } } if (!empty($level_config_array)) { foreach ($level_config_array as $key => $val) { if (!empty($val['unlock_skill_info'])) { $player_task = $this->get_data('PlayerTask')->get_task_info($player_id); $this->get_game('PlayerSkill')->flush_locked_skill($player_id, $career_type, $val['unlock_skill_info'], $key + 1, $player_task['main_val']); } if ($key == 42) { $this->get_game('PlayerWing')->update_wing_activation_condition($player_id, 7, $key); #激活翅膀 } if ($key == 30) { $my_arena_info = $this->get_data('KFArena')->get_kf_arena_info($player_id); if (empty($my_arena_info)) { $this->get_game('KFArena')->init_player_kf_arean($player_id, $name, $career_type); } } } } // $this->get_game('TaskTrigger')->trigger_task($player_id,8,8,$update['level']); if ($update['level'] > 4) { $this->get_game('PlayerFriend')->push_recommend_friend($player_id, $old_level, $update['level']); $this->get_game('PlayerAchieve')->async_trigger_achieve_target($player_id, 2, $update['level'], 2, $update['level']); #更新排行榜数据 $this->get_data('RankList')->set_level_list($player_id, $update['level']); if ($update['level'] > 19 && $union_id == 0) { $this->get_data('Player')->add_no_union_player($player_id, $update['level']); } } $this->get_game('PlayerGradeFunc')->async_update_grade_func($player_id, $update['level']); if ($update['level'] > 23) { $this->get_game('UnionAchieve')->async_trigger_union_achieve($player_id, 7, $update['level'], 2); } if ($update['level'] > 37) { $this->get_game('TaskChain')->upgrade_change_chain_task($player_id, $update['level']); } // 人物等级: // 1:恭喜{玩家名}人物等级达到{n}级,又一个新星冉冉升起! // $val = "玩家等级" $replace_info = array(array("rep_type" => 0, "rep_val" => $player_id), array("rep_type" => 7, "txt" => $arr_player['level'])); $this->get_game('SystemNotice')->push_sys_notice($player_id, 10, $arr_player['level'], $replace_info); // $arr_player['player_id'] = $this->_player[$player_id]['player_id']; Protocol::out($gateway); return true; } return false; }
public function run() { $rurl = MAIN_DOMAIN_URL; $arrData = $this->_parseData; $strUserAccount = isset($arrData["account"]) ? trim($arrData["account"]) : ""; $iAdultFlag = isset($arrData["adult_flag"]) ? $arrData["adult_flag"] : 0; $iAdultGameTime = isset($arrData["game_time"]) ? $arrData["game_time"] : 0; $strClientIp = isset($arrData["ip"]) ? $arrData["ip"] : ""; $strAdInfo = isset($arrData["ad_info"]) ? trim($arrData["ad_info"]) : ""; $strTocken = isset($arrData['tocken']) ? $arrData['tocken'] : ""; $serverId = isset($arrData['sid']) ? $arrData['sid'] : 0; $active_type = isset($arrData['active_type']) ? $arrData['active_type'] : 1; if ($iAdultFlag == 0 && $iAdultGameTime >= 3 * 3600) { $msg = Cache_Language::getInstance()->get_language_info(10306); Com_System::url_msg_redirect($msg['content'], $rurl); exit; } $account_info = $this->get_data('Account')->get_account_info($strUserAccount); if (!$account_info || empty($account_info['name'])) { $_SESSION = array(); $_SESSION['sid'] = session_id(); $_SESSION["account"] = $strUserAccount; $_SESSION['client_ip'] = $strClientIp; $_SESSION['ad_Info'] = $strAdInfo; $_SESSION['server_id'] = $serverId; $_SESSION['vip'] = 0; $_SESSION['level'] = 0; $ad_info = $strAdInfo > 0 ? 1 : 0; if (isset($account_info['player_id']) && $account_info['player_id']) { $playerid = $account_info['player_id']; Com_DataCenter::getInstance()->publish_data($playerid, 'login', array('ad_info' => $ad_info, 'status' => 'on', 'keep_time' => 0, 'time' => $this->current_time)); } else { $playerid = $this->get_data('Account')->add_account($strUserAccount, '', $serverId, $strAdInfo); $log_data = array('player_id' => $playerid, 'channel' => 2, 'user_account' => $strUserAccount, 'ad_info' => $strAdInfo, 'client_ip' => $strClientIp, 'reg_time' => $this->current_time, 'type' => 0, 'add_time' => $this->current_time); Log_Common::getInstance()->add_log($log_data); Com_DataCenter::getInstance()->publish_data($playerid, 'est', array('ad_info' => $ad_info, 'step' => 'get', 'time' => $this->current_time)); } $_SESSION['player_id'] = $playerid; $_SESSION['name'] = ''; #zhe shi hou hai mei ming zi $_SESSION['career_type'] = ''; #zhe shi hou hai mei ming zi $_SESSION['active_type'] = $active_type; $_SESSION['adult_flag'] = $iAdultFlag; $this->get_game('Online')->write_session(); $arr_cache = array('player_id' => $playerid, 'name' => '', 'user_account' => $strUserAccount, 'ad_info' => $strAdInfo, 'reg_time' => 0, 'career_type' => 0, 'first_load' => 0); $this->get_data('Player')->set_rookie_loading_cache($playerid, $arr_cache); # -------------------------------------------------------------------- # 活动日志记录 # -------------------------------------------------------------------- /** $event_log_info = array( 'log_type' => 'login', 'player_id' => $_SESSION['player_id'], 'login_time' => $this->current_time, 'logout_time' => 0, ); $this->get_game('Event')->async_deal_event_log($event_log_info); **/ if ($iAdultFlag == 0) { $this->get_game('Adlut')->add_timer($playerid); #放沉迷定时器 } Com_System::url_redirect(SERVER_DOMAIN . '/index.php'); } else { if ($iAdultFlag == 0) { $flag = $this->get_data('Online')->get_adlut_ban($account_info['player_id']); if (!$flag) { $this->get_game('Adlut')->add_timer($account_info['player_id']); #放沉迷定时器 } if ($flag) { $msg = Cache_Language::getInstance()->get_language_info(10306); Com_System::url_msg_redirect($msg['content'], $rurl); exit; } } $client_ip = Com_System::get_client_ip(); $this->get_game('DailySign')->async_trigger_login_times($account_info['player_id']); $objPlayerData = $this->get_data('Player'); if ($account_info['player_id'] == $_SESSION['player_id']) { // Com_Log::log("account:{$account_info['player_id']} session:{$_SESSION['player_id']} sid:{$_SESSION['']}",'login_test',1); $up_arr = array('session_id' => $_SESSION['sid'], 'adult_flag' => $iAdultFlag, 'client_ip' => $client_ip); //上一次离线时长计算 $pinfo = $objPlayerData->get_player_info($account_info['player_id'], array('logout_time', 'heart_time', 'offline_reward_time')); $logout_time = max($pinfo['logout_time'], $pinfo['heart_time'], $pinfo['offline_reward_time']); $last_offline_time = $this->current_time - $logout_time; $up_arr['last_offline_time'] = $last_offline_time; $up_arr['offline_reward_time'] = $this->current_time; if ($last_offline_time >= 3600) { //1小时以上给奖励 $up_arr['offline_reward_status'] = 1; } else { $up_arr['offline_reward_status'] = 0; } //已经登录 $objPlayerData->update_player_info($account_info['player_id'], $up_arr); Com_System::url_redirect(SERVER_DOMAIN . '/index.php'); exit; } $arrUser = $objPlayerData->get_player_info($account_info['player_id']); if ($arrUser['is_ban'] == 3) { #封号了 Com_System::url_msg_redirect("亲爱的魔法师,由于您的账号数据存在异常,魔法管理员已暂时将您的账号封停,如有疑问可联系客服咨询。", $rurl); exit; } if (empty($arrData['nologin']) && $arrUser['ban_time'] > $this->current_time) { Com_System::url_redirect(SERVER_DOMAIN . '/index.php' . "?ecode=-15"); } $oldPlayerId = isset($_SESSION['player_id']) ? $_SESSION['player_id'] : 0; if ($oldPlayerId) { //如果有老的playerid 则生成新的session_id // session_regenerate_id(); } $_SESSION = array(); $_SESSION['sid'] = session_id(); $_SESSION["player_id"] = $arrUser["player_id"]; $_SESSION['active_type'] = 0; $_SESSION['name'] = $arrUser["name"]; $_SESSION["account"] = $strUserAccount; $_SESSION['career_type'] = $arrUser['career_type']; $_SESSION['adult_flag'] = $iAdultFlag; $_SESSION['ad_Info'] = $arrUser['ad_Info']; $_SESSION['client_ip'] = $strClientIp; $_SESSION['server_id'] = $serverId; $_SESSION['vip'] = $arrUser['vip']; $_SESSION['level'] = $arrUser['level']; $objOnline = $this->get_game('Online'); $objOnline->write_session(); $up_arr = array('session_id' => $_SESSION['sid'], 'adult_flag' => $iAdultFlag, 'client_ip' => $client_ip); //上一次离线时长计算 $logout_time = max($arrUser['logout_time'], $arrUser['heart_time'], $arrUser['offline_reward_time']); $last_offline_time = $this->current_time - $logout_time; $up_arr['last_offline_time'] = $last_offline_time; $up_arr['offline_reward_time'] = $this->current_time; if ($last_offline_time >= 3600) { //1个小时以上给奖励 $up_arr['offline_reward_status'] = 1; } else { $up_arr['offline_reward_status'] = 0; } $objPlayerData->update_player_info($arrUser["player_id"], $up_arr); //更新下session $log_data = array('player_id' => $arrUser["player_id"], 'channel' => 1, 'client_ip' => $strClientIp, 'game_client_ip' => $client_ip, 'reg_time' => $arrUser['reg_time'], 'ad_info' => $arrUser['ad_Info'], 'player_level' => $arrUser['level'], 'vip_level' => $arrUser['vip'], 'vip_special_level' => $arrUser['privilege_level']); #Log_Login::getInstance()->add_log($log_data); Log_Common::getInstance()->add_log($log_data, 'day'); $arr_cache = array('player_id' => $arrUser["player_id"], 'name' => $arrUser["name"], 'user_account' => $strUserAccount, 'ad_info' => $arrUser['ad_Info'], 'reg_time' => $arrUser['reg_time'], 'career_type' => $arrUser['career_type'], 'first_load' => $arrUser['first_load']); $this->get_data('Player')->set_rookie_loading_cache($arrUser["player_id"], $arr_cache); $ad_info = $strAdInfo > 0 ? 1 : 0; Com_DataCenter::getInstance()->publish_data($arrUser["player_id"], 'login', array('ad_info' => $ad_info, 'status' => 'on', 'keep_time' => 0, 'time' => $this->current_time)); if ($ad_info == 1) { #广告系统用户推送每天首次登陆 if (date('Ymd', $arrUser["reg_time"]) != date('Ymd') && date('Ymd') != date('Ymd', $arrUser["login_time"])) { $activelog = Com_System::send_request(array('user_account' => $arrUser['user_account']), 'login'); } } #记录登陆登出信息 $this->get_data('Online')->set_online_list($arrUser["player_id"], array('login_time' => $this->current_time, 'logout_time' => $arrUser['logout_time'])); // Com_Log::log("arrUser:{$arrUser["player_id"]} session:{$_SESSION['player_id']} sid:{$_SESSION['sid']}",'login_test',1); # -------------------------------------------------------------------- # 活动日志记录 # -------------------------------------------------------------------- /** $event_log_info = array( 'log_type' => 'login', 'player_id' => $_SESSION['player_id'], 'login_time' => $this->current_time, 'logout_time' => 0, ); $this->get_game('Event')->async_deal_event_log($event_log_info); **/ Com_System::url_redirect(SERVER_DOMAIN . '/index.php'); } }
public function tencent() { $server_state = Com_System::check_server_halt(); if (!$server_state['state']) { $result = array('ret' => 1001, 'msg' => $server_state['msg']); echo json_encode($result); exit; } $arrData = $this->_parseData; //平台登陆测试开关 $is_login_debug = isset($arrData['nologin']) ? $arrData['nologin'] : false; $key_list = array('openid', 'openkey', 'pf', 'pfkey'); $miss_key_arr = array(); foreach ($key_list as $key) { if (empty($arrData[$key])) { $miss_key_arr[] = $key; } //$_SESSION[$key] = $arrData[$key]; $this->public_tencent_params[$key] = $arrData[$key]; } if (!empty($miss_key_arr) && !$is_login_debug) { printf("Login param miss: [%s]\n", implode('|', $miss_key_arr)); exit; } /* 合服后处理待定 if($serverid != Config::check('serverId')) { //todo 后续合服需要调整(通过hefuServerIds) $hefuServerIds = Config::check('hefuServerIds'); if($hefuServerIds) { $hefuServerIds = explode(',',$hefuServerIds); if(!in_array($serverid,$hefuServerIds)) { printf("Config errro: [Platform_server_id_%s != Config_server_id_%s]\n", $serverid, Config::check('serverId')); exit; } } else { printf("Config errro: [Platform_server_id_%s != Config_server_id_%s]\n", $serverid, Config::check('serverId')); exit; } } */ $result = $this->get_game('Tencent')->isLogin($this->public_tencent_params); //file_put_contents(PROJECT_ROOT.'/uuzudo.log',var_export(array(l1,$_SESSION,$result,$arrData),true)."\n",FILE_APPEND); if (!empty($result) && $result['ret'] == 0 || $is_login_debug) { //$this->isSafari(); //游戏登陆 /* $res = $this->ipLimit(); if(!$res){ $this->isClose(); } */ //$_SESSION['account'] = $arrData['openid']; //$_SESSION['id'] = 0; //$_SESSION['time'] = 0; //$this->run(); //$code = UserRegister::getInstance()->login(); //Com_System::url_redirect(SERVER_DOMAIN.'/index.php'); } else { //todo 玩家重新登陆 printf("Login error! [msg=%s]\n", json_encode($result['msg'])); exit; } $rurl = MAIN_DOMAIN_URL; $strUserAccount = isset($arrData['openid']) ? trim($arrData['openid']) : ""; $iAdultFlag = isset($arrData["adult_flag"]) ? $arrData["adult_flag"] : 0; $iAdultGameTime = isset($arrData["game_time"]) ? $arrData["game_time"] : 0; $strClientIp = isset($arrData["ip"]) ? $arrData["ip"] : ""; $strAdInfo = isset($arrData["ad_info"]) ? trim($arrData["ad_info"]) : ""; $strTocken = isset($arrData['tocken']) ? $arrData['tocken'] : ""; $serverId = isset($arrData['serverid']) ? $arrData['serverid'] : 0; $active_type = isset($arrData['active_type']) ? $arrData['active_type'] : 1; $platform = isset($arrData['platform']) ? trim($arrData['platform']) : ""; $openid = isset($arrData['openid']) ? trim($arrData['openid']) : ""; $openkey = isset($arrData['openkey']) ? trim($arrData['openkey']) : ""; $pf = isset($arrData['pf']) ? trim($arrData['pf']) : ""; $pfkey = isset($arrData['pfkey']) ? trim($arrData['pfkey']) : ""; /* if($iAdultFlag == 0 && $iAdultGameTime >= (3*3600)) { $msg = Cache_Language::getInstance()->get_language_info(10306); Com_System::url_msg_redirect($msg['content'],$rurl); exit; } */ // $playerid = $this->get_data('Account')->get_pid_byaccount($strUserAccount, true, $serverId); // Com_Log::log("===============[start]==============",'login_test',1); // Com_Log::log("user_account:{$strUserAccount}",'login_test',1); $account_info = $this->get_data('Account')->get_account_info($strUserAccount); // Com_Log::log($account_info,'login_test',1); // Com_Log::log($_SESSION,'login_test',1); //file_put_contents(PROJECT_ROOT.'/uuzudo.log',var_export(array(l2,$_SESSION,$account_info,$arrData),true)."\n",FILE_APPEND); if (!$account_info || empty($account_info['name'])) { // $sessAccount = $_SESSION["account"]; // if(isset($_SESSION['player_id']) && $_SESSION['player_id'] // || $sessAccount && $strUserAccount != $sessAccount){ // // } // session_regenerate_id(); $_SESSION = array(); $_SESSION['sid'] = session_id(); $_SESSION["account"] = $strUserAccount; $_SESSION['client_ip'] = $strClientIp; $_SESSION['ad_Info'] = $strAdInfo; $_SESSION['server_id'] = $serverId; $_SESSION['vip'] = 0; $_SESSION['level'] = 0; $_SESSION['openid'] = $openid; $_SESSION['openkey'] = $openkey; $_SESSION['pf'] = $pf; $_SESSION['pfkey'] = $pfkey; $_SESSION['platform'] = $platform; foreach (array('app_custom', 'invkey', 'itime', 'iopenid', 'app_appbitmap') as $key) { if (!empty($arrData[$key])) { $_SESSION[$key] = $arrData[$key]; } } //todo 临时解决 if (isset($_SESSION['app_custom'])) { $tmp_str = urldecode($_SESSION['app_custom']); $_SESSION['app_custom'] = str_replace('|', '.', $tmp_str); } $ad_info = $strAdInfo > 0 ? 1 : 0; if (isset($account_info['player_id']) && $account_info['player_id']) { $playerid = $account_info['player_id']; // Com_DataCenter::getInstance()->publish_data($playerid,'login',array('ad_info'=>$ad_info,'status'=>'on','keep_time'=>0,'time'=>$this->current_time)); } else { $playerid = $this->get_data('Account')->add_account($strUserAccount, '', $serverId, $strAdInfo); ############################################################################### # 注册用户,上报数据 Com_TencentDataUpload::getInstance()->init($platform, $serverId, $playerid, $openid); if (!($res = Com_TencentDataUpload::getInstance()->register_data_upload())) { Com_Log::write("uploadDataError", "register_data_upload failed!"); } ############################################################################### $log_data = array('player_id' => $playerid, 'channel' => 2, 'user_account' => $strUserAccount, 'ad_info' => $strAdInfo, 'client_ip' => $strClientIp, 'reg_time' => $this->current_time, 'type' => 0, 'add_time' => $this->current_time); Log_Common::getInstance()->add_log($log_data); //Com_DataCenter::getInstance()->publish_data($playerid,'est',array('ad_info'=>$ad_info,'step'=>'get','time'=>$this->current_time)); } $_SESSION['player_id'] = $playerid; $_SESSION['name'] = ''; #zhe shi hou hai mei ming zi $_SESSION['career_type'] = ''; #zhe shi hou hai mei ming zi $_SESSION['active_type'] = $active_type; $_SESSION['adult_flag'] = $iAdultFlag; $this->get_game('Online')->write_session(); $arr_cache = array('player_id' => $playerid, 'name' => '', 'user_account' => $strUserAccount, 'ad_info' => $strAdInfo, 'reg_time' => 0, 'career_type' => 0, 'first_load' => 0); $this->get_data('Player')->set_rookie_loading_cache($playerid, $arr_cache); # -------------------------------------------------------------------- # 活动日志记录 # -------------------------------------------------------------------- /** $event_log_info = array( 'log_type' => 'login', 'player_id' => $_SESSION['player_id'], 'login_time' => $this->current_time, 'logout_time' => 0, ); $this->get_game('Event')->async_deal_event_log($event_log_info); **/ if ($iAdultFlag == 0) { $this->get_game('Adlut')->add_timer($playerid); #放沉迷定时器 } $this->redis()->hash_set($this->user_tencent_table . ':' . $playerid, $this->public_tencent_params); /*######################################################################### # 玩家登陆成功,判断是否从任务集市进入,并保存传入参数到数据中心服redis # 如果不是从任务集市进入,则只写入最后一次登录的服务器ip和id等数据 if(isset($arrData['app_user_source']) && $arrData['app_user_source'] == "marketV3"){ $app_user_source = $arrData['app_user_source']; $app_contract_id = $arrData['app_contract_id']; $app_custom = $arrData['app_custom']; $arrTask = array( "player_id"=>$account_info['player_id'], "app_user_source"=>$app_user_source, "app_custom"=>$app_custom, "app_contract_id"=>$app_contract_id, "last_server_id"=>SERVER_ID, "last_server_ip"=>PROCESS_MAIN_IP, "last_server_host"=>SERVER_DOMAIN, "last_login_time"=>time() ); if(!$this->get_game('TencentTaskMarket')->set_tencent_task_data($openid,$arrTask)){ Com_Log::write("TencentTaskMarket","TaskMarket data failed!"); } }else{ $arrTask = array( "player_id"=>$account_info['player_id'], "last_server_id"=>SERVER_ID, "last_server_ip"=>PROCESS_MAIN_IP, "last_server_host"=>SERVER_DOMAIN, "last_login_time"=>time() ); if(!$this->get_game('TencentTaskMarket')->set_tencent_task_data($openid,$arrTask)){ Com_Log::write("TencentTaskMarket","TaskMarket data failed!"); } } ##########################################################################*/ Com_System::url_redirect(SERVER_DOMAIN . '/index.php'); } else { /* if($iAdultFlag == 0){ $flag = $this->get_data('Online')->get_adlut_ban($account_info['player_id']); if(!$flag){ $this->get_game('Adlut')->add_timer($account_info['player_id']); #放沉迷定时器 } if($flag){ $msg = Cache_Language::getInstance()->get_language_info(10306); Com_System::url_msg_redirect($msg['content'],$rurl); exit; } } */ $this->get_game('DailySign')->async_trigger_login_times($account_info['player_id']); $objPlayerData = $this->get_data('Player'); if ($account_info['player_id'] == $_SESSION['player_id']) { // Com_Log::log("account:{$account_info['player_id']} session:{$_SESSION['player_id']} sid:{$_SESSION['']}",'login_test',1); $up_arr = array('session_id' => $_SESSION['sid'], 'adult_flag' => $iAdultFlag); //上一次离线时长计算 $logout_time = $objPlayerData->get_player_info($account_info['player_id'], 'logout_time'); $last_offline_time = $this->current_time - $logout_time; $up_arr['last_offline_time'] = $last_offline_time; if ($last_offline_time >= 28800) { //8小时以上给奖励 $up_arr['offline_reward_status'] = 1; } else { $up_arr['offline_reward_status'] = 0; } //已经登录 $objPlayerData->update_player_info($account_info['player_id'], $up_arr); $_SESSION['openkey'] = $openkey; $_SESSION['pf'] = $pf; $_SESSION['pfkey'] = $pfkey; $_SESSION['platform'] = $platform; $_SESSION['openid'] = $openid; //file_put_contents(PROJECT_ROOT.'/uuzudo.log',var_export(array(l3,$_SESSION,$account_info,$arrData),true)."\n",FILE_APPEND); $objOnline = $this->get_game('Online'); $objOnline->write_session(); $this->redis()->hash_set($this->user_tencent_table . ':' . $account_info['player_id'], $this->public_tencent_params); Com_System::url_redirect(SERVER_DOMAIN . '/index.php'); exit; } $arrUser = $objPlayerData->get_player_info($account_info['player_id']); ############################################################################### # 登录成功,上报数据 $playerid = $account_info['player_id']; Com_TencentDataUpload::getInstance()->init($platform, $serverId, $playerid, $openid); $level = $arrUser['level']; if (!($res = Com_TencentDataUpload::getInstance()->login_data_upload($level))) { Com_Log::write("uploadDataError", "login_data_upload failed!" . var_export($res) . "sss"); } ############################################################################### if ($arrUser['is_ban'] == 3) { #封号了 Com_System::url_msg_redirect("亲爱的魔法师,由于您的账号数据存在异常,魔法管理员已暂时将您的账号封停,如有疑问可联系客服咨询。", $rurl); exit; } if (empty($arrData['nologin']) && $arrUser['ban_time'] > $this->current_time) { Com_System::url_redirect(SERVER_DOMAIN . '/index.php' . "?ecode=-15"); } $oldPlayerId = isset($_SESSION['player_id']) ? $_SESSION['player_id'] : 0; if ($oldPlayerId) { //如果有老的playerid 则生成新的session_id // session_regenerate_id(); } $_SESSION = array(); $_SESSION['sid'] = session_id(); $_SESSION["player_id"] = $arrUser["player_id"]; $_SESSION['active_type'] = 0; $_SESSION['name'] = $arrUser["name"]; $_SESSION["account"] = $strUserAccount; $_SESSION['career_type'] = $arrUser['career_type']; $_SESSION['adult_flag'] = $iAdultFlag; $_SESSION['ad_Info'] = $arrUser['ad_Info']; $_SESSION['client_ip'] = $strClientIp; $_SESSION['server_id'] = $serverId; $_SESSION['vip'] = $arrUser['vip']; $_SESSION['level'] = $arrUser['level']; $_SESSION['openid'] = $openid; $_SESSION['openkey'] = $openkey; $_SESSION['pf'] = $pf; $_SESSION['pfkey'] = $pfkey; $_SESSION['platform'] = $platform; $objOnline = $this->get_game('Online'); $objOnline->write_session(); //file_put_contents(PROJECT_ROOT.'/uuzudo.log',var_export(array(l4,$_SESSION,$account_info,$arrData),true)."\n",FILE_APPEND); $up_arr = array('session_id' => $_SESSION['sid'], 'adult_flag' => $iAdultFlag); //上一次离线时长计算 $last_offline_time = $this->current_time - $arrUser['logout_time']; $up_arr['last_offline_time'] = $last_offline_time; if ($last_offline_time >= 28800) { //8小时以上给奖励 $up_arr['offline_reward_status'] = 1; } else { $up_arr['offline_reward_status'] = 0; } $objPlayerData->update_player_info($arrUser["player_id"], $up_arr); //更新下session $log_data = array('player_id' => $arrUser["player_id"], 'channel' => 1, 'client_ip' => $strClientIp, 'game_client_ip' => Com_System::get_client_ip(), 'reg_time' => $arrUser['reg_time'], 'ad_info' => $arrUser['ad_Info'], 'player_level' => $arrUser['level'], 'vip_level' => $arrUser['vip'], 'vip_special_level' => $arrUser['privilege_level']); #Log_Login::getInstance()->add_log($log_data); Log_Common::getInstance()->add_log($log_data, 'day'); $arr_cache = array('player_id' => $arrUser["player_id"], 'name' => $arrUser["name"], 'user_account' => $strUserAccount, 'ad_info' => $arrUser['ad_Info'], 'reg_time' => $arrUser['reg_time'], 'career_type' => $arrUser['career_type'], 'first_load' => $arrUser['first_load']); $this->get_data('Player')->set_rookie_loading_cache($arrUser["player_id"], $arr_cache); $ad_info = $strAdInfo > 0 ? 1 : 0; //Com_DataCenter::getInstance()->publish_data($arrUser["player_id"],'login',array('ad_info'=>$ad_info,'status'=>'on','keep_time'=>0,'time'=>$this->current_time)); if ($ad_info == 1) { #广告系统用户推送每天首次登陆 if (date('Ymd', $arrUser["reg_time"]) != date('Ymd') && date('Ymd') != date('Ymd', $arrUser["login_time"])) { $activelog = Com_System::send_request(array('user_account' => $arrUser['user_account']), 'login'); } } #记录登陆登出信息 $this->get_data('Online')->set_online_list($arrUser["player_id"], array('login_time' => $this->current_time, 'logout_time' => $arrUser['logout_time'])); // Com_Log::log("arrUser:{$arrUser["player_id"]} session:{$_SESSION['player_id']} sid:{$_SESSION['sid']}",'login_test',1); /*######################################################################### # 玩家登陆成功,判断是否从任务集市进入,并保存传入参数到数据中心服redis if(isset($arrData['app_user_source']) && $arrData['app_user_source'] == "marketV3"){ $app_user_source = $arrData['app_user_source']; $app_contract_id = $arrData['app_contract_id']; $app_custom = $arrData['app_custom']; $arrTask = array( "player_id"=>$account_info['player_id'], "app_user_source"=>$app_user_source, "app_custom"=>$app_custom, "app_contract_id"=>$app_contract_id, "last_server_id"=>SERVER_ID, "last_server_ip"=>PROCESS_MAIN_IP, "last_server_host"=>SERVER_DOMAIN, "last_login_time"=>time() ); if(!$this->get_game('TencentTaskMarket')->set_tencent_task_data($openid,$arrTask)){ Com_Log::write("TencentTaskMarket","TaskMarket data failed!"); } }else{ $arrTask = array( "player_id"=>$account_info['player_id'], "last_server_id"=>SERVER_ID, "last_server_ip"=>PROCESS_MAIN_IP, "last_server_host"=>SERVER_DOMAIN, "last_login_time"=>time() ); if(!$this->get_game('TencentTaskMarket')->set_tencent_task_data($openid,$arrTask)){ Com_Log::write("TencentTaskMarket","TaskMarket data failed!"); } } ##########################################################################*/ # -------------------------------------------------------------------- # 活动日志记录 # -------------------------------------------------------------------- /** $event_log_info = array( 'log_type' => 'login', 'player_id' => $_SESSION['player_id'], 'login_time' => $this->current_time, 'logout_time' => 0, ); $this->get_game('Event')->async_deal_event_log($event_log_info); **/ $this->redis()->hash_set($this->user_tencent_table . ':' . $arrUser["player_id"], $this->public_tencent_params); Com_System::url_redirect(SERVER_DOMAIN . '/index.php'); } }