This commit is contained in:
aozhiwei 2022-04-05 15:07:50 +08:00
parent 9824958f41
commit 1d78165d86
3 changed files with 51 additions and 14 deletions

36
webapp/mt/KillReward.php Normal file
View File

@ -0,0 +1,36 @@
<?php
namespace mt;
use phpcommon;
class KillReward {
public static function get($kill)
{
self::msutBeHash();
return getXVal(self::$killHash, $kill);
}
protected static function mustBeHash()
{
if (is_null(self::$killHash)) {
self::$killHash = array();
foreach (self::getMetaList() as $meta) {
self::$killHash[$meta['kill_num']] = $meta;
}
}
}
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('killReward@killReward.php');
}
return self::$metaList;
}
protected static $metaList;
protected static $killHash;
}

View File

@ -6,24 +6,20 @@ use phpcommon;
class RankReward {
public static function get($id)
public static function get($rank)
{
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
self::msutBeHash();
return getXVal(self::$rankHash, $rank);
}
public static function getOldRankReward($id)
protected static function mustBeHash()
{
$meta = self::get($id);
return array(
'rank' => $meta['rank'],
'parameter' => $meta['parameter'],
'drop' => $meta['drop'],
'ad_drop' => $meta['ad_drop'],
'ad_num' => $meta['ad_num'],
'js_num' => $meta['js_num'],
'js_drop' => $meta['js_drop'],
'zbmode_param' => $meta['zbmode_param'],
);
if (is_null(self::$rankHash)) {
self::$rankHash = array();
foreach (self::getMetaList() as $meta) {
self::$rankHash[$meta['rank']] = $meta;
}
}
}
protected static function getMetaList()
@ -35,5 +31,6 @@ class RankReward {
}
protected static $metaList;
protected static $rankHash;
}

View File

@ -26,6 +26,10 @@ class BattleDataService extends BaseService {
public function updateBattleData()
{
$heroDb = Hero::find(getReqVal('hero_uniid', 0));
if (!$heroDb) {
return false;
}
error_log(json_encode($_REQUEST));
error_log('updateBattleData1');
if (!$this->decCost()) {