Compare commits
112 Commits
Author | SHA1 | Date | |
---|---|---|---|
aa6c01ea4f | |||
1e1b9fa12a | |||
37e9287d90 | |||
92cdfeb020 | |||
00e55be078 | |||
7a6bfaf43f | |||
aae81fb474 | |||
3ad8fc699a | |||
d2f69355df | |||
646744ef62 | |||
![]() |
86098dab7f | ||
![]() |
0e8d26bbd2 | ||
![]() |
4789c8b79e | ||
![]() |
459d4b60f0 | ||
![]() |
fc7fc373ab | ||
![]() |
295b166f10 | ||
![]() |
5d15963669 | ||
![]() |
9a7969f8c2 | ||
![]() |
a11bae8228 | ||
![]() |
a1781b88be | ||
![]() |
5f02435b83 | ||
![]() |
fe3371f582 | ||
![]() |
5a0271e16c | ||
![]() |
d75b043ad7 | ||
![]() |
f868be7a6f | ||
![]() |
b8d6bc7dc7 | ||
![]() |
a52da5f340 | ||
![]() |
a626e2f7c8 | ||
![]() |
8bdd8a2a9a | ||
![]() |
094af88a2a | ||
![]() |
0e53c4fb4b | ||
![]() |
475559d940 | ||
![]() |
afa249b971 | ||
![]() |
8cc91174fb | ||
![]() |
d832278f7f | ||
![]() |
d6c647435e | ||
![]() |
3db573de32 | ||
![]() |
4ae9d942a1 | ||
![]() |
dc9f31d88c | ||
![]() |
4ecaf526ff | ||
![]() |
2dae4f597a | ||
![]() |
b50f879ce5 | ||
![]() |
25b836342c | ||
![]() |
368a9aae47 | ||
![]() |
377dd51fa8 | ||
![]() |
424acd4b6d | ||
![]() |
f291a48ecc | ||
![]() |
6f74fbd43c | ||
![]() |
701f9355ba | ||
![]() |
76061af451 | ||
![]() |
6034eea5ef | ||
![]() |
2573bcaece | ||
![]() |
76fe69ba24 | ||
![]() |
fefb1f86d9 | ||
![]() |
a4be7ae478 | ||
![]() |
596f1fe00c | ||
![]() |
916710ca48 | ||
![]() |
be4e106e10 | ||
![]() |
81cd2a0c44 | ||
![]() |
31eadfbed1 | ||
![]() |
7a99149051 | ||
![]() |
f178eb9698 | ||
![]() |
a0cb91a85c | ||
![]() |
94336932c0 | ||
![]() |
886f01720a | ||
![]() |
0199a168fc | ||
![]() |
36332c336f | ||
![]() |
5421634fa8 | ||
![]() |
d10a78bdda | ||
![]() |
89eeb7fab1 | ||
![]() |
0ebd3ff7bc | ||
![]() |
09ee7e68cc | ||
![]() |
af7dacc7d7 | ||
![]() |
2102c549f4 | ||
![]() |
b2ce076058 | ||
![]() |
76eae61d73 | ||
![]() |
e24f508e4b | ||
![]() |
08da30d44d | ||
![]() |
991be62e99 | ||
![]() |
1282516fd9 | ||
![]() |
c8192a9ed2 | ||
![]() |
decbf68bd8 | ||
![]() |
ba1c546fef | ||
![]() |
dad69185ad | ||
![]() |
9e28ff1144 | ||
![]() |
9610eb8fe2 | ||
![]() |
d04c4c4bf8 | ||
![]() |
386a499c64 | ||
![]() |
ea6f77d65f | ||
![]() |
a5e4c21c63 | ||
![]() |
26ba763997 | ||
![]() |
a583fcbc43 | ||
![]() |
66eaf31290 | ||
![]() |
684e4b20b2 | ||
![]() |
107fbed7b4 | ||
![]() |
1da9e882b2 | ||
![]() |
67add2e2ee | ||
![]() |
ee139ae6f1 | ||
![]() |
ce7ff506b5 | ||
![]() |
56d928c1fa | ||
![]() |
1fca42b393 | ||
![]() |
ec61d9f753 | ||
![]() |
85901d567a | ||
![]() |
be0a73d426 | ||
![]() |
6e96183dce | ||
![]() |
8a92611255 | ||
![]() |
bbbff6d101 | ||
![]() |
b3f27fdc06 | ||
![]() |
e49923b9b7 | ||
![]() |
79aae72bf9 | ||
![]() |
5f726add19 | ||
![]() |
3755b9d5e0 |
263
doc/AAWheel.py
263
doc/AAWheel.py
@ -8,121 +8,284 @@ class AAWheel(object):
|
|||||||
'method': 'POST',
|
'method': 'POST',
|
||||||
'name': '/api/v1/user/login',
|
'name': '/api/v1/user/login',
|
||||||
'desc': '登录',
|
'desc': '登录',
|
||||||
'group': '!AAActivity',
|
'group': '!AAWheel',
|
||||||
'url': 'https://wheel-test.kingsome.cn/api/v1/user/login',
|
'url': 'https://wheel-test.kingsome.cn/api/v1/user/login',
|
||||||
'headers': _common.MaybeJwtHeader,
|
'headers': _common.JwtHeader,
|
||||||
'is_json_params': True,
|
'is_json_params': True,
|
||||||
'request_params': [
|
'request_params': [
|
||||||
],
|
],
|
||||||
'params': [
|
'params': [
|
||||||
['token', '', 'token'],
|
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['info', _common.WheelUser(), '用户名'],
|
['info', _common.WheelUser(), '用户信息'],
|
||||||
|
['server_time', 0, '服务器时间'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'method': 'POST',
|
'method': 'POST',
|
||||||
'name': '/api/v1/roll_dice',
|
'name': '/api/v1/activity/roll_dice',
|
||||||
'desc': '掷骰子',
|
'desc': '掷骰子',
|
||||||
'group': '!AAActivity',
|
'group': '!AAWheel',
|
||||||
'url': 'https://wheel-test.kingsome.cn/api/v1/roll_dice',
|
'url': 'https://wheel-test.kingsome.cn/api/v1/activity/roll_dice',
|
||||||
'headers': _common.JwtHeader,
|
'headers': _common.JwtHeader,
|
||||||
'is_json_params': True,
|
'is_json_params': True,
|
||||||
'params': [
|
'params': [
|
||||||
|
['forward_point', 0, '指定前进点数(会扣除spec_dice数量,0随机)'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_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',
|
'method': 'GET',
|
||||||
'name': '/api/v1/friend/list',
|
'name': '/api/v1/friend/list',
|
||||||
'desc': '好友列表',
|
'desc': '好友列表',
|
||||||
'group': '!AAActivity',
|
'group': '!AAWheel',
|
||||||
'url': 'https://wheel-test.kingsome.cn/api/v1/friend/list',
|
'url': 'https://wheel-test.kingsome.cn/api/v1/friend/list',
|
||||||
'headers': _common.JwtHeader,
|
'headers': _common.JwtHeader,
|
||||||
'params': [
|
'params': [
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
]
|
['!data', [_common.WheelFriend()], '好友列表'],
|
||||||
},
|
|
||||||
{
|
|
||||||
'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(),
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'method': 'GET',
|
'method': 'GET',
|
||||||
'name': '/api/v1/mission/list',
|
'name': '/api/v1/mission/list',
|
||||||
'desc': '任务列表',
|
'desc': '任务列表',
|
||||||
'group': '!AAActivity',
|
'group': '!AAWheel',
|
||||||
'url': 'https://wheel-test.kingsome.cn/api/v1/mission/list',
|
'url': 'https://wheel-test.kingsome.cn/api/v1/mission/list',
|
||||||
'headers': _common.JwtHeader,
|
'headers': _common.JwtHeader,
|
||||||
'params': [
|
'params': [
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_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',
|
'method': 'GET',
|
||||||
'name': '/api/v1/chip/list',
|
'name': '/api/v1/chip/list',
|
||||||
'desc': '芯片列表',
|
'desc': '芯片列表',
|
||||||
'group': '!AAActivity',
|
'group': '!AAWheel',
|
||||||
'url': 'https://wheel-test.kingsome.cn/api/v1/chip/list',
|
'url': 'https://wheel-test.kingsome.cn/api/v1/chip/list',
|
||||||
'headers': _common.JwtHeader,
|
'headers': _common.JwtHeader,
|
||||||
'params': [
|
'params': [
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
]
|
['!data', [_common.WheelChip()], '芯片列表'],
|
||||||
},
|
|
||||||
{
|
|
||||||
'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(),
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'method': 'GET',
|
'method': 'GET',
|
||||||
'name': '/api/v1/shop/goods',
|
'name': '/api/v1/shop/goods',
|
||||||
'desc': '商店-商品列表',
|
'desc': '商店-商品列表',
|
||||||
'group': '!AAActivity',
|
'group': '!AAWheel',
|
||||||
'url': 'https://wheel-test.kingsome.cn/api/v1/shop/goods',
|
'url': 'https://wheel-test.kingsome.cn/api/v1/shop/goods',
|
||||||
'headers': _common.JwtHeader,
|
'headers': _common.JwtHeader,
|
||||||
'params': [
|
'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': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
]
|
]
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
* errcode=1008 该接口功能已关闭(admin后台上配置为功能关闭,客户端需刷新功能开关)
|
* errcode=1008 该接口功能已关闭(admin后台上配置为功能关闭,客户端需刷新功能开关)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* 以下是积分转盘专有
|
||||||
|
* 所有的协议都可能携带award()和side_effect,award用来显示获得的东西,side_effect用来更新本地数据
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1959,9 +1959,95 @@ class WheelUser(object):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.fields = [
|
self.fields = [
|
||||||
['name', '', '用户名'],
|
['nickname', '', '用户名'],
|
||||||
['avatar', '', '头像'],
|
['avatar', '', '头像'],
|
||||||
['score', '', '积分'],
|
['score', '', '积分'],
|
||||||
['hourly_earnings', 0, '每小时收益'],
|
['hourly_earnings', 0, '每小时收益'],
|
||||||
['dice', 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:已发货'],
|
||||||
]
|
]
|
||||||
|
@ -2051,12 +2051,14 @@ DROP TABLE IF EXISTS `t_circuit_battle`;
|
|||||||
CREATE TABLE `t_circuit_battle` (
|
CREATE TABLE `t_circuit_battle` (
|
||||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
`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 '赛季',
|
`season` int(11) NOT NULL DEFAULT '0' COMMENT '赛季',
|
||||||
`cumulative_score` int(11) NOT NULL DEFAULT '0' COMMENT '积分',
|
`cumulative_score` 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`),
|
||||||
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;
|
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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` (
|
CREATE TABLE `t_circuit_battle_phase` (
|
||||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
`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 '赛季',
|
`season` int(11) NOT NULL DEFAULT '0' COMMENT '赛季',
|
||||||
`phase` int(11) NOT NULL DEFAULT '0' COMMENT '阶段',
|
`phase` int(11) NOT NULL DEFAULT '0' COMMENT '阶段',
|
||||||
`cumulative_score` int(11) NOT NULL DEFAULT '0' COMMENT '积分',
|
`cumulative_score` 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`),
|
||||||
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;
|
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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;
|
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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 */;
|
||||||
|
|
||||||
|
@ -43,6 +43,11 @@ class BaseController {
|
|||||||
return $this->nowtime + $this->timeOffset;
|
return $this->nowtime + $this->timeOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function _setNowTime($newTime)
|
||||||
|
{
|
||||||
|
$this->nowtime = $newTime;
|
||||||
|
}
|
||||||
|
|
||||||
public function _getTimeOffset()
|
public function _getTimeOffset()
|
||||||
{
|
{
|
||||||
return $this->timeOffset;
|
return $this->timeOffset;
|
||||||
|
@ -767,6 +767,7 @@ class BattleController extends BaseAuthedController {
|
|||||||
|
|
||||||
public function getNormalBattleData()
|
public function getNormalBattleData()
|
||||||
{
|
{
|
||||||
|
error_log(json_encode($_REQUEST));
|
||||||
$version = getReqVal('version', 0);
|
$version = getReqVal('version', 0);
|
||||||
$ignoreAndroid = false;
|
$ignoreAndroid = false;
|
||||||
if ($version < 1) {
|
if ($version < 1) {
|
||||||
|
@ -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();
|
$rankingList = array();
|
||||||
$ranking = 0;
|
$ranking = 0;
|
||||||
foreach ($data as $k=>$row){
|
foreach ($data as $k=>$row){
|
||||||
|
@ -19,7 +19,9 @@ use models\Circuit;
|
|||||||
use models\User;
|
use models\User;
|
||||||
use models\Hero;
|
use models\Hero;
|
||||||
use models\HeroSkin;
|
use models\HeroSkin;
|
||||||
|
|
||||||
class OutAppCircuitController extends BaseController {
|
class OutAppCircuitController extends BaseController {
|
||||||
|
|
||||||
private $redis_key_circuit_ranking = 'circuit_ranking';
|
private $redis_key_circuit_ranking = 'circuit_ranking';
|
||||||
private $redis_key_circuit_phase_ranking = 'circuit_phase_ranking';
|
private $redis_key_circuit_phase_ranking = 'circuit_phase_ranking';
|
||||||
|
|
||||||
@ -31,37 +33,163 @@ class OutAppCircuitController extends BaseController {
|
|||||||
}
|
}
|
||||||
$address = getReqVal('address', '');
|
$address = getReqVal('address', '');
|
||||||
if (empty($address)){
|
if (empty($address)){
|
||||||
|
/*
|
||||||
if (SERVER_ENV == _ONLINE) {
|
if (SERVER_ENV == _ONLINE) {
|
||||||
myself()->_rspErr(1, 'param error');
|
myself()->_rspErr(1, 'param error');
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
$user = User::findByAddress($address);
|
$user = User::findByAddress($address);
|
||||||
if (SERVER_ENV != _ONLINE) {
|
if (SERVER_ENV != _ONLINE) {
|
||||||
$user = User::find('2_2006_I75DCdyQRllgGRYvT0wcGtPR9gbDUZws');
|
$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(
|
$info = array(
|
||||||
'star_time' => strtotime($currentCircuitMeta['start_time']),
|
'start_time' => strtotime($currentCircuitMeta['start_time']),
|
||||||
'end_time' => strtotime($currentCircuitMeta['end_time']),
|
'end_time' => strtotime($currentCircuitMeta['end_time']),
|
||||||
'ranking' => $myInfo['ranking'],
|
'ranking' => 0,
|
||||||
'score' => $myInfo['score'],
|
'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(
|
$this->_rspData(array(
|
||||||
'rank_list' => $list,
|
'rank_list' => $list,
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
@ -76,41 +204,51 @@ class OutAppCircuitController extends BaseController {
|
|||||||
}
|
}
|
||||||
$address = getReqVal('address', '');
|
$address = getReqVal('address', '');
|
||||||
if (empty($address)){
|
if (empty($address)){
|
||||||
|
/*
|
||||||
if (SERVER_ENV == _ONLINE) {
|
if (SERVER_ENV == _ONLINE) {
|
||||||
myself()->_rspErr(1, 'param error');
|
myself()->_rspErr(1, 'param error');
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
$user = User::findByAddress($address);
|
$user = User::findByAddress($address);
|
||||||
if (SERVER_ENV != _ONLINE) {
|
if (SERVER_ENV != _ONLINE) {
|
||||||
$user = User::find('2_2006_I75DCdyQRllgGRYvT0wcGtPR9gbDUZws');
|
$user = User::find('2_2006_I75DCdyQRllgGRYvT0wcGtPR9gbDUZws');
|
||||||
}
|
}
|
||||||
if (!$user){
|
if (!$user){
|
||||||
myself()->_rspErr(1, 'user not found');
|
$info = array(
|
||||||
return;
|
'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(
|
$this->_rspData(array(
|
||||||
'rank_list' => $list,
|
'rank_list' => $list,
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
@ -196,7 +334,12 @@ class OutAppCircuitController extends BaseController {
|
|||||||
$this->_rspErr(1,'未满足结算条件');
|
$this->_rspErr(1,'未满足结算条件');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _extractRankingInfo($data){
|
private function _extractRankingInfo($data)
|
||||||
|
{
|
||||||
|
return myself()->_callServiceStatic('CircuitRankingService', 'extractRankingInfo', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _extractRankingInfoOld($data){
|
||||||
$rankingList = array();
|
$rankingList = array();
|
||||||
$ranking = 0;
|
$ranking = 0;
|
||||||
foreach ($data as $k=>$row){
|
foreach ($data as $k=>$row){
|
||||||
@ -217,7 +360,8 @@ class OutAppCircuitController extends BaseController {
|
|||||||
'skin_id' => $skinId,
|
'skin_id' => $skinId,
|
||||||
'ranking' => $ranking,
|
'ranking' => $ranking,
|
||||||
'weight' => $rewardWeight,
|
'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, '.', ''),
|
'score_boost' => number_format($row['score_boost'], 2, '.', ''),
|
||||||
);
|
);
|
||||||
array_push($rankingList,$info);
|
array_push($rankingList,$info);
|
||||||
|
@ -5,12 +5,15 @@ require_once('phpcommon/sqlhelper.php');
|
|||||||
require_once('services/BlockChainService.php');
|
require_once('services/BlockChainService.php');
|
||||||
require_once('services/BattleBoxService.php');
|
require_once('services/BattleBoxService.php');
|
||||||
require_once('models/BuyRecord.php');
|
require_once('models/BuyRecord.php');
|
||||||
|
require_once('services/NameService.php');
|
||||||
|
require_once('mt/Robot.php');
|
||||||
|
|
||||||
use models\Battle;
|
use models\Battle;
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
use services\BlockChainService;
|
use services\BlockChainService;
|
||||||
use services\BattleBoxService;
|
use services\BattleBoxService;
|
||||||
use models\BuyRecord;
|
use models\BuyRecord;
|
||||||
|
use services\NameService;
|
||||||
|
|
||||||
class ToolsController extends BaseController {
|
class ToolsController extends BaseController {
|
||||||
|
|
||||||
@ -521,4 +524,67 @@ class ToolsController extends BaseController {
|
|||||||
BattleBoxService::set($phase, $day);
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,8 @@ class Circuit extends BaseModel
|
|||||||
|
|
||||||
|
|
||||||
public static function getRankingList($season){
|
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(
|
$whereKv = array(
|
||||||
":season" => $season,
|
":season" => $season,
|
||||||
);
|
);
|
||||||
@ -115,7 +116,8 @@ class Circuit extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getPhaseRankingList($season,$phase){
|
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(
|
$whereKv = array(
|
||||||
":season" => $season,
|
":season" => $season,
|
||||||
":phase" => $phase,
|
":phase" => $phase,
|
||||||
|
@ -49,6 +49,16 @@ class CircuitTime {
|
|||||||
return null;
|
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){
|
public static function getNextStage($season){
|
||||||
$next = array();
|
$next = array();
|
||||||
foreach (self::getListBySeason($season) as $meta){
|
foreach (self::getListBySeason($season) as $meta){
|
||||||
|
@ -33,6 +33,15 @@ class Robot {
|
|||||||
return $members;
|
return $members;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function traverse($cb)
|
||||||
|
{
|
||||||
|
foreach (self::getMetaList() as $meta) {
|
||||||
|
if (!$cb($meta)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected static function getMetaList()
|
protected static function getMetaList()
|
||||||
{
|
{
|
||||||
if (!self::$metaList) {
|
if (!self::$metaList) {
|
||||||
|
331
webapp/services/CircuitRankingService.php
Normal file
331
webapp/services/CircuitRankingService.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -29,6 +29,16 @@ class NameService extends BaseService {
|
|||||||
'key' => '2006'
|
'key' => '2006'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
if (!empty($row)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$row = SqlHelper::ormSelectOne
|
||||||
|
($conn,
|
||||||
|
't_android',
|
||||||
|
array(
|
||||||
|
'name' => $name,
|
||||||
|
)
|
||||||
|
);
|
||||||
return !empty($row);
|
return !empty($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class RoomBattleDataService extends BaseService {
|
|||||||
//巡回模式排位分计算
|
//巡回模式排位分计算
|
||||||
if ($this->mapMode == mt\MapMode::CIRCUIT_MODE){
|
if ($this->mapMode == mt\MapMode::CIRCUIT_MODE){
|
||||||
$circuitMeta = mt\CircuitTime::getCurrentCircuit();
|
$circuitMeta = mt\CircuitTime::getCurrentCircuit();
|
||||||
$circuitStageMeta = mt\CircuitTime::getCurrentStage();
|
$circuitStageMeta = mt\CircuitTime::getCurrentBattleStage();
|
||||||
if ($circuitMeta && $circuitStageMeta){
|
if ($circuitMeta && $circuitStageMeta){
|
||||||
$minScore = mt\Parameter::getVal('circuit_rank_score_min',0);
|
$minScore = mt\Parameter::getVal('circuit_rank_score_min',0);
|
||||||
$multConstant = mt\Parameter::getVal('circuit_score_mult_constant',1);
|
$multConstant = mt\Parameter::getVal('circuit_score_mult_constant',1);
|
||||||
|
@ -70,6 +70,10 @@ class ServerSwitchService {
|
|||||||
$redis->set(self::SERVER_SWITCH_KEY,json_encode($data));
|
$redis->set(self::SERVER_SWITCH_KEY,json_encode($data));
|
||||||
$redis->pexpire(self::SERVER_SWITCH_KEY , 10*1000);
|
$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;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user