优化代码

xsign
nineven 3 years ago
parent c765658fb5
commit fb77c251c3
  1. 4
      fir_ser/api/views/login_wx.py
  2. 4
      fir_ser/api/views/order.py
  3. 4
      fir_ser/xsign/views/receiveudids.py

@ -57,7 +57,7 @@ class WeChatBindView(APIView):
return wx_qr_code_response(ret, code, qr_info, get_real_ip_address(request))
def login_res(result, *args, **kwargs):
def expect_func(result, *args, **kwargs):
return result and result.get('pk')
@ -68,7 +68,7 @@ class WeChatLoginCheckView(APIView):
return Response(ret.dict)
ticket = request.data.get("ticket")
if ticket:
status, wx_ticket_data = get_pending_result(get_wx_ticket_login_info_cache, login_res, ticket=ticket,
status, wx_ticket_data = get_pending_result(get_wx_ticket_login_info_cache, expect_func, ticket=ticket,
locker_key=ticket)
if status:
if wx_ticket_data.get('pk', -1) == -1:

@ -123,7 +123,7 @@ def get_order_obj(user_obj, order_number):
return Order.objects.filter(user_id=user_obj, order_number=order_number).first()
def except_result(result, *args, **kwargs):
def expect_func(result, *args, **kwargs):
if result and result.status in [0, 4, 5, 6]:
return True
@ -135,7 +135,7 @@ class OrderSyncView(APIView):
res = BaseResponse()
order_number = request.data.get("order_number", None)
if order_number:
status, result = get_pending_result(get_order_obj, except_result, order_number=order_number,
status, result = get_pending_result(get_order_obj, expect_func, order_number=order_number,
locker_key=order_number, user_obj=request.user)
if not status and result:
res.code = 1001

@ -80,7 +80,7 @@ class IosUDIDView(APIView):
"%s/%s?udid=%s%s" % (server_domain, short, format_udid_info.get("udid"), msg))
def except_result(result, *args, **kwargs):
def expect_func(result, *args, **kwargs):
app_info = kwargs.get('app_info')
logger.info(f"app {app_info} sign task state {result.state} AA {result.successful()}")
cache = TaskStateCache(app_info.pk, kwargs.get('task_id'))
@ -111,7 +111,7 @@ class TaskView(APIView):
if task_id:
app_info = Apps.objects.filter(short=short).first()
if app_info:
status, result = get_pending_result(task_func, except_result, task_id=task_id,
status, result = get_pending_result(task_func, expect_func, task_id=task_id,
locker_key=task_id, app_info=app_info)
if status:
if result.successful():

Loading…
Cancel
Save