Browse Source

调整

1257
H Vs 2 weeks ago
parent
commit
89039dc1b2
2 changed files with 13 additions and 8 deletions
  1. +4
    -4
      app/endpoints/agent_endpoint.py
  2. +9
    -4
      services/gewe_service.py

+ 4
- 4
app/endpoints/agent_endpoint.py View File

@@ -27,7 +27,7 @@ class GetWxQRCodeRequest(BaseModel):


class LogincCaptchCode(BaseModel):
tokenId: str
tel: str
captchCode:str

@agent_router.post("/getlogin", response_model=None)
@@ -108,7 +108,7 @@ async def waitting_login_result(request: Request, token_id, app_id,region_id, ag
break

logger.info(f"{token_id} 使用 {app_id},等待扫码登录,二维码有效时间 {150 - int(now - start_time)} 秒")
captch_code = await request.app.state.gewe_service.get_login_wx_captch_code_from_cache_async(token_id)
captch_code = await request.app.state.gewe_service.get_login_wx_captch_code_from_cache_async(agent_tel)
captch_code= captch_code if captch_code else ''
logger.info(f"{token_id} 使用 {app_id} 的验证码 {captch_code}")
ret,msg,res = await request.app.state.gewe_service.check_login_async(token_id, app_id, uuid,captch_code)
@@ -202,7 +202,7 @@ async def waitting_login_result(request: Request, token_id, app_id,region_id, ag

@agent_router.post("/logincaptchcode", response_model=None)
async def login_captch_code(request: Request, body: LogincCaptchCode, ):
token_id = body.tokenId
tel = body.tel
captch_code=body.captchCode
res=await request.app.state.gewe_service.save_login_wx_captch_code_to_cache_async(token_id,captch_code)
res=await request.app.state.gewe_service.save_login_wx_captch_code_to_cache_async(tel,captch_code)
return {'message': '操作成功'}

+ 9
- 4
services/gewe_service.py View File

@@ -1085,12 +1085,17 @@ class GeWeService:
return ""


async def save_login_wx_captch_code_to_cache_async(self,token_id,captch_code):
hash_key = f"__AI_OPS_WX__:WXCAPTCHCODE:{token_id}"
async def save_login_wx_captch_code_to_cache_async(self,tel,captch_code):
hash_key = f"__AI_OPS_WX__:WXCAPTCHCODE:{tel}"
await self.redis_service.set_hash(hash_key,{"data":captch_code},30)

async def get_login_wx_captch_code_from_cache_async(self,token_id)->str:
hash_key = f"__AI_OPS_WX__:WXCAPTCHCODE:{token_id}"
# async def get_login_wx_captch_code_from_cache_async(self,token_id)->str:
# hash_key = f"__AI_OPS_WX__:WXCAPTCHCODE:{token_id}"
# r=await self.redis_service.get_hash_field(hash_key,"data")
# return r
async def get_login_wx_captch_code_from_cache_async(self,tel)->str:
hash_key = f"__AI_OPS_WX__:WXCAPTCHCODE:{tel}"
r=await self.redis_service.get_hash_field(hash_key,"data")
return r



Loading…
Cancel
Save