diff --git a/src/modules/network_element/controller/ne_license.go b/src/modules/network_element/controller/ne_license.go index 64d60acb..9c171e8e 100644 --- a/src/modules/network_element/controller/ne_license.go +++ b/src/modules/network_element/controller/ne_license.go @@ -191,7 +191,6 @@ func (s *NeLicenseController) State(c *gin.Context) { c.JSON(200, result.ErrMsg(i18n.TKey(language, "neLicense.noData"))) return } - neLicense.Status = "0" // 查询网元获取IP获取网元状态 neInfo := s.neInfoService.SelectNeInfoByNeTypeAndNeID(neLicense.NeType, neLicense.NeId) @@ -203,15 +202,20 @@ func (s *NeLicenseController) State(c *gin.Context) { neLicense.SerialNum = fmt.Sprint(neState["sn"]) neLicense.ExpiryDate = fmt.Sprint(neState["expire"]) neLicense.Status = "1" + } else { + neLicense.SerialNum = "-" + neLicense.ExpiryDate = "-" + neLicense.Status = "0" } - // 在线时更新授权信息 + // 更新授权信息 + code, licensePath := s.neLicenseService.ReadLicenseInfo(neLicense) + neLicense.ActivationRequestCode = code + neLicense.LicensePath = licensePath + neLicense.UpdateBy = ctx.LoginUserToUserName(c) + s.neLicenseService.Update(neLicense) + if neLicense.Status == "1" { - code, licensePath := s.neLicenseService.ReadLicenseInfo(neLicense) - neLicense.ActivationRequestCode = code - neLicense.LicensePath = licensePath - neLicense.UpdateBy = ctx.LoginUserToUserName(c) - s.neLicenseService.Update(neLicense) c.JSON(200, result.OkData(map[string]string{ "sn": neLicense.SerialNum, "expire": neLicense.ExpiryDate,