diff --git a/webapp/models/FragmentPool.php b/webapp/models/FragmentPool.php index 4fa87264..2920f1ce 100644 --- a/webapp/models/FragmentPool.php +++ b/webapp/models/FragmentPool.php @@ -7,9 +7,9 @@ use phpcommon\SqlHelper; class FragmentPool extends BaseModel { - public static function dropHero() + public static function dropHero($type) { - $items = self::internalGet(0); + $items = self::internalGet(0, $type); if (count($items)) { $idx = array_rand($items, 1); $fragmentId = $items[$idx]['fragment_id']; @@ -19,9 +19,9 @@ class FragmentPool extends BaseModel { return 0; } - public static function dropGun() + public static function dropGun($type) { - $items = self::internalGet(1); + $items = self::internalGet(1, $type); if (count($items)) { $idx = array_rand($items, 1); $fragmentId = $items[$idx]['fragment_id']; @@ -31,9 +31,9 @@ class FragmentPool extends BaseModel { return 0; } - public static function getHeroNum() + public static function getHeroNum($type) { - $items = self::internalGet(0); + $items = self::internalGet(0, $type); $num = 0; foreach ($items as $item) { $num += $item['fragment_num']; @@ -41,9 +41,9 @@ class FragmentPool extends BaseModel { return $num; } - public static function getGunNum() + public static function getGunNum($type) { - $items = self::internalGet(1); + $items = self::internalGet(1, $type); $num = 0; foreach ($items as $item) { $num += $item['fragment_num']; @@ -51,14 +51,15 @@ class FragmentPool extends BaseModel { return $num; } - private static function internalGet($type) + private static function internalGet($fragmentType, $type) { $allocTime = self::getAllocTime(); $rows = SqlHelper::ormSelect (myself()->_getSelfMysql(), 't_fragment_pool', array( - 'fragment_type' => $type, + 'type' => $type, + 'fragment_type' => $fragmentType, 'alloc_time' => $allocTime, ) ); diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 7d489e43..e31ece2e 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -524,8 +524,8 @@ class BattleDataService extends BaseService { $todayPvpBattleTimes = myself()->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0); $onlineNum = RealtimeData::getOnline(); - $heroFragmentNum = FragmentPool::getHeroNum(); - $gunFragmentNum = FragmentPool::getGunNum(); + $heroFragmentNum = FragmentPool::getHeroNum0(); + $gunFragmentNum = FragmentPool::getGunNum(0); $heroProbability = FormulaService::calcHeroFragmentProbabilityPvp ($_REQUEST, @@ -553,8 +553,8 @@ class BattleDataService extends BaseService { if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum < self::MAX_DROP_NUM) { $onlineNum = RealtimeData::getOnline(); - $heroFragmentNum = FragmentPool::getHeroNum(); - $gunFragmentNum = FragmentPool::getGunNum(); + $heroFragmentNum = FragmentPool::getHeroNum(1); + $gunFragmentNum = FragmentPool::getGunNum(1); $instanceLevel = $this->pveGeminiMeta['gemini_lv']; $instanceRank = $this->instanceRank; @@ -756,8 +756,12 @@ class BattleDataService extends BaseService { $propertyChgService = new services\PropertyChgService(); $awardService = new services\AwardService(); $matchMode = getReqVal('match_mode', 0); + $type = 0; + if ($matchMode == self::MATCH_MODE_PVE) { + $type = 1; + } if ($dropIdx == 0) { - $itemId = FragmentPool::dropHero(); + $itemId = FragmentPool::dropHero($type); if ($itemId) { array_push($this->reward['items'], array( @@ -781,7 +785,7 @@ class BattleDataService extends BaseService { } } } else if ($dropIdx == 1) { - $itemId = FragmentPool::dropGun(); + $itemId = FragmentPool::dropGun($type); if ($itemId) { array_push($this->reward['items'], array(