package model

import "time"
import "github.com/globalsign/mgo/bson"

// 破产次数统计
var (
	BankruptLogCollName = "log_bankrupt"
)

// 破产次数统计
type BankruptLog struct {
	LogId      bson.ObjectId `bson:"_id"`
	SnId       int32         //玩家id
	Platform   string        //平台名称
	GameId     int           //游戏id
	GameFreeID int32         //房间id

	CreateTime int64 // 注册时间
	UseCoin    int64 // 消耗金币
	Ts         int64 // 破产时间
}

func NewBankruptLog() *BankruptLog {
	log := &BankruptLog{LogId: bson.NewObjectId()}
	return log
}

func NewBankruptLogEx(snid int32, gamefreeid int32, createtime, usecoin int64, platform string, gameId int) *BankruptLog {
	cl := NewBankruptLog()
	cl.SnId = snid
	cl.Platform = platform
	cl.GameId = gameId

	cl.GameFreeID = gamefreeid
	cl.CreateTime = createtime

	now := time.Now()
	cl.Ts = now.Unix()
	cl.UseCoin = usecoin

	return cl
}
