企業微信 每日健康打卡
倉庫
其他所有接口匯總:
https://blog.nanshaobit.top/104
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())