8b75be6e14
- P04: fix Withdrawal.TableName() to return 'withdrawals' - P03: add WithdrawalStatus* and WithdrawalMethod* constants; replace magic numbers; add CommissionTypeWithdrawCancel=338 - P01: add POST /v1/public/user/withdrawal_cancel to cancel pending withdrawals with ownership check, row lock, commission refund, and audit log - P02: add method/account/qr_code_url fields to Withdrawal model and API; add input validation (qr_code_url required for Alipay/Wechat, account required for bank) - P05: add method filter to admin GET /v1/admin/user/withdrawal/list Co-authored-by: multica-agent <github@multica.ai>
27 lines
725 B
Go
27 lines
725 B
Go
package user
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/perfect-panel/server/internal/logic/public/user"
|
|
"github.com/perfect-panel/server/internal/svc"
|
|
"github.com/perfect-panel/server/internal/types"
|
|
"github.com/perfect-panel/server/pkg/result"
|
|
)
|
|
|
|
// Cancel Withdrawal
|
|
func CancelWithdrawalHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
|
return func(c *gin.Context) {
|
|
var req types.CancelWithdrawalRequest
|
|
_ = c.ShouldBind(&req)
|
|
validateErr := svcCtx.Validate(&req)
|
|
if validateErr != nil {
|
|
result.ParamErrorResult(c, validateErr)
|
|
return
|
|
}
|
|
|
|
l := user.NewCancelWithdrawalLogic(c.Request.Context(), svcCtx)
|
|
resp, err := l.CancelWithdrawal(&req)
|
|
result.HttpResult(c, resp, err)
|
|
}
|
|
}
|