add Encounter Level
This commit is contained in:
parent
4649b697f1
commit
da2ecf2eba
1
app/model/TODO.md
Normal file
1
app/model/TODO.md
Normal file
@ -0,0 +1 @@
|
||||
[ ] 之后 model 下的子文件还是再多增一层包的区分。
|
@ -23,6 +23,7 @@ type Encounter struct { // Encounter 或者称为 post,指的就是 Human 单
|
||||
|
||||
Title string `gorm:"size:20;column:title" json:"title"`
|
||||
Content string `json:"content"`
|
||||
Level uint8 `json:"level" gorm:"level;default:1"`
|
||||
// Time 从 CreatedAt 中解析
|
||||
|
||||
// TAG Avatar 最好是压缩后的备份图像
|
||||
|
5
app/model/encounter_com.go
Normal file
5
app/model/encounter_com.go
Normal file
@ -0,0 +1,5 @@
|
||||
package model
|
||||
|
||||
type EncounerLevel struct {
|
||||
BriefModel
|
||||
}
|
@ -35,3 +35,26 @@ func TestEncounterLike(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncounterLevel(t *testing.T) {
|
||||
Init()
|
||||
|
||||
encounterLevel := model.EncounerLevel{}
|
||||
err := DB.AutoMigrate(&encounterLevel)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
ZH := []string{"日常", "重大", "标志", "代办", "日程"}
|
||||
EN := []string{"daily", "serious", "flag", "todo", "schedule"}
|
||||
|
||||
for i := 0; i < len(ZH); i++ {
|
||||
encounterLevel := model.EncounerLevel{
|
||||
BriefModel: model.BriefModel{
|
||||
NameZh: ZH[i],
|
||||
NameEn: EN[i],
|
||||
},
|
||||
}
|
||||
DB.Create(&encounterLevel)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user