| 56 | notify(f"任务:欢太早睡打卡\n时间:{time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())}") |
| 57 | |
| 58 | class CheckInEarly: |
| 59 | def __init__(self,dic): |
| 60 | self.dic = dic |
| 61 | self.sess = requests.session() |
| 62 | |
| 63 | # 登录验证 |
| 64 | def login(self): |
| 65 | url = 'https://store.oppo.com/cn/oapi/users/web/member/check' |
| 66 | headers = { |
| 67 | 'Host': 'store.oppo.com', |
| 68 | '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', |
| 69 | 'Content-Type': 'application/x-www-form-urlencoded', |
| 70 | 'Connection': 'keep-alive', |
| 71 | 'Accept-Language': 'zh-cn', |
| 72 | 'Accept-Encoding': 'gzip, deflate, br', |
| 73 | } |
| 74 | response = self.sess.get(url=url,headers=headers).json() |
| 75 | if response['code'] == 200: |
| 76 | notify(f"{self.dic['user']}\t登录成功") |
| 77 | return True |
| 78 | else: |
| 79 | notify(f"{self.dic['user']}\t登录失败") |
| 80 | return False |
| 81 | |
| 82 | # 报名或打卡 |
| 83 | # 报名或打卡是同一个链接,配合Linux定时系统 |
| 84 | def early(self): |
| 85 | url = 'https://store.oppo.com/cn/oapi/credits/web/clockin/applyOrClockIn' |
| 86 | headers = {'Host': 'store.oppo.com', |
| 87 | 'Connection': 'keep-alive', |
| 88 | 'source_type': '501', |
| 89 | 'clientPackage': 'com.oppo.store', |
| 90 | 'Accept': 'application/json, text/plain, */*', |
| 91 | 'Referer': 'https://store.oppo.com/cn/app/cardingActivities?us=gerenzhongxin&um=hudongleyuan&uc=zaoshuidaka', |
| 92 | 'Accept-Encoding': 'gzip, deflate', |
| 93 | 'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7' |
| 94 | } |
| 95 | response = self.sess.get(url=url,headers=headers).json() |
| 96 | if response['code'] == 200: |
| 97 | if response['data']['clockInStatus'] == 0: |
| 98 | if response['data']['applyStatus'] == 0: |
| 99 | notify(f"{self.dic['user']}\t积分过少,取消报名!") |
| 100 | elif response['data']['applyStatus'] == 1: |
| 101 | notify(f"{self.dic['user']}\t报名成功!") |
| 102 | elif response['data']['applyStatus'] == 2: |
| 103 | notify(f"{self.dic['user']}\t已报名!") |
| 104 | elif response['data']['clockInStatus'] == 1: |
| 105 | notify(f"{self.dic['user']}\t早睡瓜分积分,打卡成功!") |
| 106 | elif response['data']['clockInStatus'] == 2: |
| 107 | notify(f"{self.dic['user']}\t早睡瓜分积分,已成功打卡!") |
| 108 | elif response['code'] == 1000005: |
| 109 | notify(f"{self.dic['user']}\t{response['errorMessage']}") |
| 110 | |
| 111 | # 执行欢太商城实例对象 |
| 112 | def start(self): |
| 113 | self.sess.headers.update({ |
| 114 | "User-Agent":self.dic['UA'] |
| 115 | }) |