结算周期设置
newapi_settlement_config · newapi_batch_task[settlement_cron]用于判定本周是否为结算周:(daysBetween(now, ref)/7) % 2 == 0
1–28 安全;>28 在月末容错补触发
:
生成的 cron 表达式 (settlement_cron)
0 5 * * 4
每周四 05:00 (Asia/Shanghai)
当前结算状态
当前批次—
结算周期—
下次结算触发—
倒计时—
batch_id 生成规则
format: "WEEK_{year}W{week:02d}"
example: "WEEK_2026W17"
// 保障幂等性: 相同 batch_id 不重复结算
example: "WEEK_2026W17"
// 保障幂等性: 相同 batch_id 不重复结算
计算精度
Node.js
Decimal.jsMySQL
DECIMAL(14,2)时间戳
bigint (ms)双周 / 月末容错规则
biweekly: 每周触发,执行时用基准日期过滤
monthly: 若 day > 本月最大日,取月末补触发
// 未通过过滤时写 run.status=skipped
monthly: 若 day > 本月最大日,取月末补触发
// 未通过过滤时写 run.status=skipped