Skip to content

Commit

Permalink
✨ 新增(README.md): 优化README.md中的图片和链接格式
Browse files Browse the repository at this point in the history
✨ 新增(dailycheckin): 添加奥拉星签到功能模块
🐛 修复(imaotai/main.py): 改用JSON响应中的successDesc字段
🐛 修复(smzdm/main.py): 优化签到奖励信息的显示,使用具体字段替代整个响应输出
♻️ 重构(dailycheckin/__version__.py): 更新版本号至24.2.6
  • Loading branch information
Sitoi committed Feb 6, 2024
1 parent c8b1a7d commit e3d006a
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 15 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

<img src="https://socialify.git.ci/Sitoi/dailycheckin/image?font=Rokkitt&forks=1&issues=1&language=1&name=1&owner=1&pattern=Circuit%20Board&pulls=1&stargazers=1&theme=Dark">
<img src="https://socialify.git.ci/Sitoi/dailycheckin/image?font=Rokkitt&forks=1&issues=1&language=1&name=1&owner=1&pattern=Circuit%20Board&pulls=1&stargazers=1&theme=Dark">

<h1>DailyCheckIn</h1>

Expand Down Expand Up @@ -90,7 +90,7 @@ This project is [MIT](./LICENSE) licensed.
[github-issues-shield]: https://img.shields.io/github/issues/sitoi/dailycheckin?color=ff80eb&labelColor=black&style=flat-square
[github-license-link]: https://github.com/sitoi/dailycheckin/blob/main/LICENSE
[github-license-shield]: https://img.shields.io/github/license/sitoi/dailycheckin?labelColor=black&style=flat-square
[github-stars-link]: https://github.com/sitoi/dailycheckin/network/stargazers
[github-stars-link]: https://github.com/sitoi/dailycheckin/stargazers
[github-stars-shield]: https://img.shields.io/github/stars/sitoi/dailycheckin?color=ffcb47&labelColor=black&style=flat-square
[github-releases-link]: https://github.com/sitoi/dailycheckin/releases
[github-releases-shield]: https://img.shields.io/github/v/release/sitoi/dailycheckin?labelColor=black&style=flat-square
Expand All @@ -101,7 +101,7 @@ This project is [MIT](./LICENSE) licensed.
[github-contrib-link]: https://github.com/sitoi/dailycheckin/graphs/contributors
[github-contrib-shield]: https://contrib.rocks/image?repo=sitoi%2Fdailycheckin
[docker-pull-shield]: https://img.shields.io/docker/pulls/sitoi/dailycheckin?labelColor=black&style=flat-square
[docker-pull-link]: https://hub.docker.com/repository/docker/sitoi/
[docker-pull-link]: https://hub.docker.com/repository/docker/sitoi/dailycheckin
[docker-size-shield]: https://img.shields.io/docker/image-size/sitoi/dailycheckin?labelColor=black&style=flat-square
[docker-size-link]: https://hub.docker.com/repository/docker/sitoi/dailycheckin
[docker-stars-shield]: https://img.shields.io/docker/stars/sitoi/dailycheckin?labelColor=black&style=flat-square
Expand Down
2 changes: 1 addition & 1 deletion dailycheckin/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "24.1.20"
__version__ = "24.2.6"
Empty file.
94 changes: 94 additions & 0 deletions dailycheckin/aolaxing/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import json
import os
import time

import requests

from dailycheckin import CheckIn


class AoLaXing(CheckIn):
name = "奥拉星"

def __init__(self, check_item: dict):
self.check_item = check_item

def user(self, headers):
url = "http://service.100bt.com/creditmall/my/user_info.jsonp"
user_json = requests.get(url, headers=headers).json()
user_data = user_json["jsonResult"]["data"]
try:
credit = user_data["credit"]
creditHistory = user_data["creditHistory"]
phoneNum = user_data["phoneNum"]
signInTotal = user_data["signInTotal"]
except Exception as e:
return [{"name": "签到", "value": str(e)}]
msgs = [
{"name": "用户", "value": phoneNum},
{"name": "当前积分", "value": credit},
{"name": "总共获得积分", "value": creditHistory},
{"name": "总签到", "value": signInTotal},
]
return msgs

