完成getSeason改造

This commit is contained in:
aozhiwei 2021-11-22 10:58:52 +08:00
parent 9569816478
commit 7dc6645b6a
6 changed files with 47 additions and 61 deletions

View File

@ -85,7 +85,7 @@ class FriendController extends BaseAuthedController {
$rank = 1; $rank = 1;
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
$seaPoint = $this->getSeasonPoint($ii); $seaPoint = mt\Season::getOldSeasonPoint($ii);
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|| $seaPoint['max'] == -1) { || $seaPoint['max'] == -1) {
$rank = $ii; $rank = $ii;

View File

@ -5,6 +5,9 @@ require 'classes/AddReward.php';
require_once 'metatable/parameter.php'; require_once 'metatable/parameter.php';
require_once 'metatable/season.php'; require_once 'metatable/season.php';
require_once 'metatable/seasoncard.php'; require_once 'metatable/seasoncard.php';
require_once('mt/Season.php');
class PassController extends BaseAuthedController { class PassController extends BaseAuthedController {
@ -21,22 +24,6 @@ class PassController extends BaseAuthedController {
return $arr; return $arr;
} }
protected function getSeason($season_id)
{
$season_meta_table = require('../res/season@season.php');
$season_meta = getSeasonConfig($season_meta_table, $season_id);
$season = array(
'number' => $season_meta['season_number'],
'open_time' => $season_meta['time1'],
'end_time' => $season_meta['time2'],
'reward' => $season_meta['season_reward'],
'weekreward' => $season_meta['week_reward'],
'season_overreward' => $season_meta['season_overreward'],
'reward2' => $season_meta['season_reward2'],
);
return $season;
}
protected function getSeasonPoint($seaPoint_id) protected function getSeasonPoint($seaPoint_id)
{ {
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
@ -150,7 +137,7 @@ class PassController extends BaseAuthedController {
$rank_status = 0; $rank_status = 0;
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
$seaPoint = $this->getSeasonPoint($ii); $seaPoint = mt\Season::getOldSeasonPoint($ii);
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1)
{ {
@ -278,7 +265,7 @@ class PassController extends BaseAuthedController {
$season = array(); $season = array();
$season_meta_table = require('../res/season@season.php'); $season_meta_table = require('../res/season@season.php');
for ($i = 1; $i <= count($season_meta_table); $i++) { for ($i = 1; $i <= count($season_meta_table); $i++) {
$season = $this->getSeason($i); $season = mt\Season::getOldSeason($i);
if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) { if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) {
break; break;
} }
@ -373,14 +360,14 @@ class PassController extends BaseAuthedController {
$level = 0; $level = 0;
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
$seaPoint = $this->getSeasonPoint($ii); $seaPoint = mt\Season::getOldSeasonPoint($ii);
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1)
{ {
$season = array(); $season = array();
$season_meta_table = require('../res/season@season.php'); $season_meta_table = require('../res/season@season.php');
for ($i = 1; $i <= count($season_meta_table); $i++) { for ($i = 1; $i <= count($season_meta_table); $i++) {
$season = $this->getSeason($i); $season = mt\Season::getOldSeason($i);
if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) { if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) {
break; break;
} }
@ -476,7 +463,7 @@ class PassController extends BaseAuthedController {
//积分结算 //积分结算
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
$seaPoint = $this->getSeasonPoint($ii); $seaPoint = mt\Season::getOldSeasonPoint($ii);
if ($row['season_end_score'] >= $seaPoint['min'] && $row['season_end_score'] <= $seaPoint['max'] if ($row['season_end_score'] >= $seaPoint['min'] && $row['season_end_score'] <= $seaPoint['max']
|| $row['season_end_score'] >= $seaPoint['min'] && $seaPoint['max'] == -1) || $row['season_end_score'] >= $seaPoint['min'] && $seaPoint['max'] == -1)
{ {
@ -488,7 +475,7 @@ class PassController extends BaseAuthedController {
$season_meta_table = require('../res/season@season.php'); $season_meta_table = require('../res/season@season.php');
$id = 0; $id = 0;
for ($i = 1; $i <= count($season_meta_table); $i++) { for ($i = 1; $i <= count($season_meta_table); $i++) {
$season = $this->getSeason($i); $season = mt\Season::getOldSeason($i);
if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) { if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) {
$open_time = strtotime($season['open_time']); $open_time = strtotime($season['open_time']);
$end_time = strtotime($season['end_time']); $end_time = strtotime($season['end_time']);
@ -496,7 +483,7 @@ class PassController extends BaseAuthedController {
break; break;
} }
} }
$s = $this->getSeason($id); $s = mt\Season::getOldSeason($id);
if ($s) { if ($s) {
$delim1 = '|'; $delim1 = '|';
@ -684,7 +671,7 @@ class PassController extends BaseAuthedController {
$season = array(); $season = array();
$season_meta_table = require('../res/season@season.php'); $season_meta_table = require('../res/season@season.php');
for ($i = 1; $i <= count($season_meta_table); $i++) { for ($i = 1; $i <= count($season_meta_table); $i++) {
$season = $this->getSeason($i); $season = mt\Season::getOldSeason($i);
if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) { if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) {
break; break;
} }

View File

@ -51,7 +51,7 @@ class RankController extends BaseAuthedController {
if ($row) { if ($row) {
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
$seaPoint = $this->getSeasonPoint($ii); $seaPoint = mt\Season::getOldSeasonPoint($ii);
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|| $seaPoint['max'] == -1) { || $seaPoint['max'] == -1) {
$rank = $ii; $rank = $ii;
@ -188,7 +188,7 @@ class RankController extends BaseAuthedController {
$rank = 0; $rank = 0;
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
$seaPoint = $this->getSeasonPoint($ii); $seaPoint = mt\Season::getOldSeasonPoint($ii);
if ($integral_db[$i][8] >= $seaPoint['min'] && $integral_db[$i][8] <= $seaPoint['max'] if ($integral_db[$i][8] >= $seaPoint['min'] && $integral_db[$i][8] <= $seaPoint['max']
|| $integral_db[$i][8] >= $seaPoint['min'] && $seaPoint['max'] == -1) || $integral_db[$i][8] >= $seaPoint['min'] && $seaPoint['max'] == -1)
{ {

View File

@ -7,6 +7,7 @@ require 'NTaskController.class.php';
require_once('mt/Parameter.php'); require_once('mt/Parameter.php');
require_once('mt/Drop.php'); require_once('mt/Drop.php');
require_once('mt/EquipUpgrade.php'); require_once('mt/EquipUpgrade.php');
require_once('mt/Season.php');
class RoleController extends BaseAuthedController { class RoleController extends BaseAuthedController {
@ -23,20 +24,6 @@ class RoleController extends BaseAuthedController {
return $arr; return $arr;
} }
protected function getSeason($season_id)
{
$season_meta_table = require('../res/season@season.php');
$season_meta = getSeasonConfig($season_meta_table, $season_id);
$season = array(
'number' => $season_meta['season_number'],
'open_time' => $season_meta['time1'],
'end_time' => $season_meta['time2'],
'reward' => $season_meta['season_reward'],
'weekreward' => $season_meta['season_reward2'],
);
return $season;
}
protected function getSeasonPoint($seaPoint_id) protected function getSeasonPoint($seaPoint_id)
{ {
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
@ -126,7 +113,7 @@ class RoleController extends BaseAuthedController {
$season_time = 0; $season_time = 0;
$season_meta_table = require('../res/season@season.php'); $season_meta_table = require('../res/season@season.php');
for ($i = 1; $i <= count($season_meta_table); $i++) { for ($i = 1; $i <= count($season_meta_table); $i++) {
$season = $this->getSeason($i); $season = mt\Season::getOldSeason($i);
if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) { if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) {
$season_time = strtotime($season['end_time']); $season_time = strtotime($season['end_time']);
break; break;
@ -517,7 +504,7 @@ class RoleController extends BaseAuthedController {
$season_meta_table = require('../res/season@season.php'); $season_meta_table = require('../res/season@season.php');
$end_time = 0; $end_time = 0;
for ($i = 1; $i <= count($season_meta_table); $i++) { for ($i = 1; $i <= count($season_meta_table); $i++) {
$season = $this->getSeason($i); $season = mt\Season::getOldSeason($i);
if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) { if (phpcommon\getNowTime() >= strtotime($season['open_time']) && phpcommon\getNowTime() <= strtotime($season['end_time'])) {
$end_time = strtotime($season['end_time']); $end_time = strtotime($season['end_time']);
break; break;
@ -526,7 +513,7 @@ class RoleController extends BaseAuthedController {
$season_point_table = require('../res/seasomPoint@seasomPoint.php'); $season_point_table = require('../res/seasomPoint@seasomPoint.php');
$integral = 0; $integral = 0;
for ($j = 1; $j <= count($season_point_table); $j++) { for ($j = 1; $j <= count($season_point_table); $j++) {
$seasonpoint = $this->getSeasonPoint($j); $seasonpoint = mt\Season::getOldSeasonPoint($j);
if ($rowUser['integral'] <= $seasonpoint['max'] || if ($rowUser['integral'] <= $seasonpoint['max'] ||
$seasonpoint['max'] == -1) { $seasonpoint['max'] == -1) {
$integral = $seasonpoint['topoint']; $integral = $seasonpoint['topoint'];
@ -789,7 +776,7 @@ class RoleController extends BaseAuthedController {
$is_pro = 0; $is_pro = 0;
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
$seaPoint = $this->getSeasonPoint($ii); $seaPoint = mt\Season::getOldSeasonPoint($ii);
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) {
$is_pro = $seaPoint['is_protect']; $is_pro = $seaPoint['is_protect'];

View File

@ -4,6 +4,7 @@ require 'classes/Quest.php';
require 'classes/AddReward.php'; require 'classes/AddReward.php';
require_once('mt/Parameter.php'); require_once('mt/Parameter.php');
require_once('mt/Season.php');
class SignController extends BaseAuthedController { class SignController extends BaseAuthedController {
@ -63,18 +64,6 @@ class SignController extends BaseAuthedController {
return $sh; return $sh;
} }
protected function getSeason($season_id)
{
$season_meta_table = require('../res/season@season.php');
$season_meta = getSeasonConfig($season_meta_table, $season_id);
$season = array(
'number' => $season_meta['season_number'],
'open_time' => $season_meta['time1'],
'end_time' => $season_meta['time2'],
);
return $season;
}
protected function getSeasonPoint($seaPoint_id) protected function getSeasonPoint($seaPoint_id)
{ {
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');

View File

@ -6,13 +6,19 @@ use phpcommon;
class Season { class Season {
public static function get($id)
{
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
}
protected static function getMeta() protected static function getMeta()
{ {
if (!self::$meta) { if (!self::$metaList) {
self::$meta = getMetaTable('season@season.php'); self::$metaList = getMetaTable('season@season.php');
} }
return self::$meta; return self::$metaList;
} }
public static function getSeasonRewardByLv($lv) public static function getSeasonRewardByLv($lv)
{ {
$seasonCfg = self::getMeta(); $seasonCfg = self::getMeta();
@ -20,12 +26,14 @@ class Season {
return $seasonCfg; return $seasonCfg;
} }
public static function getSeasonCfg() public static function getSeasonCfg()
{ {
$seasonCfg = self::getMeta(); $seasonCfg = self::getMeta();
return $seasonCfg; return $seasonCfg;
} }
public static function getTaskCfgByID($_itemID) public static function getTaskCfgByID($_itemID)
{ {
$playerSkinCfg = self::getMeta(); $playerSkinCfg = self::getMeta();
@ -41,7 +49,22 @@ class Season {
} }
return $itemData; return $itemData;
} }
public static function getOldSeason($id)
{
$meta = self::get($id);
return array(
'number' => $meta['season_number'],
'open_time' => $meta['time1'],
'end_time' => $meta['time2'],
'reward' => $meta['season_reward'],
'weekreward' => $meta['week_reward'],
'season_overreward' => $meta['season_overreward'],
'reward2' => $meta['season_reward2'],
);
}
protected static $itemArr; protected static $itemArr;
protected static $meta; protected static $metaList;
} }