Files
makemd/docs/01_Architecture/STATE_MACHINE.md
wurenzhi aa2cf560c6 feat: 添加汇率服务和缓存服务,优化数据源和日志服务
refactor: 重构数据源工厂和类型定义,提升代码可维护性

fix: 修复类型转换和状态机文档中的错误

docs: 更新服务架构文档,添加新的服务闭环流程

test: 添加汇率服务单元测试

chore: 清理无用代码和注释,优化代码结构
2026-03-19 14:19:01 +08:00

144 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# STATE_MACHINE
## Merchant商户状态
pending
→ active
→ inactive
→ suspended
---
## User用户状态
pending
→ active
→ inactive
→ locked
---
## Store店铺状态
pending
→ active
→ inactive
→ suspended
---
## Feature功能状态
inactive
→ pending_payment
→ active
→ expired
→ suspended
---
## Order订单状态
pending
→ paid
→ split
→ processing
→ shipped
→ completed
→ refunded
→ cancelled
---
## SubOrder子订单状态
pending
→ processing
→ shipped
→ completed
→ refunded
→ cancelled
---
## Product商品状态
draft
→ pending_approval
→ active
→ inactive
→ discontinued
---
## Inventory库存状态
normal
→ low
→ out_of_stock
→ overstock
---
## Payment支付状态
created
→ processing
→ paid
→ failed
→ refunded
---
## Bill账单状态
pending
→ confirmed
→ settled
→ disputed
---
## Settlement结算状态
pending
→ processing
→ completed
→ failed
---
## Task任务状态
pending
→ running
→ success
→ failed
→ cancelled
---
## 状态变更原则
- 所有状态变更必须通过 Service
- 禁止前端直接控制状态
- 状态变更必须记录操作日志
- 状态变更必须遵循预定义的流转路径
- 状态变更可能触发相关业务逻辑(如通知、计费等)
---
## 状态变更触发条件
- 商户状态:审核结果、逾期未付费、违规行为
- 用户状态:登录异常、权限变更、账号管理
- 店铺状态:平台审核、违规行为、商户操作
- 功能状态:支付结果、订阅到期、手动操作
- 订单状态:支付结果、商户操作、物流状态
- 商品状态:审核结果、库存状态、商户操作
- 库存状态:库存数量变化、库存同步
- 支付状态:支付渠道反馈、人工处理
- 账单状态:系统确认、支付结果、人工处理
- 结算状态:系统处理、支付结果、人工处理
- 任务状态:任务触发、执行结果、人工取消