diff --git a/doc/BattleHistory.py b/doc/BattleHistory.py index b47435ec..f96407d1 100644 --- a/doc/BattleHistory.py +++ b/doc/BattleHistory.py @@ -14,7 +14,7 @@ class BattleHistory(object): 'params': [ _common.ReqHead(), ['target_id', '', ' 用户 account'], - ['room_mode', '', ' 0:pvp 2:moba'], + ['type', '', ' 1:pvp 2:moba 3:巡回模式'], ], 'response': [ _common.RspHead(), @@ -68,6 +68,8 @@ class BattleSettlementInfo(object): ['new_rank', 0, '新段位'], ['old_score', 0, '老段位积分'], ['new_score', 0, '新段位积分'], + ['old_circuit_score', 0, '巡回赛老积分'], + ['new_circuit_score', 0, '巡回赛新积分'], ['pvp_kill', 0, 'pvp击杀敌人数'], ['pvp_damage', 0, 'pvp伤害总量'], ['pvp_assist', 0, 'pvp助攻'], diff --git a/doc/Circuit.py b/doc/Circuit.py new file mode 100644 index 00000000..2f764b53 --- /dev/null +++ b/doc/Circuit.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +import _common + +class Circuit(object): + + def __init__(self): + self.apis = [ + { + 'name': 'getCurrentStage', + 'desc': '巡回赛当前阶段', + 'group': 'Circuit', + 'url': 'webapp/index.php?c=Circuit&a=getCurrentStage', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['!info', [stageInfo()], '巡回赛当前阶段信息'], + ] + } + ] + + + + +class stageInfo(object): + + def __init__(self): + self.fields = [ + ['start_time', 0, '开始时间'], + ['end_time', 0, '结束时间'], + ['cec_pool', 0, '当前阶段奖池'], + ] + diff --git a/doc/Other.py b/doc/Other.py index 58cc2abc..344c629d 100644 --- a/doc/Other.py +++ b/doc/Other.py @@ -81,6 +81,13 @@ class Other(object): _common.RspHead(), ['!mode_list', [ ['id',0,'mapMode配置id'], + ['stage_state',0,'阶段开始状态 0:未开 1:已开,id=7(巡回模式)才有'], + ['next_star_time',0,'下个阶段开始时间,id=7(巡回模式)才有'], + ['state',0,'开启状态 0:未开 1:已开,特殊模式才有(见mapMode配置表)'], + ['daily_open_time',0,'每天开始时间1,特殊模式才有(见mapMode配置表)'], + ['daily_end_time',0,'每天结束时间1,特殊模式才有(见mapMode配置表)'], + ['daily_open_time_2',0,'每天开始时间2,特殊模式才有(见mapMode配置表)'], + ['daily_end_time_2',0,'每天结束时间2,特殊模式才有(见mapMode配置表)'], ], '地图模式列表'], ] }, diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 8c3b6636..56d51b0d 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -2037,3 +2037,23 @@ CREATE TABLE `t_contribution_history` ( KEY `idx_account_id` (`account_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_circuit_battle` +-- + +DROP TABLE IF EXISTS `t_circuit_battle`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_circuit_battle` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `season` int(11) NOT NULL DEFAULT '0' COMMENT '赛季', + `cumulative_score` int(11) NOT NULL DEFAULT '0' COMMENT '积分', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `idx_account_season` (`account_id`, `season`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; \ No newline at end of file diff --git a/sql/gamedb2006_migrate_240915_01.sql b/sql/gamedb2006_migrate_240915_01.sql new file mode 100644 index 00000000..babc536e --- /dev/null +++ b/sql/gamedb2006_migrate_240915_01.sql @@ -0,0 +1,16 @@ +begin; + +CREATE TABLE `t_circuit_battle` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `season` int(11) NOT NULL DEFAULT '0' COMMENT '赛季', + `cumulative_score` int(11) NOT NULL DEFAULT '0' COMMENT '积分', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `idx_account_season` (`account_id`, `season`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +insert into version (version) values(2024091501); + +commit; diff --git a/webapp/controller/BattleHistoryController.class.php b/webapp/controller/BattleHistoryController.class.php index 51396112..0af611f0 100644 --- a/webapp/controller/BattleHistoryController.class.php +++ b/webapp/controller/BattleHistoryController.class.php @@ -10,11 +10,12 @@ class BattleHistoryController extends BaseAuthedController { public function getBattleList(){ $accountId = getReqVal('target_id', 0); - $room_mode = getReqVal('room_mode', 0); +// $room_mode = getReqVal('room_mode', 0); + $type = getReqVal('type', 0); if (!$accountId){ $accountId = myself()->_getAccountId(); } - $singleList = BattleSettlement::getSingleList($accountId,$room_mode); + $singleList = BattleSettlement::getSingleList($accountId,$type); $historyList = BattleHistory::orderBy($singleList,'desc'); $data = array(); foreach ($historyList as $k=>$history){ diff --git a/webapp/controller/CircuitController.class.php b/webapp/controller/CircuitController.class.php new file mode 100644 index 00000000..ccc81391 --- /dev/null +++ b/webapp/controller/CircuitController.class.php @@ -0,0 +1,30 @@ +_rspErr(1, 'current stage Have not yet started'); + return ; + } + $info = array( + 'start_time' => strtotime($circuitStageMeta['start_time']), + 'end_time' => strtotime($circuitStageMeta['end_time']), + 'cec_pool' => $circuitStageMeta['cec_pool'] + ); + $this->_rspData(array('info' => $info)); + } + + public function getCircuitRanking(){ + $currentCircuitMeta = mt\CircuitTime::getCurrentCircuit(); + if (!$currentCircuitMeta){ + $this->_rspErr(1, 'current stage Have not yet started'); + return ; + } + } +} diff --git a/webapp/controller/OtherController.class.php b/webapp/controller/OtherController.class.php index b262f6ae..e1882e8f 100644 --- a/webapp/controller/OtherController.class.php +++ b/webapp/controller/OtherController.class.php @@ -9,6 +9,7 @@ require_once('mt/ActivityRewards.php'); require_once('mt/MapMode.php'); require_once('mt/ServerTaskTime.php'); require_once('mt/AchievementsCycle.php'); +require_once('mt/CircuitTime.php'); @@ -332,18 +333,30 @@ class OtherController extends BaseAuthedController { // $taskStatus = GlobalData::getServerTaskStatus(); // $taskMeta = mt\ServerTaskTime::getCurrentTime(); $rankSeasonMeta = mt\RankSeason::getCurrentSeason(); - mt\MapMode::traverseMeta(function($modeMeta) use(&$modeList, $rankSeasonMeta){ + $circuitTimeMeta = mt\CircuitTime::getCurrentCircuit(); + mt\MapMode::traverseMeta(function($modeMeta) use(&$modeList, $rankSeasonMeta,$circuitTimeMeta){ if ($modeMeta['is_open']) { if ($modeMeta['limit_time'] == 1 && !$rankSeasonMeta) { return true; } -// if ($modeMeta['limit_time'] == 2 ){ -// return true; -// } + if ($modeMeta['limit_time'] == 3 && !$circuitTimeMeta){ + return true; + } $temp = array( 'id' => $modeMeta['id'] ); + if ($modeMeta['limit_time'] == 3){ + $circuitStageMeta = mt\CircuitTime::getCurrentStage(); + if($circuitStageMeta){ + $temp['stage_state'] = 1; + }else{ + $temp['stage_state'] = 0; + $nextStageMeta = mt\CircuitTime::getNextStage($circuitTimeMeta['circuit_season']); + $temp['next_star_time'] = strtotime($nextStageMeta['start_time']); + } + } + if ($modeMeta['daily_open_time']){ $dailyOpenTimeOffset = myself()->_getDaySecondsOffset(strtotime("2024-6-22 ".$modeMeta['daily_open_time'])); $dailyEndTimeOffset = myself()->_getDaySecondsOffset(strtotime("2024-6-22 ".$modeMeta['daily_end_time'])); @@ -368,12 +381,16 @@ class OtherController extends BaseAuthedController { } } + + $isOpen = mt\MapMode::isOpen($modeMeta); if ($isOpen) { - array_push( - $modeList, - $temp - ); + if ($modeMeta['mapMode'] == \mt\MapMode::CIRCUIT_MODE){ + array_unshift($modeList,$temp); + }else{ + array_push($modeList, $temp); + } + } } return true; diff --git a/webapp/models/BattleSettlement.php b/webapp/models/BattleSettlement.php index 6e4b3eb3..e8307ed5 100644 --- a/webapp/models/BattleSettlement.php +++ b/webapp/models/BattleSettlement.php @@ -15,6 +15,10 @@ class BattleSettlement extends BaseModel const MATCH_MODE_PVP = 0; const MATCH_MODE_RANK = 1; + const PVP_MODE_TYPE = 1; + const MOBA_MODE_TYPE = 2; + const CIRCUIT_MODE_TYPE = 3; + public static function add($battleUuid, $data) { SqlHelper::upsert @@ -84,7 +88,7 @@ class BattleSettlement extends BaseModel ); } - public static function getSingleList($accountId,$roomMode) + public static function getSingleList($accountId,$type) { $rows = SqlHelper::ormSelect (myself()->_getSelfMysql(), @@ -95,23 +99,30 @@ class BattleSettlement extends BaseModel ); $pvpBattleList = array(); $mobaBattleList = array(); + $circuitBattleList = array(); foreach ($rows as $row) { $data = emptyReplace(json_decode($row['data'], true), array()); - if ($data['room_mode'] == self::ROOM_MODE_PVP ) { + if ($data['battle_history_type'] == self::PVP_MODE_TYPE ) { array_push($pvpBattleList, self::singleDto($row)); - } else if ($data['room_mode'] == self::ROOM_MODE_MOBA) { + } else if ($data['battle_history_type'] == self::MOBA_MODE_TYPE) { array_push($mobaBattleList, self::singleDto($row)); + }else if($data['battle_history_type'] == self::CIRCUIT_MODE_TYPE){ + array_push($circuitBattleList, self::singleDto($row)); } } - switch ($roomMode) { - case self::ROOM_MODE_PVP : + switch ($type) { + case self::PVP_MODE_TYPE : { return $pvpBattleList; } - case self::ROOM_MODE_MOBA : + case self::MOBA_MODE_TYPE : { return $mobaBattleList; } + case self::CIRCUIT_MODE_TYPE : + { + return $circuitBattleList; + } default : { return array(); } diff --git a/webapp/models/Circuit.php b/webapp/models/Circuit.php new file mode 100644 index 00000000..8a95288d --- /dev/null +++ b/webapp/models/Circuit.php @@ -0,0 +1,44 @@ +_getSelfMysql(), + 't_circuit_battle', + array( + 'account_id' => myself()->_getAccountId(), + 'season' => $season + ), + array( + 'cumulative_score' => $score, + 'modifytime' => myself()->_getNowTime() + ), + array( + 'account_id' => myself()->_getAccountId(), + 'season' => $season, + 'cumulative_score' => $score, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ) + ); + } + + public static function getMyScore($season){ + $row = SqlHelper::ormSelectOne( + myself()->_getMysql(''), + 't_circuit_battle', + array( + 'account_id' => myself()->_getAccountId(), + 'season' => $season + ) + ); + return $row ? $row['cumulative_score'] : 0; + } + +} \ No newline at end of file diff --git a/webapp/models/User.php b/webapp/models/User.php index dce17972..15267858 100644 --- a/webapp/models/User.php +++ b/webapp/models/User.php @@ -71,6 +71,17 @@ class User extends BaseModel { return $rows ? $rows : null; } + public static function getVipLv($address){ + $row = SqlHelper::ormSelectOne( + myself()->_getMarketMysql(''), + 't_staking_cec', + array( + 'account_address' => $address + ) + ); + return $row ? $row['vip_lv'] : 0; + } + public static function show($row) { $heroDb = Hero::findByAccountId($row['account_id'],$row['hero_id']); @@ -130,6 +141,7 @@ class User extends BaseModel { 'honor_info' => $honorInfo, 'account_lucky' => $lucky, 'chest_rate' => $rate, + 'vip_lv' => self::getVipLv($row['address']), ); } @@ -195,6 +207,7 @@ class User extends BaseModel { 'last_login_time' => $row['last_login_time'], 'account_lucky' => $lucky, 'chest_rate' => $rate, + 'vip_lv' => self::getVipLv($row['address']), ); } diff --git a/webapp/mt/CircuitTime.php b/webapp/mt/CircuitTime.php new file mode 100644 index 00000000..66c79e7b --- /dev/null +++ b/webapp/mt/CircuitTime.php @@ -0,0 +1,73 @@ +_getNowTime() >= strtotime($meta['start_time']) && + myself()->_getNowTime() <= strtotime($meta['end_time'])) { + return $meta; + } + } + return null; + } + + public static function getCurrentStage(){ + foreach (self::getCircuitAll(self::STAGE_SEASON_TYPE) as $meta){ + if (myself()->_getNowTime() >= strtotime($meta['start_time']) && + myself()->_getNowTime() <= strtotime($meta['end_time'])) { + return $meta; + } + } + return null; + } + + public static function getNextStage($season){ + $next = array(); + foreach (self::getListBySeason($season) as $meta){ + if (myself()->_getNowTime() < strtotime($meta['start_time'])){ + $next = $meta; + break; + } + } + return $next; + } + + + public static function getCircuitAll($type){ + $metas =array(); + foreach (self::getMetaList() as $meta){ + if ($meta['circuit_time_type'] == $type){ + array_push($metas,$meta); + } + } + return $metas; + } + + private static function getListBySeason($season){ + $metas =array(); + foreach (self::getMetaList() as $meta){ + if ($meta['circuit_season'] == $season && $meta['circuit_time_type'] == self::STAGE_SEASON_TYPE){ + array_push($metas,$meta); + } + } + return $metas; + } + + protected static function getMetaList() + { + if (!self::$metaList) { + self::$metaList = getMetaTable('CircuitTime@CircuitTime.php'); + } + return self::$metaList; + } + + protected static $metaList; + +} diff --git a/webapp/mt/MapMode.php b/webapp/mt/MapMode.php index 4065c248..e33f1cb6 100644 --- a/webapp/mt/MapMode.php +++ b/webapp/mt/MapMode.php @@ -12,6 +12,7 @@ class MapMode const BET_MODE = 301; const RANKING_MODE = 401; const TREASURE_BOX_MODE = 501; + const CIRCUIT_MODE = 601; public static function find($id){ return getXVal(self::getMetaList(), $id); diff --git a/webapp/mt/StakingVip.php b/webapp/mt/StakingVip.php new file mode 100644 index 00000000..2cdf88d7 --- /dev/null +++ b/webapp/mt/StakingVip.php @@ -0,0 +1,44 @@ +mapMode == mt\MapMode::CIRCUIT_MODE){ + $circuitMeta = mt\CircuitTime::getCurrentCircuit(); + if ($circuitMeta){ + $minScore = mt\Parameter::getVal('circuit_rank_score_min',0); + $multConstant = mt\Parameter::getVal('circuit_score_mult_constant',1); + $shiftConstant = mt\Parameter::getVal('circuit_score_shift_constant',1); + $circuitScore = $battleScore * $multConstant + $shiftConstant; + $myScore = Circuit::getMyScore($circuitMeta['circuit_season']); + $finalScore = max($minScore, $myScore+$circuitScore); + Circuit::updateScore($circuitMeta['circuit_season'],$finalScore); + $member['new_circuit_score'] = $finalScore; + } + } if ($this->mapMode == mt\MapMode::TREASURE_BOX_MODE && $member['move_distance'] <= 2000 ){ error_log("金币模式:消极战斗"); @@ -141,6 +158,7 @@ class RoomBattleDataService extends BaseService { $battleSingleData['new_rank'] = $member['new_rank']; $battleSingleData['new_score'] = $member['new_score']; $battleSingleData['new_elo'] = $member['new_elo']; + $battleSingleData['new_circuit_score'] = $member['new_circuit_score']; BattleSettlement::addSingle($battleSingleDb['battle_uuid'],$battleSingleDb['room_uuid'],$battleSingleData); } }else{ @@ -325,8 +343,10 @@ class RoomBattleDataService extends BaseService { $paramMeta = mt\Parameter::getVal('performance_score_range',0); $paramMetaMoba = mt\Parameter::getVal('performance_score_weight_4V4',0); $paramMetaPvp = mt\Parameter::getVal('performance_score_weight_BR',0); + $paramMetaCircuit = mt\Parameter::getVal('performance_score_weight_circuit',0); $weightMoba = explode("|",$paramMetaMoba); $weightPvp = explode("|",$paramMetaPvp); + $weightCircuit = explode("|",$paramMetaCircuit); $scoreParam = explode("|",$paramMeta); if (count($scoreParam) < 2){ error_log('Parameter table error'); @@ -388,12 +408,22 @@ class RoomBattleDataService extends BaseService { ))); switch ($room_mode){ case self::ROOM_MODE_PVP: { - if (count($weightPvp) == 5){ - $killSco *= $weightPvp[0]; - $assistSco *= $weightPvp[1]; - $damageSco *= $weightPvp[2]; - $recoverSco *= $weightPvp[3]; - $aliveSco *= $weightPvp[4]; + if (getXVal($this->inputData,'map_mode', 0) == mt\MapMode::CIRCUIT_MODE){ + if (count($weightCircuit) == 5){ + $killSco *= $weightCircuit[0]; + $assistSco *= $weightCircuit[1]; + $damageSco *= $weightCircuit[2]; + $recoverSco *= $weightCircuit[3]; + $aliveSco *= $weightCircuit[4]; + } + }else{ + if (count($weightPvp) == 5){ + $killSco *= $weightPvp[0]; + $assistSco *= $weightPvp[1]; + $damageSco *= $weightPvp[2]; + $recoverSco *= $weightPvp[3]; + $aliveSco *= $weightPvp[4]; + } } $battleScore = ($killSco + $assistSco + $damageSco + $recoverSco + $aliveSco); } diff --git a/webapp/services/TameBattleDataService.php b/webapp/services/TameBattleDataService.php index d59a6c7b..7fe3405b 100644 --- a/webapp/services/TameBattleDataService.php +++ b/webapp/services/TameBattleDataService.php @@ -15,6 +15,7 @@ require_once('mt/AchievementsCycle.php'); require_once('mt/ServerTaskTime.php'); require_once('mt/MapMode.php'); require_once('mt/BattleReward.php'); +require_once('mt/CircuitTime.php'); require_once('models/Season.php'); require_once('models/Battle.php'); @@ -24,6 +25,7 @@ require_once('models/BattleSettlement.php'); require_once('models/RankBattle.php'); require_once('models/HashRateBattleData.php'); require_once('models/GlobalData.php'); +require_once('models/Circuit.php'); require_once('services/RankActivityService.php'); require_once('services/AwardService.php'); @@ -34,6 +36,7 @@ require_once('services/LootService.php'); use models\BattleSettlement; +use models\Circuit; use models\FragmentRecord; use models\GlobalData; use models\HashRate; @@ -102,7 +105,7 @@ class TameBattleDataService extends BaseService { } myself()->_fireEvent('Battle','onSettlement',$this->battleInfo); //记录战斗有效行为 - $this->_updateBattleData(); +// $this->_updateBattleData(); //记录战斗数据的排行榜 $this->recordBattleRanking(); switch ($matchMode) { @@ -513,33 +516,29 @@ class TameBattleDataService extends BaseService { mt\Rank::calcNewRankAndScore( $newRank, $newScore); } } - -// $data = array( -// "battle_uuid" => $battleUuid, -// "account_id" => getXVal($this->battleInfo,'account_id', 0), -// "room_mode" => getXVal($this->allInfo,'room_mode', 0), -// "pvp_mode" => $pvp_mode, -// "team_mode" => getXVal($this->allInfo,'team_mode', 0), -// "battle_rank" => getXVal($this->battleInfo,'pvp_personal_rank', 0), -// "team_rank" => getXVal($this->allInfo,'pvp_team_rank', 0), -// "team_kills" => getXVal($this->allInfo,'pvp_team_kills', 0), -// "is_win" => getXVal($this->battleInfo,'pve_boss_killed', 0), -// "kills" => getXVal($this->battleInfo,'kills', 0), -// "hero_id" => getXVal($this->battleInfo,'hero_uniid', 0), -// "weapon1" => getXVal($this->battleInfo,'weapon_uuid1', 0), -// "weapon2" => getXVal($this->battleInfo,'weapon_uuid2', 0), -// "battle_end_time" => getXVal($this->battleInfo,'game_time', 0), -// "current_level_class" => $newRank, -// "current_level_class_score" => $newScore, -// "level_class_score_chg" => $newScore - $this->userInfo['score'], // 排位分改变 -// "pve_rank_score" => getXVal($this->battleInfo,'pve_score', 0), -// "pve_kill_boss" => getXVal($this->battleInfo,'pve_boss_killed', 0), -// "pve_instance_id" => getXVal($this->allInfo,'pve_instance_id', 0), -//// "pve_instance_mode" => getXVal($this->allInfo,'pve_instance_mode', 0), -// "old_elo" => $this->userInfo['elo'], -// "new_elo" => $newElo, -// 'reward' => array(), -// ); + switch (getXVal($this->allInfo,'room_mode', 0)){ + case self::ROOM_MODE_PVP: + { + if (getXVal($this->allInfo,'map_mode', 0) == mt\MapMode::CIRCUIT_MODE){ + $battle_history_type = 3; + }else{ + $battle_history_type = 1; + } + } + break; + case self::ROOM_MODE_MOBA: + { + $battle_history_type = 2; + } + break; + default: + { + $team_mode = null; + $battle_history_type = 0; + } + } + $circuitMeta = mt\CircuitTime::getCurrentCircuit(); + $circuitScore = Circuit::getMyScore($circuitMeta['circuit_season']); $data = array( "battle_uuid" => $battleUuid, "map_mode_id" => getXVal($this->allInfo,'map_mode_id', 0), @@ -568,6 +567,8 @@ class TameBattleDataService extends BaseService { 'new_score'=> $newScore, 'old_elo'=> $oldElo, 'new_elo'=> $newElo, + 'old_circuit_score'=> $circuitScore, + 'new_circuit_score'=> $circuitScore, 'pvp_kill'=> getXVal($this->battleInfo,'pvp_kill', 0), 'pvp_damage'=> getXVal($this->battleInfo,'pvp_damage', 0), 'pvp_assist'=> getXVal($this->battleInfo,'pvp_assist', 0), @@ -587,6 +588,7 @@ class TameBattleDataService extends BaseService { 'hero_lv'=> getXVal($this->battleInfo,'hero_level', 1), 'dead_times'=> getXVal($this->battleInfo,'dead_times', 0), "game_time" => getXVal($this->battleInfo,'game_time', 0), + "battle_history_type" => $battle_history_type, 'reward' => array(), ); BattleSettlement::addSingle($battleUuid,$roomUuid,$data); @@ -599,20 +601,26 @@ class TameBattleDataService extends BaseService { switch ($room_mode){ case self::ROOM_MODE_PVP: { - $team_mode = getXVal($this->allInfo,'pvp_settelement_type', 0); + if (getXVal($this->allInfo,'map_mode', 0) == mt\MapMode::CIRCUIT_MODE){ + $battle_history_type = 3; + }else{ + $battle_history_type = 1; + } } break; - case self::ROOM_MODE_PVE: + case self::ROOM_MODE_MOBA: { - $team_mode = getXVal($this->allInfo,'pve_settelement_type', 0); + $battle_history_type = 2; } break; default: { $team_mode = null; + $battle_history_type = 0; } - break; } + $circuitMeta = mt\CircuitTime::getCurrentCircuit(); + $circuitScore = Circuit::getMyScore($circuitMeta['circuit_season']); $data = array( 'version'=> getXVal($this->allInfo,'version', 0), 'team_id'=> getXVal($this->allInfo,'team_id', 0), @@ -620,7 +628,8 @@ class TameBattleDataService extends BaseService { 'room_mode'=> getXVal($this->allInfo,'room_mode', 0), 'map_mode'=> getXVal($this->allInfo,'map_mode', 0), 'map_mode_id'=> getXVal($this->allInfo,'map_mode_id', 0), - 'team_mode'=> $team_mode, + 'battle_history_type'=> $battle_history_type, + 'team_mode'=> getXVal($this->allInfo,'pvp_settelement_type', 0), 'game_over'=>1, 'victory'=> getXVal($this->allInfo,'victory', 0), 'watchable'=> 1, @@ -700,6 +709,8 @@ class TameBattleDataService extends BaseService { 'new_score'=> $newScore, 'old_elo'=> $oldElo, 'new_elo'=> $newElo, + 'old_circuit_score'=> $circuitScore, + 'new_circuit_score'=> $circuitScore, 'pvp_kill'=> getXVal($info,'pvp_kill', 0), 'pvp_damage'=> getXVal($info,'pvp_damage', 0), 'pvp_assist'=> getXVal($info,'pvp_assist', 0), @@ -1178,44 +1189,6 @@ class TameBattleDataService extends BaseService { ); } - //服务器大事件任务统计 -// $server_task_state = GlobalData::getServerTaskStatus(); -// $currentServerTask = mt\ServerTaskTime::getCurrentTime(); -// if (!isset($serverTaskData['data'])) { -// $serverTaskData['data'] = array( -// 'createtime' => myself()->_getNowTime(), -// 'modifytime' => myself()->_getNowTime() -// ); -// } -// if ($currentServerTask && myself()->_getDaySeconds($serverTaskData['data']['modifytime']) < -// myself()->_getDaySeconds(strtotime($currentServerTask['obtain_start_time']))) { -// $serverTaskData['data'] = array( -// 'createtime' => $serverTaskData['data']['createtime'], -// 'modifytime' => myself()->_getNowTime() -// ); -// } - - - - -// if ($currentHashRate && strtotime($currentHashRate['obtain_end_time']) > myself()->_getNowTime()){ -// switch (getXVal($this->allInfo,'room_mode', 0)){ -// case self::MATCH_MODE_PVP :{ -// $this->applyEx($hisBattleData['data']['pvpData']); -// } -// break; -// case self::ROOM_MODE_MOBA :{ -// $this->applyEx($hisBattleData['data']['mobaData']); -// } -// break; -// default:{ -// -// } -// break; -// } -// $hisBattleData['data']['modifytime'] = myself()->_getNowTime(); -// } - switch (getXVal($this->allInfo,'room_mode', 0)){ case self::MATCH_MODE_PVP :{ if ($currentHashRate && @@ -1241,15 +1214,9 @@ class TameBattleDataService extends BaseService { break; default:{} } -// if (! $server_task_state && $currentServerTask && -// if ( $currentServerTask && -// myself()->_getNowTime() > strtotime($currentServerTask['obtain_start_time']) && -// myself()->_getNowTime() < strtotime($currentServerTask['obtain_end_time'])) { -// $this->applyEx($serverTaskData['data']); -// $serverTaskData['data']['modifytime'] = myself()->_getNowTime(); -// } + HashRateBattleData::add(json_encode($hisBattleData)); -// GlobalData::addServerTaskData($serverTaskData); + } private function applyEx(&$battleData)