互动
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.4 KiB

5 years ago
  1. package models
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "time"
  5. )
  6. const CustomerOrderTableName = TableNamePrefix + "customer_order"
  7. type CustomerOrder struct {
  8. Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
  9. UserPrizeId int64 `json:"user_prize_id" xorm:"not null default 0 comment('用户奖品id') INT(11)"`
  10. ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('主活动id') INT(11)"`
  11. AreaId int64 `json:"area_id" xorm:"not null default 0 comment('地区id') BIGINT(20)"`
  12. AreaName string `json:"area_name" xorm:"not null default('') comment('地区名字') VARCHAR(255)"`
  13. RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式') BIGINT(20)"`
  14. OutTradeNo string `json:"out_trade_no" xorm:"not null default('') comment('订单流水号') VARCHAR(255)"`
  15. OrderEntryPersonId int64 `json:"order_enter_person_id" xorm:"not null default 0 comment('订单录入人员id') BIGINT(20)"`
  16. OrderEntryPersonName string `json:"order_entry_person_name" xorm:"-"`
  17. BuyerId int64 `json:"buyer_id" xorm:"not null default 0 comment('user表id') BIGINT(20)"`
  18. User *User `json:"user" xorm:"-"`
  19. GoodsId int64 `json:"goods_id" xorm:"not null default 0 comment('customer_goods表id') BIGINT(20)"`
  20. Good *CustomerGoods `json:"good" xorm:"-"`
  21. GoodsName string `json:"goods_name" xorm:"not null default('') comment('商品名字') VARCHAR(255)"`
  22. TotalAmount float64 `json:"total_amount" xorm:"not null default 0.00 comment('订单总额') DECIMAL"`
  23. OrderTime string `json:"order_time" xorm:"-"`
  24. IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"`
  25. CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
  26. UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"`
  27. }
  28. func (t *CustomerOrder) TableName() string {
  29. return CustomerOrderTableName
  30. }
  31. func (t *CustomerOrder) SoftDeleteById(id int64) (int64, error) {
  32. t.IsDelete = true
  33. return core.GetXormAuto().Id(id).Cols("is_delete").Update(t)
  34. }