初始提交:岩美 pay 收款服务(支付宝当面付 + 多商户多渠道架构)

- Go/Gin/GORM + 纯 Go SQLite(无 cgo)
- Channel 多渠道接口:支付宝当面付(precreate)/电脑网站支付(page.pay) 已实现,微信占位
- 多商户 merchants 表,回调验签+金额核对+幂等+查单兜底
- 收款页/结果页/二维码端点;docs/ 设计文档与部署 Runbook
- 密钥走环境变量/Bitwarden,不入库

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-25 07:21:48 +08:00
commit 6da6964451
29 changed files with 2205 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
# 支付服务配置(模板)
# ⚠️ 密钥严禁写进本文件!一律走环境变量(生产由 Bitwarden 经 rbw 灌入):
# ALIPAY_APP_PRIVATE_KEY / ALIPAY_PUBLIC_KEY
server:
port: "8080"
mode: "debug" # debug | release
# 拼 notify_url / return_url 的根地址。
# 本机只测「下单→跳收银台」用 http://localhost:8080 即可;
# 要测异步回调 notify 需公网可达地址(内网穿透,或部署到服务器用 IP/域名)。
base_url: "http://localhost:8080"
database:
driver: "sqlite" # sqlite(默认,纯 Go 无需 gcc | mysql
dsn: "pay.db" # sqlite 文件路径;mysql 时填 user:pass@tcp(host:3306)/db?...
# 启动时据此 upsert 一个支付宝商户。把 enabled 改 true、填 app_id,密钥走环境变量。
# 沙箱信息:https://open.alipay.com/develop/sandbox/app
alipay_sandbox:
enabled: false
production: false # false=沙箱网关;true=正式网关(真钱)
merchant_code: "yanmei"
merchant_name: "岩美(北京)技术有限公司"
app_id: "" # 沙箱/生产 APPID
app_private_key: "" # 留空!走环境变量 ALIPAY_APP_PRIVATE_KEY
alipay_public_key: "" # 留空!走环境变量 ALIPAY_PUBLIC_KEY
# 兜底主动查单:定时把待支付订单拿去查,防异步回调丢失
query_sync:
enabled: true
interval_sec: 30
max_age_min: 30