feat: 网元授权添加用户容量列

This commit is contained in:
TsMask
2025-05-09 11:36:43 +08:00
parent 7592c8c4d5
commit 8fe41b136f
4 changed files with 13 additions and 22 deletions

View File

@@ -156,6 +156,7 @@ func (s *NeLicenseController) Code(c *gin.Context) {
if licensePath != "" {
neLicense.LicensePath = licensePath
} else {
neLicense.Capability = 0
neLicense.SerialNum = ""
neLicense.ExpiryDate = ""
neLicense.Status = "0"
@@ -259,6 +260,7 @@ func (s *NeLicenseController) State(c *gin.Context) {
}
if neState, err := neFetchlink.NeState(neInfo); err == nil && neState["sn"] != nil {
neLicense.Status = "1"
neLicense.Capability = parse.Number(neState["capability"])
neLicense.SerialNum = fmt.Sprint(neState["sn"])
neLicense.ExpiryDate = fmt.Sprint(neState["expire"])
} else {
@@ -274,9 +276,10 @@ func (s *NeLicenseController) State(c *gin.Context) {
s.neLicenseService.Update(neLicense)
if neLicense.Status == "1" {
c.JSON(200, resp.OkData(map[string]string{
"sn": neLicense.SerialNum,
"expire": neLicense.ExpiryDate,
c.JSON(200, resp.OkData(map[string]any{
"capability": neLicense.Capability,
"sn": neLicense.SerialNum,
"expire": neLicense.ExpiryDate,
}))
return
}

View File

@@ -7,6 +7,7 @@ type NeLicense struct {
NeId string `json:"neId" gorm:"column:ne_id" binding:"required"` // 网元ID
ActivationRequestCode string `json:"activationRequestCode" gorm:"column:activation_request_code"` // 激活申请代码
LicensePath string `json:"licensePath" gorm:"column:license_path"` // 激活授权文件
Capability int64 `json:"capability" gorm:"column:capability"` // 用户容量
SerialNum string `json:"serialNum" gorm:"column:serial_num"` // 序列号
ExpiryDate string `json:"expiryDate" gorm:"column:expiry_date"` // 许可证到期日期
Status string `json:"status" gorm:"column:status"` // 状态 0无效 1有效