| 56 | notify(f"任务:欢太每日现金\n时间:{time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())}") |
| 57 | |
| 58 | class DailyCash: |
| 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 | def viewGoods(self, count,flag,dic=None): |
| 84 | headers = { |
| 85 | 'clientPackage': 'com.oppo.store', |
| 86 | 'Host': 'msec.opposhop.cn', |
| 87 | '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', |
| 88 | 'Content-Type': 'application/x-www-form-urlencoded', |
| 89 | 'Connection': 'keep-alive', |
| 90 | 'User-Agent': 'okhttp/3.12.12.200sp1', |
| 91 | 'Accept-Encoding': 'gzip' |
| 92 | } |
| 93 | result = self.getGoodMess(count=count) # 秒杀列表存在商品url |
| 94 | if result['meta']['code'] == 200: |
| 95 | for each in result['detail']: |
| 96 | url = f"https://msec.opposhop.cn/goods/v1/info/sku?skuId={each['skuid']}" |
| 97 | self.sess.get(url=url,headers=headers) |
| 98 | notify(f"正在浏览商品id:{each['skuid']}...") |
| 99 | time.sleep(random.randint(7,10)) |
| 100 | if flag == 1: # 来源天天领现金 |
| 101 | self.getCash(dic=dic) |
| 102 | |
| 103 | # 分享商品 |
| 104 | def shareGoods(self, flag,count,dic=None): |
| 105 | url = 'https://msec.opposhop.cn/users/vi/creditsTask/pushTask' |
| 106 | headers = { |
| 107 | 'clientPackage': 'com.oppo.store', |
| 108 | 'Host': 'msec.opposhop.cn', |
| 109 | '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', |
| 110 | 'Content-Type': 'application/x-www-form-urlencoded', |
| 111 | 'Connection': 'keep-alive', |
| 112 | 'User-Agent': 'okhttp/3.12.12.200sp1', |
| 113 | 'Accept-Encoding': 'gzip', |
| 114 | } |
| 115 | params = { |