clear code

This commit is contained in:
Womsxd 2022-11-03 08:52:31 +08:00
parent 2852a27dfe
commit 6a235de34c
No known key found for this signature in database
GPG Key ID: 0FE76418EE689B68
2 changed files with 7 additions and 10 deletions

11
main.py
View File

@ -46,8 +46,8 @@ def main():
if bbs.Task_do["bbs_Sign"] and bbs.Task_do["bbs_Read_posts"] and bbs.Task_do["bbs_Like_posts"] and \
bbs.Task_do["bbs_Share"]:
return_data += "\n" + f"今天已经全部完成了!\n" \
f"一共获得{mihoyobbs.today_have_get_coins}个米游币\n目前有{mihoyobbs.Have_coins}个米游币"
log.info(f"今天已经全部完成了!一共获得{mihoyobbs.today_have_get_coins}个米游币,目前有{mihoyobbs.Have_coins}个米游币")
f"一共获得{mihoyobbs.today_have_get_coins}个米游币\n目前有{mihoyobbs.have_coins}个米游币"
log.info(f"今天已经全部完成了!一共获得{mihoyobbs.today_have_get_coins}个米游币,目前有{mihoyobbs.have_coins}个米游币")
else:
i = 0
while mihoyobbs.today_get_coins != 0 and i < 3:
@ -64,9 +64,9 @@ def main():
bbs.get_tasks_list()
i += 1
return_data += "\n" + f"今天已经获得{mihoyobbs.today_have_get_coins}个米游币\n" \
f"还能获得{mihoyobbs.today_get_coins}个米游币\n目前有{mihoyobbs.Have_coins}个米游币"
f"还能获得{mihoyobbs.today_get_coins}个米游币\n目前有{mihoyobbs.have_coins}个米游币"
log.info(f"今天已经获得{mihoyobbs.today_have_get_coins}个米游币,"
f"还能获得{mihoyobbs.today_get_coins}个米游币,目前有{mihoyobbs.Have_coins}个米游币")
f"还能获得{mihoyobbs.today_get_coins}个米游币,目前有{mihoyobbs.have_coins}个米游币")
time.sleep(random.randint(2, 8))
else:
return_data += "\n" + "米游社功能未启用!"
@ -113,8 +113,6 @@ def main():
if __name__ == "__main__":
if not os.path.exists(config.config_Path):
config.update_config()
try:
status_code, message = main()
except CookieError:
@ -122,4 +120,3 @@ if __name__ == "__main__":
message = "账号Cookie出错"
log.error("账号Cookie有问题")
push.push(status_code, message)
pass

View File

@ -11,7 +11,7 @@ from error import CookieError
today_get_coins = 0
today_have_get_coins = 0 # 这个变量以后可能会用上,先留着了
Have_coins = 0
have_coins = 0
class Mihoyobbs:
@ -68,7 +68,7 @@ class Mihoyobbs:
def get_tasks_list(self):
global today_get_coins
global today_have_get_coins
global Have_coins
global have_coins
log.info("正在获取任务列表")
req = http.get(url=setting.bbs_tasks_list, headers=self.headers)
data = req.json()
@ -79,7 +79,7 @@ class Mihoyobbs:
else:
today_get_coins = data["data"]["can_get_points"]
today_have_get_coins = data["data"]["already_received_points"]
Have_coins = data["data"]["total_points"]
have_coins = data["data"]["total_points"]
# 如果当日可获取米游币数量为0直接判断全部任务都完成了
if today_get_coins == 0:
self.Task_do["bbs_Sign"] = True