From af4c87b503a2ef81e668dd6c348dbe3d7531a9fe Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Mon, 5 Jun 2023 18:00:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E5=90=8E=E6=98=9F=E6=98=9F?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/bootstrap/constant.php | 1 + .../controller/BaseAuthedController.class.php | 5 + webapp/controller/ChainController.class.php | 0 webapp/services/TameBattleDataService.php | 101 ++++++++++++------ 4 files changed, 73 insertions(+), 34 deletions(-) create mode 100644 webapp/controller/ChainController.class.php diff --git a/webapp/bootstrap/constant.php b/webapp/bootstrap/constant.php index 28c45cee..749794d3 100644 --- a/webapp/bootstrap/constant.php +++ b/webapp/bootstrap/constant.php @@ -43,6 +43,7 @@ define('TN_DAILY_PVE_GET_HERO_FRAGMENT_NUM', 9012); define('TN_DAILY_PVE_GET_GUN_FRAGMENT_NUM', 9013); define('TN_DAILY_COMPLETE_TASK_NUM', 9014); define('TN_DAILY_USED_GOLD_NUM', 9015); +define('TN_DAILY_GET_STAR_NUM', 9016); define('TN_WEEKLY_BEGIN', 10001); define('TN_WEEKLY_ACTIVE', 10002); diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 78227b4c..2d8fbf63 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -164,6 +164,10 @@ class BaseAuthedController extends BaseController { return phpcommon\extractChannel($this->_getAccountId()); } + public function _getAddress(){ + return $this->_getOpenId(); + } + public function _getSessionId() { return $this->sessionId; @@ -361,6 +365,7 @@ class BaseAuthedController extends BaseController { return "star_num + ${itemNum}"; } )); + $this->_incDailyV(TN_DAILY_GET_STAR_NUM, 0,$itemNum); } break; default: diff --git a/webapp/controller/ChainController.class.php b/webapp/controller/ChainController.class.php new file mode 100644 index 00000000..e69de29b diff --git a/webapp/services/TameBattleDataService.php b/webapp/services/TameBattleDataService.php index d0ff55bd..1182e6ac 100644 --- a/webapp/services/TameBattleDataService.php +++ b/webapp/services/TameBattleDataService.php @@ -144,8 +144,8 @@ class TameBattleDataService extends BaseService { //记录战斗数据的排行榜 $this->recordBattleRanking(); - //结算用户star数量 -// $this->calStarNum(); +// //结算用户star数量 +// $this->rewardStarNum(); } break; //PVE模式 @@ -168,40 +168,39 @@ class TameBattleDataService extends BaseService { } - //每局战斗结算star数量 - private function calStarNum(){ - $paramMeta = mt\Parameter::getByName('star_get_num'); - if ($paramMeta){ - $star_get_num = getXVal($paramMeta,'param_value', 0); - $num_arr = explode('|',$star_get_num); - $rank = getXVal($this->battleInfo,'pvp_personal_rank', 0); - if ($rank>count($num_arr) || $rank<1){ - $items = array( - array( - 'item_id'=>V_ITEM_STAR, - 'item_num'=>0 - ) - ); +// //每局战斗结算star数量 +// private function rewardStarNum(){ +// $paramMeta = mt\Parameter::getByName('star_get_num'); +// if ($paramMeta){ +// $star_get_num = getXVal($paramMeta,'param_value', 0); +// $num_arr = explode('|',$star_get_num); +// $rank = getXVal($this->battleInfo,'pvp_personal_rank', 0); +// if ($rank>count($num_arr) || $rank<1){ +// $finalNum = 0; +// }else{ +// $finalNum = $this->calFinalStarNum($num_arr[$rank-1]); +// } +// $items = array( +// array( +// 'item_id'=>V_ITEM_STAR, +// 'item_num'=>$finalNum +// ) +// );print_r($items); +// $propertyChgService = new services\PropertyChgService(); +// $awardService = new services\AwardService(); +//// myself()->_addItems($items, $awardService,$propertyChgService); +// myself()->_incDailyV(TN_DAILY_GET_STAR_NUM, 0,$finalNum); +// } +// } + - }else{ - $items = array( - array( - 'item_id'=>V_ITEM_STAR, - 'item_num'=>$num_arr[$rank-1] - ) - ); - } - $propertyChgService = new services\PropertyChgService(); - $awardService = new services\AwardService(); - myself()->_addItems($items, $awardService,$propertyChgService); - } - } //记录战斗数据的排行榜 private function recordBattleRanking(){ $account = getXVal($this->battleInfo,'account_id', 0); //游戏场次 (存活30S算有效场次) - if (getXVal($this->battleInfo,'pvp_survia_time', 0)/1000 > 30 ){ + if (getXVal($this->battleInfo,'pvp_survia_time', 0)/1000 > 30 && + getXVal($this->battleInfo,'abandon_battle', 0) == 0){ RankBattle::upsert($account,RankBattle::GAME_TIMES,1); } //吃鸡数 //pvp_team_rank @@ -456,7 +455,7 @@ class TameBattleDataService extends BaseService { "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,'ranked', 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), @@ -598,6 +597,7 @@ class TameBattleDataService extends BaseService { { //pvp奖励 gold if ($userDb){ + $this->calStarNum($temp['reward'],getXVal($info,'pvp_personal_rank', 0)); $heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0)); if (!$heroDb){ break; @@ -607,6 +607,7 @@ class TameBattleDataService extends BaseService { $temp['reward']['hero']['id'] = $heroDto['hero_id']; $temp['reward']['hero']['gold_uplimit'] = $heroDto['gold_uplimit']; $this->rewardGoldPvp($temp['reward'],$heroDto,$userDb['rank']); + } } break; @@ -627,6 +628,23 @@ class TameBattleDataService extends BaseService { ); } + private function calStarNum(&$reward,$pvp_rank){ + $paramMeta = mt\Parameter::getByName('star_get_num'); + if ($paramMeta){ + $star_get_num = getXVal($paramMeta,'param_value', 0); + $num_arr = explode('|',$star_get_num); + if ($pvp_rank>count($num_arr) || $pvp_rank<1){ + $finalNum = 0; + }else{ + $finalNum = $this->calFinalStarNum($num_arr[$pvp_rank-1]); + } + array_push($reward['items'],array( + 'item_id'=> V_ITEM_STAR, + 'item_num'=>$finalNum, + )); + } + } + private function rewardGoldPvp(&$reward,$heroDto,$userRank) { $heroPvpGold = FormulaService::calcHeroPvpGold($heroDto, $this->allInfo,$userRank); @@ -643,6 +661,21 @@ class TameBattleDataService extends BaseService { } } + private function calFinalStarNum($num){ + $finalNum = 0; + if ($num <= 0) { + return $finalNum; + } + $paramMeta = mt\Parameter::getByName('starroad_max'); + $starMax = getXVal($paramMeta,'param_value', 0); + if ($starMax){ + $starNum = myself()->_getDailyV(TN_DAILY_GET_STAR_NUM, 0); + $newNum = min($starMax,$starNum + $num); + $finalNum = max(0,$newNum-$starNum); + } + return $finalNum; + } + private function settlementReward(){ error_log('settlementReward'); $battle_uuid = getXVal($this->allInfo,'battle_uuid', 0); @@ -857,12 +890,12 @@ class TameBattleDataService extends BaseService { //组队模式战斗次数 $this->incValue($battleData, 'total_team_battle_times', 1); //组队模式前30名次数 - if (getXVal($this->battleInfo,'ranked', 0) <= 30){ + if (getXVal($this->battleInfo,'pvp_personal_rank', 0) <= 30){ $this->incValue($battleData, 'total_team_top_X_battle_times', 1); } } //排名 - $ranked = getXVal($this->battleInfo,'ranked', 0); + $ranked = getXVal($this->battleInfo,'pvp_team_rank', 0); if ($ranked == 1) { //吃鸡次数 $this->incValue($battleData, 'total_win_times', 1); @@ -1039,7 +1072,7 @@ class TameBattleDataService extends BaseService { $heroInfo[$hero['hero_id']] = array(); } $this->incValue($heroInfo[$hero['hero_id']], "use_times", 1); //每个英雄使用次数 - $ranked = getXVal($this->battleInfo,'ranked', 0); + $ranked = getXVal($this->battleInfo,'pvp_team_rank', 0); if ($ranked == 1) { //吃鸡次数 $this->incValue($heroInfo[$hero['hero_id']], 'win_times', 1);//使用该英雄吃鸡获胜次数