package asset import ( "github.com/gin-gonic/gin" "github.com/shopspring/decimal" ) func (s *Server) Withdraw(ctx *gin.Context) { c := s.FromContext(ctx) type request struct { Amount decimal.Decimal `json:"amount"` Symbol string `json:"symbol"` } req := new(request) if err := c.ShouldBindJSON(&req); err != nil { c.Resp(err.Error()) return } user, err := s.WithdrawCheck(c.UserId(), req.Symbol, req.Amount) if err != nil { c.Resp(err.Error()) return } err = s.WithdrawApply(user, req.Symbol, req.Amount) if err != nil { c.Resp(err.Error()) return } c.Resp(nil) }