From cd7767932dddeaf6d9c73a83d4a9b38f0341b77f Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 28 一月 2022 12:46:17 +0800 Subject: [PATCH] bug修复 --- src/main/java/com/yeshi/buwan/aspect/SignAspect.java | 40 ++++++++++++++++++++++++++++------------ 1 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/aspect/SignAspect.java b/src/main/java/com/yeshi/buwan/aspect/SignAspect.java index 224f430..32c541f 100644 --- a/src/main/java/com/yeshi/buwan/aspect/SignAspect.java +++ b/src/main/java/com/yeshi/buwan/aspect/SignAspect.java @@ -9,8 +9,15 @@ import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.commons.CommonsMultipartResolver; +import org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest; import org.yeshi.utils.StringUtil; import javax.annotation.Resource; @@ -31,9 +38,9 @@ //绛惧悕楠岃瘉 @Around("execution(public * com.yeshi.buwan.controller.api.*.*(..))") public Object verifySign(ProceedingJoinPoint joinPoint) throws Throwable { - ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); - HttpServletRequest request = servletContainer.getRequest(); - HttpServletResponse response = servletContainer.getResponse(); + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = (HttpServletRequest) requestAttributes.resolveReference(RequestAttributes.REFERENCE_REQUEST); + HttpServletResponse response = ((ServletRequestAttributes) requestAttributes).getResponse(); PrintWriter out = null; AcceptData acceptData = null; Object[] args = joinPoint.getArgs(); @@ -48,16 +55,18 @@ //濡傛灉鏄疉ndroid鏂扮増鏈垯璋冪敤鏂扮殑绛惧悕鏂规硶 //甯冧父3.8.7涔嬪悗璋冪敤鏂扮殑绛惧悕鏂规硶 - if (acceptData != null && "android" .equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) { + if (acceptData != null && "android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) { Map<String, String[]> params = request.getParameterMap(); - //绛惧悕 List<String> list = new ArrayList<>(); + + //绛惧悕 for (Iterator<String> its = params.keySet().iterator(); its.hasNext(); ) { String key = its.next(); - if ("sign" .equalsIgnoreCase(key)) + if ("sign".equalsIgnoreCase(key)) continue; list.add(key + "=" + params.get(key)[0]); } + Collections.sort(list); String str = StringUtil.concat(list, "&"); String sign = StringUtil.Md5(str + "8888B&*@-uWan88/',@@^"); @@ -79,19 +88,26 @@ if (acceptData != null) { - if ("ios" .equalsIgnoreCase(acceptData.getPlatform())) { + if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { acceptData.setChannel("appstore"); } - if (acceptData.getPackageName().equalsIgnoreCase("com.doudou.ysvideo.lite")) - acceptData.setPackageName("com.doudou.ysvideo"); + 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); - acceptData.setChildPackage(acceptData.getPackage()); - detailSystem = systemService.getDetailSystemByPackage(acceptData.getChildPackage()); - + acceptData.setChildDetailSystem(detailSystem); } -- Gitblit v1.8.0