fix: License检查错误抛出到错误信息

This commit is contained in:
TsMask
2025-04-28 17:42:49 +08:00
parent 43b436c830
commit 18bd26c7a8
2 changed files with 18 additions and 10 deletions

View File

@@ -146,9 +146,13 @@ func (s *NeLicenseController) Code(c *gin.Context) {
}
// 更新授权码
code, licensePath := s.neLicenseService.ReadLicenseInfo(neLicense)
neLicense.ActivationRequestCode = code
if licensePath != "" {
code, licensePath, err := s.neLicenseService.ReadLicenseInfo(neLicense)
if err != nil {
c.JSON(200, result.ErrMsg(err.Error()))
return
}
if code != "" && licensePath != "" {
neLicense.ActivationRequestCode = code
neLicense.LicensePath = licensePath
} else {
neLicense.SerialNum = ""
@@ -255,7 +259,11 @@ func (s *NeLicenseController) State(c *gin.Context) {
neLicense.Status = "1"
neLicense.SerialNum = fmt.Sprint(neState["sn"])
neLicense.ExpiryDate = fmt.Sprint(neState["expire"])
code, licensePath := s.neLicenseService.ReadLicenseInfo(neLicense)
code, licensePath, err := s.neLicenseService.ReadLicenseInfo(neLicense)
if err != nil {
c.JSON(200, result.ErrMsg(err.Error()))
return
}
neLicense.ActivationRequestCode = code
neLicense.LicensePath = licensePath
} else {