互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
2.6 KiB

5 years ago
  1. package models
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "time"
  5. )
  6. const UserOrderTableName = TableNamePrefix + "user_order"
  7. type UserOrder struct {
  8. Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
  9. DeviceInfo string `json:"device_info" xorm:"not null default('') comment('设备号') VARCHAR(32)"`
  10. GoodType int `json:"good_type" xorm:"not null default(0) comment('1霸屏2打赏')"`
  11. Desc string `json:"desc" xorm:"not null default('') comment('') VARCHAR(128)"`
  12. OutTradeNo string `json:"out_trade_no" xorm:"not null default('') comment('商户订单号') VARCHAR(32)"`
  13. FeeType string `json:"fee_type" xorm:"not null default('CNY') comment('货币种类') VARCHAR(16)"`
  14. TotalFee int `json:"total_fee" xorm:"not null default(0) comment('订单总金额,单位是分') INT(88)"`
  15. TradeType string `json:"trade_type" xorm:"not null default('JSAPI') comment('交易类型') VARCHAR(16)"`
  16. OpenId string `json:"open_id" xorm:"not null default('') comment('用户标识') VARCHAR(128)"`
  17. UserId int64 `json:"user_id" xorm:"not null default(0) comment('用户id') INT(11)"`
  18. ActivityId int64 `json:"activity_id" xorm:"not null default(0) comment('活动id') INT(11)"`
  19. TransactionId string `json:"transaction_id" xorm:"not null default('') comment('微信支付订单号') VARCHAR(32)"`
  20. TimeStart string `json:"time_start" xorm:"not null default('') comment('交易起始时间') VARCHAR(14)"`
  21. TimeExpire string `json:"time_expire" xorm:"not null default('') comment('交易结束时间') VARCHAR(14)"`
  22. TimeEnd string `json:"time_end" xorm:"not null default('') comment('交易结算时间') VARCHAR(14)"`
  23. PrepayId string `json:"prepay_id" xorm:"not null default('') comment('预支付交易会话标识') VARCHAR(64)"`
  24. Status int `json:"status" xorm:"not null default(0) comment('-1订单关闭0尚未支付1支付成功') TINYINT(1)"`
  25. IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)" description:"是否删除"`
  26. CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME" description:"创建时间"`
  27. UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME" description:"更新时间"`
  28. }
  29. func (t *UserOrder) TableName() string {
  30. return UserOrderTableName
  31. }
  32. func (t *UserOrder) GetByOutTradeNo(no string) (bool, error) {
  33. return core.GetXormAuto().Where("is_delete=0 and out_trade_no=?", no).Get(t)
  34. }