Add the field deletedKeepDays.

This commit is contained in:
lishuang 2020-07-12 17:53:33 +08:00
parent 21d61d9cd2
commit b82bac40fc
2 changed files with 12 additions and 0 deletions

View File

@ -83,6 +83,7 @@ func (this *PreferenceController) Edit(writer http.ResponseWriter, request *http
downloadDirMaxNumStr := request.FormValue("downloadDirMaxNum")
defaultTotalSizeLimitStr := request.FormValue("defaultTotalSizeLimit")
allowRegisterStr := request.FormValue("allowRegister")
deletedKeepDaysStr := request.FormValue("deletedKeepDays")
if name == "" {
panic(result.BadRequest("name cannot be null"))
@ -115,6 +116,15 @@ func (this *PreferenceController) Edit(writer http.ResponseWriter, request *http
defaultTotalSizeLimit = int64(intDefaultTotalSizeLimit)
}
var deletedKeepDays int64 = 0
if deletedKeepDaysStr == "" {
panic(result.BadRequest("deletedKeepDays cannot be null"))
} else {
intDeletedKeepDays, err := strconv.Atoi(deletedKeepDaysStr)
this.PanicError(err)
deletedKeepDays = int64(intDeletedKeepDays)
}
var allowRegister = false
if allowRegisterStr == TRUE {
allowRegister = true
@ -130,6 +140,7 @@ func (this *PreferenceController) Edit(writer http.ResponseWriter, request *http
preference.DownloadDirMaxNum = downloadDirMaxNum
preference.DefaultTotalSizeLimit = defaultTotalSizeLimit
preference.AllowRegister = allowRegister
preference.DeletedKeepDays = deletedKeepDays
preference = this.preferenceService.Save(preference)

View File

@ -18,6 +18,7 @@ type Preference struct {
AllowRegister bool `json:"allowRegister" gorm:"type:tinyint(1) not null;default:0"`
PreviewConfig string `json:"previewConfig" gorm:"type:text"`
ScanConfig string `json:"scanConfig" gorm:"type:text"`
DeletedKeepDays int64 `json:"deletedKeepDays" gorm:"type:bigint(20) not null;default:7"`
Version string `json:"version" gorm:"-"`
}