This commit is contained in:
aozhiwei 2021-11-29 17:04:37 +08:00
parent 42d1f3dff1
commit 1d87b368e3
3 changed files with 14 additions and 7 deletions

View File

@ -5,10 +5,12 @@ require_once('mt/GunTalent.php');
require_once('models/GunSkin.php'); require_once('models/GunSkin.php');
require_once('models/GunTalent.php'); require_once('models/GunTalent.php');
require_once('models/User.php');
use phpcommon\SqlHelper; use phpcommon\SqlHelper;
use models\GunSkin; use models\GunSkin;
use models\GunTalent; use models\GunTalent;
use models\User;
class GunController extends BaseAuthedController { class GunController extends BaseAuthedController {
@ -69,13 +71,18 @@ class GunController extends BaseAuthedController {
$this->_rspErr(2, '已满级'); $this->_rspErr(2, '已满级');
return; return;
} }
$ormUserInfo = $this->_getOrmUserInfo(); /*$ormUserInfo = $this->_getOrmUserInfo();
if ($ormUserInfo['level'] < $growMeta['need_user_level']) {
$this->_rspErr(3, '用户等级未到达');
return;
}*/
$costList = mt\GunTalentGrow::getCostList($growMeta); $costList = mt\GunTalentGrow::getCostList($growMeta);
$lackItem = array(); $lackItem = array();
if (!$this->_hasEnoughItems($costList, $lackItem)) { if (!$this->_hasEnoughItems($costList, $lackItem)) {
$this->_rspErr(3, '缺少材料'); $this->_rspErr(3, '缺少材料');
return; return;
} }
$this->_decItems($costList);
GunTalent::upgradeLv($typeId, $talentId, $currLv + 1); GunTalent::upgradeLv($typeId, $talentId, $currLv + 1);
$this->_rspData(array( $this->_rspData(array(
'property_chg' => array( 'property_chg' => array(

View File

@ -58,7 +58,7 @@ class UserController extends BaseAuthedController {
'account_id' => $this->_getAccountId(), 'account_id' => $this->_getAccountId(),
'name' => $userName, 'name' => $userName,
#'avatar_url' => $avatar_url, #'avatar_url' => $avatar_url,
'gold' => 10000, 'gold' => 10000 * 10000,
#'season_status' => 1, #'season_status' => 1,
#'newInfo' => '', #'newInfo' => '',
#'new_second_equip' => 2, #'new_second_equip' => 2,
@ -82,7 +82,7 @@ class UserController extends BaseAuthedController {
} }
} }
{ {
$this->_addItem(array( $this->_addItems(array(
array( array(
'item_id' => 16001, 'item_id' => 16001,
'item_num' => 0, 'item_num' => 0,

View File

@ -31,7 +31,7 @@ class GunTalentGrow {
public static function getByIdLv($talentId, $talentLv) public static function getByIdLv($talentId, $talentLv)
{ {
self::mustBeIdLvHash(); self::mustBeIdLvHash();
$idMeta = getXVal($idLvHash, $talentId, null); $idMeta = getXVal(self::$idLvHash, $talentId, null);
return $idMeta ? getXVal($idMeta, $talentLv, null) : null; return $idMeta ? getXVal($idMeta, $talentLv, null) : null;
} }
@ -40,12 +40,12 @@ class GunTalentGrow {
if (!self::$idLvHash) { if (!self::$idLvHash) {
self::$idLvHash = array(); self::$idLvHash = array();
foreach (self::getMetaList() as $meta) { foreach (self::getMetaList() as $meta) {
$idMeta = getXVal($idLvHash, $talentId, null); $idMeta = getXVal(self::$idLvHash, (int)$meta['talent_id'], null);
if (!$idMeta) { if (!$idMeta) {
$idMeta = array(); $idMeta = array();
$idLvHash[$meta['id']] = $idMeta; self::$idLvHash[(int)$meta['talent_id']] = $idMeta;
} }
$idLvHash[$meta['id']][$meta['talent_lv']] = $meta; self::$idLvHash[(int)$meta['talent_id']][(int)$meta['talent_lv']] = $meta;
} }
} }
} }