/** * @Purpose: * c++进入副本请求 * @Method Name: enter_fb_req_s2p() * @Parameter: $player_id 玩家ID * @Parameter: $map_id 副本ID * @Return: 返回请求结果 */ public function enter_fb_req_s2p($player_id, $map_id, $portal_id) { $map_id = intval($map_id); $data = array(); $is_task_fb = 0; $this->start_trans(); if (is_array($player_id)) { $enter_fb_res = array(); //获取副本配置表 $fb_table = $this->get_fb_table_data($map_id); #VIP副本验证 if ($this->vip_fb_chapter == $fb_table['chapter'] && $this->vip_fb_page == $fb_table['page']) { $buy_times_table = Cache_BuyTimes::getInstance()->get_buy_times_info(4); $map_vip_table = Cache_MapVip::getInstance()->get_map_vip_info(array('map_id' => $map_id)); foreach ($player_id as $pkeys => $pid) { #获取玩家副本记录 $fb_data = $this->get_data('PlayerFB')->get_player_fb_info($pid); if (empty($fb_data) || $fb_data['vip_sweep_state'] != 0 || $fb_data['sweep_state'] != 0) { foreach ($player_id as $keys => $val) { $data['player_id'][$keys] = $val; $data['error_code'][$keys] = $this->return_code['receive']; if ($fb_data['vip_sweep_state'] == 1 || $fb_data['sweep_state'] == 1) { $data['error_code'][$keys] = $this->return_code['sweeping']; } } $data['map_id'] = $map_id; $rtn_error = Struct_PlayerAttr::get_enter_fb_ack_struct_p2s($data); return $rtn_error; } $player_info = $this->get_data('Player')->get_player_info($pid, array('level', 'vip', 'privilege_level')); #已使用的日次数 $used_day_times = $this->get_data('PlayerFB')->get_player_fb_num($pid, 'vip_used_times'); #已增加的日次数 $add_day_times = $this->get_data('PlayerFB')->get_player_fb_num($pid, 'vip_add_times'); $code = 0; #等级不足 if (!isset($player_info['level']) || intval($player_info['level']) < $map_vip_table['level_limit']) { $code = $this->return_code['level_low']; } else { if (!isset($player_info['vip']) || intval($player_info['vip']) < $map_vip_table['vip_level_limit']) { $code = $this->return_code['vip_low']; } else { if ($used_day_times >= $this->vip_day_num_limit + $add_day_times) { $code = $this->return_code['no_times']; } else { if (!isset($buy_times_table['per_num']) || $buy_times_table['per_num'] < 1) { $code = $this->return_code['sql_error']; } } } } if (!empty($code)) { foreach ($player_id as $keys => $val) { $data['player_id'][$keys] = $val; $data['error_code'][$keys] = $code; } $data['map_id'] = $map_id; $rtn_error = Struct_PlayerAttr::get_enter_fb_ack_struct_p2s($data); return $rtn_error; } $enter_fb_res[$pkeys] = $this->return_code['true']; #增加已使用日次数 $add_res = $this->get_data('PlayerFB')->add_player_fb_num($pid, 'vip_used_times'); if (!$add_res) { $enter_fb_res[$pkeys] = $this->return_code['sql_error']; } //找回资源埋点 $this->get_game('GetBackCurrency')->add_function_day_times($pid, 3); } } else { if (in_array($fb_table['dungeon_type'], $this->dungeon_type)) { //副本章节合法性验证 if (!$fb_table || $fb_table['chapter'] < 0 || $fb_table['page'] < 1) { foreach ($player_id as $keys1 => $val1) { $data['player_id'][$keys1] = $val1; $data['error_code'][$keys1] = $this->return_code['no_enter']; } $data['map_id'] = $map_id; $data['portal_id'] = $portal_id; $rtn_error = Struct_PlayerAttr::get_enter_fb_ack_struct_p2s($data); return $rtn_error; } foreach ($player_id as $keys => $val) { $player_fb_data = $this->get_player_chapter_by_id($val); if (empty($player_fb_data) || $player_fb_data['sweep_state'] != 0 || $player_fb_data['vip_sweep_state'] != 0) { foreach ($player_id as $keys1 => $val1) { $data['player_id'][$keys1] = $val1; $data['error_code'][$keys1] = $this->return_code['receive']; if ($player_fb_data['sweep_state'] == 1 || $player_fb_data['vip_sweep_state'] == 1) { $data['error_code'][$keys1] = $this->return_code['sweeping']; } } $data['map_id'] = $map_id; $rtn_error = Struct_PlayerAttr::get_enter_fb_ack_struct_p2s($data); return $rtn_error; } //副本章节合法性验证 if ($fb_table['chapter'] > $player_fb_data['chapter_id']) { if ($fb_table['chapter'] != $this->test_fb_chapter) { foreach ($player_id as $keys2 => $id2) { $data['player_id'][$keys2] = $id2; $data['error_code'][$keys2] = $this->return_code['no_enter']; } $data['map_id'] = $map_id; $data['portal_id'] = $portal_id; $rtn_error = Struct_PlayerAttr::get_enter_fb_ack_struct_p2s($data); return $rtn_error; } } else { if ($fb_table['chapter'] != $this->test_fb_chapter) { //副本页合法性验证 if ($fb_table['page'] > $player_fb_data['page']) { if ($fb_table['chapter'] == $player_fb_data['chapter_id']) { foreach ($player_id as $keys3 => $id3) { $data['player_id'][$keys3] = $id3; $data['error_code'][$keys3] = $this->return_code['no_enter']; } $data['map_id'] = $map_id; $data['portal_id'] = $portal_id; $rtn_error = Struct_PlayerAttr::get_enter_fb_ack_struct_p2s($data); return $rtn_error; } } } } $task_info = $this->get_data('PlayerTask')->get_task_info($val); if ($task_info && !empty($task_info['main_val'])) { if (Com_Array::is_good_arr($task_info['main_val'])) { foreach ($task_info['main_val'] as $task) { if (isset($task['task_status']) && $task['task_status'] == 1) { if (isset($task['target']) && !empty($task['target']) && $task['target'][$map_id]) { $is_task_fb = 1; break; } } } } } //进入副本验证 $enter_fb_res[$keys] = $this->is_enter_fb($val, $fb_table['chapter'], $map_id, $is_task_fb); } } else { if ($this->is_egg_active_fb($map_id)) { foreach ($player_id as $keys => $val) { $error_code = $this->return_code['true']; $is_no_times = false; $Activity_table = Cache_ActivityHall::getInstance()->get_Activity_set($map_id); $Activity_table = $Activity_table[0]; #时间限制 if (!empty($Activity_table['start_time']) && !empty($Activity_table['end_time'])) { $open_t = explode(":", $Activity_table['start_time']); $act_info['open_time_h'] = $open_t[0]; $act_info['open_time_m'] = $open_t[1]; $close_t = explode(":", $Activity_table['end_time']); $act_info['close_time_h'] = $close_t[0]; $act_info['close_time_m'] = $close_t[1]; $start_time = mktime($act_info['open_time_h'], $act_info['open_time_m'], 0, date('m'), date('d'), date('Y')); $end_time = mktime($act_info['close_time_h'], $act_info['close_time_m'], 0, date('m'), date('d'), date('Y')); if (time() < $start_time || time() > $end_time) { $error_code = $this->return_code['no_times']; $is_no_times = true; } } #等级限制 $player_info = $this->get_data('Player')->get_player_info($val, array('level')); if (!$is_no_times && (!empty($Activity_table['join_min_lvl']) && $player_info['level'] < $Activity_table['join_min_lvl'])) { $error_code = $this->return_code['level_low']; $is_no_times = true; } if (!$is_no_times && (!empty($Activity_table['join_max_lvl']) && $player_info['level'] > $Activity_table['join_max_lvl'])) { $error_code = $this->return_code['level_low']; $is_no_times = true; } #次数限制 if (!$is_no_times && (empty($Activity_table) || empty($Activity_table['max_times']) || $Activity_table['max_times'] < 1)) { $error_code = $this->return_code['no_times']; $is_no_times = true; } $max_times = $Activity_table['max_times']; $max_times += $this->get_data('PlayerDailyTime')->get_player_used_time($val, 'add_egg_active_times'); $used_times = $this->get_data('PlayerDailyTime')->get_player_used_time($val, 'egg_active_times'); if (!$is_no_times && $used_times >= $max_times) { $error_code = $this->return_code['no_times']; $is_no_times = true; } if ($is_no_times) { foreach ($player_id as $keys1 => $id1) { $data['player_id'][$keys1] = $id1; $data['error_code'][$keys1] = $error_code; } $data['map_id'] = $map_id; $data['portal_id'] = $portal_id; $rtn_error = Struct_PlayerAttr::get_enter_fb_ack_struct_p2s($data); return $rtn_error; } $res = $this->get_data('PlayerDailyTime')->pre_add_used_time($val, 'egg_active_times'); if (!$res) { foreach ($player_id as $keys2 => $id2) { $data['player_id'][$keys2] = $id2; $data['error_code'][$keys2] = $this->return_code['sql_error']; } $data['map_id'] = $map_id; $data['portal_id'] = $portal_id; $rtn_error = Struct_PlayerAttr::get_enter_fb_ack_struct_p2s($data); return $rtn_error; } //进入副本验证 $enter_fb_res[$keys] = $this->return_code['true']; //找回资源埋点 $this->get_game('GetBackCurrency')->add_function_day_times($val, 10); } } else { foreach ($player_id as $keys => $val) { //进入副本验证 $enter_fb_res[$keys] = $this->return_code['true']; } } } } $is_rollback = false; //更新成功判断 foreach ($enter_fb_res as $val) { if ($val) { $is_rollback = true; $this->rollback(); break; } } if (!$is_rollback) { $this->commit(); } if ($this->vip_fb_chapter == $fb_table['chapter'] && $this->vip_fb_page == $fb_table['page'] || in_array($fb_table['dungeon_type'], $this->dungeon_type)) { foreach ($player_id as $pid) { $this->get_game('PlayerFunc')->sync_func_tips($pid, 1010); } } if (in_array($fb_table['dungeon_type'], $this->dungeon_type)) { if ($fb_table['difficulty'] > 0) { foreach ($player_id as $pid) { #每日活跃度更新 $this->get_game('DailyBoon')->async_trigger_daily_boon_task($pid, 3000); } } } if ($this->is_egg_active_fb($map_id)) { foreach ($player_id as $pid) { $this->get_game('DailyBoon')->async_trigger_daily_boon_task($pid, 3011, 1); } } $data['player_id'] = $player_id; $data['error_code'] = $enter_fb_res; $data['map_id'] = $map_id; $data['portal_id'] = $portal_id; $data['task_fb'] = $is_task_fb; } return Struct_PlayerAttr::get_enter_fb_ack_struct_p2s($data); }