auto: sync OpenClaw config 2026-08-08 23:17
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import pymysql, json
|
||||
cfg = json.load(open('db_config.json'))
|
||||
conn = pymysql.connect(host=cfg['host'], port=cfg['port'], user=cfg['user'],
|
||||
password=cfg.get('password'), database=cfg['database'], charset='utf8mb4')
|
||||
cur = conn.cursor()
|
||||
# 微信记录按年月
|
||||
cur.execute("""SELECT date_format(recorded_date,'%%Y-%%m'), COUNT(*), SUM(amount) FROM variable_expenses
|
||||
WHERE member_id=3 AND note LIKE '%[微信]%' AND recorded_date BETWEEN '2026-01-01' AND '2026-12-31'
|
||||
GROUP BY 1 ORDER BY 1""")
|
||||
print("王芳2026 [微信]支出 按月:")
|
||||
for y, n, a in cur.fetchall():
|
||||
print(f" {y}: {n}笔 ¥{float(a):.2f}")
|
||||
print()
|
||||
# 有多少是今天之前就存在的(即不是本次导入的)— 通过 note 前缀区分
|
||||
cur.execute("""SELECT COUNT(*), SUM(amount) FROM variable_expenses
|
||||
WHERE member_id=3 AND note LIKE '%[微信]%' AND recorded_date BETWEEN '2026-01-01' AND '2026-06-30'""")
|
||||
print("2026H1 [微信]支出总计(含历史):", cur.fetchone())
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user