diff --git a/dyn/bili_data_types.py b/dyn/bili_data_types.py index fbfd15f..807ed00 100644 --- a/dyn/bili_data_types.py +++ b/dyn/bili_data_types.py @@ -22,6 +22,9 @@ class DynRaffleStatus: prize_cmt_1st = attr.ib(validator=attr.validators.instance_of(str)) # 奖品描述这里必须str,下同,且不提供type转换 prize_cmt_2nd = attr.ib(default='', validator=attr.validators.instance_of(str)) prize_cmt_3rd = attr.ib(default='', validator=attr.validators.instance_of(str)) + prize_num_1st = attr.ib(default=-1, validator=attr.validators.instance_of(int)) + prize_num_2nd = attr.ib(default=-1, validator=attr.validators.instance_of(int)) + prize_num_3rd = attr.ib(default=-1, validator=attr.validators.instance_of(int)) # 命名模仿attrs的astuple,非数据库数据转化为数据库数据直接使用,无需在sqlite内再次转换类型 def as_sql_values(self): diff --git a/tasks/dyn_raffle_handler.py b/tasks/dyn_raffle_handler.py index 67c130e..1aac767 100644 --- a/tasks/dyn_raffle_handler.py +++ b/tasks/dyn_raffle_handler.py @@ -155,6 +155,11 @@ async def check_and_fetch_raffle(user, doc_id, handle_status=-1, feed_limit=Fals first_prize_cmt = data['first_prize_cmt'] second_prize_cmt = data.get('second_prize_cmt', '') third_prize_cmt = data.get('third_prize_cmt', '') + + first_prize = data['first_prize'] + second_prize = data.get('second_prize', 0) + third_prize = data.get('third_prize', 0) + # 需要邮寄???????存疑 # post = data['need_post'] dyn_raffle_status = DynRaffleStatus( @@ -169,7 +174,10 @@ async def check_and_fetch_raffle(user, doc_id, handle_status=-1, feed_limit=Fals handle_status=handle_status, prize_cmt_1st=first_prize_cmt, prize_cmt_2nd=second_prize_cmt, - prize_cmt_3rd=third_prize_cmt + prize_cmt_3rd=third_prize_cmt, + prize_num_1st=first_prize, + prize_num_2nd=second_prize, + prize_num_3rd=third_prize ) print('获取到的抽奖信息为', dyn_raffle_status) return 0, dyn_raffle_status