fix(welfare): review 修复 — 里程碑"暂不发金币"文档同步 + 消息提醒奖励降为 1000
- comparison_milestone: 删 record_milestone_reward 死导入(ruff F401), 模块 docstring 同步"暂不发金币" - 里程碑文档群对齐实现: compare-milestones / comparison_milestone_claim / MilestoneStateOut.coin 描述都标注暂不真发金币 - models/comparison: comparison_results JSONB 形状注释补 coupon_saved - enable_notification 奖励 10000→1000(产品定, =¥0.1); test_exchange_flow 改 grant_coins 直接供款(不再靠该任务=兑换下限) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+16
-4
@@ -12,6 +12,9 @@ from app.core.rewards import (
|
||||
TASK_ENABLE_NOTIFICATION,
|
||||
TASK_REWARDS,
|
||||
)
|
||||
from app.db.session import SessionLocal
|
||||
from app.repositories import wallet as crud_wallet
|
||||
from app.repositories.user import get_user_by_phone
|
||||
|
||||
|
||||
def _login(client, phone: str) -> str:
|
||||
@@ -130,10 +133,19 @@ def test_exchange_info(client) -> None:
|
||||
|
||||
|
||||
def test_exchange_flow(client) -> None:
|
||||
"""先用任务领够金币 → 兑换 1 元 → 金币扣、现金加 → 现金流水有记录。"""
|
||||
token = _login(client, "13800001005")
|
||||
# 领"打开消息提醒"得 10000 金币(= 1 元额度)
|
||||
client.post(f"/api/v1/tasks/{TASK_ENABLE_NOTIFICATION}/claim", headers=_auth(token))
|
||||
"""先供款够兑换下限的金币 → 兑换 1 元 → 金币扣、现金加 → 现金流水有记录。
|
||||
|
||||
打开消息提醒任务已降到 1000 金币(不再 = 兑换下限), 不能再靠领任务供款;
|
||||
直接 grant_coins 注入 MIN_EXCHANGE_COIN(= COIN_PER_YUAN = 10000)当种子。
|
||||
"""
|
||||
phone = "13800001005"
|
||||
token = _login(client, phone)
|
||||
# 供款: 直接注入 1 元额度金币(替代原先靠 notification=10000 领任务供款)
|
||||
with SessionLocal() as db:
|
||||
user = get_user_by_phone(db, phone)
|
||||
assert user is not None
|
||||
crud_wallet.grant_coins(db, user.id, MIN_EXCHANGE_COIN, biz_type="test_seed", remark="测试供款")
|
||||
db.commit()
|
||||
|
||||
# 兑换 10000 金币 → 100 分
|
||||
r = client.post(
|
||||
|
||||
Reference in New Issue
Block a user