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.
|
|
package models
import ( "time"
"github.com/ouxuanserver/osmanthuswine/src/core" )
const AuctionHistoryTableName = TableNamePrefix + "auction_history"
//竞拍历史
type AuctionHistory struct { Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` UserId int64 `json:"user_id" xorm:"not null comment('用户表id') INT(11)"` RehearsalId int64 `json:"rehearsal_id" xorm:"not null comment('彩排id, 0是正式') INT(11)"` PlayerId int64 `json:"player_id" xorm:"not null comment('竞拍者id') INT(11)"` ActivityId int64 `json:"activity_id" xorm:"not null comment('互动id') INT(11)"` AreaId int64 `json:"area_id" xorm:"not null comment('地区id') INT(11)"` AreaName string `json:"area_name" xorm:"not null comment('地区名字') VARCHAR(128)"` UserName string `json:"user_name" xorm:"not null comment('用户名') VARCHAR(128)"` UserPhone string `json:"user_phone" xorm:"not null comment('用户手机') VARCHAR(128)"` AuctionGoodsName string `json:"auction_goods_name" xorm:"not null comment('竞拍商品名字') VARCHAR(255)"` AuctionActivityId int64 `json:"auction_activity_id" xorm:"not null comment('竞拍活动id') INT(11)"` PlayerCode int64 `json:"player_code" xorm:"not null comment('竞拍参与者号码') INT(11)"` Unit int `json:"unit" xorm:"not null default(1) comment('单位') TINYINT(1)"` Money float64 `json:"money" xorm:"not null comment('计算总价格') DECIMAL(20)"` Version int `json:"version" xorm:"not null default(0) version comment('乐观锁') INT(11)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除') TINYINT(1)"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"` }
func (t *AuctionHistory) TableName() string { return AuctionHistoryTableName }
func (t *AuctionHistory) GetHighestMoney(rid, aid int64) (bool, error) { return core.GetXormAuto().Where("auction_activity_id = ? and rehearsal_id=? and is_delete=0", aid, rid). Desc("money").Asc("updated_at").Get(t) }
func (t *AuctionHistory) CountHistory(rid, aid int64) (int64, error) { return core.GetXormAuto().Where("auction_activity_id = ? and rehearsal_id=? and is_delete=0", aid, rid).Count(t) }
func GetAuctionHistoriesByAuctionId(aid, rid int64, orderBy string) ([]*AuctionHistory, error) { histories := make([]*AuctionHistory, 0) err := core.GetXormAuto().Where("is_delete=0 and auction_activity_id=? and rehearsal_id=?", aid, rid). OrderBy(orderBy).Find(&histories) return histories, err }
func GetAuctionHistoriesByAuctionIds(ids []int64, rid int64, orderBy string) ([]*AuctionHistory, error) { histories := make([]*AuctionHistory, 0) err := core.GetXormAuto().Where("is_delete=0 and rehearsal_id=?", rid). In("auction_activity_id", ids).OrderBy(orderBy).Find(&histories) return histories, err }
|