Giter Site home page Giter Site logo

cx_health_sign's Introduction

ChaoXing Health Sign

超星学习通健康打卡上报

Ver.21.10.03:01

项目地址:https://github.com/panghaibin/cx_health_sign

特色

  • 支持多用户使用

  • 支持默认表单模板或学校自定义模板

  • 支持多种消息推送渠道,可将打卡上报结果推送给自己

  • 支持将所有打卡结果推送给指定的一人

开始使用

在 GitHub Actions 上使用

  1. StarFork本项目

  2. 前往 Settings-Secrets , 点击 New repository secret

  3. 在新建 Secret 的界面上, Name 值输入 USERSValue 处输入用户的配置信息,多个用户配置之间使用英文分号隔开。

    单个用户的配置信息格式如下([ ]内为可选参数):

    username,password,post_type[,school_id,api_type,api_key]
    

    username, password 分别是学号和密码

    post_type是本程序目前支持填报的表单代码,详情见支持的学校表单中的[表单代码]一栏

    school_id是学校代号,获取方法见学校id获取

    api_type, api_key是消息推送类型代号及密钥,详情见消息推送介绍

    示例如下:

    用户需要消息推送服务,并且使用学号登录:

    20192233,12345Abc,default,209,2,5e58d2264821c69ebcd46c448e7f5fe6
    

    若用户不使用学号登录,或者不需要使用消息推送服务,则按照上述格式的顺序,仅保留需要的参数即可

    例如用户使用手机号而不是学号登录,需要消息推送服务:

    13878000000,5678Zyx,default,2,46d002ca1ed0c82e1c251a9e5893cd62
    

    使用手机号登录,仅需要基础功能:

    18866000000,8899Qwe,nnnu
    

    要注意不能以,作为末尾

    多用户时,每个用户的配置信息用英文分号;间隔:

    20192233,12345Abc,default,209,2,5e58d2264821c69ebcd46c448e7f5fe6;13878000000,5678Zyx,default,2,46d002ca1ed0c82e1c251a9e5893cd62;18866000000,8899Qwe,nnnu
    

    同样注意末尾不需要有分号;

    完成后点击Add secret保存该 Secret

  4. (可选)用同样的方法添加一个名为 SEND 的 Secret ,用于将所有用户的填报结果推送给管理员。

    格式为api_type,api_key,例如

    2,5e58d2264821c69ebcd46c448e7f5fe6
    
  5. (可选)再添加一个名为 LOGPASS 的 Secret ,用于将 GitHub Actions 的执行结果日志加密。

    这是因为 GitHub Actions 的日志是公开的,设置该 Secret 后会将日志文件用 7z 加密压缩并上传,可在每个 Action 页面的 Artifacts 处下载,使用任意解压软件解压即可查看。

    若不设置该 Secret 则不会保留日志,也无法查看,除非设置了消息推送可以查看填报结果。

  6. Secret 添加完成后,前往项目的 Actions 面板,同意开启并进入 Actions 。然后选择 Health Report ,点击 Enable workflow 开启工作流。此时 Actions 开启成功,可以点击 Run workflow 测试填报一次。

  7. 当本项目更新时,你所 Fork 的项目不会自动更新。在你的项目主页上点击 Fetch upstream-Fetch and merge以更新程序。

在自己的服务器上使用

  1. 克隆本项目,进入项目文件夹

    git clone https://github.com/panghaibin/cx_health_sign
    cd cx_health_sign
  2. 添加用户

    python3 main.py add

    部分参数选填,根据提示执行添加用户操作

    获取学校id的方法见学校id获取

    要使用消息推送服务,你需要提前注册第三方的消息推送服务以获取密钥,见消息推送介绍

  3. (可选)设置全局推送

    python3 main.py send

    根据提示操作,设置后所有用户的填报结果都会推送到对应接口

    以上两步也可通过直接创建 setting.yaml 文件以保存配置,格式参考 setting.bak.yal

  4. 执行程序

    python3 main.py

    这将会立即填报一次,确保可以正确填报

  5. 设置定时填报

    vim /etc/crontab

    向其中添加

    0 7,12,19 * * * root /usr/bin/python3 /root/cx_health_sign/main.py >> /root/cx_health_sign/output.log
    

    请根据实际情况作出修改

    保存文件后执行

    crontab /etc/crontab

    以应用 crontab 配置

支持的学校表单

表单代码 名称 备注
test 测试用表单 一个不限时间和次数的填报表单,表单主页
default 学习通默认健康打卡表单 绝大部分学校所用,表单主页
nnnu 南宁师范大学三检 早检表单 午检表单 晚检表单

如果你的学校未使用默认健康打卡表单,而使用自定义打卡表,但不在本项目支持列表之内,你可以:

  • 自己抓包学习通的表单链接得到 form_idenc ,在本项目的 config 文件夹下新建一个 Python 文件,新建一个继承自 config._Report 的类,参考 test.py 下或其它文件的适配方法,根据实际情况,对你的学校进行适配。测试通过后即可向本项目 Pull request
  • 提 Issue 请求适配

消息推送介绍

目前支持以下消息推送服务:

接口代号 名称 官网
1 Server酱 https://sct.ftqq.com/
2 推送加 https://www.pushplus.plus/
3 推送加(hxtrip域名下) https://pushplus.hxtrip.com/

请前往任意官网注册得到key后即可在本项目中使用,在 GitHub Actions 中使用时注意接口代号正确设置。

学校id获取

  1. 访问 http://passport2.chaoxing.com/login

  2. 按下面动图操作

    2020/04/15/cdf5a0415014614.gif

    图片来源

Thanks

本项目受到了mkdir700/chaoxing_auto_sign 的启发,特此表示感谢!

cx_health_sign's People

Contributors

panghaibin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.