diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b2a13ea..78960a3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -147,7 +147,7 @@ jobs: # 组合协议、匿名化后的域名和路径,输出结果 echo "${protocol}${anonymized_domain}${path}" } - LOGINURL="/xtgl/login_slogin.html" + LOGINURL="xtgl/login_slogin.html" FULLURL="${URL}${LOGINURL}" # 方便通过截图快速定位到用户 diff --git a/README.md b/README.md index 898d5d6..132b4c8 100644 --- a/README.md +++ b/README.md @@ -53,12 +53,12 @@ > Name = Name,Secret = 例子 -| Name | 例子 | 说明 | -| -------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| URL | https://www.nianbroken.top/ | 教务系统地址 | -| USERNAME | 2971802058 | 教务系统用户名 | -| PASSWORD | Y3xhaCkb5PZ4 | 教务系统密码 | -| TOKEN | J65KWMBfyDh3YPLpcvm8 | [PushPlus 的 token](https://www.pushplus.plus/doc/guide/openApi.html#_1-%E8%8E%B7%E5%8F%96token "PushPlus 的 token") | +| Name | 例子 | 说明 | +| -------- | --------------------------- | ------------------------------------------------------------------------- | +| URL | https://www.nianbroken.top/ | 教务系统地址 | +| USERNAME | 2971802058 | 教务系统用户名 | +| PASSWORD | Y3xhaCkb5PZ4 | 教务系统密码 | +| TOKEN | J65KWMBfyDh3YPLpcvm8 | [Showdoc 的 token](https://push.showdoc.com.cn/#/push "Showdoc 的 token") | ### 4. 开启 Actions @@ -101,4 +101,3 @@ _若是第一次运行程序,上述步骤会执行两遍_ ## 其他 欢迎提交 `Issues` 和 `Pull requests` - diff --git a/docs/README.md b/docs/README.md index f874549..2792070 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,6 +15,10 @@ +
1. 点击 Fork
+ +2. 点击 Create fork
+ ## 2. 开启工作流读写权限1. 点击 Settings
+ +2. 点击 Actions
+ +3. 点击 General
+ +4. 找到 Workflow permissions
+ +5. 点击 Read and write permissions
+ +6. 点击 Save
+ ## 3. 添加 Secrets > Name = Name,Secret = 例子 -| Name | 例子 | 说明 | -| -------- | --------------------------- | ---------------------------------------------------- | -| URL | https://www.nianbroken.top/ | 教务系统地址 | -| USERNAME | 2971802058 | 教务系统用户名 | -| PASSWORD | Y3xhaCkb5PZ4 | 教务系统密码 | -| TOKEN | J65KWMBfyDh3YPLpcvm8 | [PushPlus 的 token](#获取-token "PushPlus 的 token") | +| Name | 例子 | 说明 | +| -------- | --------------------------- | -------------------------------------------------- | +| URL | https://www.nianbroken.top/ | 教务系统地址 | +| USERNAME | 2971802058 | 教务系统用户名 | +| PASSWORD | Y3xhaCkb5PZ4 | 教务系统密码 | +| TOKEN | J65KWMBfyDh3YPLpcvm8 | [Showdoc 的 token](#获取-token "Showdoc 的 token") |1. 点击 Settings
+ +2. 点击 Secrets and variables
+ +3. 点击 Actions
+ +4. 点击 Secrets 选项卡
+ +5. 找到 Repository secrets
+ +6. 点击 New repository secret
+ +7. 根据上面的表格填写正确的 Name 以及 Secret
+ +8. 点击 Add secret
+ ### 获取 TOKEN -1. 登录 PushPlus
+ -
+2. 使用微信扫码关注公众号
-2. 获取 Token
- -打开“获取 Token”的页面后,你会得到一个与下列所示几乎一致的 Json 代码块,`data`中的值就是 TOKEN - -```json -{ - "code": 200, - "msg": "请求成功", - "data": "cd735c356aa14d16b1452aa932ac89cc", - "count": null -} -``` - -当你的 Secrets 添加完成后,你的页面应该与下图所示的页面完全一致或几乎一致 - -
-
-3. 相关文档
- -## 4. 开启 Actions +3. 红框内的字符就是token
-
+
|
-
+
+ |
+
+
|
+
+## 4. 开启 Actions
1. 点击 Actions
+ +2. 点击 I understand my workflows, go ahead and enable them
+ +3. 点击 CheckScores
+ +4. 点击 Enable workflow
+ +## 5. 运行程序1. 点击 Actions
+ +2. 点击 CheckScores
+ +3. 点击 Run workflow
+ +4. 再次点击 Run workflow
+ +## 6. 查看运行结果 + +
+
+ |
+
+
+ |
+
+
diff --git a/img/1.jpg b/img/1.jpg
index 7095e09..bbfc7a1 100644
Binary files a/img/1.jpg and b/img/1.jpg differ
diff --git a/img/16.png b/img/16.png
index 3fb670e..1e99878 100644
Binary files a/img/16.png and b/img/16.png differ
diff --git a/img/18.png b/img/18.png
index 4bea3a2..7a018e0 100644
Binary files a/img/18.png and b/img/18.png differ
diff --git a/img/19.png b/img/19.png
index c9efd53..4cace0c 100644
Binary files a/img/19.png and b/img/19.png differ
diff --git a/img/2.jpg b/img/2.jpg
index e9812bc..b4e1cc2 100644
Binary files a/img/2.jpg and b/img/2.jpg differ
diff --git a/img/20.png b/img/20.png
index 4db5357..891bbce 100644
Binary files a/img/20.png and b/img/20.png differ
diff --git a/img/21.png b/img/21.png
index 40afeb7..c9efd53 100644
Binary files a/img/21.png and b/img/21.png differ
diff --git a/img/22.png b/img/22.png
index e7ed955..4db5357 100644
Binary files a/img/22.png and b/img/22.png differ
diff --git a/img/23.png b/img/23.png
index d1cac3a..40afeb7 100644
Binary files a/img/23.png and b/img/23.png differ
diff --git a/img/24.png b/img/24.png
index 0d3d4e0..e7ed955 100644
Binary files a/img/24.png and b/img/24.png differ
diff --git a/img/25.png b/img/25.png
index 67ddbad..d1cac3a 100644
Binary files a/img/25.png and b/img/25.png differ
diff --git a/img/26.png b/img/26.png
index 8639174..0d3d4e0 100644
Binary files a/img/26.png and b/img/26.png differ
diff --git a/img/27.png b/img/27.png
new file mode 100644
index 0000000..67ddbad
Binary files /dev/null and b/img/27.png differ
diff --git a/img/3.jpg b/img/3.jpg
index cfdc5fb..7ca51d1 100644
Binary files a/img/3.jpg and b/img/3.jpg differ
diff --git a/img/4.jpg b/img/4.jpg
index c858d10..6fa5d4d 100644
Binary files a/img/4.jpg and b/img/4.jpg differ
diff --git a/img/5.jpg b/img/5.jpg
index b0095bb..c827d35 100644
Binary files a/img/5.jpg and b/img/5.jpg differ
diff --git a/img/6.jpg b/img/6.jpg
index 82b04d7..7ced011 100644
Binary files a/img/6.jpg and b/img/6.jpg differ
diff --git a/img/7.jpg b/img/7.jpg
index 3af38cb..16b53e3 100644
Binary files a/img/7.jpg and b/img/7.jpg differ
diff --git a/img/8.png b/img/8.png
index c6bb817..f59acfd 100644
Binary files a/img/8.png and b/img/8.png differ
diff --git a/main.py b/main.py
index 4322600..48934f3 100644
--- a/main.py
+++ b/main.py
@@ -7,7 +7,7 @@ from scripts.user_login import login
from scripts.get_user_info import get_user_info
from scripts.get_grade import get_grade
from scripts.get_selected_courses import get_selected_courses
-from scripts.pushplus import send_message
+from scripts.push import send_message
from datetime import datetime
diff --git a/scripts/delete_old_runs.py b/scripts/delete_old_runs.py
index f42aac1..f3365ed 100644
--- a/scripts/delete_old_runs.py
+++ b/scripts/delete_old_runs.py
@@ -61,7 +61,8 @@ class GitHubActionsManager:
break
def log(self, message):
- current_time_str = datetime.now().strftime("%Y-%m-%d %H:%M:%S:%f")[:-3] # 获取当前时间,精确到三位毫秒
+ beijing_time = datetime.now(timezone.utc).astimezone(timezone(timedelta(hours=8))) # 获取北京时间
+ current_time_str = beijing_time.strftime("%Y-%m-%d %H:%M:%S:%f")[:-3] # 获取当前时间,精确到三位毫秒
print(f"{current_time_str} {message}") # 打印日志消息
diff --git a/scripts/get_grade.py b/scripts/get_grade.py
index 4e108a3..13b4f47 100644
--- a/scripts/get_grade.py
+++ b/scripts/get_grade.py
@@ -28,7 +28,9 @@ def get_grade(student_client, output_type="none"):
total_xfjd = sum(float(course["xfjd"]) for course in grade)
# (百分制成绩*学分)的总和
- sum_of_percentage_grades_multiplied_by_credits = sum(float(course["percentage_grades"]) * float(course["credit"]) for course in grade)
+ sum_of_percentage_grades_multiplied_by_credits = sum(
+ float(course["percentage_grades"]) * float(course["credit"]) for course in grade
+ )
# GPA计算 (学分*绩点)的总和/学分总和
gpa = "{:.2f}".format(total_xfjd / total_credit)
@@ -49,7 +51,16 @@ def get_grade(student_client, output_type="none"):
score_grades = f"{course['grade']} ({course['percentage_grades']})"
# 整合成绩信息
- integrated_grade_info += f"\n" f"教学班ID:{course['class_id']}\n" f"课程名称:{course['title']}\n" f"任课教师:{course['teacher']}\n" f"成绩:{score_grades}\n" f"提交时间:{course['submission_time']}\n" f"提交人姓名:{course['name_of_submitter']}\n" f"------"
+ integrated_grade_info += (
+ f"\n"
+ f"教学班ID:{course['class_id']}\n"
+ f"课程名称:{course['title']}\n"
+ f"任课教师:{course['teacher']}\n"
+ f"成绩:{score_grades}\n"
+ f"提交时间:{course['submission_time']}\n"
+ f"提交人姓名:{course['name_of_submitter']}\n"
+ f"------"
+ )
if output_type == "grade":
return grade
diff --git a/scripts/push.py b/scripts/push.py
new file mode 100644
index 0000000..d82d981
--- /dev/null
+++ b/scripts/push.py
@@ -0,0 +1,27 @@
+import requests
+import json
+import re
+
+
+def send_message(token, title, content):
+ url = f"https://push.showdoc.com.cn/server/api/push/{token}"
+ pattern = re.compile(r"^.*教学班ID.*$\n?", re.MULTILINE)
+ content = re.sub(pattern, "", content).strip()
+ replacements = {
+ "------": "\n------\n",
+ "个人信息:": "