feat: add capability in ne_license
This commit is contained in:
@@ -397,6 +397,9 @@ func (s *NeInfoController) Add(c *gin.Context) {
|
||||
neLicense.ExpiryDate = v.(string)
|
||||
neLicense.Status = "1"
|
||||
}
|
||||
if v, ok := body.ServerState["capability"]; ok && v != nil {
|
||||
neLicense.Capability = v.(string)
|
||||
}
|
||||
}
|
||||
|
||||
s.neVersionService.Insert(neVersion)
|
||||
@@ -492,6 +495,9 @@ func (s *NeInfoController) Edit(c *gin.Context) {
|
||||
neLicense.Status = "1"
|
||||
neLicense.UpdateBy = loginUserName
|
||||
}
|
||||
if v, ok := body.ServerState["capability"]; ok && v != nil {
|
||||
neLicense.Capability = v.(string)
|
||||
}
|
||||
}
|
||||
|
||||
if neVersion.ID != "" {
|
||||
|
||||
@@ -255,6 +255,7 @@ func (s *NeLicenseController) State(c *gin.Context) {
|
||||
neLicense.Status = "1"
|
||||
neLicense.SerialNum = fmt.Sprint(neState["sn"])
|
||||
neLicense.ExpiryDate = fmt.Sprint(neState["expire"])
|
||||
neLicense.Capability = fmt.Sprint(neState["capability"])
|
||||
code, licensePath := s.neLicenseService.ReadLicenseInfo(neLicense)
|
||||
neLicense.ActivationRequestCode = code
|
||||
neLicense.LicensePath = licensePath
|
||||
|
||||
@@ -9,6 +9,7 @@ type NeLicense struct {
|
||||
LicensePath string `json:"licensePath" gorm:"license_path"` // 激活授权文件
|
||||
SerialNum string `json:"serialNum" gorm:"serial_num"` // 序列号
|
||||
ExpiryDate string `json:"expiryDate" gorm:"expiry_date"` // 许可证到期日期
|
||||
Capability string `json:"capability" gorm:"capability"` // 许可证用户容量
|
||||
Status string `json:"status" gorm:"status"` // 状态 0无效 1有效
|
||||
Remark string `json:"remark" gorm:"remark"` // 备注
|
||||
CreateBy string `json:"createBy" gorm:"create_by"` // 创建者
|
||||
|
||||
@@ -14,7 +14,8 @@ import (
|
||||
// 实例化数据层 NeLicense 结构体
|
||||
var NewNeLicense = &NeLicense{
|
||||
selectSql: `select
|
||||
id, ne_type, ne_id, activation_request_code, license_path, serial_num, expiry_date, status, remark, create_by, create_time, update_by, update_time
|
||||
id, ne_type, ne_id, activation_request_code, license_path, serial_num,
|
||||
expiry_date, capability, status, remark, create_by, create_time, update_by, update_time
|
||||
from ne_license`,
|
||||
|
||||
resultMap: map[string]string{
|
||||
@@ -25,6 +26,7 @@ var NewNeLicense = &NeLicense{
|
||||
"license_path": "LicensePath",
|
||||
"serial_num": "SerialNum",
|
||||
"expiry_date": "ExpiryDate",
|
||||
"capability": "Capability",
|
||||
"status": "Status",
|
||||
"remark": "Remark",
|
||||
"create_by": "CreateBy",
|
||||
@@ -202,6 +204,9 @@ func (r *NeLicense) Insert(neLicense model.NeLicense) string {
|
||||
if neLicense.ExpiryDate != "" {
|
||||
params["expiry_date"] = neLicense.ExpiryDate
|
||||
}
|
||||
if neLicense.Capability != "" {
|
||||
params["capability"] = neLicense.Capability
|
||||
}
|
||||
if neLicense.Status != "" {
|
||||
params["status"] = neLicense.Status
|
||||
}
|
||||
@@ -262,6 +267,9 @@ func (r *NeLicense) Update(neLicense model.NeLicense) int64 {
|
||||
if neLicense.ExpiryDate != "" {
|
||||
params["expiry_date"] = neLicense.ExpiryDate
|
||||
}
|
||||
if neLicense.Capability != "" {
|
||||
params["capability"] = neLicense.Capability
|
||||
}
|
||||
if neLicense.Status != "" {
|
||||
params["status"] = neLicense.Status
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user