Compare commits

...

112 Commits
master ... hjb

Author SHA1 Message Date
aa6c01ea4f 1 2024-12-12 17:16:34 +08:00
1e1b9fa12a 任务 2024-12-10 13:52:51 +08:00
37e9287d90 1 2024-12-09 12:04:41 +08:00
92cdfeb020 mission update & claim 2024-12-09 12:04:21 +08:00
00e55be078 格子完成大奖 2024-12-09 11:07:07 +08:00
7a6bfaf43f 1 2024-12-08 17:42:54 +08:00
aae81fb474 1 2024-12-08 16:45:45 +08:00
3ad8fc699a 增加已获奖格子字段 2024-12-08 16:36:34 +08:00
d2f69355df 1 2024-12-06 18:02:49 +08:00
646744ef62 user/claim 2024-12-06 10:52:33 +08:00
aozhiwei
86098dab7f 1 2024-12-03 13:57:02 +08:00
aozhiwei
0e8d26bbd2 1 2024-12-03 13:32:13 +08:00
aozhiwei
4789c8b79e 1 2024-11-29 15:31:59 +08:00
aozhiwei
459d4b60f0 1 2024-11-29 15:27:57 +08:00
aozhiwei
fc7fc373ab 1 2024-11-29 13:44:12 +08:00
aozhiwei
295b166f10 1 2024-11-29 11:29:40 +08:00
aozhiwei
5d15963669 1 2024-11-29 10:44:37 +08:00
aozhiwei
9a7969f8c2 1 2024-11-27 14:24:13 +08:00
aozhiwei
a11bae8228 Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb 2024-11-27 10:44:44 +08:00
aozhiwei
a1781b88be 1 2024-11-27 10:44:37 +08:00
aozhiwei
5f02435b83 1 2024-11-27 10:41:55 +08:00
aozhiwei
fe3371f582 1 2024-11-27 10:37:55 +08:00
aozhiwei
5a0271e16c 1 2024-11-27 10:36:51 +08:00
aozhiwei
d75b043ad7 1 2024-11-25 17:14:13 +08:00
aozhiwei
f868be7a6f 1 2024-11-25 16:31:58 +08:00
aozhiwei
b8d6bc7dc7 1 2024-11-20 15:13:51 +08:00
aozhiwei
a52da5f340 1 2024-11-20 12:42:42 +08:00
aozhiwei
a626e2f7c8 1 2024-11-20 11:41:21 +08:00
aozhiwei
8bdd8a2a9a 1 2024-11-20 11:39:58 +08:00
aozhiwei
094af88a2a 1 2024-11-13 16:23:13 +08:00
aozhiwei
0e53c4fb4b 1 2024-11-13 13:53:16 +08:00
aozhiwei
475559d940 1 2024-11-13 13:46:53 +08:00
aozhiwei
afa249b971 1 2024-11-13 13:40:18 +08:00
aozhiwei
8cc91174fb 1 2024-11-11 16:15:46 +08:00
aozhiwei
d832278f7f 1 2024-11-11 15:48:27 +08:00
aozhiwei
d6c647435e 1 2024-11-11 14:37:41 +08:00
aozhiwei
3db573de32 1 2024-11-11 14:35:53 +08:00
aozhiwei
4ae9d942a1 1 2024-11-11 14:30:07 +08:00
aozhiwei
dc9f31d88c 1 2024-11-11 14:28:25 +08:00
aozhiwei
4ecaf526ff 1 2024-11-09 19:14:23 +08:00
aozhiwei
2dae4f597a 1 2024-11-09 19:05:01 +08:00
aozhiwei
b50f879ce5 1 2024-11-09 19:00:56 +08:00
aozhiwei
25b836342c 1 2024-11-09 14:57:10 +08:00
aozhiwei
368a9aae47 1 2024-11-09 14:45:48 +08:00
aozhiwei
377dd51fa8 1 2024-11-09 14:38:59 +08:00
aozhiwei
424acd4b6d 1 2024-11-09 14:28:42 +08:00
aozhiwei
f291a48ecc 1 2024-11-09 14:26:22 +08:00
aozhiwei
6f74fbd43c 1 2024-11-09 14:23:57 +08:00
aozhiwei
701f9355ba 1 2024-11-09 14:23:22 +08:00
aozhiwei
76061af451 1 2024-11-09 13:43:00 +08:00
aozhiwei
6034eea5ef 1 2024-11-09 13:26:09 +08:00
aozhiwei
2573bcaece 1 2024-11-09 13:03:01 +08:00
aozhiwei
76fe69ba24 1 2024-11-09 13:00:38 +08:00
aozhiwei
fefb1f86d9 1 2024-11-09 12:43:15 +08:00
aozhiwei
a4be7ae478 1 2024-11-09 12:41:45 +08:00
aozhiwei
596f1fe00c 1 2024-11-09 12:25:16 +08:00
aozhiwei
916710ca48 1 2024-11-09 12:22:33 +08:00
aozhiwei
be4e106e10 1 2024-11-09 11:53:53 +08:00
aozhiwei
81cd2a0c44 1 2024-11-09 10:33:50 +08:00
aozhiwei
31eadfbed1 1 2024-11-09 10:29:56 +08:00
aozhiwei
7a99149051 1 2024-11-09 10:27:52 +08:00
aozhiwei
f178eb9698 1 2024-11-09 10:18:08 +08:00
aozhiwei
a0cb91a85c 1 2024-11-09 10:10:58 +08:00
aozhiwei
94336932c0 1 2024-11-09 10:01:22 +08:00
aozhiwei
886f01720a 1 2024-11-09 09:40:35 +08:00
aozhiwei
0199a168fc 1 2024-11-09 09:18:58 +08:00
aozhiwei
36332c336f 1 2024-11-08 16:24:40 +08:00
aozhiwei
5421634fa8 1 2024-11-08 15:30:31 +08:00
aozhiwei
d10a78bdda 1 2024-11-08 15:26:57 +08:00
aozhiwei
89eeb7fab1 1 2024-11-08 15:16:59 +08:00
aozhiwei
0ebd3ff7bc 1 2024-11-08 14:58:08 +08:00
aozhiwei
09ee7e68cc 1 2024-11-08 14:57:17 +08:00
aozhiwei
af7dacc7d7 1 2024-11-08 14:45:24 +08:00
aozhiwei
2102c549f4 1 2024-11-08 14:31:24 +08:00
aozhiwei
b2ce076058 1 2024-11-08 11:20:16 +08:00
aozhiwei
76eae61d73 1 2024-11-08 11:19:01 +08:00
aozhiwei
e24f508e4b 1 2024-11-08 11:12:36 +08:00
aozhiwei
08da30d44d 1 2024-11-08 11:10:34 +08:00
aozhiwei
991be62e99 1 2024-11-08 10:50:46 +08:00
aozhiwei
1282516fd9 1 2024-11-07 20:59:24 +08:00
aozhiwei
c8192a9ed2 1 2024-11-07 20:25:15 +08:00
aozhiwei
decbf68bd8 1 2024-11-07 14:28:51 +08:00
aozhiwei
ba1c546fef 1 2024-11-06 17:49:56 +08:00
aozhiwei
dad69185ad 1 2024-11-06 17:47:33 +08:00
aozhiwei
9e28ff1144 1 2024-11-06 17:45:03 +08:00
aozhiwei
9610eb8fe2 1 2024-11-06 17:43:19 +08:00
aozhiwei
d04c4c4bf8 1 2024-11-06 17:37:25 +08:00
aozhiwei
386a499c64 1 2024-11-06 17:30:48 +08:00
aozhiwei
ea6f77d65f 1 2024-11-06 17:26:51 +08:00
aozhiwei
a5e4c21c63 1 2024-11-06 17:25:02 +08:00
aozhiwei
26ba763997 1 2024-11-06 17:22:37 +08:00
aozhiwei
a583fcbc43 1 2024-11-06 17:19:33 +08:00
aozhiwei
66eaf31290 1 2024-11-06 17:15:12 +08:00
aozhiwei
684e4b20b2 1 2024-11-06 17:14:17 +08:00
aozhiwei
107fbed7b4 1 2024-11-06 17:07:48 +08:00
aozhiwei
1da9e882b2 1 2024-11-06 16:59:02 +08:00
aozhiwei
67add2e2ee 1 2024-11-06 16:52:35 +08:00
aozhiwei
ee139ae6f1 1 2024-11-06 16:46:23 +08:00
aozhiwei
ce7ff506b5 1 2024-11-06 16:31:50 +08:00
aozhiwei
56d928c1fa 1 2024-11-06 16:31:09 +08:00
aozhiwei
1fca42b393 1 2024-11-05 16:53:46 +08:00
aozhiwei
ec61d9f753 1 2024-11-04 16:42:38 +08:00
aozhiwei
85901d567a 1 2024-11-04 16:37:30 +08:00
aozhiwei
be0a73d426 1 2024-11-04 16:21:43 +08:00
aozhiwei
6e96183dce 1 2024-11-04 15:58:56 +08:00
aozhiwei
8a92611255 1 2024-11-04 15:43:59 +08:00
aozhiwei
bbbff6d101 1 2024-11-04 15:06:02 +08:00
aozhiwei
b3f27fdc06 1 2024-11-04 14:21:21 +08:00
aozhiwei
e49923b9b7 1 2024-11-01 16:26:01 +08:00
aozhiwei
79aae72bf9 1 2024-10-29 16:11:34 +08:00
aozhiwei
5f726add19 1 2024-10-29 15:38:29 +08:00
aozhiwei
3755b9d5e0 1 2024-10-29 15:14:19 +08:00
16 changed files with 969 additions and 104 deletions

