From f7178996ca77a1bccc941c0e7a73b36803e508cb Mon Sep 17 00:00:00 2001 From: vince <757871790@qq.com> Date: 星期五, 01 三月 2024 16:13:11 +0800 Subject: [PATCH] 优化协议 --- src/main/java/com/fzzy/gateway/hx2023/controller/GatewayController.java | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/fzzy/gateway/hx2023/controller/GatewayController.java b/src/main/java/com/fzzy/gateway/hx2023/controller/GatewayController.java index 20cdbc2..fd4433d 100644 --- a/src/main/java/com/fzzy/gateway/hx2023/controller/GatewayController.java +++ b/src/main/java/com/fzzy/gateway/hx2023/controller/GatewayController.java @@ -7,12 +7,14 @@ import com.fzzy.gateway.entity.GatewayConf; import com.fzzy.gateway.hx2023.data.GatewayAuthData; import com.fzzy.gateway.service.GatewayConfService; +import com.ld.license.LicenseVerify; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; +import java.util.UUID; /** * @@ -71,7 +73,7 @@ } - String token = "fzzy-" + gatewayId; + String token = "fzzy-" + UUID.randomUUID(); log.debug("============閴存潈==========={}--{}--{}", data.getUsername(), data.getPassword(), token); @@ -83,7 +85,21 @@ json.put("message", "鎴愬姛"); json.put("status", 0); json.put("code", 200); - return json; + try{ + LicenseVerify licenseVerify = new LicenseVerify(); + //鏍¢獙璇佷功鏄惁鏈夋晥 + boolean verifyResult = licenseVerify.verify(); + + if(verifyResult){ + return json; + }else{ + log.error("璇佷功楠岃瘉澶辫触!鎷掔粷璁块棶"); + return null; + } + }catch (Exception e){ + log.error("璇佷功楠岃瘉澶辫触:" + e.getMessage(),e); + return null; + } } public void updateGatewayToken(String token, String username) { -- Gitblit v1.9.3