diff --git a/doc/_common.py b/doc/_common.py index 3a1592a3..daf1c1b7 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -171,6 +171,7 @@ class UserInfo(object): ['!ring_list', [0], '勋章(戒指)列表'], ['!honor_info', [HonorInfo()], '荣誉信息'], ['account_lucky', 0, '用户幸运值'], + ['chest_rate', 0, '宝箱概率'], ] class UserBattleInfo(object): diff --git a/webapp/models/User.php b/webapp/models/User.php index 8407ae84..dce17972 100644 --- a/webapp/models/User.php +++ b/webapp/models/User.php @@ -5,6 +5,7 @@ namespace models; require_once('mt/Item.php'); require_once('mt/LevelUp.php'); require_once('mt/StarLevel.php'); +require_once('mt/Parameter.php'); require_once('models/UserSeasonRing.php'); require_once('models/Parachute.php'); require_once('models/Hero.php'); @@ -84,6 +85,11 @@ class User extends BaseModel { if ($row['address']){ $honorInfo = UserHonor::info($row['address']); } + $lucky = Hero::getAccountLuckyTemp(); + $luckyParam = \mt\Parameter::getVal('economy_account_luck_K',0); + + $rangeArr = explode("|",\mt\Parameter::getVal('economy_account_luck_range',0)); + $rate = ($rangeArr[1]-$rangeArr[0]) * $lucky/($lucky+$luckyParam) + $rangeArr[0]; return array( 'activated' => $row['activated'], 'rename_count' => $row['rename_count'], @@ -122,7 +128,8 @@ class User extends BaseModel { 'ring_id' => $row['ring_id'], 'ring_list' => UserSeasonRing::ringList($row['account_id']), 'honor_info' => $honorInfo, - 'account_lucky' => Hero::getAccountLuckyTemp() + 'account_lucky' => $lucky, + 'chest_rate' => $rate, ); } @@ -141,6 +148,11 @@ class User extends BaseModel { if ($row['address']){ $honorInfo = UserHonor::info($row['address']); } + $lucky = Hero::getAccountLuckyTemp(); + $luckyParam = \mt\Parameter::getVal('economy_account_luck_K',0); + + $rangeArr = explode("|",\mt\Parameter::getVal('economy_account_luck_range',0)); + $rate = ($rangeArr[1]-$rangeArr[0]) * $lucky/($lucky+$luckyParam) + $rangeArr[0]; return array( 'activated' => $row['activated'], 'rename_count' => $row['rename_count'], @@ -181,7 +193,8 @@ class User extends BaseModel { 'parachute_list' => Parachute::getMyParachute(), 'honor_info' => $honorInfo, 'last_login_time' => $row['last_login_time'], - 'account_lucky' => Hero::getAccountLuckyTemp() + 'account_lucky' => $lucky, + 'chest_rate' => $rate, ); } diff --git a/webapp/services/HashRateService.php b/webapp/services/HashRateService.php index 5a12f947..f009de99 100644 --- a/webapp/services/HashRateService.php +++ b/webapp/services/HashRateService.php @@ -72,11 +72,11 @@ class HashRateService extends BaseService 'task'.AchievementsPower::TYPE3 => array(), 'task'.AchievementsPower::TYPE4 => array(), 'currentPeriod' => 0, - 'initTime' => 0 + 'modifytime' => 0 ); } $currentPeriod= \mt\AchievementsCycle::getCurrentPeriod(); - if ($currentPeriod && $currentPeriod['id'] != $this->hashRateTask['currentPeriod']){ + if ($currentPeriod && myself()->_getDaySeconds($this->hashRateTask['modifytime']) < myself()->_getNowDaySeconds()){ $this->initHashRateTask($currentPeriod['id']); } @@ -336,7 +336,7 @@ class HashRateService extends BaseService $this->randHashRateTaskList(AchievementsPower::TYPE2); $this->randHashRateTaskList(AchievementsPower::TYPE3); $this->randHashRateTaskList(AchievementsPower::TYPE4); - $this->hashRateTask['initTime'] = myself()->_getNowDaySeconds(); + $this->hashRateTask['modifytime'] = myself()->_getNowTime(); $this->hashRateTask['currentPeriod'] = $currentId; $this->saveHashRateTask(); }