MCPcopy Create free account
hub / github.com/Mashiro2000/HeyTapTask / TaskCenter

Class TaskCenter

TaskCenter.py:59–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58# 欢太任务中心类
59class TaskCenter:
60 def __init__(self,dic):
61 self.dic = dic
62 self.sess = requests.session()
63
64 # 登录验证
65 def login(self):
66 url = 'https://store.oppo.com/cn/oapi/users/web/member/check'
67 headers = {
68 'Host': 'store.oppo.com',
69 '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',
70 'Content-Type': 'application/x-www-form-urlencoded',
71 'Connection': 'keep-alive',
72 'Accept-Language': 'zh-cn',
73 'Accept-Encoding': 'gzip, deflate, br',
74 }
75 response = self.sess.get(url=url,headers=headers).json()
76 if response['code'] == 200:
77 notify(f"{self.dic['user']}\t登录成功")
78 return True
79 else:
80 notify(f"{self.dic['user']}\t登录失败")
81 return False
82
83 # 任务中心
84 # 位置:我的 -> 任务中心
85 # 函数作用:获取任务数据以及判断CK是否正确
86 def getTaskList(self):
87 url = 'https://store.oppo.com/cn/oapi/credits/web/credits/show'
88 headers = {
89 'Host': 'store.oppo.com',
90 'Connection': 'keep-alive',
91 'source_type': '501',
92 'clientPackage': 'com.oppo.store',
93 'Accept': 'application/json, text/plain, */*',
94 'Accept-Encoding': 'gzip, deflate',
95 'Accept-Language': 'zh-CN,en-US;q=0.9',
96 'X-Requested-With': 'com.oppo.store',
97 'Referer': 'https://store.oppo.com/cn/app/taskCenter/index?us=gerenzhongxin&um=hudongleyuan&uc=renwuzhongxin'
98 }
99 response = self.sess.get(url=url,headers=headers).json()
100 if response['code'] == 200:
101 self.taskData = response['data']
102 return True
103 else:
104 notify(f"{self.dic['user']}\t失败原因:{response['errorMessage']}")
105 return False
106
107 # 每日签到
108 # 位置: APP → 我的 → 签到
109 def signIn(self):
110 signInData = self.taskData['userReportInfoForm'] # 签到数据源
111 if signInData['status'] == 0 :
112 for each in signInData['gifts']:
113 if each['today'] == True:
114 url = 'https://store.oppo.com/cn/oapi/credits/web/report/immediately'
115 headers = {
116 'Host': 'store.oppo.com',

Callers 1

main_handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected