mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
remove id field in every form struct, fix cron & ddns db (#11)
This commit is contained in:
@@ -33,6 +33,15 @@ type Cron struct {
|
||||
ServersRaw string `json:"-"`
|
||||
}
|
||||
|
||||
func (c *Cron) BeforeSave(tx *gorm.DB) error {
|
||||
if data, err := utils.Json.Marshal(c.Servers); err != nil {
|
||||
return err
|
||||
} else {
|
||||
c.ServersRaw = string(data)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cron) AfterFind(tx *gorm.DB) error {
|
||||
return utils.Json.Unmarshal([]byte(c.ServersRaw), &c.Servers)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user