统一推送前Python代码格式
This commit is contained in:
@@ -56,7 +56,9 @@ class GoodsMixin:
|
||||
result = response.to_dict()
|
||||
result["act_id"] = act_id
|
||||
act_info = client.get_act_info(act_id=act_id)
|
||||
user_tasks = client.get_act_user_task_detail(uid=uid, cookie=cookie, act_id=act_id)
|
||||
user_tasks = client.get_act_user_task_detail(
|
||||
uid=uid, cookie=cookie, act_id=act_id
|
||||
)
|
||||
if act_info is not None:
|
||||
result["act_info"] = act_info.to_dict()
|
||||
if user_tasks is not None:
|
||||
@@ -347,20 +349,28 @@ class GoodsMixin:
|
||||
return
|
||||
now_ts = int(time.time())
|
||||
if prize.isCanExchange == 0:
|
||||
self._mark_task(worker_db, task, "failed", "该商品当前不可兑换", detail_result)
|
||||
self._mark_task(
|
||||
worker_db, task, "failed", "该商品当前不可兑换", detail_result
|
||||
)
|
||||
return
|
||||
if prize.isShowNum and prize.leftNum <= 0:
|
||||
self._mark_task(worker_db, task, "failed", "该商品库存不足", detail_result)
|
||||
return
|
||||
if prize.exchangeStartTime and now_ts < prize.exchangeStartTime:
|
||||
self._mark_task(worker_db, task, "failed", "该商品尚未开始兑换", detail_result)
|
||||
self._mark_task(
|
||||
worker_db, task, "failed", "该商品尚未开始兑换", detail_result
|
||||
)
|
||||
return
|
||||
if prize.exchangeEndTime and now_ts > prize.exchangeEndTime:
|
||||
self._mark_task(worker_db, task, "failed", "该商品兑换已结束", detail_result)
|
||||
self._mark_task(
|
||||
worker_db, task, "failed", "该商品兑换已结束", detail_result
|
||||
)
|
||||
return
|
||||
score = client.query_user_score(uid=uid, cookie=cookie, sid=sid_int)
|
||||
if score is None:
|
||||
self._mark_task(worker_db, task, "error", "兑换前积分查询无响应", detail_result)
|
||||
self._mark_task(
|
||||
worker_db, task, "error", "兑换前积分查询无响应", detail_result
|
||||
)
|
||||
return
|
||||
if score.status != 200 or score.available_score < prize.newScore:
|
||||
detail_result["score"] = score.to_dict()
|
||||
@@ -396,7 +406,9 @@ class GoodsMixin:
|
||||
return
|
||||
|
||||
post_score = client.query_user_score(uid=uid, cookie=cookie, sid=sid_int)
|
||||
post_records = client.get_user_prize_records(uid=uid, cookie=cookie, sid=sid_int)
|
||||
post_records = client.get_user_prize_records(
|
||||
uid=uid, cookie=cookie, sid=sid_int
|
||||
)
|
||||
if post_score is not None:
|
||||
result["post_exchange_score"] = post_score.to_dict()
|
||||
account.points = post_score.available_score
|
||||
|
||||
Reference in New Issue
Block a user