config_asset.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package admin
  2. import (
  3. "app/commons/constant"
  4. "github.com/gin-gonic/gin"
  5. "github.com/shopspring/decimal"
  6. )
  7. func (s *Server) AssetConfig(ctx *gin.Context) {
  8. c := s.FromContext(ctx)
  9. type Request struct {
  10. WithdrawStatus bool `json:"withdrawStatus" gorm:"type:tinyint;default:false;comment:是否允许提现(全局):0=禁止,1=允许"`
  11. WithdrawNoauditLimit decimal.Decimal `json:"withdrawNoauditLimit" gorm:"default:0;type:decimal(25,8);comment:提现免审额度,0表示都需要审核"`
  12. MinWithdrawAmount decimal.Decimal `json:"minWithdrawAmount" gorm:"default:0;type:decimal(25,8);comment:提现最小限额,0表示无限制"`
  13. MaxWithdrawAmount decimal.Decimal `json:"maxWithdrawAmount" gorm:"default:0;type:decimal(25,8);comment:每笔提现最大限额,-1表示无限制,0表示不能提现"`
  14. WithdrawRatio decimal.Decimal `json:"withdrawRatio" gorm:"type:decimal(25,8);comment:提现手续费比例"`
  15. WithdrawAmount decimal.Decimal `json:"withdrawAmount" gorm:"type:decimal(25,8);comment:单次提现手续费数量"`
  16. }
  17. req := new(Request)
  18. if err := c.ShouldBindJSON(&req); err != nil {
  19. c.Resp(constant.ErrorParams)
  20. return
  21. }
  22. //sysConfig, err := s.GetWithdrawConfig()
  23. //if err != nil {
  24. // c.Resp(err.Error())
  25. // return
  26. //}
  27. //if req.WithdrawRatio.LessThan(decimal.Zero) {
  28. // c.Resp("最小提现手续费不能小于0")
  29. // return
  30. //}
  31. //if req.MinWithdrawAmount.LessThan(decimal.Zero) {
  32. // c.Resp("最小提现数量不能小于0")
  33. // return
  34. //}
  35. //if req.MaxWithdrawAmount.LessThan(decimal.Zero) {
  36. // c.Resp("最大提现数量不能小于0")
  37. // return
  38. //}
  39. //if req.WithdrawAmount.LessThan(decimal.Zero) {
  40. // c.Resp("最小提现手续费不能小于0")
  41. // return
  42. //}
  43. c.Resp(nil)
  44. }