zoukankan      html  css  js  c++  java
  • 常州大学/企业微信/每日健康打卡

    企业微信 每日健康打卡

    仓库

    UID 需要抓包获得,也可通过查询当日脚本遍历得出(不推荐)。
    查询当日脚本中, "deptCode":"X","schoolYear":"X" 代表 班号、年级 同一个班在一起,按学号升序。

    上报接口

    • url: http://yuyue.cczu.edu.cn:8081/api/healthReporting
    • method: POST
    • headers:
      • "Authorization": "Basic d2ViQXBwOndlYkFwcA==" (Username: webApp, Password: webApp)
      • "Referer": "http://yuyue.cczu.edu.cn:8090/" 必须
    • data:
    // 2021-11-06 日 更新
    // 两个版本 
    // http://yuyue.cczu.edu.cn:8090/healthCode 
    // http://yuyue.cczu.edu.cn:8090/healthCodeStudent 
    {
        "vaccinesState": "2",   // 2021-10-30 新增 未显示 疫苗接种情况 /1否/2是/
        
        "healthState": "1",   // 健康情况 /1正常/2发热/other其他/
        "healthRemark": "", // 健康状况备注 (健康情况 other时必填)
        
        "temperature": "36.4", // 当前体温 建议在区间内随机
        "temperatureState": "1",  // 体温状况:1.正常 2.异常,由前台根据填写值判断>37.3返回2
        
        "isDangerousArea": "1", // 中高风险地区 路过停留接触 /1 否/ other 其他/
        "dangerousAreaRemark": "", // 中高风险地区备注 (中高风险地区 other时必填)
        
        "isDangerousPeople": "1", // 触过疑似或者确诊 /1 否/ other 其他/
        "dangerousPeopleRemark": "", // 触过疑似或者确诊备注 (触过疑似或者确诊 other时必填)
        
        "isAbroadGat": "1", // 境外人员接触  /1 否/ other 其他/
        "abroadGatRemark": "", // // 境外人员接触备注 (境外人员接触 other时必填)
        
        "address": "江苏省常州市武进区", // 地址
        "addressShen": "江苏省", // 省
        "addressShi": "常州市",  // 市
        "addressXian": "武进区", // 县/区
        "coordinate": "119.83168806623213,31.71513305947064", // 经纬度定位 此为西太湖校区 建议在区间内随机
        "userId": "uid", //用户id(localStorage.getItem('userid')) uid 抓包可得, 也可通过查询接口遍历, 根据班号推断(id自增,班级内按学号升序)
        "userJob": "4" // 填报用户身份(localStorage.getItem('job') 0.其他、1.教师、2.门卫、3.研究生、4.本科生)
        
        // 以下参数 http://yuyue.cczu.edu.cn:8090/healthCode 版本有 start
        "isInSchool": "1", // 是否在校 /1 是/ 0 否/
        "campus":"",  // 校区选择 (在校为1必填) ['科教城校区', '西太湖校区']
        
        "chengqu": "武进区",// 现居住地 城区选择  ['武进区', '天宁区', '钟楼区', '新北区', '金坛区', '溧阳市', '其他']
        "zhuzhi": "", // 现居住地详细信息 住校人员要填到宿舍号,家庭地址要具体到门牌号,现居住地在本市的请不要重复填写省、市、区信息
        
        "isclose": "0", // 现居住地是否为管控区域 /0 否/1 是/
        
        "sfz": "", // 身份证号
        "dh": "" // 手机号
        
        // 以下参数 http://yuyue.cczu.edu.cn:8090/healthCode 版本有 end
     
    }
    
    • 正确响应:
      • {"data":null,"resp_code":0,"resp_msg":"填报成功!"}

    查询当日打卡结果接口

    • url: http://yuyue.cczu.edu.cn:8081/api/healthReporting
    • method: GET
    • query_str: userId 用户ID, 抓包得, 非学号。

    脚本 注意 data区 数据已过时 最新请安装上方/readme中的参数介绍填写

    依赖库: requests

    [多人脚本] health_report.py含数据随机函数, 需要重写get_user 方法, 部分参数为机器人通知需要,表单内不要

    health_report 代码

    # @DateTime     : 2021-10-01 18:41
    # @Author       : Nanshao
    # @Mail         : Nanshao@n-s.fun
    # @Description  :
    import random
    
    import requests
    
    
    class HealthReport:
        def __init__(self):
    
            self.url = "http://yuyue.cczu.edu.cn:8081/api/healthReporting"
            """
            Username: webApp
            Password: webApp
            """
            self.headers = {
                "Authorization": "Basic d2ViQXBwOndlYkFwcA==",
                "Referer": "http://yuyue.cczu.edu.cn:8090/"
            }
            # 数据接口已于(2021-11-06)过时, 请根据readme中的参数填写。
            self.data = {
                "healthState": "1",
                "healthRemark": "",
                "temperatureState": "1",
                "isDangerousArea": "1",
                "dangerousAreaRemark": "",
                "isDangerousPeople": "1",
                "dangerousPeopleRemark": "",
                "isAbroadGat": "1",
                "abroadGatRemark": "",
            }
    
        def get_random_jwd(self):
            """
            西太湖校区内 随机经纬度
            :return:
            """
            return "{},{}".format(random.uniform(119.830999, 119.834107), random.uniform(31.709172, 31.717343))
    
        def get_random_c(self):
            """
            36.3-36.7 随机温度
            :return:
            """
            return random.choice([i / 10 + 36 for i in range(3, 7)])
    
        def get_user(self):
            """
            从数据库取 待打卡列表
            @return: sid, inchool, qq, uid, ujob, addr, sheng, shi, xian, jwd
            sid: 学号 用于机器人通知,表单内不需要
            inchool: 是否在校,表单不需要,若在校,经纬度将在校区内随机
            qq: QQ号, 用户机器人通知,表单内不需要
            """
            pass
            # 具体内容 自定, 获取打卡列表用户参数
            return ()
    
        def auto_report_health(self):
            #  多个用户 具体参数见 get_user 说明
            for sid, inchool, qq, uid, job, addr, sheng, shi, xian, jwd in self.get_user():
                c = self.get_random_c()
                if inchool == "1":
                    self.data["coordinate"] = self.get_random_jwd()
                else:
                    self.data["coordinate"] = jwd
    
                self.data["address"] = addr
                self.data["addressShen"] = sheng
                self.data["addressShi"] = shi
                self.data["addressXian"] = xian
                self.data["userId"] = uid
                self.data["userJob"] = job
                self.data["temperature"] = c
    
                # resp 成功响应 {"data":null,"resp_code":0,"resp_msg":"填报成功!"}
                response = ""
                try:
                    with requests.post(self.url, data=self.data, headers=self.headers, timeout=5) as resp:
                        response = resp.content.decode()
                except Exception as e:
                    # 异常处理
                    pass
                finally:
                    # 数据交给上游 做下一步处理
                    yield qq, sid, addr, c, response
    
    
    if __name__ == '__main__':
        # 初始化类
        t = HealthReport()
        #  多个用户,循环响应到机器人,脚本不需要。
        for i in t.auto_report_health():
            pass
    

    [单人脚本] one.py 可结合多人脚本的随机温度、随机经纬度方法使用

    one 代码

    # @DateTime     : 2021-10-01 11:37
    # @Author       : Nanshao
    # @Mail         : Nanshao@n-s.fun
    # @Description  :
    import requests
    
    # 修改为你的UID / 抓包可得
    uid = ""
    
    url = "http://yuyue.cczu.edu.cn:8081/api/healthReporting"
    """
    Authorization
    --
    Username: webApp
    Password: webApp
    """
    headers = {
        "Authorization": "Basic d2ViQXBwOndlYkFwcA==",
        "Referer": "http://yuyue.cczu.edu.cn:8090/"
    }
    # 数据接口已于(2021-11-06)过时, 请根据readme中的参数填写。
    data = {
        "healthState": "1",
        "healthRemark": "",
        "temperature": "36.4",  # 温度
        "temperatureState": "1",
        "isDangerousArea": "1",
        "dangerousAreaRemark": "",
        "isDangerousPeople": "1",
        "dangerousPeopleRemark": "",
        "isAbroadGat": "1",
        "abroadGatRemark": "",
        "address": "江苏省常州市武进区",  # 地址
        "addressShen": "江苏省",  # 省
        "addressShi": "常州市",  # 市
        "addressXian": "武进区",  # 区/县
        "coordinate": "119.83168806623213,31.71513305947064",  # 经纬度
        "userId": uid,  # 用户ID
        "userJob": "4"
    }
    
    with requests.post(url, data=data, headers=headers) as resp:
        # {"data":null,"resp_code":0,"resp_msg":"填报成功!"}
        print(resp.content.decode())
    

    [查询结果脚本] query_result.py 查询当日上报结果

    query_result 代码:

    # @DateTime     : 2021-10-20 11:46
    # @Author       : Nanshao
    # @Mail         : Nanshao@n-s.fun
    # @Description  :
    
    import requests
    
    # 修改为你的UID / 抓包可得
    uid = ""
    with requests.get("http://yuyue.cczu.edu.cn:8081/api/healthReporting?userId={}".format(uid), timeout=2) as resp:
        print(resp.content.decode())
    

    end


    个人博客: https://blog.nanshaobit.top
    CSDN: https://blog.csdn.net/LZ_nanshao
    码云: https://gitee.com/nanshaobit
    Github: https://github.com/nanshaobit

  • 相关阅读:
    用新版本的job打成jar包在终端运行mapreduce程序遇到的问题 找不到Map class?
    在map端使用关联数组实现wordcount
    基数排序c++实现
    (sql补充)关于锁
    (sql server补充)关于事务
    (sql补充)关于游标
    java api文档的阅读技巧
    android开发学习路线图
    (sql补充)关于索引
    Android开发之学习路线
  • 原文地址:https://www.cnblogs.com/nanshaobit/p/cczu_wechat_report_temperature.html
Copyright © 2011-2022 走看看