mirror of
https://github.com/Sitoi/dailycheckin.git
synced 2024-11-17 13:48:03 +08:00
优化日志输出
This commit is contained in:
parent
758c7e732c
commit
94c0fddd70
7
.github/ISSUE_TEMPLATE/CHECKINADD.md
vendored
7
.github/ISSUE_TEMPLATE/CHECKINADD.md
vendored
@ -6,11 +6,10 @@ labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
|
||||
<!-- 这是隐藏的信息 -->
|
||||
<!-- 👆这样括起来的信息将被隐藏,填写时注意不要写在里面。 -->
|
||||
|
||||
|
8
.github/ISSUE_TEMPLATE/CHECKINERROR.md
vendored
8
.github/ISSUE_TEMPLATE/CHECKINERROR.md
vendored
@ -6,9 +6,9 @@ labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
<!-- 请先在 issues 页面搜索你的问题,包括已关闭的issue,很可能已被解决。 -->
|
||||
|
||||
<!-- 这是隐藏的信息 -->
|
||||
<!-- 👆这样括起来的信息将被隐藏,填写时注意不要写在里面。 -->
|
||||
@ -41,7 +41,7 @@ Q:是否仔细阅读了教程
|
||||
- [ ] 方法一:本地安装 Python
|
||||
- [ ] 方法三:Docker
|
||||
- [ ] 方法二:腾讯云函数
|
||||
- [ ] 方法二:Github Action
|
||||
- [ ] 方法二:Github Actions
|
||||
|
||||
|
||||
## 3. 详细叙述
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -130,4 +130,5 @@ dmypy.json
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
.idea
|
||||
jingdong
|
||||
config.json
|
@ -58,7 +58,8 @@ class OnePlusBBSCheckIn:
|
||||
("do", "draw"),
|
||||
)
|
||||
sum_list = []
|
||||
msg = ""
|
||||
success_count = 0
|
||||
error_count = 0
|
||||
for i in range(10):
|
||||
try:
|
||||
data = requests.post(url="https://www.oneplusbbs.com/plugin.php", headers=headers, params=params).json()
|
||||
@ -73,17 +74,20 @@ class OnePlusBBSCheckIn:
|
||||
sum_list.append(ret_map.get(ret, 0))
|
||||
one_msg = data["msg"]
|
||||
if str(ret) in ["-1", "-6", "-7"]:
|
||||
msg = one_msg
|
||||
break
|
||||
else:
|
||||
success_count += 1
|
||||
else:
|
||||
error_count += 1
|
||||
one_msg = "抽奖失败"
|
||||
except Exception as e:
|
||||
one_msg = f"抽奖失败: {e}"
|
||||
msg = one_msg
|
||||
error_count += 1
|
||||
print(f"第{i + 1}次抽奖结果:" + str(one_msg))
|
||||
time.sleep(5)
|
||||
draw_msg = "抽奖状态:" + str(msg)
|
||||
draw_msg += f"\n抽奖信息:获得 {sum(sum_list)} 加油"
|
||||
msg = f"成功抽奖 {success_count} 次,{one_msg}"
|
||||
draw_msg = "抽奖状态: " + str(msg)
|
||||
draw_msg += f"\n抽奖结果: 获得 {sum(sum_list) - success_count * 10} 加油"
|
||||
print(draw_msg)
|
||||
return draw_msg
|
||||
|
||||
@ -94,7 +98,7 @@ class OnePlusBBSCheckIn:
|
||||
bbs_uname = re.findall(r"bbs_uname=(.*?);", oneplusbbs_cookie)[0].split("%7C")[0]
|
||||
sign_msg = self.sign(cookie=oneplusbbs_cookie)
|
||||
draw_msg = self.draw(cookie=oneplusbbs_cookie)
|
||||
msg = f"【一加手机社区官方论坛】\n帐号信息: {bbs_uname}\n{sign_msg}\n{draw_msg}"
|
||||
msg = f"【一加手机社区官方论坛】\n帐号信息: {bbs_uname}\n签到信息: {sign_msg}\n{draw_msg}"
|
||||
print(msg)
|
||||
msg_list.append(msg)
|
||||
return msg_list
|
||||
|
@ -34,7 +34,13 @@ class PojieCheckIn:
|
||||
for pojie_cookie in self.pojie_cookie_list:
|
||||
pojie_cookie = pojie_cookie.get("pojie_cookie")
|
||||
uid = re.findall(r"htVD_2132_lastcheckfeed=(.*?);", pojie_cookie)[0].split("%7C")[0]
|
||||
headers = {"Cookie": pojie_cookie}
|
||||
headers = {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.60",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
||||
"Referer": "https://www.52pojie.cn/index.php",
|
||||
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,fr;q=0.5,pl;q=0.4",
|
||||
"cookie": pojie_cookie
|
||||
}
|
||||
msg = self.sign(headers=headers)
|
||||
msg = f"【吾爱破解签到】\n帐号信息: {uid}\n签到状态: {msg}"
|
||||
print(msg)
|
||||
@ -44,6 +50,6 @@ class PojieCheckIn:
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"), "r", encoding="utf-8") as f:
|
||||
data = json.loads(f.read())
|
||||
_pojie_cookie_list = data.get("52pojie", [])
|
||||
datas = json.loads(f.read())
|
||||
_pojie_cookie_list = datas.get("POJIE_COOKIE_LIST", [])
|
||||
PojieCheckIn(pojie_cookie_list=_pojie_cookie_list).main()
|
||||
|
Loading…
Reference in New Issue
Block a user