admin
2021-09-24 f788607ff771a47bc60d6a86e00b3433c40f3d2c
src/main/java/com/yeshi/buwan/aspect/SignAspect.java
@@ -1,6 +1,6 @@
package com.yeshi.buwan.aspect;
import com.yeshi.buwan.domain.DetailSystem;
import com.yeshi.buwan.domain.system.DetailSystem;
import com.yeshi.buwan.service.imp.SystemService;
import com.yeshi.buwan.util.JsonUtil;
import com.yeshi.buwan.util.Utils;
@@ -30,7 +30,7 @@
    //签名验证
    @Around("execution(public * com.yeshi.buwan.controller.api.*.*(..))")
    public Object verifySign(ProceedingJoinPoint joinPoint) throws IOException {
    public Object verifySign(ProceedingJoinPoint joinPoint) throws Throwable {
        ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = servletContainer.getRequest();
        HttpServletResponse response = servletContainer.getResponse();
@@ -40,15 +40,6 @@
        for (Object obj : args) {
            if (obj instanceof AcceptData) {
                acceptData = (AcceptData) obj;
                if (acceptData != null) {
                    if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
                        acceptData.setChannel("appstore");
                    }
                    //注入detailSystem
                    DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
                    acceptData.setDetailSystem(detailSystem);
                }
            } else if (obj instanceof PrintWriter) {
                out = (PrintWriter) obj;
            }
@@ -86,13 +77,32 @@
            }
        }
        Object obj = null;
        try {
            obj = joinPoint.proceed(args);
        } catch (Throwable e) {
            e.printStackTrace();
        if (acceptData != null) {
            if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
                acceptData.setChannel("appstore");
            }
            if (acceptData.getPackageName().equalsIgnoreCase("com.doudou.ysvideo.lite")) {
                //小米上架使用
                if (!"xiaomi".equalsIgnoreCase(acceptData.getChannel())) {
                    acceptData.setPackageName("com.doudou.ysvideo");
                    acceptData.setChildPackage("com.doudou.ysvideo.lite");
                } else {
                    acceptData.setChildPackage("com.doudou.ysvideo.lite");
                }
            } else {
                acceptData.setChildPackage(acceptData.getPackage());
            }
            //注入detailSystem
            DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
            acceptData.setDetailSystem(detailSystem);
            detailSystem = systemService.getDetailSystemByPackage(acceptData.getChildPackage());
            acceptData.setChildDetailSystem(detailSystem);
        }
        return obj;
        return joinPoint.proceed(args);
    }