/** * 获取英雄后补孔开启数量 * @param $level 玩家等级 * @param $hole_num 当前开启数量 */ private function get_hero_after_hole_num($level) { if (empty($this->_hero_after_hole_info)) { //在cli模式下把信息缓存到内存 避免重复查询 $data = Cache_HeroAfterHole::getInstance()->get_hero_after_hole_info(); if ($data) { foreach ($data as $val) { $this->_hero_after_hole_info[$val['player_level']] = $val['hole_num']; } } } $hole_num = 0; foreach ($this->_hero_after_hole_info as $player_level => $num) { if ($level >= $player_level) { $hole_num = $num; } } return $hole_num; }
/** * 获取英雄后补孔开启数量 * @param $level 玩家等级 * @param $hole_num 当前开启数量 */ private function get_hero_after_hole_num($level) { $hole_num = 0; $data = Cache_HeroAfterHole::getInstance()->get_hero_after_hole_info(); foreach ($data as $hole_info) { if ($level >= $hole_info['player_level']) { $hole_num = $hole_info['hole_num']; } } return $hole_num; }