健康申报程序
开发环境
太懒了,不想写介绍,自己看源代码吧
import pyautogui
import time
import datetime
class LaPeople(object):
def __init__(self):
pyautogui.PAUSE = 1
# 打开微信
first_position01 = pyautogui.Point(x=220, y=1057)
first_position02 = pyautogui.Point(x=955, y=609)
# 打开小程序
first_position03 = pyautogui.Point(x=116, y=841)
# 调查问卷
icon_position = pyautogui.Point(x=962, y=485)
pyautogui.click(first_position01, duration=1)
time.sleep(5)
pyautogui.click(first_position02, duration=1)
time.sleep(15)
pyautogui.doubleClick(first_position03, interval=0.2, duration=1)
time.sleep(15)
pyautogui.click(icon_position, duration=1)
def mains02(self):
# 进行填写
entry_position = pyautogui.Point(x=1048, y=396)
# 点击正常
click_position = pyautogui.Point(x=782, y=323)
# 点击提交
end_position = pyautogui.Point(x=948, y=501)
# 关闭小程序
end_position02 = pyautogui.Point(x=953, y=587)
end_position03 = pyautogui.Point(x=1138, y=166)
time.sleep(10)
pyautogui.click(entry_position, duration=1)
time.sleep(2)
pyautogui.click(click_position, duration=0.2)
pyautogui.click(end_position, duration=0.5)
pyautogui.click(end_position02, duration=0.5)
pyautogui.click(end_position03, duration=0.5)
def mains01(self):
# 进行填写
entry_position = pyautogui.Point(x=1051, y=630)
# 点击正常
click_position = pyautogui.Point(x=782, y=323)
# 点击提交
end_position = pyautogui.Point(x=939, y=424)
# 关闭小程序
end_position02 = pyautogui.Point(x=953, y=587)
end_position03 = pyautogui.Point(x=1138, y=166)
time.sleep(10)
pyautogui.click(entry_position, duration=1)
time.sleep(2)
pyautogui.click(click_position, duration=0.2)
pyautogui.click(end_position, duration=0.5)
pyautogui.click(end_position02, duration=0.5)
pyautogui.click(end_position03, duration=0.5)
def main(user):
with open("C:/Users/" + user + "/Desktop/健康申报日志.txt") as f:
content = f.read()
tem_time = 0
now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
year, time1 = now.split(" ")
# print(year)
# print(time1)
while True:
if year > content:
print("申报中...")
if time1 >= "07:00:00" and time1 <= "10:30:00":
if tem_time == 0:
time.sleep(30)
la = LaPeople()
la.mains01()
print("申报完成第一个时间段")
tem_time = 1
else:
time.sleep(3600)
elif time1 >= "12:00:00" and time1 <= "16:00:00":
time.sleep(30)
la = LaPeople()
la.mains02()
with open("C:/Users/16385/Desktop/健康申报日志.txt", "w") as f:
f.write(year)
print("申报完成第二个时间段")
time.sleep(5)
break
else:
print("错过了时间,申报不了到了哦,请找老罗")
time.sleep(5)
break
elif year == content:
print("哦对,今日已申报过了哦(0_0)")
time.sleep(0.5)
print("那我不打扰,我走了")
time.sleep(5)
break
else:
print("错误!昨日时间大于今日时间")
print("请修改日志文件并手动申报")
time.sleep(5)
break
def new_loge(user):
with open("C:/Users/" + user + "/Desktop/健康申报日志.txt", "w") as f:
f.write("2020-12-03")
print("创建日志成功,请再执行一遍进行打卡")
if __name__ == '__main__':
# print(pyautogui.position())
print()
print()
print("~~~~~~~~~健康申报啦~~~~~~~~~~")
time.sleep(3)
# 首次打开请把user改成自己的用户
# 首次打开请把__init__(self)的坐标改成自己的微信、小程序的坐标
try:
main("user")
except Exception as result:
new_loge("user")