1
This commit is contained in:
parent
d5977c23fc
commit
9346a5f558
@ -26,6 +26,8 @@ class Bag(object):
|
|||||||
'url': 'webapp/index.php?c=Bag&a=useItem',
|
'url': 'webapp/index.php?c=Bag&a=useItem',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
|
['item_id', 0, '道具id'],
|
||||||
|
['item_num', 0, '道具数量'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
|
@ -77,8 +77,6 @@ class Item(object):
|
|||||||
self.fields = [
|
self.fields = [
|
||||||
['item_id', 0, '道具id'],
|
['item_id', 0, '道具id'],
|
||||||
['item_num', 0, '道具数量'],
|
['item_num', 0, '道具数量'],
|
||||||
['item_state', 0, '英雄皮肤状态 0=已经购,1 = 试用状态'],
|
|
||||||
['try_expire_at', 0, '试用到期时间(utc时间)'],
|
|
||||||
]
|
]
|
||||||
|
|
||||||
class AwardItem(object):
|
class AwardItem(object):
|
||||||
@ -178,18 +176,43 @@ class Mission(object):
|
|||||||
['state', 0, '任务状态 0:可领取 1:已领取 2:未完成(不可领取)'],
|
['state', 0, '任务状态 0:可领取 1:已领取 2:未完成(不可领取)'],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
class SeassonCardLvUnlockReward(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['card_lv', 0, '手册等级'],
|
||||||
|
['state', 0, '0:不可领取 1:可领取 2:已领取'],
|
||||||
|
['item', AwardItem(), '奖品'],
|
||||||
|
]
|
||||||
|
|
||||||
class SeasonCard(object):
|
class SeasonCard(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.fields = [
|
self.fields = [
|
||||||
['mission_id', 0, '任务id'],
|
['season_id', 0, '赛季id(客户端显示为Sxxx)'],
|
||||||
['current', 0, '任务进度-当前'],
|
['card_lv', 0, '手册等级'],
|
||||||
['target', 0, '任务进度-目标'],
|
['card_exp', 0, '手册经验'],
|
||||||
['state', 0, '任务状态 0:可领取 1:已领取 2:未完成(不可领取)'],
|
['!purchased_gift_packages', [0], '已购买的礼包列表'],
|
||||||
|
['!unlock_rewards', [SeassonCardLvUnlockReward()], '等级解锁的奖励领取列表'],
|
||||||
|
]
|
||||||
|
|
||||||
|
class SeasonMission(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['state', 0, '0:不可领取 1:可领取 2:已领取'],
|
||||||
|
['current', 0, '当前匹配场次'],
|
||||||
|
['target', 0, '目标匹配场次'],
|
||||||
|
['target_rank', 0, '目标段位'],
|
||||||
]
|
]
|
||||||
|
|
||||||
class Season(object):
|
class Season(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.fields = [
|
self.fields = [
|
||||||
|
['season_id', 0, '赛季id(客户端显示为Sxxx)'],
|
||||||
|
['rank', 0, '段位'],
|
||||||
|
['score', 0, '积分'],
|
||||||
|
['max_score', 0, '积分上限'],
|
||||||
|
['mission', SeasonMission(), '赛季任务'],
|
||||||
]
|
]
|
||||||
|
@ -107,8 +107,6 @@ CREATE TABLE `t_bag` (
|
|||||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||||
`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 '0' COMMENT '数量',
|
`item_num` int(11) NOT NULL DEFAULT '0' COMMENT '数量',
|
||||||
`item_state` int(11) NOT NULL DEFAULT '0' COMMENT '状态(0=已经购,1 = 试用状态)',
|
|
||||||
`try_expire_at` int(11) 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 '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
@ -9,9 +9,6 @@ use phpcommon\SqlHelper;
|
|||||||
|
|
||||||
class Bag extends BaseModel {
|
class Bag extends BaseModel {
|
||||||
|
|
||||||
const GETED_STATE = 0;
|
|
||||||
const TRY_USING_STATE = 1;
|
|
||||||
|
|
||||||
public static function find($itemId)
|
public static function find($itemId)
|
||||||
{
|
{
|
||||||
$row = SqlHelper::ormSelectOne(
|
$row = SqlHelper::ormSelectOne(
|
||||||
@ -30,8 +27,6 @@ class Bag extends BaseModel {
|
|||||||
return array(
|
return array(
|
||||||
'item_id' => $row['item_id'],
|
'item_id' => $row['item_id'],
|
||||||
'item_num' => $row['item_num'],
|
'item_num' => $row['item_num'],
|
||||||
'item_state' => $row['item_state'],
|
|
||||||
'try_expire_at' => $row['try_expire_at'],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,44 +55,11 @@ class Bag extends BaseModel {
|
|||||||
array(
|
array(
|
||||||
'item_num' => function () use($itemNum) { return "item_num + {$itemNum}";},
|
'item_num' => function () use($itemNum) { return "item_num + {$itemNum}";},
|
||||||
'modifytime' => myself()->_getNowTime(),
|
'modifytime' => myself()->_getNowTime(),
|
||||||
'item_state' => self::GETED_STATE,
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
'item_id' => $itemId,
|
'item_id' => $itemId,
|
||||||
'item_num' => $itemNum,
|
'item_num' => $itemNum,
|
||||||
'item_state' => self::GETED_STATE,
|
|
||||||
'try_expire_at' => 0,
|
|
||||||
'createtime' => myself()->_getNowTime(),
|
|
||||||
'modifytime' => myself()->_getNowTime()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function addTryUsingItem($itemId, $itemNum, $tryUsingTime)
|
|
||||||
{
|
|
||||||
if (myself()->_isVirtualItem($itemId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$itemMeta = mt\Item::get($itemId);
|
|
||||||
if (!$itemMeta) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SqlHelper::upsert
|
|
||||||
(myself()->_getSelfMysql(),
|
|
||||||
't_bag',
|
|
||||||
array(
|
|
||||||
'account_id' => myself()->_getAccountId(),
|
|
||||||
'item_id' => $itemId
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'account_id' => myself()->_getAccountId(),
|
|
||||||
'item_id' => $itemId,
|
|
||||||
'item_num' => $itemNum,
|
|
||||||
'item_state' => self::TRY_USING_STATE,
|
|
||||||
'try_expire_at' => myself()->_getNowTime() + $tryUsingTime,
|
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime()
|
'modifytime' => myself()->_getNowTime()
|
||||||
)
|
)
|
||||||
@ -112,7 +74,6 @@ class Bag extends BaseModel {
|
|||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
'item_id' => $itemId,
|
'item_id' => $itemId,
|
||||||
'item_state' => self::GETED_STATE,
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'item_num' => function () use($itemNum) {
|
'item_num' => function () use($itemNum) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user