优化支付退款钱包链路

This commit is contained in:
yml
2026-06-03 21:47:04 +08:00
parent 04193ae687
commit c80d3f960e
26 changed files with 1342 additions and 504 deletions
+28
View File
@@ -95,6 +95,32 @@ func (h *Handler) AdminMarkAbnormal(c *gin.Context) {
h.adminAction(c, h.service.AdminMarkAbnormal, gin.H{"abnormal": true})
}
func (h *Handler) AdminRefund(c *gin.Context) {
orderID, ok := parseID(c)
if !ok {
return
}
item, err := h.service.AdminRefund(orderID)
if err != nil {
writeOrderError(c, err)
return
}
response.OK(c, item)
}
func (h *Handler) AdminRefundStatus(c *gin.Context) {
orderID, ok := parseID(c)
if !ok {
return
}
item, err := h.service.AdminRefundStatus(orderID)
if err != nil {
writeOrderError(c, err)
return
}
response.OK(c, item)
}
func (h *Handler) adminAction(c *gin.Context, fn func(uint64, uint64, AdminActionRequest, AuditMeta) error, okData gin.H) {
adminID, ok := currentAdminID(c)
if !ok {
@@ -394,6 +420,8 @@ func writeOrderError(c *gin.Context, err error) {
response.BadRequest(c, "不能租用自己发布的账号")
case errors.Is(err, ErrInsufficientBalance):
response.Error(c, http.StatusConflict, "insufficient_balance", "钱包余额不足,请先充值")
case errors.Is(err, ErrChannelPaymentRequired):
response.Error(c, http.StatusGone, "channel_payment_required", "请使用第三方支付入口完成订单付款")
case errors.Is(err, ErrOrderCannotPay):
response.Error(c, http.StatusConflict, "order_cannot_pay", "当前订单不能支付")
case errors.Is(err, ErrOrderCannotCancel):