fix: 网元授权信息在线时更新授权信息,失败提示异常
This commit is contained in:
@@ -267,6 +267,7 @@ 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)
|
||||
@@ -274,25 +275,24 @@ func (s *NeLicenseController) State(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
neLicense.Status = "0"
|
||||
if neState, err := neService.NeState(neInfo); err == nil {
|
||||
neLicense.SerialNum = fmt.Sprint(neState["sn"])
|
||||
neLicense.ExpiryDate = fmt.Sprint(neState["expire"])
|
||||
neLicense.Status = "1"
|
||||
}
|
||||
|
||||
// 更新授权信息
|
||||
code, licensePath := s.neLicenseService.ReadLicenseInfo(neLicense)
|
||||
neLicense.ActivationRequestCode = code
|
||||
neLicense.LicensePath = licensePath
|
||||
neLicense.UpdateBy = ctx.LoginUserToUserName(c)
|
||||
rows := s.neLicenseService.Update(neLicense)
|
||||
if rows > 0 {
|
||||
// 在线时更新授权信息
|
||||
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,
|
||||
}))
|
||||
return
|
||||
}
|
||||
c.JSON(200, result.Err(nil))
|
||||
c.JSON(200, result.ErrMsg(fmt.Sprintf("%s service status exception", neLicense.NeType)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user