Skip to content

Commit

Permalink
fix: single person
Browse files Browse the repository at this point in the history
  • Loading branch information
ZianTT committed Feb 29, 2024
1 parent d98abd1 commit 75f6ba9
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ def __init__(self, config):
if response.status_code == 412:
logger.error("被412风控,请联系作者")
response = response.json()
if(response["errno"] == 3):
logger.error("未找到项目ID")
exit()
if(response["data"] == {}):
logger.error("服务器无返回")
exit()

self.config["id_bind"] = response["data"]["id_bind"]
self.config["is_paper_ticket"] = response["data"]["has_paper_ticket"]
screens = response["data"]["screen_list"]
Expand Down Expand Up @@ -74,7 +81,7 @@ def __init__(self, config):
"addr_id" : addr["addr"],
"addr" : addr["prov"]+addr["city"]+addr["area"]+addr["addr"],
},ensure_ascii=False)
logger.debug("您的screen_id 和 sku_id 和 pay_money 分别为:"+self.config["screen_id"]+" ",self.config["sku_id"]+" ",self.config["pay_money"])
logger.debug("您的screen_id 和 sku_id 和 pay_money 分别为:"+self.config["screen_id"]+" "+self.config["sku_id"]+" "+self.config["pay_money"])
self.token = ""
if self.config["id_bind"] != 0 and ("buyer_info" not in self.config):
url = "https://show.bilibili.com/api/ticket/buyer/list"
Expand All @@ -90,14 +97,21 @@ def __init__(self, config):
if(self.config["id_bind"] == 1):
logger.info("本项目只能购买一人票")
multiselect = False
buyerids = pick([buyer_infos[i]["name"]+" "+buyer_infos[i]["personal_id"]+" "+buyer_infos[i]["tel"] for i in range(len(buyer_infos))],

if multiselect:
buyerids = pick([buyer_infos[i]["name"]+" "+buyer_infos[i]["personal_id"]+" "+buyer_infos[i]["tel"] for i in range(len(buyer_infos))],
"请选择购票人:",
multiselect=multiselect,
min_selection_count=1)
self.config["buyer_info"] = []
for select in buyerids:
self.config["buyer_info"].append(buyer_infos[select[1]]) # type: ignore
logger.info("已选择购票人"+buyer_infos[select[1]]["name"]) # type: ignore
self.config["buyer_info"] = []
for select in buyerids:
self.config["buyer_info"].append(buyer_infos[select[1]]) # type: ignore
logger.info("已选择购票人"+buyer_infos[select[1]]["name"]) # type: ignore
else:
buyerids, index = pick([buyer_infos[i]["name"]+" "+buyer_infos[i]["personal_id"]+" "+buyer_infos[i]["tel"] for i in range(len(buyer_infos))],
"请选择购票人:")
self.config["buyer_info"].append(buyer_infos[index])
logger.info("已选择购票人"+buyer_infos[index]["name"])
if "count" not in self.config:
self.config["count"] = len(self.config["buyer_info"])
self.config["buyer_info"] = json.dumps(self.config["buyer_info"])
Expand Down

0 comments on commit 75f6ba9

Please sign in to comment.