fix: 修复应用设置保存时未传字段被覆盖为空值/默认值的问题
This commit is contained in:
@@ -367,31 +367,61 @@ func handleUpdateApplication(c *gin.Context) {
|
||||
|
||||
app.Name = req.Name
|
||||
app.Description = req.Description
|
||||
app.BillingType = req.BillingType
|
||||
app.LoginPolicy = req.LoginPolicy
|
||||
if req.BillingType != "" {
|
||||
app.BillingType = req.BillingType
|
||||
}
|
||||
if req.LoginPolicy != "" {
|
||||
app.LoginPolicy = req.LoginPolicy
|
||||
}
|
||||
app.AllowRegister = req.AllowRegister
|
||||
app.EnableLoginVerify = req.EnableLoginVerify
|
||||
app.EnableRegisterVerify = req.EnableRegisterVerify
|
||||
app.VerifyMethod = req.VerifyMethod
|
||||
if req.VerifyMethod != "" {
|
||||
app.VerifyMethod = req.VerifyMethod
|
||||
}
|
||||
app.EmailConfigID = req.EmailConfigID
|
||||
app.SmsConfigID = req.SmsConfigID
|
||||
app.EncryptType = req.EncryptType
|
||||
if req.EncryptType != "" {
|
||||
app.EncryptType = req.EncryptType
|
||||
}
|
||||
if req.EncryptKey != "" {
|
||||
app.EncryptKey = req.EncryptKey
|
||||
}
|
||||
app.BindType = req.BindType
|
||||
app.MaxDevices = req.MaxDevices
|
||||
app.ChangeLimit = req.ChangeLimit
|
||||
app.ChangeInterval = req.ChangeInterval
|
||||
app.ChangeExceedAction = req.ChangeExceedAction
|
||||
app.ChangeDeductAmount = req.ChangeDeductAmount
|
||||
app.MultiOpenMode = req.MultiOpenMode
|
||||
app.MaxInstances = req.MaxInstances
|
||||
if req.BindType != "" {
|
||||
app.BindType = req.BindType
|
||||
}
|
||||
if req.MaxDevices > 0 {
|
||||
app.MaxDevices = req.MaxDevices
|
||||
}
|
||||
if req.ChangeLimit > 0 {
|
||||
app.ChangeLimit = req.ChangeLimit
|
||||
}
|
||||
if req.ChangeInterval > 0 {
|
||||
app.ChangeInterval = req.ChangeInterval
|
||||
}
|
||||
if req.ChangeExceedAction != "" {
|
||||
app.ChangeExceedAction = req.ChangeExceedAction
|
||||
}
|
||||
if req.ChangeDeductAmount > 0 {
|
||||
app.ChangeDeductAmount = req.ChangeDeductAmount
|
||||
}
|
||||
if req.MultiOpenMode != "" {
|
||||
app.MultiOpenMode = req.MultiOpenMode
|
||||
}
|
||||
if req.MaxInstances > 0 {
|
||||
app.MaxInstances = req.MaxInstances
|
||||
}
|
||||
app.EnableTrial = req.EnableTrial
|
||||
app.TrialBalance = req.TrialBalance
|
||||
app.TrialDays = req.TrialDays
|
||||
if req.TrialBalance > 0 {
|
||||
app.TrialBalance = req.TrialBalance
|
||||
}
|
||||
if req.TrialDays > 0 {
|
||||
app.TrialDays = req.TrialDays
|
||||
}
|
||||
app.EnableFreePeriod = req.EnableFreePeriod
|
||||
app.FreePeriodType = req.FreePeriodType
|
||||
if req.FreePeriodType != "" {
|
||||
app.FreePeriodType = req.FreePeriodType
|
||||
}
|
||||
app.FreePeriodStart = req.FreePeriodStart
|
||||
app.FreePeriodEnd = req.FreePeriodEnd
|
||||
app.FreePeriodWeekdays = req.FreePeriodWeekdays
|
||||
@@ -409,12 +439,24 @@ func handleUpdateApplication(c *gin.Context) {
|
||||
if req.LockDuration > 0 {
|
||||
app.LockDuration = req.LockDuration
|
||||
}
|
||||
app.Status = req.Status
|
||||
app.DeductionMode = req.DeductionMode
|
||||
app.DeductionType = req.DeductionType
|
||||
app.DeductionInterval = req.DeductionInterval
|
||||
app.DeductionUnit = req.DeductionUnit
|
||||
app.DeductionAmount = req.DeductionAmount
|
||||
if req.Status != "" {
|
||||
app.Status = req.Status
|
||||
}
|
||||
if req.DeductionMode != "" {
|
||||
app.DeductionMode = req.DeductionMode
|
||||
}
|
||||
if req.DeductionType != "" {
|
||||
app.DeductionType = req.DeductionType
|
||||
}
|
||||
if req.DeductionInterval > 0 {
|
||||
app.DeductionInterval = req.DeductionInterval
|
||||
}
|
||||
if req.DeductionUnit != "" {
|
||||
app.DeductionUnit = req.DeductionUnit
|
||||
}
|
||||
if req.DeductionAmount > 0 {
|
||||
app.DeductionAmount = req.DeductionAmount
|
||||
}
|
||||
app.EnablePasswordReset = req.EnablePasswordReset
|
||||
if req.PasswordResetMethod != "" {
|
||||
app.PasswordResetMethod = req.PasswordResetMethod
|
||||
|
||||
Reference in New Issue
Block a user