通用修改

main
RogerWork 3 weeks ago
parent fad8ab3392
commit 77c43d4ac8
  1. 24
      jd_playwright.py
  2. 11
      jd_uia.py
  3. 28
      main_uia.py
  4. 10
      test.py

@ -1,9 +1,23 @@
import re import re
from playwright.sync_api import Playwright, sync_playwright, expect from playwright.sync_api import Playwright, sync_playwright, expect
import time import time, datetime
from get_jd_timestamp import jd_timer from get_jd_timestamp import jd_timer
target: str = '2025-01-21 15:41:00'
def get_firday():
today = datetime.datetime.strptime(datetime.datetime.strftime(datetime.date.today(), '%Y-%m-%d') + ' 20:00:00', '%Y-%m-%d %H:%M:%S')
friday = today + datetime.timedelta( days=(4-today.weekday())%7)
print(friday)
return datetime.datetime.strftime(friday, '%Y-%m-%d %H:%M:%S')
# 需要每次定义
target: str = get_firday()
# 19920002680
# user = {'mobile': '19920002680', 'password': 'Sxzgx1209'}
# 18611659484
user = {'mobile': '18611659484', 'password': 'Rog129Sunx1532'}
target_timestamp = int(time.mktime(time.strptime(target, '%Y-%m-%d %H:%M:%S'))*1000) target_timestamp = int(time.mktime(time.strptime(target, '%Y-%m-%d %H:%M:%S'))*1000)
AC_URL = f"https://h5static.m.jd.com/mall/active/xXzWGzxuJ6HRksjXms2x3cQsh25/index.html?utm_term=Wxfriends&utm_user=plusmember&utm_source=iosapp&utm_campaign=t_335139774&utm_medium=appshare&_ts={str(target_timestamp)}&ad_od=share&gxd=RnAowmYKPGXfnp4Sq4B_W578vOMp4E7JgUugKDcomXTOIlSPI-BCnvuytD0G7kc&gx=RnAomDgLPTTeyp5Z_sA9" AC_URL = f"https://h5static.m.jd.com/mall/active/xXzWGzxuJ6HRksjXms2x3cQsh25/index.html?utm_term=Wxfriends&utm_user=plusmember&utm_source=iosapp&utm_campaign=t_335139774&utm_medium=appshare&_ts={str(target_timestamp)}&ad_od=share&gxd=RnAowmYKPGXfnp4Sq4B_W578vOMp4E7JgUugKDcomXTOIlSPI-BCnvuytD0G7kc&gx=RnAomDgLPTTeyp5Z_sA9"
@ -16,13 +30,13 @@ def run(playwright: Playwright) -> None:
page.goto("https://www.jd.com/") page.goto("https://www.jd.com/")
page.get_by_role("link", name="你好,请登录").click() page.get_by_role("link", name="你好,请登录").click()
page.get_by_placeholder("账号名/手机号/邮箱").click() page.get_by_placeholder("账号名/手机号/邮箱").click()
page.get_by_placeholder("账号名/手机号/邮箱").fill("18611659484") page.get_by_placeholder("账号名/手机号/邮箱").fill(user['mobile']) # 19920002680 18611659484
page.get_by_placeholder("密码").fill("Rog129Sunx1532") page.get_by_placeholder("密码").fill(user['password'])
page.get_by_role("link", name="    ").click() page.get_by_role("link", name="    ").click()
time.sleep(30) time.sleep(30)
if page.get_by_text("hehedehehe"): if page.get_by_text("切换账号"):
# 打开活动页面 # 打开活动页面
print('登录成功!') print('登录成功!')
print(AC_URL) print(AC_URL)

@ -38,11 +38,14 @@ class JdClient:
self.dev.implicitly_wait(1) self.dev.implicitly_wait(1)
# print('等待1秒') # print('等待1秒')
while True: self.dev.implicitly_wait(2)
if self.dev(text='为好友助力').exists: self.dev.click(531, 1323)
print(self.device, '为好友助力') while True: #531,1323
if self.dev(text='成功邀请10人助力赢好礼').exists:
print(self.device, '成功邀请10人助力赢好礼')
self.dev.implicitly_wait(1) self.dev.implicitly_wait(1)
self.dev(text='为好友助力').click() # self.dev(text='为好友助力').click()
self.dev.click(531, 1323)
break break
else: else:
self.dev.implicitly_wait(1) self.dev.implicitly_wait(1)

@ -5,20 +5,24 @@ import multiprocessing, threading
# device_list = ['127.0.0.1:16416', # device_list = ['127.0.0.1:16416',
# '127.0.0.1:16448'] # '127.0.0.1:16448']
device_list = device_list = [ # NUC14
'127.0.0.1:16416', device_list = [
'127.0.0.1:16448', '127.0.0.1:16416', # 1
'127.0.0.1:16480', '127.0.0.1:16448', # 2
'127.0.0.1:16512', '127.0.0.1:16480', # 3
# '127.0.0.1:16544', '127.0.0.1:16512', # 4
# '127.0.0.1:16576', '127.0.0.1:16608', # 7
'127.0.0.1:16608',
# '127.0.0.1:16640',
# '127.0.0.1:16672',
# '127.0.0.1:16704',
# 'b189a9ab', # 一加
] ]
# HomeServer
# device_list = [
# '127.0.0.1:16384',
# '127.0.0.1:16416',
# '127.0.0.1:16448',
# '127.0.0.1:16480',
# '127.0.0.1:16512',
# ]
# listen_list = ['Honey', '分身199'] # listen_list = ['Honey', '分身199']
listen_list = ['Honey'] listen_list = ['Honey']

@ -0,0 +1,10 @@
import datetime
def get_firday():
today = datetime.datetime.strptime(datetime.datetime.strftime(datetime.date.today(), '%Y-%m-%d') + ' 20:00:00', '%Y-%m-%d %H:%M:%S')
print(today)
friday = today + datetime.timedelta( days=(4-today.weekday())%7)
return friday
if __name__ == '__main__':
print(get_firday())
Loading…
Cancel
Save