This commit is contained in:
hujiabin 2024-01-17 16:41:41 +08:00
parent 84061729ad
commit b0d754ba2e
2 changed files with 47 additions and 26 deletions

View File

@ -2,11 +2,13 @@
namespace services; namespace services;
require_once('models/Hero.php');
require_once('models/HashRate.php'); require_once('models/HashRate.php');
require_once('models/HashRateBattleData.php'); require_once('models/HashRateBattleData.php');
use models\HashRateBattleData; use models\HashRateBattleData;
use models\HashRate; use models\HashRate;
use models\Hero;
use mt\AchievementsPower; use mt\AchievementsPower;
class HashRateService extends BaseService class HashRateService extends BaseService
{ {
@ -23,16 +25,6 @@ class HashRateService extends BaseService
$this->hisBattleData = HashRateBattleData::getMyBattleData(); $this->hisBattleData = HashRateBattleData::getMyBattleData();
$this->hashRateData = getXVal($this->hisBattleData, 'data', array()); $this->hashRateData = getXVal($this->hisBattleData, 'data', array());
// $currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
// if (myself()->_getDaySeconds(getXVal($this->hashRateData, 'modifytime', 0)) <
// myself()->_getDaySeconds($currentPeriod['obtain_end_time'])) {
// $this->hashRateData = array(
// 'pvpData' => array(),
// 'mobaData' => array(),
// 'createtime' => myself()->_getNowTime(),
// 'modifytime' => myself()->_getNowTime(),
// );
// }
if (!$this->hashRateData){ if (!$this->hashRateData){
$this->hashRateData = array( $this->hashRateData = array(
'pvpData' => array(), 'pvpData' => array(),
@ -41,6 +33,15 @@ class HashRateService extends BaseService
'modifytime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime(),
); );
} }
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
if (myself()->_getDaySeconds(getXVal($this->hashRateData, 'modifytime', 0)) <
myself()->_getDaySeconds($currentPeriod['obtain_start_time'])) {
$this->hashRateData = array(
'pvpData' => array(),
'mobaData' => array(),
'modifytime' => myself()->_getNowTime(),
);
}
$this->pvpBattleData = $this->hashRateData['pvpData']; $this->pvpBattleData = $this->hashRateData['pvpData'];
$this->mobaBattleData = $this->hashRateData['mobaData']; $this->mobaBattleData = $this->hashRateData['mobaData'];
} }
@ -73,12 +74,14 @@ class HashRateService extends BaseService
break; break;
//X分钟内结束比赛 //X分钟内结束比赛
case AchievementsPower::NOMINAL_TIME_BATTLE_END : { case AchievementsPower::NOMINAL_TIME_BATTLE_END : {
//.... $taskDto['current'] = $this->getBattleData($taskMate,
'total_fiveMin_times');
} }
break; break;
//在局内升级最快次数 //在局内升级最快次数
case AchievementsPower::IN_BATTLE_UP_LV : { case AchievementsPower::IN_BATTLE_UP_LV : {
//..... $taskDto['current'] = $this->getBattleData($taskMate,
'total_first_Lv_up');
} }
break; break;
//游戏场次 //游戏场次
@ -101,12 +104,20 @@ class HashRateService extends BaseService
break; break;
//累计行走距离(米) //累计行走距离(米)
case AchievementsPower::WALKING_DISTANCE : { case AchievementsPower::WALKING_DISTANCE : {
//.../ $taskDto['current'] = $this->getBattleData($taskMate,
'total_walking_distance');
} }
break; break;
//指定英雄升阶数 //指定英雄升阶数
case AchievementsPower::HERO_UP_QUALITY : { case AchievementsPower::HERO_UP_QUALITY : {
//..../ $condition = $taskMate['condition'];
$quality = 0;
Hero::getHeroList(function ($row) use ($condition,&$quality) {
if ($row['hero_id'] == $condition && $row['quality'] > $quality){
$quality = $row['quality'];
}
});
$taskDto['current'] = $quality;
} }
break; break;
//拥有英雄nft数 //拥有英雄nft数

View File

@ -1260,30 +1260,40 @@ class TameBattleDataService extends BaseService {
private function applyEx(&$battleData) private function applyEx(&$battleData)
{ {
//战斗次数 //战斗次数
$this->incValue($battleData, 'total_battle_times', 1); if (! getXVal($this->battleInfo,'is_run_away', 0)){
//排名 $this->incValue($battleData, 'total_battle_times', 1);
$ranked = 0; }
switch (getXVal($this->allInfo,'room_mode', 0)){ switch (getXVal($this->allInfo,'room_mode', 0)){
case self::MATCH_MODE_PVP :{ case self::MATCH_MODE_PVP :{
$ranked = getXVal($this->battleInfo,'pvp_team_rank', 0); //排名
$ranked = getXVal($this->battleInfo,'pvp_personal_rank', 0);
if ($ranked == 40){ if ($ranked == 40){
$this->incValue($battleData, 'total_last_runner_times', 1); $this->incValue($battleData, 'total_last_runner_times', 1);
} }
//救援次数 //救援次数
$this->incValue($battleData, 'total_rescue_times', getXVal($this->battleInfo,'rescue_teammate_times', 0)); $this->incValue($battleData, 'total_rescue_times', getXVal($this->battleInfo,'rescue_teammate_times', 0));
//行走距离
$distance = getXVal($this->battleInfo,'move_distance', 0);
$this->incValue($battleData, 'total_walking_distance', $distance);
} }
break; break;
case self::ROOM_MODE_MOBA :{ case self::ROOM_MODE_MOBA :{
/* //几分钟结束战斗
排名 $duration = getXVal($this->battleInfo,'game_duration', 0);
几分钟结束战斗 if ($duration && floor($duration / 60) < 5){
第一个升满级 $this->incValue($battleData, 'total_fiveMin_times', 1);
*/ }
//第一个升满级
$fullLv = getXVal($this->battleInfo,'full_level_idx', 0);
if ($fullLv == 1){
$this->incValue($battleData, 'total_first_Lv_up', 1);
}
} }
break; break;
} }
if ($ranked == 1){ //是否胜利
if (getXVal($this->allInfo,'victory', 0)){
$this->incValue($battleData, 'total_win_times', 1); $this->incValue($battleData, 'total_win_times', 1);
} }
//击杀 //击杀
@ -1293,4 +1303,4 @@ class TameBattleDataService extends BaseService {
$this->procWeaponsSlot($battleData); $this->procWeaponsSlot($battleData);
} }
} }