Bläddra i källkod

feat : 非嵌入式SDK接入, 接口提交3

bilingfeng 11 månader sedan
förälder
incheckning
aa32869109

+ 1 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/SDKApplication.java

@@ -23,7 +23,7 @@ public class SDKApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(SDKApplication.class, args);
-        System.out.println("赞象SDK服务启动成功 <非嵌入式SDK接入, 接口提交3> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功 <非嵌入式SDK接入, 接口提交4> ( ´・・)ノ(._.`) \n" +
                 " ___________ _   __\n" +
                 "/  ___|  _  \\ | / /\n" +
                 "\\ `--.| | | | |/ / \n" +

+ 21 - 10
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/adapter/WebHandlerAdapter.java

@@ -38,20 +38,31 @@ public class WebHandlerAdapter implements HandlerInterceptor {
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
         HandlerMethod handlerMethod = (HandlerMethod) handler;
         //推送数据的签名校验
-        PushDataCheck pushCheck = handlerMethod.getMethod().getAnnotation(PushDataCheck.class);
-        //数据推送签名校验
-        if (pushCheck != null) {
+        PushDataCheck[] pushDataChecks = handlerMethod.getMethod().getAnnotationsByType(PushDataCheck.class);
+        if (pushDataChecks.length != 0){
+            log.error("PushDataCheck注解拿到了, 长度为 : {}", pushDataChecks.length);
             this.pushCheck(request);
         }
-        log.error("推送注解获取到为空");
+        log.error("PushDataCheck注解为kong");
         //排除签名认证接口注解
-        UnSignCheck unSignCheck = handlerMethod.getMethod().getAnnotation(UnSignCheck.class);
-        //接口签名验证
-        if (unSignCheck == null) {
-            return this.signCheck(request);
+        UnSignCheck[] unSignChecks = handlerMethod.getMethod().getAnnotationsByType(UnSignCheck.class);
+        if (unSignChecks.length != 0){
+            log.error("UnSignCheck注解拿到了, 长度为 : {}", unSignChecks.length);
+            return Boolean.TRUE;
         }
-        log.error("UnSignCheck注解获取到不是kong");
-        return Boolean.TRUE;
+        log.error("UnSignCheck注解为kong");
+        return this.signCheck(request);
+
+
+
+
+//        UnSignCheck unSignCheck = handlerMethod.getMethod().getAnnotation(UnSignCheck.class);
+//        //接口签名验证
+//        if (unSignCheck == null) {
+//            return this.signCheck(request);
+//        }
+//        log.error("UnSignCheck注解获取到不是kong");
+//        return Boolean.TRUE;
     }
 
     private boolean signCheck(HttpServletRequest request) throws Exception {