def practise(self, headers, task_id):
url = f"http://service.100bt.com/creditmall/activity/do_task.jsonp?taskId={task_id}&gameId=2&_=1643440166690"
task_json = requests.get(url, headers=headers).json()
try:
message = task_json["jsonResult"]["message"]
except:
message = "NO"
return message

def task(self, headers, msg: bool = False):
url = "http://service.100bt.com/creditmall/activity/daily_task_list.jsonp?gameId=2&_=1643437206026"
task_json = requests.get(url, headers=headers).json()
task_data = task_json["jsonResult"]["data"]
task_finish_count = 0
for task_item in task_data:
name = task_item["name"]
status_desc = task_item["status_desc"]
task_id = task_item["taskID"]
if msg:
if status_desc == "已完成":
task_finish_count += 1
else:
if status_desc == "未完成":
print(f"开始任务:{name}")
res = self.practise(task_id=task_id, headers=headers)
print(f"返回状态:{res}")
time.sleep(2.5)
msgs = [
{"name": "今日任务总数", "value": len(task_data)},
{"name": "今日任务完成数", "value": task_finish_count},
]
return msgs

def main(self):
cookie = self.check_item.get("cookie")
headers = {
"Host": "service.100bt.com",
"Proxy-Connection": "keep-alive",
"Accept": "*/*",
"Referer": "http://www.100bt.com/",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9",
"Cookie": cookie,
}
_ = self.task(headers)
task_msgs = self.task(headers=headers, msg=True)
user_msgs = self.user(headers=headers)
msgs = task_msgs + user_msgs
msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msgs])
return msg


if __name__ == "__main__":
with open(
os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"),
encoding="utf-8",
) as f:
datas = json.loads(f.read())
_check_item = datas.get("AOLAXING", [])[0]
print(AoLaXing(check_item=_check_item).main())
6 changes: 3 additions & 3 deletions dailycheckin/imaotai/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def reservation(self, params: dict):
)
msg = {
"name": "申购结果",
"value": responses.text,
"value": responses.json().get("data", {}).get("successDesc"),
}
return msg

Expand All @@ -264,14 +264,14 @@ def getUserEnergyAward(self):
"YX_SUPPORT_WEBP": "1",
}
response = requests.post(
"https://h5.moutai519.com.cn/game/isolationPage/getUserEnergyAward",
url="https://h5.moutai519.com.cn/game/isolationPage/getUserEnergyAward",
cookies=cookies,
headers=self.headers,
json={},
)
return {
"name": "小茅运",
"value": response.text,
"value": response.json().get("message"),
}

def main(self):
Expand Down
24 changes: 16 additions & 8 deletions dailycheckin/smzdm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,20 @@ def all_reward(self, headers, data):
url2 = "https://user-api.smzdm.com/checkin/all_reward"
resp = requests.post(url=url2, headers=headers, data=data)
result = resp.json()
return result
normal_reward = result["data"]["normal_reward"]
msgs = []
if normal_reward:
msgs = [
{
"name": "签到奖励",
"value": normal_reward["reward_add"]["content"],
},
{
"name": "连续签到",
"value": normal_reward["sub_title"],
},
]
return msgs

def active(self, cookie):
zdm_active_id = ["ljX8qVlEA7"]
Expand Down Expand Up @@ -164,13 +177,8 @@ def main(self):
token = self.robot_token(headers)
error_msg, data = self.sign(headers, token)
msg.append({"name": "签到结果", "value": error_msg})
result = self.all_reward(headers, data)
msg.append(
{
"name": "什么值得买",
"value": json.dumps(result["data"], ensure_ascii=False),
},
)
reward_msg = self.all_reward(headers, data)
msg += reward_msg
msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg])
return msg

Expand Down

0 comments on commit e3d006a

Please sign in to comment.