diff --git a/.github/workflows/run_script.yml b/.github/workflows/run_script.yml new file mode 100644 index 0000000..daa1145 --- /dev/null +++ b/.github/workflows/run_script.yml @@ -0,0 +1,28 @@ +name: Run Script at 15:20 UTC + +on: + schedule: +# - cron: '20 15 * * *' # 每天 UTC 时间 15:20 执行 + - cron: '59 13 * * *' + - workflow_dispatch: + +jobs: + run_script: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.x # 更改为你的 Python 版本 + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + pip install requests + + - name: Run Python script + run: python3 main.py # 更改为你的脚本路径 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/KexieAutoSign.iml b/.idea/KexieAutoSign.iml new file mode 100644 index 0000000..2c80e12 --- /dev/null +++ b/.idea/KexieAutoSign.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ddc7c68 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..457193e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..a13f201 --- /dev/null +++ b/main.py @@ -0,0 +1,53 @@ +import datetime +import sys +import time + +import requests + +student_ID = 2300320225 + +def post_http(jsonBody, uriAdress): + response = requests.post(uriAdress, json= jsonBody) + print(response.text) + +def sign_out(student_ID): + body = {'userId': student_ID} + post_http(body, 'https://at.kexie.space/api/user/signOut') + +def sign_in(): + body = {'userId': student_ID} + response = requests.post('https://at.kexie.space/api/user/signIn', json= body) + print(response.text) + +def find_target_is_online(): + response = requests.get(f'https://at.kexie.space/api/record/online/{student_ID}') + temp = response.json() + online = temp['data']['status'] + return online + +sign_out(student_ID) + +# def auto_sign_out(): +# now_time = time.strftime('%H:%M:%S', time.localtime()) +# print(now_time) +# target_time = '23:20:00' +# if now_time == target_time: +# if find_target_is_online(student_ID) == 1: +# sign_out(student_ID) +# else: print('当前不在线,不用签退') +# else: print('还未到时间') + +# print("选择功能:\n") +# print('1.签到\n2.签退\n3.查看当前在线状态\n4.开启11点半前自动签退') +# num = input('输入序号选择功能:') +# if num == 1: +# sign_in() +# elif num == 2: +# sign_out() +# elif num == 3: +# find_target_is_online() +# elif num == 4: +# auto_sign_out() +# else: +# print('输入异常,程序退出') +# sys.exit(1) diff --git a/msedgedriver.exe b/msedgedriver.exe new file mode 100644 index 0000000..dfae49e Binary files /dev/null and b/msedgedriver.exe differ