From 1c866d8fdea8d905a770b0e23b4c009ae7bfbf33 Mon Sep 17 00:00:00 2001 From: zhilv Date: Wed, 17 Dec 2025 21:50:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A2=AB=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 6 ++++++ README.md | 51 +++++++++++++++++++++++++++++++++++++-------------- main.py | 6 +++--- 3 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..50ffa27 --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +# 城科水电 +UID= +USER_NO= +SCHOOL_ACCOUNT= +USER_NAME= +WECHAT_COMANY_BOT_KEY= \ No newline at end of file diff --git a/README.md b/README.md index 3cb3ed4..e37e711 100644 --- a/README.md +++ b/README.md @@ -10,32 +10,55 @@ ### 使用 -- 配置当前目录下的 `config.py` 文件 +- 修改配置文件(二选一即可) - - 手动去 Github 下载 [LXGWWenKai-Medium 字体](https://github.com/lxgw/LxgwWenKai) 保存到fonts文件夹中,或者使用 wget 进行获取,然后修改配置文件 - - ```sh - curl -L -o ./fonts/LXGWWenKaiMono-Medium.ttf https://github.5700.cf/https://github.com/lxgw/LxgwWenKai/releases/download/v1.521/LXGWWenKaiMono-Medium.ttf - ``` + 1. 将 `.env.example` 复制为 `.env` - - `UID` 获取,使用支付宝进行扫描下方二维码即可获得 `uid` + - 手动去 Github 下载 [LXGWWenKai-Medium 字体](https://github.com/lxgw/LxgwWenKai) 保存到fonts文件夹中,或者使用 wget 进行获取,然后修改配置文件 + + ```sh + curl -L -o ./fonts/LXGWWenKaiMono-Medium.ttf https://github.5700.cf/https://github.com/lxgw/LxgwWenKai/releases/download/v1.521/LXGWWenKaiMono-Medium.ttf + ``` - ![UID 获取](./images/image.png) + - `UID` 获取,使用支付宝进行扫描下方二维码即可获得 `uid` + + ![UID 获取](./images/image.png) - - `USER_NO` 获取,通过抓包获取,使用抓包软件进行抓取微信小程序**扫呗团餐**,对响应体进行搜索`user_no`即可 + - `USER_NO` 获取,通过抓包获取,使用抓包软件进行抓取微信小程序**扫呗团餐**,对响应体进行搜索`user_no`即可 - ![USER_NO 获取](./images/image2.png) + ![USER_NO 获取](./images/image2.png) - - `SCHOOL_ACCOUNT` 这是学号(可选) - - `USER_NAME` 这是姓名(可选) - - `WECHAT_COMANY_BOT_KEY` 企业微信机器人 key + - `SCHOOL_ACCOUNT` 这是学号(可选) + - `USER_NAME` 这是姓名(可选) + - `WECHAT_COMANY_BOT_KEY` 企业微信机器人 key + + 2. 配置当前目录下的 `config.py` 文件 + + - 手动去 Github 下载 [LXGWWenKai-Medium 字体](https://github.com/lxgw/LxgwWenKai) 保存到fonts文件夹中,或者使用 wget 进行获取,然后修改配置文件 + + ```sh + curl -L -o ./fonts/LXGWWenKaiMono-Medium.ttf https://github.5700.cf/https://github.com/lxgw/LxgwWenKai/releases/download/v1.521/LXGWWenKaiMono-Medium.ttf + ``` + + - `UID` 获取,使用支付宝进行扫描下方二维码即可获得 `uid` + + ![UID 获取](./images/image.png) + + + - `USER_NO` 获取,通过抓包获取,使用抓包软件进行抓取微信小程序**扫呗团餐**,对响应体进行搜索`user_no`即可 + + ![USER_NO 获取](./images/image2.png) + + - `SCHOOL_ACCOUNT` 这是学号(可选) + - `USER_NAME` 这是姓名(可选) + - `WECHAT_COMANY_BOT_KEY` 企业微信机器人 key - 安装依赖 ```sh - pip install aiosqlite apscheduler httpx matplotlib + pip install aiosqlite apscheduler httpx matplotlib dotenv ``` - 通过 `scheduler.py` 修改监控时长配置(不懂的请问 AI) diff --git a/main.py b/main.py index 8fc7d21..4b8d730 100644 --- a/main.py +++ b/main.py @@ -25,10 +25,10 @@ if db_dir and not os.path.exists(db_dir): async def main(): - # await WaterUsageModel.create_table() - # await AmmeterUsageModel.create_table() + await WaterUsageModel.create_table() + await AmmeterUsageModel.create_table() - # start_scheduler() + start_scheduler() await SD().push()