View File

@ -8,121 +8,284 @@ class AAWheel(object):
'method': 'POST',
'name': '/api/v1/user/login',
'desc': '登录',
'group': '!AAActivity',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/user/login',
'headers': _common.MaybeJwtHeader,
'headers': _common.JwtHeader,
'is_json_params': True,
'request_params': [
],
'params': [
['token', '', 'token'],
],
'response': [
_common.RspHead(),
['info', _common.WheelUser(), '用户名'],
['info', _common.WheelUser(), '用户信息'],
['server_time', 0, '服务器时间'],
]
},
{
'method': 'POST',
'name': '/api/v1/roll_dice',
'name': '/api/v1/activity/roll_dice',
'desc': '掷骰子',
'group': '!AAActivity',
'url': 'https://wheel-test.kingsome.cn/api/v1/roll_dice',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/activity/roll_dice',
'headers': _common.JwtHeader,
'is_json_params': True,
'params': [
['forward_point', 0, '指定前进点数(会扣除spec_dice数量,0随机)'],
],
'response': [
_common.RspHead(),
['point', 0, '点数'],
['award', _common.WheelAward(), '奖励信息'],
['side_effect', _common.WheelSideEffect(), '附加效应'],
['award_grid', 0, '0:普通奖励;1:格子大奖']
]
},
{
'method': 'GET',
'name': '/api/v1/activity/claim',
'desc': '请求格子完成大奖',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/activity/claim',
'headers': _common.JwtHeader,
'is_json_params': True,
'params': [
],
'response': [
_common.RspHead(),
['award', _common.WheelAward(), '奖励信息'],
['side_effect', _common.WheelSideEffect(), '附加效应'],
]
},
{
'method': 'GET',
'name': '/api/v1/friend/list',
'desc': '好友列表',
'group': '!AAActivity',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/friend/list',
'headers': _common.JwtHeader,
'params': [
],
'response': [
_common.RspHead(),
]
},
{
'method': 'GET',
'name': '/api/v1/friend/invite',
'desc': '好友邀请',
'group': '!AAActivity',
'url': 'https://wheel-test.kingsome.cn/api/v1/friend/invite',
'headers': _common.JwtHeader,
'params': [
],
'response': [
_common.RspHead(),
]
},
{
'method': 'GET',
'name': '/api/v1/friend/agree',
'desc': '好友邀请',
'group': '!AAActivity',
'url': 'https://wheel-test.kingsome.cn/api/v1/friend/agree',
'headers': _common.JwtHeader,
'params': [
],
'response': [
_common.RspHead(),
['!data', [_common.WheelFriend()], '好友列表'],
]
},
{
'method': 'GET',
'name': '/api/v1/mission/list',
'desc': '任务列表',
'group': '!AAActivity',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/mission/list',
'headers': _common.JwtHeader,
'params': [
],
'response': [
_common.RspHead(),
['!data', [_common.WheelMission()], '任务列表'],
]
},
{
'method': 'POST',
'name': '/api/v1/mission/update',
'desc': '更新任务进度',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/mission/update',
'headers': _common.JwtHeader,
'params': [
['mission_id', 0, '任务id仅限条件是前端判断的任务'],
],
'response': [
_common.RspHead(),
['!data', [_common.WheelMission()], '任务列表'],
]
},
{
'method': 'POST',
'name': '/api/v1/mission/claim',
'desc': '请求任务奖励',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/mission/claim',
'headers': _common.JwtHeader,
'params': [
['mission_id', 0, '任务id'],
],
'response': [
_common.RspHead(),
['!data', [_common.WheelMission()], '任务列表'],
['award', _common.WheelAward(), '奖励信息'],
['side_effect', _common.WheelSideEffect(), '附加效应'],
]
},
{
'method': 'GET',
'name': '/api/v1/chip/list',
'desc': '芯片列表',
'group': '!AAActivity',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/chip/list',
'headers': _common.JwtHeader,
'params': [
],
'response': [
_common.RspHead(),
]
},
{
'method': 'GET',
'name': '/api/v1/item/list',
'desc': '道具列表',
'group': '!AAActivity',
'url': 'https://wheel-test.kingsome.cn/api/v1/item/list',
'headers': _common.JwtHeader,
'params': [
],
'response': [
_common.RspHead(),
['!data', [_common.WheelChip()], '芯片列表'],
]
},
{
'method': 'GET',
'name': '/api/v1/shop/goods',
'desc': '商店-商品列表',
'group': '!AAActivity',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/shop/goods',
'headers': _common.JwtHeader,
'params': [
],
'response': [
_common.RspHead(),
['!data', [_common.WheelGoods()], '商品列表'],
]
},
{
'method': 'POST',
'name': '/api/v1/shop/buy',
'desc': '商店-购买',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/shop/buy',
'headers': _common.JwtHeader,
'is_json_params': True,
'params': [
['item_id', 0, '道具id'],
],
'response': [
_common.RspHead(),
['point', 0, '点数'],
['award', _common.WheelAward(), '奖励信息'],
['side_effect', _common.WheelSideEffect(), '附加效应'],
]
},
{
'method': 'POST',
'name': '/api/v1/user/info',
'desc': '获取用户信息',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/user/info',
'headers': _common.JwtHeader,
'is_json_params': True,
'request_params': [
],
'params': [
],
'response': [
_common.RspHead(),
['info', _common.WheelUser(), '用户信息'],
]
},
{
'method': 'GET',
'name': '/api/v1/buff/list',
'desc': 'buff-列表',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/buff/list',
'headers': _common.JwtHeader,
'params': [
],
'response': [
_common.RspHead(),
['!data', [_common.WheelBuff()], 'buff列表'],
]
},
{
'method': 'GET',
'name': '/api/v1/bag/list',
'desc': '背包-道具列表',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/bag/list',
'headers': _common.JwtHeader,
'params': [
],
'response': [
_common.RspHead(),
['!data', [_common.WheelItem()], '芯片列表'],
]
},
{
'method': 'POST',
'name': '/api/v1/bag/use_item',
'desc': '背包-使用道具',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/bag/use_item',
'headers': _common.JwtHeader,
'is_json_params': True,
'request_params': [
],
'params': [
['item_uniid', 0, '道具唯一id'],
['item_num', 0, '道具数量'],
],
'response': [
_common.RspHead(),
]
},
{
'method': 'POST',
'name': '/api/v1/gm/exec_cmd',
'desc': 'gm-指向gm指令',
'group': '!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/gm/exec_cmd',
'headers': _common.JwtHeader,
'is_json_params': True,
'request_params': [
],
'params': [
['cmd', '', '指令及参数']
],
'response': [
_common.RspHead(),
['text', '', '回显文字']
]
},
{
'method': 'POST',
'desc': '内购商店-购买',
'name': '/api/v1/inapp_shop/purchase',
'group': '!!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/inapp_shop/purchase',
'headers': _common.JwtHeader,
'is_json_params': True,
'params': [
['goods_id', '', '商品唯一id'],
['goods_num', 0, '商品数量'],
],
'response': [
_common.RspHead(),
['order_id', '', '订单id'],
]
},
{
'method': 'GET',
'desc': '内购商店-查询订单状态',
'name': '/api/v1/inapp_shop/order/:order_id',
'group': '!!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/inapp_shop/order/:order_id',
'headers': _common.JwtHeader,
'params': [
],
'response': [
_common.RspHead(),
['data', _common.WheelInappOrder(), '订单信息'],
]
},
{
'method': 'POST',
'desc': '内购商店-支付成功回调',
'name': '/api/v1/inapp_shop/callback',
'group': '!!AAWheel',
'url': 'https://wheel-test.kingsome.cn/api/v1/inapp_shop/callback',
'headers': _common.JwtHeader,
'is_json_params': True,
'params': [
],
'response': [
_common.RspHead(),
]

View File

@ -11,6 +11,10 @@
* errcode=1008 该接口功能已关闭(admin后台上配置为功能关闭客户端需刷新功能开关)
*
*
* 以下是积分转盘专有
* 所有的协议都可能携带award()和side_effectaward用来显示获得的东西,side_effect用来更新本地数据
*
*
*/
/**

View File

@ -1959,9 +1959,95 @@ class WheelUser(object):
def __init__(self):
self.fields = [
['name', '', '用户名'],
['nickname', '', '用户名'],
['avatar', '', '头像'],
['score', '', '积分'],
['hourly_earnings', 0, '每小时收益'],
['dice', 0, '骰子数'],
['spec_dice', 0, '特殊骰子数(道具)'],
['curr_grid', 0, '当前格子(从1)'],
['last_present_dice_time', 0, '最后赠送色子时间'],
['!award_grids', [0], '已获大奖的格子'],
]
class WheelAwardItem(object):
def __init__(self):
self.fields = [
['item_id', 0, '道具id'],
['item_num', 0, '道具数量'],
]
class WheelAward(object):
def __init__(self):
self.fields = [
['!items', [WheelAwardItem()], '奖励物品列表'],
]
class WheelSideEffect(object):
def __init__(self):
self.fields = [
['user_info', WheelUser(), '用户信息变更(用来更新本地客户端字段(有则更新无则不变))'],
['!effects', [], '变更列表 buff:刷新buff列表 bag:背包 fullgrid:奖励格子拿完 task:任务有更新'],
]
class WheelFriend(object):
def __init__(self):
self.fields = [
['nickname', '', '用户名'],
]
class WheelMission(object):
def __init__(self):
self.fields = [
['mission_id', 0, '任务id'],
['current', 0, '任务进度-当前'],
['target', 0, '任务进度-目标'],
['award', 0, '0:未领奖;1:已领奖']
]
class WheelChip(object):
def __init__(self):
self.fields = [
['item_id', 0, '道具id'],
['left_time', 0, '剩余时间'],
['total_time', 0, '有效时间(总时间)'],
]
class WheelItem(object):
def __init__(self):
self.fields = [
['item_uniid', 0, '背包道具唯一id'],
['item_id', 0, '背包道具配置表id'],
['item_num', 0, '道具数量'],
]
class WheelGoods(object):
def __init__(self):
self.fields = [
['item_id', 0, '道具id'],
]
class WheelBuff(object):
def __init__(self):
self.fields = [
['buff_uniid', 0, 'buff唯一id'],
['buff_id', 0, 'buff配置表id'],
['expires_time', 0, '过期时间(单位秒)'],
]
class WheelInappOrder(object):
def __init__(self):
self.fields = [
['order_id', '', '订单id'],
['status', '', '0:等待支付成功 1:支付成功 2:已发货'],
]

View File

@ -2051,12 +2051,14 @@ DROP TABLE IF EXISTS `t_circuit_battle`;
CREATE TABLE `t_circuit_battle` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`is_android` int(11) NOT NULL DEFAULT '0' COMMENT 'is android',
`season` int(11) NOT NULL DEFAULT '0' COMMENT '赛季',
`cumulative_score` int(11) NOT NULL DEFAULT '0' COMMENT '积分',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
KEY `idx_account_season` (`account_id`, `season`)
KEY `idx_account_season` (`account_id`, `season`),
KEY `idx_is_android` (`is_android`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -2071,13 +2073,15 @@ DROP TABLE IF EXISTS `t_circuit_battle_phase`;
CREATE TABLE `t_circuit_battle_phase` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`is_android` int(11) NOT NULL DEFAULT '0' COMMENT 'is android',
`season` int(11) NOT NULL DEFAULT '0' COMMENT '赛季',
`phase` int(11) NOT NULL DEFAULT '0' COMMENT '阶段',
`cumulative_score` int(11) NOT NULL DEFAULT '0' COMMENT '积分',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
KEY `idx_account_season_phase` (`account_id`, `season`, `phase`)
KEY `idx_account_season_phase` (`account_id`, `season`, `phase`),
KEY `idx_is_android` (`is_android`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -2296,3 +2300,24 @@ CREATE TABLE `t_circuit_task_value` (
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_android`
--
DROP TABLE IF EXISTS `t_android`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_android` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`robot_id` int(11) NOT NULL DEFAULT '0' COMMENT 'robot_id',
`name` varchar(60) NOT NULL DEFAULT '' COMMENT 'name',
`used` int(11) NOT NULL DEFAULT '0' COMMENT '是否已创建',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `uk_robot_id` (`robot_id`),
UNIQUE KEY `uk_name` (`name`),
KEY `idx_used` (`used`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@ -43,6 +43,11 @@ class BaseController {
return $this->nowtime + $this->timeOffset;
}
public function _setNowTime($newTime)
{
$this->nowtime = $newTime;
}
public function _getTimeOffset()
{
return $this->timeOffset;

View File

@ -767,6 +767,7 @@ class BattleController extends BaseAuthedController {
public function getNormalBattleData()
{
error_log(json_encode($_REQUEST));
$version = getReqVal('version', 0);
$ignoreAndroid = false;
if ($version < 1) {

View File

@ -126,7 +126,12 @@ class CircuitController extends BaseAuthedController {
));
}
private function _extractRankingInfo($data){
private function _extractRankingInfo($data)
{
return myself()->_callServiceStatic('CircuitRankingService', 'extractRankingInfo', $data);
}
private function _extractRankingInfoOld($data){
$rankingList = array();
$ranking = 0;
foreach ($data as $k=>$row){

View File

@ -19,7 +19,9 @@ use models\Circuit;
use models\User;
use models\Hero;
use models\HeroSkin;
class OutAppCircuitController extends BaseController {
private $redis_key_circuit_ranking = 'circuit_ranking';
private $redis_key_circuit_phase_ranking = 'circuit_phase_ranking';
@ -31,37 +33,163 @@ class OutAppCircuitController extends BaseController {
}
$address = getReqVal('address', '');
if (empty($address)){
/*
if (SERVER_ENV == _ONLINE) {
myself()->_rspErr(1, 'param error');
return;
}
}*/
}
$user = User::findByAddress($address);
if (SERVER_ENV != _ONLINE) {
$user = User::find('2_2006_I75DCdyQRllgGRYvT0wcGtPR9gbDUZws');
}
if (!$user){
myself()->_rspErr(1, 'user not found');
return;
}
$redis = $this->_getRedis($this->redis_key_circuit_ranking);
if (! $redis->exists(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking)){
$rows = Circuit::getCircuitList($currentCircuitMeta['circuit_season']);
$sortRows = myself()->arraySort($rows, 'cumulative_score', 'desc');
$list = $this->_extractRankingInfo($sortRows);
$redis->set(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking , json_encode($list));
$redis->pexpire(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking , 10*60*1000);
}else{
$listStr = $redis->get(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking);
$list = emptyReplace(json_decode($listStr, true), array());
}
$myInfo = $this->_celMyRankingInfo($list,$user['account_id']);
$info = array(
'star_time' => strtotime($currentCircuitMeta['start_time']),
'start_time' => strtotime($currentCircuitMeta['start_time']),
'end_time' => strtotime($currentCircuitMeta['end_time']),
'ranking' => $myInfo['ranking'],
'score' => $myInfo['score'],
'ranking' => 0,
'score' => 0,
);
if (!$user){
} else {
myself()->_callServiceStatic('CircuitRankingService',
'fillRanking',
$currentCircuitMeta
);
$redis = $this->_getRedis($this->redis_key_circuit_ranking);
if (! $redis->exists(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking)){
$rows = Circuit::getCircuitList($currentCircuitMeta['circuit_season']);
$sortRows = myself()->arraySort($rows, 'cumulative_score', 'desc');
$list = $this->_extractRankingInfo($sortRows);
$redis->set(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking , json_encode($list));
$redis->pexpire(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking , 10*60*1000);
}else{
$listStr = $redis->get(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking);
$list = emptyReplace(json_decode($listStr, true), array());
}
$myInfo = $this->_celMyRankingInfo($list,$user['account_id']);
$info = array(
'start_time' => strtotime($currentCircuitMeta['start_time']),
'end_time' => strtotime($currentCircuitMeta['end_time']),
'ranking' => $myInfo['ranking'],
'score' => $myInfo['score'],
);
}
$this->_rspData(array(
'rank_list' => $list,
'info' => $info,
));
}
public function getCircuitRankingTmp(){
$this->_setNowTime(strtotime('2024-12-01 14:59:59'));
$currentCircuitMeta = mt\CircuitTime::getCurrentCircuit();
if (!$currentCircuitMeta){
$this->_rspErr(1, 'current stage Have not yet started');
return ;
}
$address = getReqVal('address', '');
if (empty($address)){
/*
if (SERVER_ENV == _ONLINE) {
myself()->_rspErr(1, 'param error');
return;
}*/
}
$user = User::findByAddress($address);
if (SERVER_ENV != _ONLINE) {
$user = User::find('1_2006_email|6737dc9c219c150ace316a39');
}
$info = array(
'start_time' => strtotime($currentCircuitMeta['start_time']),
'end_time' => strtotime($currentCircuitMeta['end_time']),
'ranking' => 0,
'score' => 0,
);
if (!$user){
} else {
myself()->_callServiceStatic('CircuitRankingService',
'fillRanking',
$currentCircuitMeta
);
$redis = $this->_getRedis($this->redis_key_circuit_ranking);
if (! $redis->exists(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking)){
$rows = Circuit::getCircuitList($currentCircuitMeta['circuit_season']);
$sortRows = myself()->arraySort($rows, 'cumulative_score', 'desc');
$list = $this->_extractRankingInfo($sortRows);
$redis->set(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking , json_encode($list));
$redis->pexpire(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking , 10*60*1000);
}else{
$listStr = $redis->get(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking);
$list = emptyReplace(json_decode($listStr, true), array());
}
$myInfo = $this->_celMyRankingInfo($list,$user['account_id']);
$info = array(
'start_time' => strtotime($currentCircuitMeta['start_time']),
'end_time' => strtotime($currentCircuitMeta['end_time']),
'ranking' => $myInfo['ranking'],
'score' => $myInfo['score'],
);
}
$this->_rspData(array(
'rank_list' => $list,
'info' => $info,
));
}
public function getCircuitPhaseRankingTmp(){
$this->_setNowTime(strtotime('2024-12-01 14:59:59'));
$currentCircuitMeta = mt\CircuitTime::getCurrentCircuit();
if (!$currentCircuitMeta){
$this->_rspErr(1, 'current stage Have not yet started');
return ;
}
$address = getReqVal('address', '');
if (empty($address)){
/*
if (SERVER_ENV == _ONLINE) {
myself()->_rspErr(1, 'param error');
return;
}*/
}
$user = User::findByAddress($address);
if (SERVER_ENV != _ONLINE) {
$user = User::find('1_2006_email|6737dc9c219c150ace316a39');
}
if (!$user){
$info = array(
'start_time' => strtotime($currentStageMeta['start_time']),
'end_time' => strtotime($currentStageMeta['end_time']),
'ranking' => 0,
'score' => 0
);
} else {
$currentStageMeta = mt\CircuitTime::getCurrentStage();
if (!$currentStageMeta){
$currentStageMeta = mt\CircuitTime::getPrevStage();
}
myself()->_callServiceStatic('CircuitRankingService',
'fillPhaseRanking',
$currentCircuitMeta,
$currentStageMeta);
$redis = $this->_getRedis($this->redis_key_circuit_phase_ranking);
if (! $redis->exists(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking)){
$rows = Circuit::getCircuitPhaseList($currentStageMeta['circuit_season'],$currentStageMeta['circuit_phase']);
$sortRows = myself()->arraySort($rows, 'cumulative_score', 'desc');
$list = $this->_extractRankingInfo($sortRows);
$redis->set(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking , json_encode($list));
$redis->pexpire(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking , 10*60*1000);
}else{
$listStr = $redis->get(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking);
$list = emptyReplace(json_decode($listStr, true), array());
}
$myInfo = $this->_celMyRankingInfo($list,$user['account_id']);
$info = array(
'start_time' => strtotime($currentStageMeta['start_time']),
'end_time' => strtotime($currentStageMeta['end_time']),
'ranking' => $myInfo['ranking'],
'score' => $myInfo['score'],
);
}
$this->_rspData(array(
'rank_list' => $list,
'info' => $info,
@ -76,41 +204,51 @@ class OutAppCircuitController extends BaseController {
}
$address = getReqVal('address', '');
if (empty($address)){
/*
if (SERVER_ENV == _ONLINE) {
myself()->_rspErr(1, 'param error');
return;
}
}*/
}
$user = User::findByAddress($address);
if (SERVER_ENV != _ONLINE) {
$user = User::find('2_2006_I75DCdyQRllgGRYvT0wcGtPR9gbDUZws');
}
if (!$user){
myself()->_rspErr(1, 'user not found');
return;
$info = array(
'start_time' => strtotime($currentStageMeta['start_time']),
'end_time' => strtotime($currentStageMeta['end_time']),
'ranking' => 0,
'score' => 0
);
} else {
$currentStageMeta = mt\CircuitTime::getCurrentStage();
if (!$currentStageMeta){
$currentStageMeta = mt\CircuitTime::getPrevStage();
}
myself()->_callServiceStatic('CircuitRankingService',
'fillPhaseRanking',
$currentCircuitMeta,
$currentStageMeta);
$redis = $this->_getRedis($this->redis_key_circuit_phase_ranking);
if (! $redis->exists(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking)){
$rows = Circuit::getCircuitPhaseList($currentStageMeta['circuit_season'],$currentStageMeta['circuit_phase']);
$sortRows = myself()->arraySort($rows, 'cumulative_score', 'desc');
$list = $this->_extractRankingInfo($sortRows);
$redis->set(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking , json_encode($list));
$redis->pexpire(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking , 10*60*1000);
}else{
$listStr = $redis->get(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking);
$list = emptyReplace(json_decode($listStr, true), array());
}
$myInfo = $this->_celMyRankingInfo($list,$user['account_id']);
$info = array(
'start_time' => strtotime($currentStageMeta['start_time']),
'end_time' => strtotime($currentStageMeta['end_time']),
'ranking' => $myInfo['ranking'],
'score' => $myInfo['score'],
);
}
$currentStageMeta = mt\CircuitTime::getCurrentStage();
if (!$currentStageMeta){
$currentStageMeta = mt\CircuitTime::getPrevStage();
}
$redis = $this->_getRedis($this->redis_key_circuit_phase_ranking);
if (! $redis->exists(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking)){
$rows = Circuit::getCircuitPhaseList($currentStageMeta['circuit_season'],$currentStageMeta['circuit_phase']);
$sortRows = myself()->arraySort($rows, 'cumulative_score', 'desc');
$list = $this->_extractRankingInfo($sortRows);
$redis->set(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking , json_encode($list));
$redis->pexpire(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking , 10*60*1000);
}else{
$listStr = $redis->get(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking);
$list = emptyReplace(json_decode($listStr, true), array());
}
$myInfo = $this->_celMyRankingInfo($list,$user['account_id']);
$info = array(
'star_time' => strtotime($currentStageMeta['start_time']),
'end_time' => strtotime($currentStageMeta['end_time']),
'ranking' => $myInfo['ranking'],
'score' => $myInfo['score'],
);
$this->_rspData(array(
'rank_list' => $list,
'info' => $info,
@ -196,7 +334,12 @@ class OutAppCircuitController extends BaseController {
$this->_rspErr(1,'未满足结算条件');
}
private function _extractRankingInfo($data){
private function _extractRankingInfo($data)
{
return myself()->_callServiceStatic('CircuitRankingService', 'extractRankingInfo', $data);
}
private function _extractRankingInfoOld($data){
$rankingList = array();
$ranking = 0;
foreach ($data as $k=>$row){
@ -217,7 +360,8 @@ class OutAppCircuitController extends BaseController {
'skin_id' => $skinId,
'ranking' => $ranking,
'weight' => $rewardWeight,
'score' => $row['cumulative_score'],
#'score' => $row['cumulative_score'],
'score' => number_format($row['cumulative_score'], 2, '.', ''),
'score_boost' => number_format($row['score_boost'], 2, '.', ''),
);
array_push($rankingList,$info);

View File

@ -5,12 +5,15 @@ require_once('phpcommon/sqlhelper.php');
require_once('services/BlockChainService.php');
require_once('services/BattleBoxService.php');
require_once('models/BuyRecord.php');
require_once('services/NameService.php');
require_once('mt/Robot.php');
use models\Battle;
use phpcommon\SqlHelper;
use services\BlockChainService;
use services\BattleBoxService;
use models\BuyRecord;
use services\NameService;
class ToolsController extends BaseController {
@ -521,4 +524,67 @@ class ToolsController extends BaseController {
BattleBoxService::set($phase, $day);
}
public function genAndroid()
{
$data = array();
mt\Robot::traverse(function ($meta) use(&$data) {
$row = SqlHelper::ormSelectOne
($this->_getMysql(''),
't_android',
array(
'name' => $meta['name']
)
);
if (array_key_exists($meta['name'], $data)) {
return true;
}
$data[$meta['name']] = $meta;
if (!$row) {
echo 'INSERT INTO t_android(robot_id, name, createtime, modifytime)VALUES('
. $meta['id'] . ",'" . $meta['name'] . "'," . myself()->_getNowTime() . ',' . myself()->_getNowTime() . ");\n";
}
return true;
});
}
public function updateAndroid()
{
$rows = SqlHelper::ormSelect
($this->_getMysql(''),
't_android',
array(
)
);
foreach ($rows as $row) {
$userDb = SqlHelper::ormSelectOne
($this->_getMysql(''),
't_user',
array(
'name' => $row['name']
)
);
if ($userDb) {
echo "UPDATE t_android SET used=1 WHERE name='" . $row['name'] . "';\n";
} else {
echo "UPDATE t_android SET used=0 WHERE name='" . $row['name'] . "';\n";
}
}
}
public function nameIsUsed()
{
$name = getReqVal('name', '');
var_dump(NameService::nameUsed($name));
}
public function genAndroidData()
{
myself()->_callServiceStatic('CircuitRankingService', 'genAndroidData');
}
public function recalcRanking()
{
myself()->_callServiceStatic('CircuitRankingService', 'recalcRanking');
}
}

View File

@ -84,7 +84,8 @@ class Circuit extends BaseModel
public static function getRankingList($season){
$sql = "select * from t_circuit_battle where season=:season order by cumulative_score desc,modifytime asc";
$sql = "select * from t_circuit_battle where season=:season and cumulative_score >= 0" .
"order by cumulative_score desc,modifytime asc";
$whereKv = array(
":season" => $season,
);
@ -115,7 +116,8 @@ class Circuit extends BaseModel
}
public static function getPhaseRankingList($season,$phase){
$sql = "select * from t_circuit_battle_phase where season=:season and phase=:phase order by cumulative_score desc,modifytime asc";
$sql = "select * from t_circuit_battle_phase where season=:season and phase=:phase " .
"and cumulative_score >= 0 order by cumulative_score desc,modifytime asc";
$whereKv = array(
":season" => $season,
":phase" => $phase,

View File

@ -49,6 +49,16 @@ class CircuitTime {
return null;
}
public static function getCurrentBattleStage(){
foreach (self::getCircuitAll(self::STAGE_SEASON_TYPE) as $meta){
if (myself()->_getNowTime() >= strtotime($meta['start_time']) &&
myself()->_getNowTime() <= strtotime($meta['end_time']) + 60 * 30) {
return $meta;
}
}
return null;
}
public static function getNextStage($season){
$next = array();
foreach (self::getListBySeason($season) as $meta){

View File

@ -33,6 +33,15 @@ class Robot {
return $members;
}
public static function traverse($cb)
{
foreach (self::getMetaList() as $meta) {
if (!$cb($meta)) {
return;
}
}
}
protected static function getMetaList()
{
if (!self::$metaList) {

View File

@ -0,0 +1,331 @@
<?php
namespace services;
require_once('models/User.php');
require_once('models/Hero.php');
require_once('models/HeroSkin.php');
require_once('mt/CircuitTime.php');
require_once('mt/CircuitTime.php');
use mt;
use phpcommon\SqlHelper;
use models\User;
use models\Hero;
use models\HeroSkin;
class CircuitRankingService extends BaseService {
public static function fillPhaseRanking($currentCircuitMeta, $currentStageMeta)
{
$rows = myself()->_callModelStatic('Circuit', 'getCircuitPhaseList',
$currentStageMeta['circuit_season'],
$currentStageMeta['circuit_phase']);
if (count($rows) < 100) {
return;
}
}
public static function fillRanking($currentCircuitMeta)
{
$rows = myself()->_callModelStatic('Circuit', 'getCircuitList',
$currentCircuitMeta['circuit_season']);
if (count($rows) < 100) {
return;
}
}
public static function repairPhaseRanking($currentCircuitMeta)
{
$rows = myself()->_callModelStatic('Circuit', 'getCircuitPhaseList',
$currentStageMeta['circuit_season'],
$currentStageMeta['circuit_phase']);
$androidHash = array();
foreach ($rows as $row) {
$androidHash[$row['account_id']] = $row;
}
$androidHashDb = self::getAndroidHashDb($androidHash);
if (count($androidHash) < 100) {
for ($i = count($androidHash); $i < 100; $i++) {
if (!empty($androidHashDb)) {
}
}
}
}
public static function getAndroidHashDb($alreadyAndroidHash)
{
$androidHash = array();
$rows = SqlHelper::ormSelectOne
($this->_getMysql(''),
't_android',
array(
'used' => 0
)
);
foreach ($rows as $row) {
if (!array_key_exists($row['robot_id'], $alreadyAndroidHash)) {
$androidHash[$row['robot_id']] = $row;
}
}
return $androidHash;
}
public static function repairRanking($currentCircuitMeta)
{
$rows = myself()->_callModelStatic('Circuit', 'getCircuitList',
$currentCircuitMeta['circuit_season']);
if (count($rows) < 100) {
return;
}
}
public static function genAndroidData()
{
$currentStageMeta = mt\CircuitTime::getCurrentStage();
if (empty($currentStageMeta)) {
myself()->_rspErr(1, 'currentStageMeta Is empty');
return;
}
$rows = SqlHelper::ormSelect
(myself()->_getMysql(''),
't_android',
array(
'used' => 0
)
);
$num = 0;
foreach ($rows as $row) {
++$num;
if ($num > 75) {
break;
}
SqlHelper::upsert
(myself()->_getMysql(''),
't_circuit_battle_phase',
array(
'account_id' => $row['robot_id'],
'season' => $currentStageMeta['circuit_season'],
'phase' => $currentStageMeta['circuit_phase'],
),
array(),
array(
'account_id' => $row['robot_id'],
'is_android' => 1,
'cumulative_score' => 10,
'season' => $currentStageMeta['circuit_season'],
'phase' => $currentStageMeta['circuit_phase'],
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
}
myself()->_rspOk();
}
public static function extractRankingInfo($data){
$rankingList = array();
$ranking = 0;
foreach ($data as $k=>$row){
++$ranking;
$userDb = null;
$heroDb = null;
$heroId = 0;
$skinId = 0;
if ($row['is_android']) {
$robotMeta = myself()->_callMtStatic('Robot', 'get', $row['account_id']);
$userDb = array(
'account_id' => $row['account_id'],
'name' => $robotMeta['name'],
'head_id' => 50001,
'head_frame' => 60000,
);
$heroDb = array(
'hero_id' => $robotMeta['hero_id'],
'skin_id' => 0,
);
$heroId = $heroDb ? $heroDb['hero_id']:0;
$skinId = $skinDb ? $skinDb['skin_id']:0;
} else {
$userDb = User::find($row['account_id']);
$heroDb = Hero::findByAccountId($userDb['account_id'],$userDb['hero_id']);
$skinDb = HeroSkin::findByAccountId($heroDb['skin_id'], $userDb['account_id']);
$heroId = $heroDb ? $heroDb['hero_id']:0;
$skinId = $skinDb ? $skinDb['skin_id']:0;
}
error_log(json_encode($row));
$rewardWeight = \mt\CircuitReward::getRewardWeight($ranking);
if ($userDb){
$info = array(
'account_id' => $userDb['account_id'],
'name' => utf8_encode($userDb['name']),
'head_id' => $userDb['head_id'],
'head_frame' => $userDb['head_frame'],
'hero_id' => $heroId,
'skin_id' => $skinId,
'ranking' => $ranking,
'weight' => $rewardWeight,
#'score' => $row['cumulative_score'],
'score' => number_format($row['cumulative_score'], 2, '.', ''),
'score_boost' => number_format($row['score_boost'], 2, '.', ''),
);
array_push($rankingList,$info);
}
}
return $rankingList;
}
public static function recalcRanking()
{
$currentStageMeta = mt\CircuitTime::getCurrentStage();
if (empty($currentStageMeta)) {
myself()->_rspErr(1, 'currentStageMeta Is empty');
return;
}
$androids = SqlHelper::ormSelect
(myself()->_getMysql(''),
't_circuit_battle_phase',
array(
'season' => $currentStageMeta['circuit_season'],
'phase' => $currentStageMeta['circuit_phase'],
'is_android' => 1,
)
);
$rows = SqlHelper::ormSelect
(myself()->_getMysql(''),
't_circuit_battle_phase',
array(
'season' => $currentStageMeta['circuit_season'],
'phase' => $currentStageMeta['circuit_phase'],
'is_android' => 0,
)
);
$data = array();
foreach ($rows as $row) {
if ($row['cumulative_score'] > 0) {
array_push($data, $row);
}
}
$sortRows = myself()->arraySort($data, 'cumulative_score', 'desc');
$sortRows = self::toArray($sortRows);
/*
{
if (SERVER_ENV != _ONLINE) {
for ($i = 0; $i < 200; ++$i) {
array_push($sortRows, array(
'account_id' => $i,
'cumulative_score' => 2000 - $i * 3
));
}
}
}*/
if (count($sortRows) <= 20) {
myself()->_rspErr(1, '人数不足20');
return;
}
$maxScore = $sortRows[19]['cumulative_score'] - 1;
if ($maxScore <= 0) {
myself()->_rspErr(1, '分数不足');
return;
}
//21-100之间的名次 塞入35名
//101-200之间的名次 塞入40名
$sortAndroids = myself()->arraySort($androids, 'cumulative_score', 'desc');
$sortAndroids = self::toArray($sortAndroids);
$lastScore = $maxScore;
for ($i = 0; $i < 75; ++$i) {
if (20 + $i > count($sortRows)) {
break;
}
if ($i > count($sortAndroids)) {
break;
}
$currUser = $sortRows[20 + $i];
$currScore = $currUser['cumulative_score'];
if ($currScore >= $lastScore) {
continue;
}
$rangeScore = $lastScore - $currScore;
$allocScore = $currScore + rand(0, $rangeScore - 1);
$curAndroid = $sortAndroids[$i];
self::updateAndroidScore($curAndroid, $allocScore, $currentStageMeta);
$lastScore = $currScore;
}
myself()->_rspOk();
}
private static function updateAndroidScore($android, $newScore, $currentStageMeta)
{
if ($newScore <= $android['cumulative_score']) {
return;
}
if ($android['cumulative_score'] <= 0) {
SqlHelper::upsert
(myself()->_getMysql(''),
't_circuit_battle',
array(
'account_id' => $android['account_id'],
'season' => $currentStageMeta['circuit_season'],
),
array(
'cumulative_score' => $newScore,
),
array(
'account_id' => $android['account_id'],
'season' => $currentStageMeta['circuit_season'],
'is_android' => 1,
'cumulative_score' => $newScore,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
} else {
SqlHelper::upsert
(myself()->_getMysql(''),
't_circuit_battle',
array(
'account_id' => $android['account_id'],
'season' => $currentStageMeta['circuit_season'],
),
array(
'cumulative_score' => function() use($android, $newScore) {
$addScore = $newScore - $android['cumulative_score'];
return 'cumulative_score +' . $addScore;
},
),
array(
'account_id' => $android['account_id'],
'season' => $currentStageMeta['circuit_season'],
'is_android' => 1,
'cumulative_score' => $newScore,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
}
SqlHelper::update
(myself()->_getMysql(''),
't_circuit_battle_phase',
array(
'account_id' => $android['account_id'],
'season' => $currentStageMeta['circuit_season'],
'phase' => $currentStageMeta['circuit_phase'],
),
array(
'cumulative_score' => $newScore
)
);
}
private static function toArray($data)
{
$arr = array();
foreach ($data as $k=>$row){
array_push($arr, $row);
}
return $arr;
}
}

View File

@ -29,6 +29,16 @@ class NameService extends BaseService {
'key' => '2006'
)
);
if (!empty($row)) {
return true;
}
$row = SqlHelper::ormSelectOne
($conn,
't_android',
array(
'name' => $name,
)
);
return !empty($row);
}

View File

@ -133,7 +133,7 @@ class RoomBattleDataService extends BaseService {
//巡回模式排位分计算
if ($this->mapMode == mt\MapMode::CIRCUIT_MODE){
$circuitMeta = mt\CircuitTime::getCurrentCircuit();
$circuitStageMeta = mt\CircuitTime::getCurrentStage();
$circuitStageMeta = mt\CircuitTime::getCurrentBattleStage();
if ($circuitMeta && $circuitStageMeta){
$minScore = mt\Parameter::getVal('circuit_rank_score_min',0);
$multConstant = mt\Parameter::getVal('circuit_score_mult_constant',1);

View File

@ -70,6 +70,10 @@ class ServerSwitchService {
$redis->set(self::SERVER_SWITCH_KEY,json_encode($data));
$redis->pexpire(self::SERVER_SWITCH_KEY , 10*1000);
}
if (myself()->_getZid() == 17) {
$data['normal']['ui.popup.circuitTask'] = 0;
$data['auditing']['ui.popup.circuitTask'] = 0;
}
return $data;
}