From 87efab9e78c9f49bc6d5f9fad3c0d96b64b0c245 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 16 May 2024 09:57:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BD=91=E5=85=83=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=A3=80=E6=9F=A5=E6=97=A0=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=97=B6=E6=95=B0=E6=8D=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../network_element/controller/ne_license.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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,