# 亲密度(三颗心)脚本 - **backfill_intimacy_hearts.py**:一次性为历史用户补 3 颗心。 - **daily_deduct_intimacy.py**:每日按连续未访问天数扣心。**配置**:仅从同目录 `daily_deduct.conf` 读取(`[database]` 与 `[service]`)。其中 `[database]` 可由 **sync_deduct_conf.py** 从 `sendmsg/send.conf` 同步填充:执行 `python user-star/sync_deduct_conf.py` 即可。 ## Shell 启动命令 在**项目根目录**执行: ```bash # 一次性:历史用户补 3 颗心 bash backend/user-star/run_backfill.sh # 每日扣心(建议 crontab 每天 0 点) bash backend/user-star/run_daily_deduct.sh ``` 在 **backend 目录**执行: ```bash # 一次性 bash user-star/run_backfill.sh # 每日扣心 bash user-star/run_daily_deduct.sh ``` 或直接调用 Python: ```bash # 首次或 send.conf 变更后:把 sendmsg/send.conf 的 [database] 同步到 daily_deduct.conf python user-star/sync_deduct_conf.py # 每日扣心:在任意目录执行均可,仅读 user-star/daily_deduct.conf python user-star/daily_deduct_intimacy.py # 历史补心:需在 backend 目录下以加载 .env cd backend && python user-star/backfill_intimacy_hearts.py ``` ## Crontab 示例(每天 0 点跑每日扣心) ```bash 0 0 * * * cd /path/to/Lyrria/backend && python user-star/daily_deduct_intimacy.py >> /tmp/daily_deduct_intimacy.log 2>&1 ``` 将 `/path/to/Lyrria/backend` 替换为实际 backend 绝对路径。