From 5df64d9db928e4e4dd59f41f08ff54311eb107ce Mon Sep 17 00:00:00 2001 From: wuaho Date: Mon, 8 Nov 2021 11:34:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler_data/ta_handler.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/handler_data/ta_handler.py b/handler_data/ta_handler.py index e98bf67..37f14c9 100644 --- a/handler_data/ta_handler.py +++ b/handler_data/ta_handler.py @@ -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):