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

50 lines
2.9 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. package models
  2. import (
  3. "time"
  4. "github.com/ouxuanserver/osmanthuswine/src/core"
  5. )
  6. const AuctionResultRecordTableName = TableNamePrefix + "auction_result_record"
  7. type AuctionResultRecord struct {
  8. Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
  9. ActivityId int `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
  10. RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('0正式/!0彩排id') INT(11)"` // 增加彩排功能
  11. AuctionActivityId int `json:"auction_activity_id" xorm:"not null comment('竞拍活动id') INT(11)"`
  12. AreaId int `json:"area_id" xorm:"not null default('0') comment('地区id') INT(11)"`
  13. ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
  14. AreaName string `json:"area_name" xorm:"not null default('') comment('地区名字') VARCHAR(255)"`
  15. UserId int `json:"user_id" xorm:"not null comment('用户id') INT(11)"`
  16. UserName string `json:"user_name" xorm:"not null comment('用户名字') VARCHAR(255)"`
  17. UserPhone string `json:"user_phone" xorm:"not null comment('用户手机号码') VARCHAR(128)"`
  18. PlayerCode int64 `json:"player_code" xorm:"not null default(0) comment('竞拍编号') INT(11)"`
  19. AuctionGoodsName string `json:"auction_goods_name" xorm:"not null comment('商品名字') VARCHAR(255)"`
  20. DealPrice float64 `json:"deal_price" xorm:"not null comment('成交价格') DECIMAL(20)"`
  21. Unit int `json:"unit" xorm:"not null default(1) comment('单位') TINYINT(1)"`
  22. IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"`
  23. CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
  24. UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"`
  25. }
  26. func (t *AuctionResultRecord) TableName() string {
  27. return AuctionResultRecordTableName
  28. }
  29. func (t *AuctionResultRecord) CountHistory(rid, aid int, archId interface{}) (int64, error) {
  30. return core.GetXormAuto().Where("auction_activity_id=? and arch_id=? and rehearsal_id=? and is_delete=0",
  31. aid, archId, rid).Count(t)
  32. }
  33. func GetAuctionRecordsByAuctionId(id, rid int, archId interface{}) ([]*AuctionResultRecord, error) {
  34. records := make([]*AuctionResultRecord, 0)
  35. err := core.GetXormAuto().Where("is_delete=0 and rehearsal_id=? and auction_activity_id=? and arch_id=?", rid, id, archId).
  36. Desc("created_at").Find(&records)
  37. return records, err
  38. }
  39. func (t *AuctionResultRecord) GetByUserIdAndAuctionId(userId, auctionId, archId, rehearsalId interface{}) (bool, error) {
  40. return core.GetXormAuto().Where("is_delete=0 and user_id=? and auction_activity_id=? and arch_id=? and rehearsal_id=?",
  41. userId, auctionId, archId, rehearsalId).Get(t)
  42. }