| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package entity
- import (
- "app/commons/utils"
- "github.com/demdxx/gocast"
- "github.com/shopspring/decimal"
- "gorm.io/gorm"
- )
- // 订单支付信息
- type NodeOrderPayments struct {
- MysqlBaseModel
- PaymentRecordId string `json:"paymentRecordId" gorm:"unique;type:VARCHAR(64);comment:支付订单ID"`
- NodeOrderRecordId string `json:"nodeOrderRecordId" gorm:"index;type:VARCHAR(64);comment:节点购买记录ID"`
- UserId int64 `json:"userId" gorm:"index;comment:用户ID;"`
- Uid string `json:"uid" gorm:"index;type:varchar(64);comment:用户交易所ID:;"`
- OrderUsdAmount decimal.Decimal `json:"orderUsdAmount" gorm:"type:decimal(25,8);default:0;comment:订单总价值"`
- PaySymbol decimal.Decimal `json:"paySymbol" gorm:"type:decimal(25,8);default:0;comment:支付币种"`
- PaySymbolUsdPrice decimal.Decimal `json:"paySymbolUsdPrice" gorm:"type:decimal(25,8);default:0;comment:支付币种单价"`
- PayQuantity decimal.Decimal `json:"payQuantity" gorm:"type:decimal(25,8);default:0;comment:支付数量"`
- PayUsdAmount decimal.Decimal `json:"payUsdAmount" gorm:"type:decimal(25,8);default:0;comment:支付总价值"`
- }
- func (*NodeOrderPayments) TableName() string {
- return NodeModelPrefix + "node_order_payments"
- }
- func (*NodeOrderPayments) Comment() string {
- return "股票活期理财产品表"
- }
- func NewNodeOrderPayments() *NodeOrderPayments {
- return &NodeOrderPayments{}
- }
- // BeforeCreate GORM 钩子,在创建记录之前调用
- func (c *NodeOrderPayments) BeforeCreate(tx *gorm.DB) (err error) {
- if c.PaymentRecordId == "" {
- c.PaymentRecordId = gocast.ToString(utils.UuidPrefix("PAY"))
- }
- return nil
- }
|