package model import "time" type NeckRingBindLog struct { Id int64 `json:"id"` PastureId int64 `json:"pastureId"` NeckRingNumber string `json:"neckRingNumber"` CowId int64 `json:"cowId"` BindAt int64 `json:"bindAt"` UnBindAt int64 `json:"unBindAt"` OperationId int64 `json:"operationId"` OperationName string `json:"operationName"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } func (n *NeckRingBindLog) TableName() string { return "neck_ring_bind_log" } func NewNeckRingBindLog(pastureId int64, cowInfo *Cow, operationUser *SystemUser) *NeckRingBindLog { return &NeckRingBindLog{ PastureId: pastureId, NeckRingNumber: cowInfo.NeckRingNumber, BindAt: time.Now().Unix(), CowId: cowInfo.Id, OperationId: operationUser.Id, OperationName: operationUser.Name, } } func (n *NeckRingBindLog) UnBind() { n.UnBindAt = time.Now().Unix() }