model/model.go
@@ -11,7 +11,8 @@ type BigID uint type CommonModel struct { ID BigID `gorm:"primary_key"` ID uint `gorm:"primary_key" json:"-"` BigInt BigID `json:"ID"` CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time `sql:"index"` @@ -24,7 +25,7 @@ // 处理 ID 为负数的情况(可选) id = snowflake.GenerateID() } c.ID = BigID(id) c.ID = uint(id) } }