1.0
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// ScoreRecord 积分记录表
|
||||
type ScoreRecord struct {
|
||||
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||
UserID uint `gorm:"type:int;not null;comment:用户编号" json:"user_id" binding:"required"`
|
||||
ChangeNumber int `gorm:"type:int;not null;comment:变化数量" json:"change_number" binding:"required"`
|
||||
Note string `gorm:"type:varchar(200);not null;comment:说明" json:"note" binding:"required"`
|
||||
CreatedAt time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
|
||||
// 关联关系
|
||||
User User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
||||
}
|
||||
|
||||
func (ScoreRecord) TableName() string {
|
||||
return "score_records"
|
||||
}
|
||||
Reference in New Issue
Block a user