1
This commit is contained in:
parent
084b2bd9aa
commit
3475b9260c
@ -71,10 +71,24 @@ class ChipPage(object):
|
|||||||
['!data', [_common.ChipPage()], '页信息']
|
['!data', [_common.ChipPage()], '页信息']
|
||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
'name': 'removeChip',
|
'name': 'removeChipOne',
|
||||||
|
'desc': '芯片移除',
|
||||||
|
'group': 'ChipPage',
|
||||||
|
'url': 'webapp/index.php?c=ChipPage&a=removeChipOne',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
['page', '', '页id'],
|
||||||
|
['slot_id', '', '卡槽id'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['!data', [_common.ChipPage()], '页信息']
|
||||||
|
]
|
||||||
|
},{
|
||||||
|
'name': 'removeChipAll',
|
||||||
'desc': '芯片移除(一键移除)',
|
'desc': '芯片移除(一键移除)',
|
||||||
'group': 'ChipPage',
|
'group': 'ChipPage',
|
||||||
'url': 'webapp/index.php?c=ChipPage&a=removeChip',
|
'url': 'webapp/index.php?c=ChipPage&a=removeChipAll',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['page', '', '页id'],
|
['page', '', '页id'],
|
||||||
|
@ -164,10 +164,6 @@ CREATE TABLE `t_hero` (
|
|||||||
`last_mission_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后悬赏任务获取金币的时间',
|
`last_mission_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后悬赏任务获取金币的时间',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
`chip_ids` varchar(100) NOT NULL DEFAULT '' COMMENT '已镶嵌的芯片idx组',
|
|
||||||
`skill_common` varchar(255) NOT NULL DEFAULT '100100|100120|100140|100160|100180|100200|100220|100240|100260|100280' COMMENT '通用技能',
|
|
||||||
`skill_points` int(11) NOT NULL DEFAULT '0' COMMENT '技能点',
|
|
||||||
`labour` int(11) NOT NULL DEFAULT '0' COMMENT '劳力值',
|
|
||||||
`active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id',
|
`active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id',
|
||||||
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
|
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
|
||||||
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
||||||
@ -242,22 +238,13 @@ CREATE TABLE `t_chip` (
|
|||||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
||||||
`item_num` int(11) NOT NULL DEFAULT '1' COMMENT '数量',
|
`item_num` int(11) NOT NULL DEFAULT '1' COMMENT '数量',
|
||||||
`chip_grade` int(11) NOT NULL DEFAULT '1' COMMENT '芯片等级',
|
`chip_grade` int(11) NOT NULL DEFAULT '1' COMMENT '芯片等级',
|
||||||
`chip_type` int(11) NOT NULL DEFAULT '1' COMMENT '1:角色芯片 2:武器芯片',
|
`chip_type` int(11) NOT NULL DEFAULT '1' COMMENT '1 攻击;2 防御;3 辅助',
|
||||||
`state` int(11) NOT NULL DEFAULT '0' COMMENT '芯片添加状态:0 正常;1 选择;-1 锁定',
|
`state` int(11) NOT NULL DEFAULT '0' COMMENT '0:已购买 1:免费(GIFT标签)',
|
||||||
`supper_state` int(11) NOT NULL DEFAULT '0' COMMENT '是否锁定:0 正常;1 锁住',
|
`inlay_state` varchar(60) COMMENT '所镶嵌的芯片页id:1|2|3',
|
||||||
`inlay_state` int(11) NOT NULL DEFAULT '0' COMMENT '镶嵌状态:0 未镶嵌;1 镶嵌了',
|
|
||||||
`rand_attr` mediumblob COMMENT '随机属性',
|
`rand_attr` mediumblob COMMENT '随机属性',
|
||||||
`today_get_gold` bigint NOT NULL DEFAULT '0' COMMENT '金币',
|
|
||||||
`last_get_gold_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后获取金币的时间',
|
|
||||||
`lucky_temporary` varchar(10) NOT NULL DEFAULT '0' COMMENT '临时幸运值',
|
|
||||||
`lucky_final` varchar(10) NOT NULL DEFAULT '0' COMMENT '最终幸运值',
|
|
||||||
`strength_max` varchar(10) NOT NULL DEFAULT '0' COMMENT '最大体力值',
|
|
||||||
`strength` varchar(10) NOT NULL DEFAULT '0' COMMENT '前一天体力值',
|
|
||||||
`upgrade_mint` double NOT NULL DEFAULT '0' COMMENT 'mint费用',
|
|
||||||
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
`labour` int(11) NOT NULL DEFAULT '0' COMMENT '劳力值',
|
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
UNIQUE KEY `token_id` (`token_id`),
|
UNIQUE KEY `token_id` (`token_id`),
|
||||||
KEY `item_id` (`item_id`),
|
KEY `item_id` (`item_id`),
|
||||||
@ -294,8 +281,6 @@ CREATE TABLE `t_gun` (
|
|||||||
`last_mission_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后悬赏任务获取金币的时间',
|
`last_mission_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后悬赏任务获取金币的时间',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
`chip_ids` varchar(100) NOT NULL DEFAULT '' COMMENT '已镶嵌的芯片idx组',
|
|
||||||
`labour` int(11) NOT NULL DEFAULT '0' COMMENT '劳力值',
|
|
||||||
`active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id',
|
`active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id',
|
||||||
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
|
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
|
||||||
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
||||||
|
@ -160,6 +160,10 @@ class ChipController extends BaseAuthedController
|
|||||||
$this->_rspErr(1, "Unable to use free chip");
|
$this->_rspErr(1, "Unable to use free chip");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (count(array_filter(explode("|",$chipDbParam['inlay_state']))) > 0){
|
||||||
|
$this->_rspErr(1, "The used chip");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ($chipDbParam['chip_grade'] != $chipDbMain['chip_grade']){
|
if ($chipDbParam['chip_grade'] != $chipDbMain['chip_grade']){
|
||||||
$this->_rspErr(1, "Material chip grade does not meet");
|
$this->_rspErr(1, "Material chip grade does not meet");
|
||||||
return;
|
return;
|
||||||
|
@ -84,8 +84,6 @@ class ChipPageController extends BaseAuthedController
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
$data = emptyReplace(json_decode($chipPageDb['data'], true), array());
|
$data = emptyReplace(json_decode($chipPageDb['data'], true), array());
|
||||||
// $data[$slotId-1]['chip_id'] = $uniqueId;
|
|
||||||
// print_r($data);die;
|
|
||||||
if ( $data[$slotId-1]['state'] != 1){
|
if ( $data[$slotId-1]['state'] != 1){
|
||||||
$this->_rspErr(1,'Unlocked state');
|
$this->_rspErr(1,'Unlocked state');
|
||||||
return ;
|
return ;
|
||||||
@ -95,7 +93,8 @@ class ChipPageController extends BaseAuthedController
|
|||||||
$this->_rspErr(1, "You don't have the chip yet");
|
$this->_rspErr(1, "You don't have the chip yet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($chipDb['inlay_state'] == 1){
|
|
||||||
|
if (in_array($page,array_filter(explode("|",$chipDb['inlay_state'])))){
|
||||||
$this->_rspErr(1, "The used chip");
|
$this->_rspErr(1, "The used chip");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -105,23 +104,18 @@ class ChipPageController extends BaseAuthedController
|
|||||||
case 0 : $type = 3;break;
|
case 0 : $type = 3;break;
|
||||||
default:$type = 0;
|
default:$type = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($chipDb['chip_type'] != $type){
|
if ($chipDb['chip_type'] != $type){
|
||||||
$this->_rspErr(1, "Type mismatch");
|
$this->_rspErr(1, "Type mismatch");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( $data[$slotId-1]['chip_id'] ){
|
if ( $data[$slotId-1]['chip_id'] ){
|
||||||
Chip::update2($data[$slotId-1]['chip_id'] ,
|
|
||||||
array(
|
Chip::updateInlayState($data[$slotId-1]['chip_id'],$page);
|
||||||
'inlay_state' => 0,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
$data[$slotId-1]['chip_id'] = $uniqueId;
|
$data[$slotId-1]['chip_id'] = $uniqueId;
|
||||||
Chip::update2($uniqueId ,
|
|
||||||
array(
|
Chip::updateInlayState($uniqueId,$page);
|
||||||
'inlay_state' => 1,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
ChipPage::update($page,array(
|
ChipPage::update($page,array(
|
||||||
'data' => json_encode($data)
|
'data' => json_encode($data)
|
||||||
));
|
));
|
||||||
@ -132,8 +126,13 @@ class ChipPageController extends BaseAuthedController
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeChip(){
|
public function removeChipOne(){
|
||||||
$page = getReqVal('page',0);
|
$page = getReqVal('page',0);
|
||||||
|
$slotId = getReqVal('slot_id',0);
|
||||||
|
if (!$page || !$slotId){
|
||||||
|
$this->_rspErr(1, 'Missing parameter');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
$chipPageDb = ChipPage::find($page);
|
$chipPageDb = ChipPage::find($page);
|
||||||
if (!$chipPageDb){
|
if (!$chipPageDb){
|
||||||
$this->_rspErr(1,'page parameter error');
|
$this->_rspErr(1,'page parameter error');
|
||||||
@ -141,12 +140,8 @@ class ChipPageController extends BaseAuthedController
|
|||||||
}
|
}
|
||||||
$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['chip_id']){
|
if ($value['slot_id'] == $slotId){
|
||||||
Chip::update2($value['chip_id'] ,
|
Chip::updateInlayState($value['chip_id'],$page);
|
||||||
array(
|
|
||||||
'inlay_state' => 0,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$value['chip_id'] = 0;
|
$value['chip_id'] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,4 +154,30 @@ class ChipPageController extends BaseAuthedController
|
|||||||
'data' => $chipPageDto,
|
'data' => $chipPageDto,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeChipAll(){
|
||||||
|
$page = getReqVal('page',0);
|
||||||
|
$chipPageDb = ChipPage::find($page);
|
||||||
|
if (!$chipPageDb){
|
||||||
|
$this->_rspErr(1,'page parameter error');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$data = emptyReplace(json_decode($chipPageDb['data'], true), array());
|
||||||
|
foreach ($data as &$value){
|
||||||
|
if ($value['chip_id']){
|
||||||
|
Chip::updateInlayState($value['chip_id'],$page);
|
||||||
|
$value['chip_id'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChipPage::update($page,array(
|
||||||
|
'data' => json_encode($data)
|
||||||
|
));
|
||||||
|
$newChipPageDb = ChipPage::find($page);
|
||||||
|
$chipPageDto = ChipPage::toDtoInfo($newChipPageDb);
|
||||||
|
$this->_rspData(array(
|
||||||
|
'data' => $chipPageDto,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -296,6 +296,22 @@ class Chip extends BaseModel
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function updateInlayState($idx,$page){
|
||||||
|
$row = self::find($idx);
|
||||||
|
if ($row){
|
||||||
|
$inlayState = array_filter (explode("|",$row['inlay_state']) );
|
||||||
|
if (in_array($page,$inlayState)){
|
||||||
|
unset($inlayState[array_search($page,$inlayState)]);
|
||||||
|
}else{
|
||||||
|
array_push($inlayState,$page);
|
||||||
|
}
|
||||||
|
self::update2($idx,array(
|
||||||
|
'inlay_state' => implode('|',$inlayState)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// public static function updateRandAttr($accountId,$chip){
|
// public static function updateRandAttr($accountId,$chip){
|
||||||
// $attr_pool = mt\ChipAttr::generateOneAttr($chip['chip_type']);
|
// $attr_pool = mt\ChipAttr::generateOneAttr($chip['chip_type']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user