feat(wallet): 连续15天无活跃账户金币+现金自动清零 #137
Open
liujiahui
wants to merge 1 commits from
feat/inactive-account-clear into main
pull from: feat/inactive-account-clear
merge into: WonderableAI:main
WonderableAI:main
WonderableAI:codex/risk-monitor
WonderableAI:fix/comparison-exclude-short-stores
WonderableAI:feat/withdraw-allow-concurrent
WonderableAI:fix/coupon-claim-event-backfill-dedup
WonderableAI:codex/improve-withdraw-audit-guidance
WonderableAI:fix-homelist
WonderableAI:codex/fix-withdraw-detail-schema-compat
WonderableAI:codex/move-signin-boost-to-video-coins
WonderableAI:feat/withdrawal-auth-gate
WonderableAI:codex/fix-coupon-session-score
WonderableAI:codex/comparison-daily-limit
WonderableAI:codex/bulk-reward-review-api
WonderableAI:codex/cps-reconcile-logging
WonderableAI:codex/cps-daily-reconcile-worker
WonderableAI:codex/admin-record-percentile-aggregation
WonderableAI:codex/reward-video-early-close-zero-revenue
WonderableAI:feat-huaweipermissiontoggle
WonderableAI:feature/direct-vendor-push-main-20260702
WonderableAI:codex/monitoring-audit-rbac
WonderableAI:codex/coupon-point-score
WonderableAI:codex/regular-task-coin-whitelist
WonderableAI:fix/moneypagefix
WonderableAI:feat-recordpage
WonderableAI:codex/ad-revenue-scope-filter
WonderableAI:codex/comparison-records-fast-summary
WonderableAI:feat/inactivity-reset
WonderableAI:codex/zero-short-ad-exposure
WonderableAI:codex/fix-coupon-ad-late-callback
WonderableAI:feat/admin-dashboard-0716-optimizations-v2
WonderableAI:codex/fix-coupon-revenue-unfilled
WonderableAI:feat/openobserve-api-metrics
WonderableAI:poc/wx-kf-compare
WonderableAI:ljh-dev
WonderableAI:fix/newbie-tier-restore-on-refund
WonderableAI:feat/device-info-table
WonderableAI:feat/wechat-login
WonderableAI:poc/wx-screenshot-compare
WonderableAI:feat/oppo-withdraw-push
WonderableAI:fix/sms-send-quota-count-success
WonderableAI:fix/ad-reward-result-by-session
WonderableAI:feat/llm-token-cost
WonderableAI:fix/withdraw-repeat-login-state
WonderableAI:feat/per-session-ad-revenue
WonderableAI:79ljh
WonderableAI:dev0708
WonderableAI:feat/coupon-success-rate
WonderableAI:feat/analytics-success-rate
WonderableAI:admin-custom-perms
WonderableAI:fix/dashboard-reward-coin-feed-scene
WonderableAI:7-6ljh
WonderableAI:feat/marquee-real-shuffle-and-browse
WonderableAI:origin/intern/chenshuobo/dashboard-jd-cps-20260628
WonderableAI:feat/marquee-preview-mode-and-default-nickname
WonderableAI:fix/invite-cash-ledger-reconcile
WonderableAI:feat/admin-dashboard-metrics
WonderableAI:feat/ad-report-period-dau-arpu
WonderableAI:feat/admin-rbac-config-compare
WonderableAI:feat/meituan-cps-city-geo
WonderableAI:7-4ljh
WonderableAI:feat/compare-record-backend-harvest
WonderableAI:7-1ljh-invite-reward-notest
WonderableAI:7-3-ljh-testlab
WonderableAI:feat/api-docs-reorg
WonderableAI:refactor/simplify-login-ratelimit
WonderableAI:feature/direct-vendor-push-20260702
WonderableAI:7-1ljh
WonderableAI:fix/heartbeat-timeout-1h
WonderableAI:feat/h5-sgbridge
WonderableAI:feat/h5-offline-pool
WonderableAI:feat/feedback-type-reply-withdraw-type
WonderableAI:feat/ad-revenue-trace-aggregate
WonderableAI:fix/alembic-merge-heads
WonderableAI:intern/chenshuobo/dashboard-jd-cps-20260628
WonderableAI:chore/pangle-revenue-timer
WonderableAI:feat/coupon-data-dashboard
WonderableAI:6-29ljh
WonderableAI:feat/admin-adjust-cash-account
WonderableAI:feat/h5-sgbridge-gk
WonderableAI:feat/admin-feedback-pricereport-api
WonderableAI:fix/ad-revenue-ecpm-cap-appenv
WonderableAI:intern/chenshuobo/wechat-login-20260629
WonderableAI:feat/pangle-report-revenue
WonderableAI:feat/launch-confirm-self-evolution
WonderableAI:intern/chenshuobo/meituan-feed-improve-20260610
WonderableAI:feat/mine-h5
WonderableAI:perf/pricebot-shared-httpx-client
WonderableAI:feat/wysiwyg-display-coin
WonderableAI:fix/ad-ecpm-dedup-500
WonderableAI:feat/ad-revenue-report-paging-audit
WonderableAI:feature/draw-feed-ad
WonderableAI:feat/invite-v2-cash-reward
WonderableAI:feat/analytics-events
WonderableAI:feat/cps-day-user-drilldown
WonderableAI:feat/sms-login-rate-limit
WonderableAI:feat/admin-device-liveness
WonderableAI:fix/ad-reward-env-isolation
WonderableAI:feat/cps-wx-userinfo-auth
WonderableAI:feat/wx-cps-meituan-jd-uinfo-auth
WonderableAI:feat/withdrawal-rewarded-ad
WonderableAI:fix/wx-cps-click-dup-insert
WonderableAI:feat/ad-revenue-per-event
WonderableAI:intern/chenshuobo/alembic-merge-heads-20260623
WonderableAI:intern/chenshuobo/meituan-coupon-image-size-20260623
WonderableAI:feat/default-nickname-user-prefix
WonderableAI:feat/test-account
WonderableAI:feat/marquee-nickname-mask
WonderableAI:feat/a11y-liveness-pull
WonderableAI:fix/ad-config-default-feed-slot
WonderableAI:feat/withdraw-detail-tweaks
WonderableAI:intern/chenshuobo/feedback-review-20260622
WonderableAI:feat/compare-record-status
WonderableAI:feat/feed-ad-realcoin-orb
WonderableAI:feat/cps-distribution
WonderableAI:feat/ops-config-ad-flags-reconcile
WonderableAI:intern/chenshuobo/meituan-etl-nul-fix-20260616
WonderableAI:intern/chenshuobo/meituan-multi-city-etl-20260616
WonderableAI:feat/jd-and-launch-confirm
WonderableAI:feat/ad-revenue-report
WonderableAI:feat/a11y-liveness-heartbeat
WonderableAI:feat/jd-deeplink-invalid-share-switch
WonderableAI:integration/0615
WonderableAI:feature/6.14-coupon
WonderableAI:feat/feedback-iteration
WonderableAI:fix/admin-review-hardening
WonderableAI:feat/taobao-shopid-store-mapping
WonderableAI:fix/marquee-mask-deterministic
WonderableAI:feat/unbind-wechat-reviewing-confirm
WonderableAI:feat/nickname-maxlength-20
WonderableAI:feat/daily-auto-exchange
WonderableAI:coupon-checkout-funnel
WonderableAI:feat/home-facade-stats-and-marquee
WonderableAI:feat/meituan-precoupon
WonderableAI:feat/onboarding-completion
WonderableAI:intern/chenshuobo/meituan-etl-feed-20260610
WonderableAI:coupon_home_ui
WonderableAI:docs/coupon-tables
WonderableAI:fix/alembic-linearize-debug-trace
WonderableAI:feat/invite-landing-store
WonderableAI:feat/debug-trace-link
WonderableAI:feat/admin-price-report-review
WonderableAI:intern/chenshuobo/meituan-feed-tabs-20260609
WonderableAI:feat/home-feed-sort-tabs
WonderableAI:feat/ad-coin-ecpm-unit-audit
WonderableAI:feat/invite-display
WonderableAI:chore/merge-alembic-heads
WonderableAI:feat/coupon-flow-improvements
WonderableAI:feat/coin-system-phase2-ad-ecpm
WonderableAI:feature/withdraw-review-ops
WonderableAI:fix/created-at-beijing-tz
WonderableAI:feat/invite-mvp
WonderableAI:feat/coupon-daily-claim-gate
WonderableAI:intern/chenshuobo/meituan-coupon-etl-20260606
WonderableAI:feat/platform-stats-display
WonderableAI:feature/coupon-claim-integration
WonderableAI:feat/price-observation-pipeline
WonderableAI:feat/concurrency-multi-instance
WonderableAI:feat/sls-json-logging
WonderableAI:feat/wxpay-transfer-auth
WonderableAI:feat/admin-api-db-docs
WonderableAI:feat/wip-20260606
WonderableAI:feat/pricebot-native-async
WonderableAI:feat/admin-app-config
WonderableAI:feat/recompare-deeplink
WonderableAI:feat/price-report
WonderableAI:feat/signin-remark-and-milestone-no-coin
WonderableAI:feat/ad-ecpm-and-cooldown
WonderableAI:feat/savings-accounting-clean
WonderableAI:feat/savings-accounting-m1
WonderableAI:feat/user-profile-feedback-api
WonderableAI:dev/integration
WonderableAI:feat/postgres-migration-and-bootstrap-script
WonderableAI:feat/welfare-video-round-cooldown
WonderableAI:feat/home-feed-ranking-mvp
WonderableAI:feature/welfare-withdraw-ad
WonderableAI:feat/user-order-records
No Reviewers
Labels
No items
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
gaomengzhuo
guke
kongderong
linkeyu
liujiahui
marco
wangyaoguang
wanlangjie
wusiyi
zhuzihao
zuochenyong
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: WonderableAI/shaguabijia-app-server#137
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "feat/inactive-account-clear"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
功能
新增进程内定时任务:每天北京 0 点后扫描,对连续无活跃满 15 整天(既没发起比价、也没发起领券)的用户,清空其金币与金币兑换现金;邀请奖励金物理隔离不动,每笔清零写
inactive_clear流水可逐笔回溯。关键设计
real_compare_start/real_coupon_start/claim_started)。单纯登录不算活跃——光打开 App、不用核心功能视为流失。⚠️ 与 admin 大盘 DAU / 后台「最近活跃」列不同(那两处含登录),此处刻意去掉。created_at)豁免,不会刚注册(有礼金)就被清。daily_exchange_worker结构:文件锁同机互斥 + 北京日切(rewards.cn_today()) + 启动补跑。grant_coins/grant_cash负数入账 → 天然幂等(清完为 0 下轮跳过);grant_coins负数不动total_coin_earned,grant_cash不碰邀请金。lock=True)清零,防"算活跃集合→逐行清"间隙并发变动(如看广告发币)导致清不干净。days = max(1, days)钳位,防误配 0 导致全员清空。biz_type自由字符串)。开关 (config)
INACTIVE_CLEAR_ENABLED(默认 True)INACTIVE_CLEAR_DAYS(默认 15,语义=满 15 整天之后清:最后活跃第 15 天仍留、第 16 天起清)INACTIVE_CLEAR_CHECK_INTERVAL_SEC(默认 600)测试
本地 10 个单元测试全过(清零 / 邀请金隔离两面 / 登录不算活跃 / 新用户保护 / 比价领券活跃 / shown 不算 / 满15天边界 / dry_run / days 防御)。⚠️ 测试文件按要求未包含在本 PR。
未做
未真机、未部署。首次上线建议先看 worker 日志(
result有 scanned/cleared/skipped_active/skipped_new_user 计数),或临时INACTIVE_CLEAR_ENABLED=false后手动dry_run核对一轮。🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.