Skip to content

yy4382/XJTU-MealFlow

Repository files navigation

XJTU MealFlow

CI codecov

你在西交吃了啥?

快速开始

获取 Account 和 Cookie

校园卡网站(在某些网络下只能使用 http 访问)获取account和hallticket。

登录网站后,主要使用个人中心我的账单这两个功能来获取所需信息。

home

获取 account

进入个人中心,点击右上角账号管理,即可找到账号 (5-7 位的数字)。

alt text

获取 hallticket

进入我的账单页面。打开浏览器的开发者工具(通常按 F12 或右键选择“检查”),切换到 Application 选项卡(可能在加号里,被折叠了),找到 Cookies,点击 http://card.xjtu.edu.cn,在右侧的列表中找到 hallticket,复制其中的内容。

alt text

运行

从 Release 下载对应系统的二进制文件,即可从终端运行。

# macOS, Linux
./xjtu-mealflow
# Windows
.\xjtu-mealflow.exe

打开 Web 界面

# macOS, Linux
./xjtu-mealflow web
# Windows
.\xjtu-mealflow.exe web

导出 CSV

./xjtu-mealflow export-csv

详细参数:

Options:
  -o, --output <FILE_PATH>        Path to the output CSV file
  -m, --merchant <MERCHANT_NAME>  Filter by merchant name
      --min-amount <FLOAT>        Filter by transaction min cost (positive value) Will be converted to negative for database query
      --max-amount <FLOAT>        Filter by transaction max cost (positive value) Will be converted to negative for database query
      --time-start <DATE>         Filter by start date (inclusive) in format YYYY-MM-DD
      --time-end <DATE>           Filter by end date (exclusive) in format YYYY-MM-DD
  -h, --help                      Print help

完整命令行参数

How much did you eat at XJTU?

Usage: xjtu_mealflow [OPTIONS] [COMMAND]

Commands:
  clear-db    Clean the local database
  web
  export-csv
  help        Print this message or the help of the given subcommand(s)

Options:
  -t, --tick-rate <FLOAT>
          Tick rate, i.e. number of ticks per second

          [default: 2]

  -f, --frame-rate <FLOAT>
          Frame rate, i.e. number of frames per second

          [default: 30]

  -d, --data-dir <PATH>
          Path to the data directory

      --db-in-mem
          Use an in-memory database, which means all data will lost when the program exits [default: false]

      --account <STRING>
          Account for fetching transactions

          Get it on https://card.xjtu.edu.cn

      --hallticket <STRING>
          hallticket for fetching transactions

          Get it on https://card.xjtu.edu.cn

      --use-mock-data
          Use mock data when fetching transactions

          Note that you still need to set account or hallticket, but they can be fake placeholders

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

开发者指南

构建

使用 Cargo 构建项目:

cargo build

注意:构建前端部分需要安装 pnpm。请参考 pnpm 安装文档 进行安装。

生成文档

生成项目文档:

cargo doc --no-deps

测试

运行测试:

cargo test

代码覆盖率

使用 cargo-tarpaulin 生成代码覆盖率报告:

cargo tarpaulin

License

Copyright (c) Chris Yang [email protected]

This project is licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT)

About

你在西交都吃了啥?

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •