钱包充值为开发态测试功能(生产环境本就禁用),且支付回调存在重复入账风险:入账与标记 paid 两步非原子、wallet_ledger 去重无唯一索引、幂等键使用了可变的 ProviderOrderID。直接删除该功能从根本上消除风险。 后端: - payment 移除 StartWalletRecharge/QueryWalletRecharge 及相关 handler/DTO/常量;confirmPaid 增加 OrderID 守卫;解除对 wallet 仓库的依赖 - wallet 移除 Recharge/ConfirmRechargeFromChannel 及相关定义 - 移除三条充值路由;adminfinance 财务统计口径只统计 order_pay - 清理充值相关测试用例 前端: - 移除充值 API、WalletView 充值面板/弹窗、admin 充值标签与筛选 - 保留钱包余额、流水、提现等核心能力 go build/vet 与 vue-tsc typecheck 均通过。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
96 lines
3.2 KiB
Go
96 lines
3.2 KiB
Go
package payment
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/datatypes"
|
|
)
|
|
|
|
type StartPaymentRequest struct {
|
|
PayWay string `json:"pay_way"`
|
|
JSPayFlag string `json:"jspay_flag"`
|
|
}
|
|
|
|
type PaymentDTO struct {
|
|
ID uint64 `json:"id"`
|
|
PaymentNo string `json:"payment_no"`
|
|
OrderID uint64 `json:"order_id"`
|
|
OrderNo string `json:"order_no"`
|
|
Provider string `json:"provider"`
|
|
ThirdOrderID string `json:"third_order_id"`
|
|
ProviderOrderID string `json:"provider_order_id"`
|
|
PayWay string `json:"pay_way"`
|
|
JSPayFlag string `json:"jspay_flag"`
|
|
AmountCent int64 `json:"amount_cent"`
|
|
Status string `json:"status"`
|
|
TDCode string `json:"td_code,omitempty"`
|
|
JSPayURL string `json:"jspay_url,omitempty"`
|
|
JSPayInfo string `json:"jspay_info,omitempty"`
|
|
Paid bool `json:"paid"`
|
|
PaidAt *time.Time `json:"paid_at,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type RefundDTO struct {
|
|
ID uint64 `json:"id"`
|
|
PaymentNo string `json:"payment_no"`
|
|
OrderID uint64 `json:"order_id"`
|
|
OrderNo string `json:"order_no"`
|
|
BizType string `json:"biz_type"`
|
|
AmountCent int64 `json:"amount_cent"`
|
|
Status string `json:"status"`
|
|
ProviderOrderID string `json:"provider_order_id,omitempty"`
|
|
PaidAt *time.Time `json:"paid_at,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type NotifyResult struct {
|
|
OK bool
|
|
Message string
|
|
}
|
|
|
|
type AdminPaymentQuery struct {
|
|
UserID uint64
|
|
OrderID uint64
|
|
OrderNo string
|
|
BizType string
|
|
Status string
|
|
Provider string
|
|
Page int
|
|
PageSize int
|
|
}
|
|
|
|
type PaginatedResult struct {
|
|
Items interface{} `json:"items"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
PageSize int `json:"page_size"`
|
|
}
|
|
|
|
type AdminPaymentDTO struct {
|
|
ID uint64 `json:"id"`
|
|
PaymentNo string `json:"payment_no"`
|
|
OrderID uint64 `json:"order_id"`
|
|
OrderNo string `json:"order_no"`
|
|
UserID uint64 `json:"user_id"`
|
|
UserPhone string `json:"user_phone"`
|
|
Provider string `json:"provider"`
|
|
MerchantID string `json:"merchant_id"`
|
|
ThirdOrderID string `json:"third_order_id"`
|
|
ProviderOrderID string `json:"provider_order_id"`
|
|
PayWay string `json:"pay_way"`
|
|
AmountCent int64 `json:"amount_cent"`
|
|
BizType string `json:"biz_type"`
|
|
Status string `json:"status"`
|
|
ErrorCode string `json:"error_code"`
|
|
ErrorMessage string `json:"error_message"`
|
|
RawRequest datatypes.JSON `json:"raw_request"`
|
|
RawResponse datatypes.JSON `json:"raw_response"`
|
|
PaidAt *time.Time `json:"paid_at,omitempty"`
|
|
NotifiedAt *time.Time `json:"notified_at,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|