Skip to content

Commit

Permalink
Merge branch '0-8-4:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Night-stars-1 authored Nov 15, 2023
2 parents 18e7a0c + 4185dfd commit e104dbc
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
19 changes: 19 additions & 0 deletions firstrun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# new Env("MIUI-Auto-Task 环境配置")
echo "在本任务运行完后请不要忘记禁用该任务!"
echo "在本任务运行完后请不要忘记禁用该任务!"
echo "在本任务运行完后请不要忘记禁用该任务!"
echo "————————————"
echo "开始安装依赖"
pip install -i https://mirrors.aliyun.com/pypi/simple/ -r /ql/data/repo/0-8-4_miui-auto-tasks_master/requirements.txt
echo "依赖已安装完毕"
echo "————————————"
echo "开始首次执行"
task 0-8-4_miui-auto-tasks_master/miuitask.py
echo "首次执行完毕"
echo "————————————"
echo "请不要忘记禁用该任务!"
echo "请不要忘记禁用该任务!"
echo "请不要忘记禁用该任务!"
echo "请到 脚本管理 - 0-8-4_miui-auto-tasks_master - data - config.yml 中配置参数"
echo "————————————"
13 changes: 7 additions & 6 deletions miuitask.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
Date: 2023-11-13 20:29:19
LastEditors: Night-stars-1 [email protected]
LastEditTime: 2023-11-13 20:29:58
"""
# new Env("MIUI-Auto-Task")
# cron 30 8 * * * miuitask.py

import asyncio

from utils.api.login import Login
Expand All @@ -28,7 +26,10 @@ async def main():
if not task.showType:
log.info(f"开始执行{task.name}任务")
if task_obj := sign_task_obj.get(task.name): # 签到任务对象
await task_obj(cookies, token).sign()
if getattr(account, task_obj.__name__):
await task_obj(cookies, token).sign()
else:
log.info(f"任务{task.name}被禁用")
else:
log.error(f"未找到{task.name}任务")
else:
Expand Down
1 change: 1 addition & 0 deletions utils/api/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ async def sign(self) -> bool:
params['token'] = self.token if 'token' in params else params
data = self.DATA.copy()
data['miui_vip_ph'] = self.cookie['miui_vip_ph'] if 'miui_vip_ph' in self.cookie else data
data['token'] = self.token if 'token' in data else data
response = await post(self.URL_SIGN,
params=params, data=data,
cookies=self.cookie, headers=self.headers)
Expand Down
9 changes: 7 additions & 2 deletions utils/data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,13 @@ class SignResultHandler(ApiResultHandler):

def __init__(self, content: Dict[str, Any]):
super().__init__(content=content)

self.growth = self.content.get("entity", {}).get("score", "未知")

self.growth = self.content.get("entity", {})
if type(self.growth) == dict:
self.growth = self.growth.get("score", "未知")
elif type(self.growth) == int:
self.growth = str(self.growth)


def __bool__(self):
"""
Expand Down

0 comments on commit e104dbc

Please sign in to comment.