fix: 网元授权状态检查无连接时数据更新

This commit is contained in:
TsMask
2024-05-16 09:57:58 +08:00
parent 27be6e1be4
commit 87efab9e78

View File

@@ -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,