新设备

This commit is contained in:
wuaho 2021-11-08 11:34:00 +08:00
parent fa3cb17c61
commit 5df64d9db9

View File

@ -94,7 +94,7 @@ async def order_idx(request, rdb, data):
@TaHandler
async def role_idx(request, rdb, data):
"""
标记角色编号
滚服标记角色编号标记新设备
:param request:
:param rdb:
:param data:
@ -106,12 +106,21 @@ async def role_idx(request, rdb, data):
# key = $appid.$binduid v : uid
account = data.get("properties", {}).get("binduid")
account_id = data.get("#account_id")
distinct_id = data.get("#distinct_id")
if account and account_id:
key = f'{data["#app_id"]}_{account}_roles'
v = await rdb.execute('sadd', key, account_id)
# 新角色 编号
if v == 1:
data['properties']['role_idx'] = await rdb.execute('scard', key)
# sadd O(n)
# if distinct_id:
# key = f'{data["#app_id"]}_devices'
# v = await rdb.execute('sadd', key, distinct_id)
# if v:
# data['properties']['is_new_device'] = 1
# else:
# data['properties']['is_new_device'] = 0
# @TaHandler
# async def device_label(request, rdb, data):