瀏覽代碼

调整登录参数

develop
H Vs 17 小時之前
父節點
當前提交
c6a2d0a0b6
共有 2 個檔案被更改,包括 7 行新增7 行删除
  1. +5
    -5
      app/endpoints/agent_endpoint.py
  2. +2
    -2
      services/gewe_service.py

+ 5
- 5
app/endpoints/agent_endpoint.py 查看文件

@@ -51,7 +51,7 @@ async def get_wx_qrcode(request: Request, body: GetWxQRCodeRequest, ):
return {'code': 501, 'message': msg}
now=time.time()
expried_time=int(now)+150
flag=await request.app.state.gewe_service.acquire_login_lock_async(token_id,150)
flag=await request.app.state.gewe_service.acquire_login_lock_async(tel,150)
if not flag:
msg=f'手机号{tel}, wx_token{token_id} 登录进行中,稍后再试'
logger.warning(msg)
@@ -62,14 +62,14 @@ async def get_wx_qrcode(request: Request, body: GetWxQRCodeRequest, ):

if not qr_code:
msg=f"获取二维码失败,qr_code: {qr_code}"
await request.app.state.gewe_service.release_login_lock_async(token_id)
await request.app.state.gewe_service.release_login_lock_async(tel)
logger.warning(msg)
return {'code': 501, 'message': msg}

uuid = qr_code.get('uuid',None)
if not uuid:
msg=f"uuid获取二维码失败,uuid: {uuid}"
await request.app.state.gewe_service.release_login_lock_async(token_id)
await request.app.state.gewe_service.release_login_lock_async(tel)
logger.warning(msg)
return {'code': 501, 'message': msg}

@@ -161,7 +161,7 @@ async def waitting_login_result(request: Request, token_id, app_id,region_id, ag
# 保存登录信息
await request.app.state.redis_service.set_hash(hash_key, cleaned_login_info)
await request.app.state.gewe_service.release_login_lock_async(token_id)
await request.app.state.gewe_service.release_login_lock_async(agent_tel)

# 登录结果推送到kafka
k_message=login_result_message(token_id,agent_tel,region_id,agent_token_id,wxid)
@@ -203,7 +203,7 @@ async def waitting_login_result(request: Request, token_id, app_id,region_id, ag
logger.info(f"登录检查中: {ret}-{msg}-{res}")
await asyncio.sleep(5)
finally:
await request.app.state.gewe_service.release_login_lock_async(token_id)
await request.app.state.gewe_service.release_login_lock_async(agent_tel)

@agent_router.post("/logincaptchcode", response_model=None)
async def login_captch_code(request: Request, body: LogincCaptchCode, ):


+ 2
- 2
services/gewe_service.py 查看文件

@@ -1513,8 +1513,8 @@ class GeWeService:
return True
return False

async def release_login_lock_async(self, token_id):
hash_key = f"__AI_OPS_WX__:LOGINLOCK:{token_id}"
async def release_login_lock_async(self, agent_tel):
hash_key = f"__AI_OPS_WX__:LOGINLOCK:{agent_tel}"
await self.redis_service.client.delete(hash_key)

async def save_group_add_contacts_history_async(self,wxid,chatroom_id,contact_wxid,history:AddGroupContactsHistory):


Loading…
取消
儲存