diff --git a/controllers/admin/app.go b/controllers/admin/app.go index 6899749..19f3459 100644 --- a/controllers/admin/app.go +++ b/controllers/admin/app.go @@ -671,12 +671,12 @@ func AppGetMultiConfigHandler(w http.ResponseWriter, r *http.Request) { // AppUpdateMultiConfigHandler 更新应用多开配置 func AppUpdateMultiConfigHandler(w http.ResponseWriter, r *http.Request) { var req struct { - UUID string `json:"uuid"` - LoginType int `json:"login_type"` - MultiOpenScope int `json:"multi_open_scope"` - CleanInterval int `json:"clean_interval"` - CheckInterval int `json:"check_interval"` - MultiOpenCount int `json:"multi_open_count"` + UUID string `json:"uuid"` + LoginType int `json:"login_type"` + MultiOpenScope int `json:"multi_open_scope"` + CleanInterval int `json:"clean_interval"` + CheckInterval int `json:"check_interval"` + MultiOpenCount int `json:"multi_open_count"` } if err := json.NewDecoder(r.Body).Decode(&req); err != nil { @@ -801,18 +801,18 @@ func AppGetBindConfigHandler(w http.ResponseWriter, r *http.Request) { // 返回绑定配置信息 response := map[string]interface{}{ - "machine_code_verify": app.MachineCodeVerify, - "machine_code_rebind_enabled": app.MachineCodeRebindEnabled, - "machine_code_option": app.MachineCodeOption, - "machine_code_free_count": app.MachineCodeFreeCount, - "machine_code_rebind_count": app.MachineCodeRebindCount, - "machine_code_rebind_deduct": app.MachineCodeRebindDeduct, - "ip_verify": app.IPVerify, - "ip_rebind_enabled": app.IPRebindEnabled, - "ip_option": app.IPOption, - "ip_free_count": app.IPFreeCount, - "ip_rebind_count": app.IPRebindCount, - "ip_rebind_deduct": app.IPRebindDeduct, + "machine_verify": app.MachineVerify, + "machine_rebind_enabled": app.MachineRebindEnabled, + "machine_rebind_limit": app.MachineRebindLimit, + "machine_free_count": app.MachineFreeCount, + "machine_rebind_count": app.MachineRebindCount, + "machine_rebind_deduct": app.MachineRebindDeduct, + "ip_verify": app.IPVerify, + "ip_rebind_enabled": app.IPRebindEnabled, + "ip_rebind_limit": app.IPRebindLimit, + "ip_free_count": app.IPFreeCount, + "ip_rebind_count": app.IPRebindCount, + "ip_rebind_deduct": app.IPRebindDeduct, } w.Header().Set("Content-Type", "application/json") @@ -827,19 +827,19 @@ func AppUpdateBindConfigHandler(w http.ResponseWriter, r *http.Request) { } var req struct { - UUID string `json:"uuid"` - MachineCodeVerify int `json:"machine_code_verify"` - MachineCodeRebindEnabled int `json:"machine_code_rebind_enabled"` - MachineCodeOption int `json:"machine_code_option"` - MachineCodeFreeCount int `json:"machine_code_free_count"` - MachineCodeRebindCount int `json:"machine_code_rebind_count"` - MachineCodeRebindDeduct int `json:"machine_code_rebind_deduct"` - IPVerify int `json:"ip_verify"` - IPRebindEnabled int `json:"ip_rebind_enabled"` - IPOption int `json:"ip_option"` - IPFreeCount int `json:"ip_free_count"` - IPRebindCount int `json:"ip_rebind_count"` - IPRebindDeduct int `json:"ip_rebind_deduct"` + UUID string `json:"uuid"` + MachineVerify int `json:"machine_verify"` + MachineRebindEnabled int `json:"machine_rebind_enabled"` + MachineRebindLimit int `json:"machine_rebind_limit"` + MachineFreeCount int `json:"machine_free_count"` + MachineRebindCount int `json:"machine_rebind_count"` + MachineRebindDeduct int `json:"machine_rebind_deduct"` + IPVerify int `json:"ip_verify"` + IPRebindEnabled int `json:"ip_rebind_enabled"` + IPRebindLimit int `json:"ip_rebind_limit"` + IPFreeCount int `json:"ip_free_count"` + IPRebindCount int `json:"ip_rebind_count"` + IPRebindDeduct int `json:"ip_rebind_deduct"` } if err := json.NewDecoder(r.Body).Decode(&req); err != nil { @@ -875,20 +875,20 @@ func AppUpdateBindConfigHandler(w http.ResponseWriter, r *http.Request) { } // 验证参数范围 - if req.MachineCodeVerify < 0 || req.MachineCodeVerify > 1 { + if req.MachineVerify < 0 || req.MachineVerify > 1 { response := map[string]interface{}{ "code": 1, - "msg": "机器码验证参数无效", + "msg": "机器验证参数无效", } w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(response) return } - if req.MachineCodeOption < 0 || req.MachineCodeOption > 1 { + if req.MachineRebindLimit < 0 || req.MachineRebindLimit > 1 { response := map[string]interface{}{ "code": 1, - "msg": "机器码选项参数无效", + "msg": "机器重绑限制参数无效", } w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(response) @@ -905,20 +905,20 @@ func AppUpdateBindConfigHandler(w http.ResponseWriter, r *http.Request) { return } - if req.IPOption < 0 || req.IPOption > 1 { + if req.IPRebindLimit < 0 || req.IPRebindLimit > 1 { response := map[string]interface{}{ "code": 1, - "msg": "IP地址选项参数无效", + "msg": "IP地址重绑限制参数无效", } w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(response) return } - if req.MachineCodeRebindEnabled < 0 || req.MachineCodeRebindEnabled > 1 { + if req.MachineRebindEnabled < 0 || req.MachineRebindEnabled > 1 { response := map[string]interface{}{ "code": 1, - "msg": "机器码重绑开关参数无效", + "msg": "机器重绑开关参数无效", } w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(response) @@ -935,7 +935,7 @@ func AppUpdateBindConfigHandler(w http.ResponseWriter, r *http.Request) { return } - if req.MachineCodeFreeCount < 0 || req.MachineCodeRebindCount < 0 || req.MachineCodeRebindDeduct < 0 || + if req.MachineFreeCount < 0 || req.MachineRebindCount < 0 || req.MachineRebindDeduct < 0 || req.IPFreeCount < 0 || req.IPRebindCount < 0 || req.IPRebindDeduct < 0 { response := map[string]interface{}{ "code": 1, @@ -973,18 +973,18 @@ func AppUpdateBindConfigHandler(w http.ResponseWriter, r *http.Request) { // 更新绑定配置 updates := map[string]interface{}{ - "machine_code_verify": req.MachineCodeVerify, - "machine_code_rebind_enabled": req.MachineCodeRebindEnabled, - "machine_code_option": req.MachineCodeOption, - "machine_code_free_count": req.MachineCodeFreeCount, - "machine_code_rebind_count": req.MachineCodeRebindCount, - "machine_code_rebind_deduct": req.MachineCodeRebindDeduct, - "ip_verify": req.IPVerify, - "ip_rebind_enabled": req.IPRebindEnabled, - "ip_option": req.IPOption, - "ip_free_count": req.IPFreeCount, - "ip_rebind_count": req.IPRebindCount, - "ip_rebind_deduct": req.IPRebindDeduct, + "machine_verify": req.MachineVerify, + "machine_rebind_enabled": req.MachineRebindEnabled, + "machine_rebind_limit": req.MachineRebindLimit, + "machine_free_count": req.MachineFreeCount, + "machine_rebind_count": req.MachineRebindCount, + "machine_rebind_deduct": req.MachineRebindDeduct, + "ip_verify": req.IPVerify, + "ip_rebind_enabled": req.IPRebindEnabled, + "ip_rebind_limit": req.IPRebindLimit, + "ip_free_count": req.IPFreeCount, + "ip_rebind_count": req.IPRebindCount, + "ip_rebind_deduct": req.IPRebindDeduct, } if err := db.Model(&app).Updates(updates).Error; err != nil { diff --git a/models/app.go b/models/app.go index a9961ec..be99d71 100644 --- a/models/app.go +++ b/models/app.go @@ -53,27 +53,27 @@ type App struct { // MultiOpenCount:多开数量(默认1) MultiOpenCount int `gorm:"default:1;not null;comment:多开数量" json:"multi_open_count"` - // 机器码验证相关字段 - // MachineCodeVerify:机器码验证(0=关闭,1=开启) - MachineCodeVerify int `gorm:"default:0;not null;comment:机器码验证,0=关闭,1=开启" json:"machine_code_verify"` - // MachineCodeRebindEnabled:机器码重绑开关(0=关闭,1=开启) - MachineCodeRebindEnabled int `gorm:"default:0;not null;comment:机器码重绑开关,0=关闭,1=开启" json:"machine_code_rebind_enabled"` - // MachineCodeOption:机器码选项(0=每天,1=永久) - MachineCodeOption int `gorm:"default:0;not null;comment:机器码选项,0=每天,1=永久" json:"machine_code_option"` - // MachineCodeFreeCount:机器码免费次数(默认0) - MachineCodeFreeCount int `gorm:"default:0;not null;comment:机器码免费次数" json:"machine_code_free_count"` - // MachineCodeRebindCount:机器码重绑次数(默认0) - MachineCodeRebindCount int `gorm:"default:0;not null;comment:机器码重绑次数" json:"machine_code_rebind_count"` - // MachineCodeRebindDeduct:机器码重绑扣除(默认0,单位:分钟) - MachineCodeRebindDeduct int `gorm:"default:0;not null;comment:机器码重绑扣除,单位分钟" json:"machine_code_rebind_deduct"` + // 机器验证相关字段 + // MachineVerify:机器验证(0=关闭,1=开启) + MachineVerify int `gorm:"default:0;not null;comment:机器验证,0=关闭,1=开启" json:"machine_verify"` + // MachineRebindEnabled:机器重绑开关(0=关闭,1=开启) + MachineRebindEnabled int `gorm:"default:0;not null;comment:机器重绑开关,0=关闭,1=开启" json:"machine_rebind_enabled"` + // MachineRebindLimit:机器重绑限制(0=每天,1=永久) + MachineRebindLimit int `gorm:"default:0;not null;comment:机器重绑限制,0=每天,1=永久" json:"machine_rebind_limit"` + // MachineFreeCount:机器免费次数(默认0) + MachineFreeCount int `gorm:"default:0;not null;comment:机器免费次数" json:"machine_free_count"` + // MachineRebindCount:机器重绑次数(默认0) + MachineRebindCount int `gorm:"default:0;not null;comment:机器重绑次数" json:"machine_rebind_count"` + // MachineRebindDeduct:机器重绑扣除(默认0,单位:分钟) + MachineRebindDeduct int `gorm:"default:0;not null;comment:机器重绑扣除,单位分钟" json:"machine_rebind_deduct"` // IP地址验证相关字段 // IPVerify:IP地址验证(0=关闭,1=开启,2=开启(市),3=开启(省)) IPVerify int `gorm:"default:0;not null;comment:IP地址验证,0=关闭,1=开启,2=开启(市),3=开启(省)" json:"ip_verify"` // IPRebindEnabled:IP地址重绑开关(0=关闭,1=开启) IPRebindEnabled int `gorm:"default:0;not null;comment:IP地址重绑开关,0=关闭,1=开启" json:"ip_rebind_enabled"` - // IPOption:IP地址选项(0=每天,1=永久) - IPOption int `gorm:"default:0;not null;comment:IP地址选项,0=每天,1=永久" json:"ip_option"` + // IPRebindLimit:IP地址重绑限制(0=每天,1=永久) + IPRebindLimit int `gorm:"default:0;not null;comment:IP地址重绑限制,0=每天,1=永久" json:"ip_rebind_limit"` // IPFreeCount:IP地址免费次数(默认0) IPFreeCount int `gorm:"default:0;not null;comment:IP地址免费次数" json:"ip_free_count"` // IPRebindCount:IP地址重绑次数(默认0) diff --git a/web/template/admin/apps.html b/web/template/admin/apps.html index 0da30c6..2dbd3d8 100644 --- a/web/template/admin/apps.html +++ b/web/template/admin/apps.html @@ -146,7 +146,7 @@ { type: 'checkbox', width: 50 }, { field: 'id', title: 'ID', width: 80, sort: true }, { field: 'name', title: '应用名称', minWidth: 180 }, - { field: 'uuid', title: 'UUID', minWidth: 320 }, + { field: 'uuid', title: 'UUID', minWidth: 335 }, { field: 'version', title: '应用版本', width: 100 }, { field: 'status', @@ -572,45 +572,45 @@ // 机器码验证设置 '
' + '