芯片页功能
This commit is contained in:
parent
2fa4228fb6
commit
2202434cf7
22
doc/Chip.py
22
doc/Chip.py
@ -31,6 +31,19 @@ class Chip(object):
|
|||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['!data', [_common.Chip()], '芯片信息']
|
['!data', [_common.Chip()], '芯片信息']
|
||||||
]
|
]
|
||||||
|
},{
|
||||||
|
'name': 'upgradeAttrChange',
|
||||||
|
'desc': '芯片升级属性变化',
|
||||||
|
'group': 'Chip',
|
||||||
|
'url': 'webapp/index.php?c=Chip&a=upgradeAttrChange',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
['chip_uniid', '', '芯片唯一id'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['!data', [AttrChange()], '属性变化信息']
|
||||||
|
]
|
||||||
},{
|
},{
|
||||||
'name': 'upgradeQuality',
|
'name': 'upgradeQuality',
|
||||||
'desc': '芯片升阶',
|
'desc': '芯片升阶',
|
||||||
@ -79,3 +92,12 @@ class Chip(object):
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
class AttrChange(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['attr_id', 0, '属性id'],
|
||||||
|
['min_val', 0, '最小属性值'],
|
||||||
|
['max_val', 0, '最大属性值'],
|
||||||
|
]
|
@ -19,6 +19,20 @@ class ChipPage(object):
|
|||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['!data', [_common.ChipPage()], '页信息']
|
['!data', [_common.ChipPage()], '页信息']
|
||||||
]
|
]
|
||||||
|
},{
|
||||||
|
'name': 'unlockSlot',
|
||||||
|
'desc': '解锁卡槽',
|
||||||
|
'group': 'ChipPage',
|
||||||
|
'url': 'webapp/index.php?c=ChipPage&a=unlockSlot',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
['hero_unnid', '', '英雄唯一id'],
|
||||||
|
['slot_id', '', '卡槽id'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['property_chg', [_common.PropertyChg()], '信息变更']
|
||||||
|
]
|
||||||
},{
|
},{
|
||||||
'name': 'useChip',
|
'name': 'useChip',
|
||||||
'desc': '使用芯片(镶嵌)',
|
'desc': '使用芯片(镶嵌)',
|
||||||
@ -35,10 +49,10 @@ class ChipPage(object):
|
|||||||
['!data', [_common.ChipPage()], '页信息']
|
['!data', [_common.ChipPage()], '页信息']
|
||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
'name': 'removeChipOne',
|
'name': 'removeChip',
|
||||||
'desc': '芯片移除',
|
'desc': '芯片移除',
|
||||||
'group': 'ChipPage',
|
'group': 'ChipPage',
|
||||||
'url': 'webapp/index.php?c=ChipPage&a=removeChipOne',
|
'url': 'webapp/index.php?c=ChipPage&a=removeChip',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['hero_unnid', '', '英雄唯一id'],
|
['hero_unnid', '', '英雄唯一id'],
|
||||||
@ -46,20 +60,8 @@ class ChipPage(object):
|
|||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['!data', [_common.ChipPage()], '页信息']
|
['!data', [_common.ChipPage()], '页信息'],
|
||||||
]
|
['property_chg', [_common.PropertyChg()], '信息变更']
|
||||||
},{
|
|
||||||
'name': 'removeChipAll',
|
|
||||||
'desc': '芯片移除(一键移除)',
|
|
||||||
'group': 'ChipPage',
|
|
||||||
'url': 'webapp/index.php?c=ChipPage&a=removeChipAll',
|
|
||||||
'params': [
|
|
||||||
_common.ReqHead(),
|
|
||||||
['hero_unnid', '', '英雄唯一id'],
|
|
||||||
],
|
|
||||||
'response': [
|
|
||||||
_common.RspHead(),
|
|
||||||
['!data', [_common.ChipPage()], '页信息']
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -1110,6 +1110,7 @@ class ChipPageSlot(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.fields = [
|
self.fields = [
|
||||||
['slot_id', 0, '卡槽id'],
|
['slot_id', 0, '卡槽id'],
|
||||||
|
['slot_type', 0, '卡槽类型(和芯片类型对应)1 攻击;2 防御;3 辅助'],
|
||||||
['state', 0, '0:未解锁 1:已解锁'],
|
['state', 0, '0:未解锁 1:已解锁'],
|
||||||
['chip_id', '', '芯片唯一id'],
|
['chip_id', '', '芯片唯一id'],
|
||||||
['item_id', '', '芯片itemId'],
|
['item_id', '', '芯片itemId'],
|
||||||
|
@ -67,6 +67,53 @@ class ChipController extends BaseAuthedController
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function upgradeAttrChange(){
|
||||||
|
$chipUniId = getReqVal('chip_uniid', 0);
|
||||||
|
$chipDb = Chip::find($chipUniId);
|
||||||
|
if (!$chipDb) {
|
||||||
|
$this->_rspErr(100, 'param chip_uniid error ');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($chipDb['quality'] == Chip::CHIP_QUALITY_MAX){
|
||||||
|
$this->_rspErr(5, "It's already the highest level");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$chipAttrMeta = \mt\ChipAttribute::get($chipDb['item_id']);
|
||||||
|
if (!$chipAttrMeta){
|
||||||
|
$this->_rspErr(100, 'mt error ');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$randMetas = mt\BattleRandAttribute::getByInvoke($chipAttrMeta['battleAttribute'],$chipDb['quality'] + 1);
|
||||||
|
$attrList = array();
|
||||||
|
foreach ($randMetas as $meta){
|
||||||
|
$strs = explode('|', $meta['attributeRange']);
|
||||||
|
foreach ($strs as $str) {
|
||||||
|
$attrStr = explode(':', $str);
|
||||||
|
if (isset($attrList[$attrStr[0]])){
|
||||||
|
if ( $attrList[$attrStr[0]][0] > $attrStr[1]){
|
||||||
|
$attrList[$attrStr[0]][0] = $attrStr[1];
|
||||||
|
}
|
||||||
|
if ($attrList[$attrStr[0]][1] < $attrStr[2]){
|
||||||
|
$attrList[$attrStr[0]][1] = $attrStr[2];
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$attrList[$attrStr[0]] = array($attrStr[1],$attrStr[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data = array();
|
||||||
|
foreach ($attrList as $key => $value){
|
||||||
|
array_push($data,array(
|
||||||
|
'attr_id' => $key,
|
||||||
|
'min_val' => $value[0],
|
||||||
|
'max_val' => $value[1],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$this->_rspData(array(
|
||||||
|
'data' => $data,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
public function upgradeQuality(){
|
public function upgradeQuality(){
|
||||||
$chipUniId = getReqVal('chip_uniid', 0);
|
$chipUniId = getReqVal('chip_uniid', 0);
|
||||||
$consumeUniIds = getReqVal('consume_uniids',0);
|
$consumeUniIds = getReqVal('consume_uniids',0);
|
||||||
|
@ -3,11 +3,14 @@
|
|||||||
require_once('models/Chip.php');
|
require_once('models/Chip.php');
|
||||||
require_once('models/ChipPage.php');
|
require_once('models/ChipPage.php');
|
||||||
require_once('models/Hero.php');
|
require_once('models/Hero.php');
|
||||||
|
require_once('mt/EconomyAttribute.php');
|
||||||
require_once('services/ChipPageService.php');
|
require_once('services/ChipPageService.php');
|
||||||
|
require_once('services/PropertyChgService.php');
|
||||||
|
|
||||||
use models\Chip;
|
use models\Chip;
|
||||||
use models\ChipPage;
|
use models\ChipPage;
|
||||||
use models\Hero;
|
use models\Hero;
|
||||||
|
use mt\EconomyAttribute;
|
||||||
use services\ChipPageService;
|
use services\ChipPageService;
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
@ -26,15 +29,69 @@ class ChipPageController extends BaseAuthedController
|
|||||||
ChipPage::addChipPage($heroUid);
|
ChipPage::addChipPage($heroUid);
|
||||||
$chipPageDb = ChipPage::find($heroUid);
|
$chipPageDb = ChipPage::find($heroUid);
|
||||||
}
|
}
|
||||||
$chipPageService = new services\ChipPageService();
|
|
||||||
$chipPageService->refreshSlotState($chipPageDb,$heroDb);
|
|
||||||
$chipPageDb = ChipPage::find($heroUid);
|
|
||||||
$chipPageDto = ChipPage::toDtoInfo($chipPageDb);
|
$chipPageDto = ChipPage::toDtoInfo($chipPageDb);
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'data' => $chipPageDto,
|
'data' => $chipPageDto,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function unlockSlot(){
|
||||||
|
$heroUid = getReqVal('hero_unnid',0);
|
||||||
|
$slotId = getReqVal('slot_id',0);
|
||||||
|
if ($slotId < 1 || $slotId > ChipPage::MAX_CHIP_SLOT_NUM){
|
||||||
|
$this->_rspErr(1,'param slot_id error');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$heroDb = Hero::find($heroUid);
|
||||||
|
if (!$heroDb){
|
||||||
|
$this->_rspErr(1,'param error');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$heroMeta = \mt\Hero::get($heroDb['hero_id']);
|
||||||
|
$economyAttrMeta = EconomyAttribute::findByGrade($heroMeta['economyAttribute'],$heroDb['quality']);
|
||||||
|
if (!$economyAttrMeta){
|
||||||
|
$this->_rspErr(1,'mt error');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$chipSlot = explode("|",$economyAttrMeta['chipSlot']);
|
||||||
|
$chipPageDb = ChipPage::find($heroUid);
|
||||||
|
$pageHashData = ChipPage::dataToHash($chipPageDb);
|
||||||
|
$slotInfo = $pageHashData[$slotId];
|
||||||
|
if ($slotInfo['state'] == 1){
|
||||||
|
$this->_rspErr(1,'The slot has been unlocked');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$unlockCount = ChipPage::getUnlockCount($chipPageDb,$slotInfo['slot_type']);
|
||||||
|
if ($chipSlot[$slotInfo['slot_type']-1] <= $unlockCount){
|
||||||
|
$this->_rspErr(1,'The unlock condition was not met');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$totalUnlockCount = ChipPage::getUnlockCount($chipPageDb);
|
||||||
|
$priceArr = explode('|',\mt\Parameter::getVal('hero_solt_unlock_price',0));
|
||||||
|
if (! isset($priceArr[$totalUnlockCount])){
|
||||||
|
$this->_rspErr(1,'mt No price found');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$costItems = array(
|
||||||
|
array(
|
||||||
|
'item_id' => V_ITEM_GOLD,
|
||||||
|
'item_num' => $priceArr[$totalUnlockCount]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$propertyChgService = new services\PropertyChgService();
|
||||||
|
$lackItem = null;
|
||||||
|
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
|
||||||
|
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->_decItems($costItems);
|
||||||
|
$propertyChgService->addUserChg();
|
||||||
|
ChipPage::unlockSlot($chipPageDb,$slotId);
|
||||||
|
$this->_rspData(array(
|
||||||
|
'property_chg' => $propertyChgService->toDto(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
public function useChip(){
|
public function useChip(){
|
||||||
$hero_unnid = getReqVal('hero_unnid',0);
|
$hero_unnid = getReqVal('hero_unnid',0);
|
||||||
$slotId = getReqVal('slot_id',0);
|
$slotId = getReqVal('slot_id',0);
|
||||||
@ -53,12 +110,14 @@ class ChipPageController extends BaseAuthedController
|
|||||||
$this->_rspErr(1,'page parameter error');
|
$this->_rspErr(1,'page parameter error');
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
if ($slotId > ChipPageService::MAX_CHIP_SLOT_NUM || $slotId < 0 ){
|
if ($slotId > ChipPage::MAX_CHIP_SLOT_NUM || $slotId < 0 ){
|
||||||
$this->_rspErr(1,'No card slot exists');
|
$this->_rspErr(1,'No card slot exists');
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
$data = emptyReplace(json_decode($chipPageDb['data'], true), array());
|
$data = emptyReplace(json_decode($chipPageDb['data'], true), array());
|
||||||
if ( $data[$slotId-1]['state'] != 1){
|
$pageHashData = ChipPage::dataToHash($chipPageDb);
|
||||||
|
$slotInfo = $pageHashData[$slotId];
|
||||||
|
if ( $slotInfo['state'] != 1){
|
||||||
$this->_rspErr(1,'Unlocked state');
|
$this->_rspErr(1,'Unlocked state');
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -72,23 +131,14 @@ class ChipPageController extends BaseAuthedController
|
|||||||
$this->_rspErr(1, "The used chip");
|
$this->_rspErr(1, "The used chip");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch ($slotId%3){
|
if ($chipDb['chip_type'] != $slotInfo['slot_type']){
|
||||||
case 1 : $type = 1;break;
|
|
||||||
case 2 : $type = 2;break;
|
|
||||||
case 0 : $type = 3;break;
|
|
||||||
default:$type = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($chipDb['chip_type'] != $type){
|
|
||||||
$this->_rspErr(1, "Type mismatch");
|
$this->_rspErr(1, "Type mismatch");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( $data[$slotId-1]['chip_id'] ){
|
if ( $slotInfo['chip_id'] ){
|
||||||
|
Chip::updateInlayState($slotInfo['chip_id'],0);
|
||||||
Chip::updateInlayState($data[$slotId-1]['chip_id'],0);
|
|
||||||
}
|
}
|
||||||
$data[$slotId-1]['chip_id'] = $chip_unnid;
|
$data[$slotId-1]['chip_id'] = $chip_unnid;
|
||||||
|
|
||||||
Chip::updateInlayState($chip_unnid,1);
|
Chip::updateInlayState($chip_unnid,1);
|
||||||
ChipPage::update($hero_unnid,array(
|
ChipPage::update($hero_unnid,array(
|
||||||
'data' => json_encode($data)
|
'data' => json_encode($data)
|
||||||
@ -100,7 +150,7 @@ class ChipPageController extends BaseAuthedController
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeChipOne(){
|
public function removeChip(){
|
||||||
$hero_unnid = getReqVal('hero_unnid',0);
|
$hero_unnid = getReqVal('hero_unnid',0);
|
||||||
$slotId = getReqVal('slot_id',0);
|
$slotId = getReqVal('slot_id',0);
|
||||||
if (!$hero_unnid || !$slotId){
|
if (!$hero_unnid || !$slotId){
|
||||||
@ -117,6 +167,25 @@ class ChipPageController extends BaseAuthedController
|
|||||||
$this->_rspErr(1,'page parameter error');
|
$this->_rspErr(1,'page parameter error');
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
$price = \mt\Parameter::getVal('hero_chip_remove_price',0);
|
||||||
|
if ($price == 0){
|
||||||
|
$this->_rspErr(1,'mt price error');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$costItems = array(
|
||||||
|
array(
|
||||||
|
'item_id' => V_ITEM_GOLD,
|
||||||
|
'item_num' => $price
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$propertyChgService = new services\PropertyChgService();
|
||||||
|
$lackItem = null;
|
||||||
|
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
|
||||||
|
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->_decItems($costItems);
|
||||||
|
$propertyChgService->addUserChg();
|
||||||
$data = emptyReplace(json_decode($chipPageDb['data'], true), array());
|
$data = emptyReplace(json_decode($chipPageDb['data'], true), array());
|
||||||
foreach ($data as &$value){
|
foreach ($data as &$value){
|
||||||
if ($value['slot_id'] == $slotId){
|
if ($value['slot_id'] == $slotId){
|
||||||
@ -131,10 +200,12 @@ class ChipPageController extends BaseAuthedController
|
|||||||
$chipPageDto = ChipPage::toDtoInfo($newChipPageDb);
|
$chipPageDto = ChipPage::toDtoInfo($newChipPageDb);
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'data' => $chipPageDto,
|
'data' => $chipPageDto,
|
||||||
|
'property_chg' => $propertyChgService->toDto(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeChipAll(){
|
public function removeChipAll(){
|
||||||
|
return
|
||||||
$hero_unnid = getReqVal('hero_unnid',0);
|
$hero_unnid = getReqVal('hero_unnid',0);
|
||||||
$heroDb = Hero::find($hero_unnid);
|
$heroDb = Hero::find($hero_unnid);
|
||||||
if (!$heroDb){
|
if (!$heroDb){
|
||||||
|
@ -10,6 +10,7 @@ use services\ChipPageService;
|
|||||||
|
|
||||||
class ChipPage extends BaseModel
|
class ChipPage extends BaseModel
|
||||||
{
|
{
|
||||||
|
const MAX_CHIP_SLOT_NUM = 9;
|
||||||
|
|
||||||
public static function find($hero_unnid){
|
public static function find($hero_unnid){
|
||||||
$row = SqlHelper::ormSelectOne(
|
$row = SqlHelper::ormSelectOne(
|
||||||
@ -22,6 +23,47 @@ class ChipPage extends BaseModel
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function dataToHash($row){
|
||||||
|
$dataHash = array();
|
||||||
|
$data = emptyReplace(json_decode($row['data'], true), array());
|
||||||
|
array_walk($data, function ($row) use(&$dataHash) {
|
||||||
|
$dataHash[$row['slot_id']] = $row;
|
||||||
|
});
|
||||||
|
return $dataHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getUnlockCount($row , $slotType = 0){
|
||||||
|
$data = emptyReplace(json_decode($row['data'], true), array());
|
||||||
|
$count = 0;
|
||||||
|
if ($slotType == 0){
|
||||||
|
foreach ($data as $value){
|
||||||
|
if($value['state'] == 1){
|
||||||
|
$count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
foreach ($data as $value){
|
||||||
|
if($slotType == $value['slot_type'] && $value['state'] == 1){
|
||||||
|
$count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function unlockSlot($row,$slot){
|
||||||
|
$data = emptyReplace(json_decode($row['data'], true), array());
|
||||||
|
foreach ($data as $key=>$value){
|
||||||
|
if ($value['slot_id'] == $slot){
|
||||||
|
$data[$key]['state'] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::update($row['hero_uniid'],array(
|
||||||
|
'data' => json_encode($data)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function toDtoInfo($row){
|
public static function toDtoInfo($row){
|
||||||
$data = emptyReplace(json_decode($row['data'], true), array());
|
$data = emptyReplace(json_decode($row['data'], true), array());
|
||||||
@ -119,11 +161,19 @@ class ChipPage extends BaseModel
|
|||||||
|
|
||||||
public static function addChipPage($hero_uniid){
|
public static function addChipPage($hero_uniid){
|
||||||
$data = array();
|
$data = array();
|
||||||
for ($i=1;$i <= ChipPageService::MAX_CHIP_SLOT_NUM;$i++){
|
for ($i=1;$i <= self::MAX_CHIP_SLOT_NUM;$i++){
|
||||||
|
if ( $i<=3 ){
|
||||||
|
$slotType = 1;
|
||||||
|
}elseif($i>3 && $i <= 6){
|
||||||
|
$slotType = 2;
|
||||||
|
}else{
|
||||||
|
$slotType = 3;
|
||||||
|
}
|
||||||
array_push(
|
array_push(
|
||||||
$data,
|
$data,
|
||||||
array(
|
array(
|
||||||
'slot_id'=>$i,
|
'slot_id'=>$i,
|
||||||
|
'slot_type'=>$slotType,
|
||||||
'state'=>0,
|
'state'=>0,
|
||||||
'chip_id'=>0,
|
'chip_id'=>0,
|
||||||
)
|
)
|
||||||
|
@ -62,7 +62,7 @@ class BattleRandAttribute {
|
|||||||
return array_values($newAttr);
|
return array_values($newAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getByInvoke($invoke,$quality){
|
public static function getByInvoke($invoke,$quality){
|
||||||
$metaList = array();
|
$metaList = array();
|
||||||
foreach (self::getMetaList() as $meta){
|
foreach (self::getMetaList() as $meta){
|
||||||
$rateNeed = explode('|', $meta['rareNeed']);
|
$rateNeed = explode('|', $meta['rareNeed']);
|
||||||
|
@ -13,10 +13,10 @@ use mt\Item;
|
|||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
class ChipPageService extends BaseService
|
class ChipPageService extends BaseService
|
||||||
{
|
{
|
||||||
const MAX_CHIP_SLOT_NUM = 30;
|
const MAX_CHIP_SLOT_NUM = 9;
|
||||||
const INIT_CHIP_PAGE_NUM = 3;
|
const INIT_CHIP_PAGE_NUM = 3;
|
||||||
|
|
||||||
public function refreshSlotState($row,$heroDb){
|
public function refreshSlotState($chipPageDb,$heroDb){
|
||||||
|
|
||||||
$itemMeta = Item::get($heroDb['hero_id']);
|
$itemMeta = Item::get($heroDb['hero_id']);
|
||||||
if (!$itemMeta){
|
if (!$itemMeta){
|
||||||
@ -43,7 +43,7 @@ class ChipPageService extends BaseService
|
|||||||
array_push($slotArr,$i*3 +3 );
|
array_push($slotArr,$i*3 +3 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$data = emptyReplace(json_decode($row['data'], true), array());
|
$data = emptyReplace(json_decode($chipPageDb['data'], true), array());
|
||||||
|
|
||||||
foreach ($data as &$val){
|
foreach ($data as &$val){
|
||||||
if ( in_array($val['slot_id'],$slotArr) ){
|
if ( in_array($val['slot_id'],$slotArr) ){
|
||||||
@ -52,7 +52,7 @@ class ChipPageService extends BaseService
|
|||||||
$val['state'] = 0;
|
$val['state'] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChipPage::update($row['hero_uniid'],array(
|
ChipPage::update($chipPageDb['hero_uniid'],array(
|
||||||
'data' => json_encode($data),
|
'data' => json_encode($data),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user