dt_finance.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. package daytask
  2. // DtRechargeOrder 充值订单表
  3. type DtRechargeOrder struct {
  4. Id int64 `json:"id" gorm:"column:id;type:bigint;primarykey;comment:订单ID"`
  5. OrderNo string `json:"orderNo" gorm:"column:order_no;type:varchar(32);not null;uniqueIndex:uk_order_no;comment:订单编号"`
  6. UserId int64 `json:"userId" gorm:"column:user_id;type:bigint;not null;index:idx_user_id;comment:用户ID"`
  7. UserUid string `json:"userUid" gorm:"column:user_uid;type:varchar(32);comment:用户UID"`
  8. Channel string `json:"channel" gorm:"column:channel;type:varchar(32);not null;index:idx_channel;comment:充值渠道: usdt/momo/zalopay/bank"`
  9. Amount float64 `json:"amount" gorm:"column:amount;type:decimal(18,2);default:0.00;comment:充值金额(USDT)"`
  10. ActualAmount float64 `json:"actualAmount" gorm:"column:actual_amount;type:decimal(18,2);default:0.00;comment:实际到账"`
  11. Fee float64 `json:"fee" gorm:"column:fee;type:decimal(18,2);default:0.00;comment:手续费"`
  12. ExchangeRate float64 `json:"exchangeRate" gorm:"column:exchange_rate;type:decimal(18,6);default:1.000000;comment:汇率"`
  13. PayAmount float64 `json:"payAmount" gorm:"column:pay_amount;type:decimal(18,2);default:0.00;comment:支付金额(原币种)"`
  14. PayCurrency string `json:"payCurrency" gorm:"column:pay_currency;type:varchar(16);default:USDT;comment:支付币种"`
  15. Txid string `json:"txid" gorm:"column:txid;type:varchar(128);comment:交易哈希/流水号"`
  16. FromAddress string `json:"fromAddress" gorm:"column:from_address;type:varchar(128);comment:付款地址"`
  17. ToAddress string `json:"toAddress" gorm:"column:to_address;type:varchar(128);comment:收款地址"`
  18. Screenshot string `json:"screenshot" gorm:"column:screenshot;type:varchar(255);comment:付款截图"`
  19. PayTime int64 `json:"payTime" gorm:"column:pay_time;type:bigint;comment:支付时间"`
  20. ConfirmTime int64 `json:"confirmTime" gorm:"column:confirm_time;type:bigint;comment:确认时间"`
  21. ConfirmAdminId int64 `json:"confirmAdminId" gorm:"column:confirm_admin_id;type:bigint;comment:确认管理员ID"`
  22. Remark string `json:"remark" gorm:"column:remark;type:varchar(255);comment:备注"`
  23. Status int8 `json:"status" gorm:"column:status;type:tinyint;default:0;index:idx_status;comment:状态: 0=待支付 1=待确认 2=已完成 3=已取消 4=已退款"`
  24. CreatedAt int64 `json:"createdAt" gorm:"column:created_at;type:bigint;autoCreateTime;index:idx_created_at;comment:创建时间"`
  25. UpdatedAt int64 `json:"updatedAt" gorm:"column:updated_at;type:bigint;autoUpdateTime;comment:更新时间"`
  26. }
  27. func (*DtRechargeOrder) TableName() string {
  28. return "dt_recharge_order"
  29. }
  30. func NewDtRechargeOrder() *DtRechargeOrder {
  31. return &DtRechargeOrder{}
  32. }
  33. // DtWithdrawOrder 提现订单表
  34. type DtWithdrawOrder struct {
  35. Id int64 `json:"id" gorm:"column:id;type:bigint;primarykey;comment:订单ID"`
  36. OrderNo string `json:"orderNo" gorm:"column:order_no;type:varchar(32);not null;uniqueIndex:uk_order_no;comment:订单编号"`
  37. UserId int64 `json:"userId" gorm:"column:user_id;type:bigint;not null;index:idx_user_id;comment:用户ID"`
  38. UserUid string `json:"userUid" gorm:"column:user_uid;type:varchar(32);comment:用户UID"`
  39. Channel string `json:"channel" gorm:"column:channel;type:varchar(32);not null;index:idx_channel;comment:提现渠道: usdt/momo/zalopay/bank"`
  40. Amount float64 `json:"amount" gorm:"column:amount;type:decimal(18,2);default:0.00;comment:提现金额(USDT)"`
  41. ActualAmount float64 `json:"actualAmount" gorm:"column:actual_amount;type:decimal(18,2);default:0.00;comment:实际到账"`
  42. Fee float64 `json:"fee" gorm:"column:fee;type:decimal(18,2);default:0.00;comment:手续费"`
  43. ExchangeRate float64 `json:"exchangeRate" gorm:"column:exchange_rate;type:decimal(18,6);default:1.000000;comment:汇率"`
  44. ReceiveAmount float64 `json:"receiveAmount" gorm:"column:receive_amount;type:decimal(18,2);default:0.00;comment:收款金额(原币种)"`
  45. ReceiveCurrency string `json:"receiveCurrency" gorm:"column:receive_currency;type:varchar(16);default:USDT;comment:收款币种"`
  46. PaymentId int64 `json:"paymentId" gorm:"column:payment_id;type:bigint;comment:收款方式ID"`
  47. ReceiveAccount string `json:"receiveAccount" gorm:"column:receive_account;type:varchar(128);comment:收款账号"`
  48. ReceiveName string `json:"receiveName" gorm:"column:receive_name;type:varchar(64);comment:收款人姓名"`
  49. BankName string `json:"bankName" gorm:"column:bank_name;type:varchar(64);comment:银行名称"`
  50. Txid string `json:"txid" gorm:"column:txid;type:varchar(128);comment:交易哈希/流水号"`
  51. PayScreenshot string `json:"payScreenshot" gorm:"column:pay_screenshot;type:varchar(255);comment:打款截图"`
  52. ApplyTime int64 `json:"applyTime" gorm:"column:apply_time;type:bigint;comment:申请时间"`
  53. AuditTime int64 `json:"auditTime" gorm:"column:audit_time;type:bigint;comment:审核时间"`
  54. AuditAdminId int64 `json:"auditAdminId" gorm:"column:audit_admin_id;type:bigint;comment:审核管理员ID"`
  55. PayTime int64 `json:"payTime" gorm:"column:pay_time;type:bigint;comment:打款时间"`
  56. PayAdminId int64 `json:"payAdminId" gorm:"column:pay_admin_id;type:bigint;comment:打款管理员ID"`
  57. RejectReason string `json:"rejectReason" gorm:"column:reject_reason;type:varchar(255);comment:拒绝原因"`
  58. Remark string `json:"remark" gorm:"column:remark;type:varchar(255);comment:备注"`
  59. Status int8 `json:"status" gorm:"column:status;type:tinyint;default:0;index:idx_status;comment:状态: 0=待审核 1=审核通过 2=已打款 3=已完成 4=已拒绝 5=已取消"`
  60. CreatedAt int64 `json:"createdAt" gorm:"column:created_at;type:bigint;autoCreateTime;index:idx_created_at;comment:创建时间"`
  61. UpdatedAt int64 `json:"updatedAt" gorm:"column:updated_at;type:bigint;autoUpdateTime;comment:更新时间"`
  62. }
  63. func (*DtWithdrawOrder) TableName() string {
  64. return "dt_withdraw_order"
  65. }
  66. func NewDtWithdrawOrder() *DtWithdrawOrder {
  67. return &DtWithdrawOrder{}
  68. }
  69. // DtBalanceLog 资金流水表
  70. type DtBalanceLog struct {
  71. Id int64 `json:"id" gorm:"column:id;type:bigint;primarykey;comment:流水ID"`
  72. UserId int64 `json:"userId" gorm:"column:user_id;type:bigint;not null;index:idx_user_id;comment:用户ID"`
  73. UserUid string `json:"userUid" gorm:"column:user_uid;type:varchar(32);comment:用户UID"`
  74. Type string `json:"type" gorm:"column:type;type:varchar(32);not null;index:idx_type;comment:类型: recharge/withdraw/task_reward/invite_reward/level_purchase/refund/adjust"`
  75. Amount float64 `json:"amount" gorm:"column:amount;type:decimal(18,2);default:0.00;comment:变动金额"`
  76. BalanceBefore float64 `json:"balanceBefore" gorm:"column:balance_before;type:decimal(18,2);default:0.00;comment:变动前余额"`
  77. BalanceAfter float64 `json:"balanceAfter" gorm:"column:balance_after;type:decimal(18,2);default:0.00;comment:变动后余额"`
  78. RelatedId int64 `json:"relatedId" gorm:"column:related_id;type:bigint;comment:关联ID"`
  79. RelatedNo string `json:"relatedNo" gorm:"column:related_no;type:varchar(32);comment:关联单号"`
  80. Title string `json:"title" gorm:"column:title;type:varchar(128);comment:流水标题"`
  81. Remark string `json:"remark" gorm:"column:remark;type:varchar(255);comment:备注"`
  82. CreatedAt int64 `json:"createdAt" gorm:"column:created_at;type:bigint;autoCreateTime;index:idx_created_at;comment:创建时间"`
  83. }
  84. func (*DtBalanceLog) TableName() string {
  85. return "dt_balance_log"
  86. }
  87. func NewDtBalanceLog() *DtBalanceLog {
  88. return &DtBalanceLog{}
  89. }
  90. // DtPaymentChannel 支付渠道配置表
  91. type DtPaymentChannel struct {
  92. Id int64 `json:"id" gorm:"column:id;type:bigint;primarykey;comment:渠道ID"`
  93. Code string `json:"code" gorm:"column:code;type:varchar(32);not null;uniqueIndex:uk_code;comment:渠道编码: usdt/momo/zalopay/bank"`
  94. Name string `json:"name" gorm:"column:name;type:varchar(64);not null;comment:渠道名称"`
  95. NameVi string `json:"nameVi" gorm:"column:name_vi;type:varchar(64);comment:渠道名称(越南语)"`
  96. Icon string `json:"icon" gorm:"column:icon;type:varchar(255);comment:渠道图标"`
  97. Type int8 `json:"type" gorm:"column:type;type:tinyint;default:1;comment:类型: 1=充值 2=提现 3=双向"`
  98. MinAmount float64 `json:"minAmount" gorm:"column:min_amount;type:decimal(18,2);default:0.00;comment:最小金额"`
  99. MaxAmount float64 `json:"maxAmount" gorm:"column:max_amount;type:decimal(18,2);default:0.00;comment:最大金额"`
  100. FeeType int8 `json:"feeType" gorm:"column:fee_type;type:tinyint;default:1;comment:手续费类型: 1=固定 2=比例"`
  101. FeeValue float64 `json:"feeValue" gorm:"column:fee_value;type:decimal(18,4);default:0.0000;comment:手续费值"`
  102. ExchangeRate float64 `json:"exchangeRate" gorm:"column:exchange_rate;type:decimal(18,6);default:1.000000;comment:汇率"`
  103. Config string `json:"config" gorm:"column:config;type:json;comment:渠道配置(API密钥等)"`
  104. ReceiveAddress string `json:"receiveAddress" gorm:"column:receive_address;type:varchar(128);comment:收款地址(USDT)"`
  105. ReceiveQrcode string `json:"receiveQrcode" gorm:"column:receive_qrcode;type:varchar(255);comment:收款二维码"`
  106. Description string `json:"description" gorm:"column:description;type:varchar(512);comment:说明"`
  107. Status int8 `json:"status" gorm:"column:status;type:tinyint;default:1;comment:状态: 0=禁用 1=启用"`
  108. Sort int `json:"sort" gorm:"column:sort;type:int;default:0;comment:排序"`
  109. CreatedAt int64 `json:"createdAt" gorm:"column:created_at;type:bigint;autoCreateTime;comment:创建时间"`
  110. UpdatedAt int64 `json:"updatedAt" gorm:"column:updated_at;type:bigint;autoUpdateTime;comment:更新时间"`
  111. }
  112. func (*DtPaymentChannel) TableName() string {
  113. return "dt_payment_channel"
  114. }
  115. func NewDtPaymentChannel() *DtPaymentChannel {
  116. return &DtPaymentChannel{}
  117. }