Files
wechat-scan/.env.example
T
gjm cfb2a36c87 feat: 阶段 2 - /usage/consume、pending 授权惰性激活
- usage.py: POST /usage/consume,事务内校验会话(严格 device_id)、
  激活 pending、按 time/points 分支扣减;失败返回 ok:false + reason
- 积分扣减用条件 UPDATE 原子完成,status 赋值写在自减之前
  (MySQL SET 从左到右求值,否则 IF 读到已减 1 的值,判空差 1)
- 时间授权 usage_logs 按 (user_id, device_id) 60 秒节流;积分每次必写
- auth.py: 新增 activate_pending_authorization(),失效 active 后
  FIFO 激活 pending,时间授权按原时长从当前时刻重新锚定
- get_status/handle_scan 接入惰性激活;get_status 改事务包裹
- _get_active_authorization/_serialize_authorization 改公开供 usage 复用
- config/.env.example: 新增 USAGE_LOG_THROTTLE_SECONDS
2026-09-27 15:00:02 +08:00

33 lines
738 B
Bash

# 环境变量模板
#
# 使用方法:
# 1. 复制此文件为 .env
# 2. 填入你的实际值
# 3. .env 不会进 Git(已在 .gitignore 中排除)
#
# cp .env.example .env
# 微信测试号 - 从 https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login 获取
WECHAT_TOKEN=your_custom_token_here
WECHAT_APPID=your_appid_here
WECHAT_SECRET=your_secret_here
# MySQL
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=your_mysql_password_here
MYSQL_DB=wechat_api
# Redis
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=your_redis_password_here
# 业务配置
FREE_AUTH_DAYS=7
SCENE_TTL_SECONDS=300
SESSION_TTL_HOURS=24
# 时间授权 usage_logs 节流窗口(秒)
USAGE_LOG_THROTTLE_SECONDS=60