From 01407e36f8a1d46e065cdcfe14629540dbd6b921 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期一, 04 十一月 2019 09:41:37 +0800 Subject: [PATCH] 红包 --- fanli/src/main/java/com/yeshi/fanli/aspect/VersionLimitAspect.java | 25 ++++++++++++++++++++----- 1 files changed, 20 insertions(+), 5 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/aspect/integral/IntegralGetVersionLimitAspect.java b/fanli/src/main/java/com/yeshi/fanli/aspect/VersionLimitAspect.java similarity index 74% rename from fanli/src/main/java/com/yeshi/fanli/aspect/integral/IntegralGetVersionLimitAspect.java rename to fanli/src/main/java/com/yeshi/fanli/aspect/VersionLimitAspect.java index f8ca6be..f93e07d 100644 --- a/fanli/src/main/java/com/yeshi/fanli/aspect/integral/IntegralGetVersionLimitAspect.java +++ b/fanli/src/main/java/com/yeshi/fanli/aspect/VersionLimitAspect.java @@ -1,4 +1,4 @@ -package com.yeshi.fanli.aspect.integral; +package com.yeshi.fanli.aspect; import java.lang.reflect.Method; @@ -22,10 +22,11 @@ import com.yeshi.fanli.service.inter.user.UserActiveLogService; import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.annotation.integral.IntegralGetVersionLimit; +import com.yeshi.fanli.util.annotation.redpack.RedPackGetVersionLimit; @Component @Aspect -public class IntegralGetVersionLimitAspect { +public class VersionLimitAspect { @Resource private UserActiveLogService userActiveLogService; @@ -46,7 +47,7 @@ return expression.getValue(context).toString(); } - @Around("execution(public * com.yeshi.fanli.service.impl.user.integral.*.*(..))") + @Around("execution(public * com.yeshi.fanli.service.impl..*.*(..))") public Object requestSerializable(ProceedingJoinPoint joinPoint) throws Throwable { Signature signature = joinPoint.getSignature(); MethodSignature methodSignature = (MethodSignature) signature; @@ -62,8 +63,22 @@ UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(Long.parseLong(uid)); if (activeLog != null) { // 灏忎簬1.6.5鐗堟湰涓嶅鍔犵Н鍒� - if (!VersionUtil.greaterThan_1_6_5( - "appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android", + if (!VersionUtil.greaterThan_1_6_5("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android", + activeLog.getVersionCode())) + return null; + } + } + } + + if (realMethod.isAnnotationPresent(RedPackGetVersionLimit.class)) { + RedPackGetVersionLimit rs = realMethod.getAnnotation(RedPackGetVersionLimit.class); + String key = rs.uid(); + String uid = generateKeyBySpEL(key, joinPoint); + if (uid != null && NumberUtil.isNumeric(uid)) { + UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(Long.parseLong(uid)); + if (activeLog != null) { + // 灏忎簬2.0.2鐗堟湰涓嶅鍔犵Н鍒� + if (!VersionUtil.greaterThan_2_0_2("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android", activeLog.getVersionCode())) return null; } -- Gitblit v1.8.0