diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 0a53a658..abe7c054 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -1077,7 +1077,7 @@ CREATE TABLE `t_rank_battle` ( `channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel', `mode` int(11) NOT NULL DEFAULT '0' COMMENT '1:4v4 2:pvp', `class` int(11) NOT NULL DEFAULT '0' COMMENT '1:总榜 2:日榜 3:周榜', - `type` int(11) NOT NULL DEFAULT '0' COMMENT 'type 1:场次榜 2:吃鸡榜 3:mvp榜 4:前三名榜 5:击杀榜', + `type` int(11) NOT NULL DEFAULT '0' COMMENT 'type 1:场次榜 2:吃鸡榜 3:mvp榜 4:前三名榜 5:击杀榜 6:伤害 7:助攻 8:治疗量 9:存活时间 10:救援数', `value` bigint NOT NULL DEFAULT '0' COMMENT 'value', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', diff --git a/webapp/controller/BagController.class.php b/webapp/controller/BagController.class.php index e2da21dd..74f54b0f 100644 --- a/webapp/controller/BagController.class.php +++ b/webapp/controller/BagController.class.php @@ -50,7 +50,7 @@ class BagController extends BaseAuthedController { public function createGuildConsume() { - $consume = explode("|",mt\Parameter::getVal('create_club_cost')); + $consume = explode("|",mt\Parameter::getVal('create_club_cost', '')); $costItems = array( array( 'item_id' => $consume[0], diff --git a/webapp/controller/BaseController.class.php b/webapp/controller/BaseController.class.php index 7ad36cfa..3bcb445e 100644 --- a/webapp/controller/BaseController.class.php +++ b/webapp/controller/BaseController.class.php @@ -8,6 +8,7 @@ class BaseController { private $marketDbConn = null; private $relationDbConn = null; private $timeOffset = 0; + private $serviceHash = array(); function __construct() { @@ -235,4 +236,15 @@ class BaseController { return $channel == "0000"; } + public function callService($serviceName, $funcName) + { + if (!array_key_exists($serviceName, $this->serviceHash)) { + require_once('services/' . $serviceName . '.php'); + $this->serviceHash[$serviceName] = $this->_getNowTime(); + } + $method = new ReflectionMethod($serviceName . 'Service', $funcName); + $ret = $method->invoke(null); + return $ret; + } + } diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 9c353a46..c32e161a 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -473,7 +473,8 @@ class BattleController extends BaseAuthedController { 'node_id' => $nodeId, 'room_uuid' => $roomUuid, 'start_time' => $startTime, - 'team_list' => array() + 'team_list' => array(), + 'ob_list' => array() ); $currSeason = mt\RankSeason::getCurrentSeason(); @@ -539,6 +540,61 @@ class BattleController extends BaseAuthedController { } array_push($data['team_list'], $teamInfo); } + foreach ($customData['ob_list'] as $member) { + $accountId = $member['account_id']; + $switchOk = $this->switchOnlineAccount($accountId); + if (!$switchOk) { + myself()->_rspErr(1, 'data error'); + return; + } + $info = $this->genInitBattleData(); + $userDb = User::find($accountId); + if ($userDb) { + $userPresetInfo = User::toPreset($userDb); + $info['elo'] = $userDb['elo']; + $info['rank'] = $userDb['rank']; + $info['name'] = $userPresetInfo['name']; + $info['level'] = $userPresetInfo['level']; + $info['parachute'] = $userPresetInfo['parachute']; + $info['hero_uniid'] = $userPresetInfo['hero_uniId']; + $info['hero_id'] = $userPresetInfo['hero_id']; + $info['hero_skin'] = $userPresetInfo['hero_skin']; + $info['skill_id'] = $userPresetInfo['presetInfo']['skill_id']; + $info['weapon_uuid1'] = $userPresetInfo['presetInfo']['weapon_uid1']; + $info['weapon_uuid2'] = $userPresetInfo['presetInfo']['weapon_uid2']; + //$chipPageDb = ChipPage::find($userPresetInfo['hero_uniId']); + //$info['chip_page'] = ChipPage::toDtoBattle($chipPageDb); + $info['honor_info'] = $userPresetInfo['honor_info']; + $battleDb = Battle::find($accountId); + if ($battleDb){ + $battleData = json_decode($battleDb['battle_data'], true); + $seasonBattleData = isset($battleData) ? getXVal($battleData, 'data', array()) : array(); + $info['battle_times'] = getXVal($seasonBattleData, 'total_battle_times', 0); + } + + $heroDb = Hero::findByAccountId($accountId,$info['hero_uniid']); + if ($heroDb) { + $info['is_valid_battle'] = 1; + $info['hero_dto'] = Hero::toDto($heroDb); + } else { + $info['errcode'] = 51; + $info['errmsg'] = 'paramater error'; + } + + { + $itemDb = Bag::findEx($accountId, V_ITEM_REVIVE_COIN); + $info['revive_coin'] = $itemDb && $itemDb['item_num'] > 0 ? $itemDb['item_num'] : 0; + } + + { + $info['match_mode'] = 0; + if ($currSeason){ + $info['match_mode'] = 1; + } + } + } + array_push($data['ob_list'], $info); + } error_log(json_encode($data)); myself()->_rspData($data); } @@ -921,7 +977,7 @@ class BattleController extends BaseAuthedController { // $historyList = BattleHistory::orderBy(BattleHistory::getMyBattleHistoryByMode($mode),'desc'); $data = array(); foreach ($historyList as $k=>$history){ - if ($k < 20){ + if ($k < 40){ array_push($data,BattleHistory::toDto($history)); } } diff --git a/webapp/models/RankBattle.php b/webapp/models/RankBattle.php index 6dd7a060..4675549b 100644 --- a/webapp/models/RankBattle.php +++ b/webapp/models/RankBattle.php @@ -13,6 +13,11 @@ class RankBattle extends BaseModel const MVP_TIMES = 3; const TOP_THREE_TIMES = 4; const KILL_TIMES = 5; + const DAMAGES_OUT = 6; + const ASSIST_TIMES = 7; + const RECOVER_HP = 8; + const SURVIVAL_TIME = 9; + const RESCUE_TIMES = 10; const OVERALL_CHARTS = 1; const DAILY_CHARTS = 2; @@ -114,7 +119,6 @@ class RankBattle extends BaseModel if (!self::inspectType($type)){ return array(); } - $row = array(); switch ($class) { case self::OVERALL_CHARTS : { @@ -129,7 +133,7 @@ class RankBattle extends BaseModel ) ); } - break; + break; case self::DAILY_CHARTS :{ $row = SqlHelper::ormSelectOne (myself()->_getSelfMysql(), @@ -143,7 +147,7 @@ class RankBattle extends BaseModel ) ); } - break; + break; case self::WEEKLY_CHARTS:{ $row = SqlHelper::ormSelectOne (myself()->_getSelfMysql(), @@ -159,6 +163,7 @@ class RankBattle extends BaseModel } } return $row ; + } public static function upsert($account,$mode,$type,$val){ diff --git a/webapp/services/MsgQueueService.php b/webapp/services/MsgQueueService.php new file mode 100644 index 00000000..329e7d87 --- /dev/null +++ b/webapp/services/MsgQueueService.php @@ -0,0 +1,11 @@ +battleInfo,'pvp_kill', 0) > 0){ RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::KILL_TIMES,getXVal($this->battleInfo,'pvp_kill', 0)); } + + //伤害 + if (getXVal($this->battleInfo,'pvp_damage', 0) > 0){ + RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::DAMAGES_OUT,getXVal($this->battleInfo,'pvp_damage', 0)); + } + + //助攻 + if (getXVal($this->battleInfo,'pvp_assist', 0) > 0){ + RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::ASSIST_TIMES,getXVal($this->battleInfo,'pvp_assist', 0)); + } + + //治疗 + if (getXVal($this->battleInfo,'pvp_recover', 0) > 0){ + RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::RECOVER_HP,getXVal($this->battleInfo,'pvp_recover', 0)); + } + + //存活时间 + if (getXVal($this->battleInfo,'pvp_survia_time', 0)/1000 >= 1 ){ + RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::SURVIVAL_TIME,round(getXVal($this->battleInfo,'pvp_survia_time', 0)/1000)); + } + + //救援数 + if (getXVal($this->battleInfo,'pvp_rescue', 0) > 0){ + RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::RESCUE_TIMES,getXVal($this->battleInfo,'pvp_rescue', 0)); + } } break; case self::ROOM_MODE_MOBA : { @@ -207,6 +232,18 @@ class TameBattleDataService extends BaseService { if (getXVal($this->battleInfo,'kills', 0) > 0){ RankBattle::upsert($account,RankBattle::MOBA_DATA,RankBattle::KILL_TIMES,getXVal($this->battleInfo,'kills', 0)); } + //伤害 + if (getXVal($this->battleInfo,'damage_out', 0) > 0){ + RankBattle::upsert($account,RankBattle::MOBA_DATA,RankBattle::DAMAGES_OUT,getXVal($this->battleInfo,'damage_out', 0)); + } + //助攻 + if (getXVal($this->battleInfo,'assist', 0) > 0){ + RankBattle::upsert($account,RankBattle::MOBA_DATA,RankBattle::ASSIST_TIMES,getXVal($this->battleInfo,'assist', 0)); + } + //治疗 + if (getXVal($this->battleInfo,'recover_hp', 0) > 0){ + RankBattle::upsert($account,RankBattle::MOBA_DATA,RankBattle::RECOVER_HP,getXVal($this->battleInfo,'recover_hp', 0)); + } } } @@ -578,6 +615,8 @@ class TameBattleDataService extends BaseService { 'pve_wave'=> getXVal($this->allInfo,'pve_wave', 0), 'pve_max_wave'=> getXVal($this->allInfo,'pve_max_wave', 0), 'pve_instance_id'=> getXVal($this->allInfo,'pve_instance_id', 0), + 'moba_my_team_kills'=> getXVal($this->allInfo,'moba_my_team_kills', 0), + 'moba_enemy_team_kills'=> getXVal($this->allInfo,'moba_enemy_team_kills', 0), ); $data['members'] = array();