Bläddra i källkod

积分查询接口

yuhongqi 2 veckor sedan
förälder
incheckning
ccfb7fc2bf

+ 5 - 5
fs-service/src/main/java/com/fs/his/service/impl/IntegralTaskServiceImpl.java

@@ -112,7 +112,7 @@ public class IntegralTaskServiceImpl implements IIntegralTaskService {
         cache.put("pageType", param.getPageType());
         cache.put("goodsId", param.getGoodsId());
         cache.put("platform", param.getPlatform());
-        redisCache.setCacheObject(IntegralTaskConstants.REDIS_BROWSE_PREFIX + token, cache, 5, TimeUnit.MINUTES);
+        redisCache.setCacheObject(IntegralTaskConstants.REDIS_BROWSE_PREFIX + token, cache, 1, TimeUnit.DAYS);
         return R.ok().put("browseToken", token).put("requiredSeconds", config.getIntegralProductBrowseSeconds());
     }
 
@@ -277,8 +277,6 @@ public class IntegralTaskServiceImpl implements IIntegralTaskService {
                 config.getDownloadAppIntegral(), hasLogType(userId, 28), taskDisplayScope));
         tasks.add(buildLifetimeTask(IntegralTaskConstants.TASK_FIRST_PURCHASE, "首次完成购物",
                 config.getIntegralFirstPurchase(), hasLogType(userId, 32), taskDisplayScope));
-        tasks.add(buildLifetimeTask(IntegralTaskConstants.TASK_INVITED, "填写朋友邀请码",
-                config.getIntegralInvited(), hasLogType(userId, 19), taskDisplayScope));
         hideCompletedNewbieTasks(tasks, userId);
         return tasks;
     }
@@ -300,6 +298,10 @@ public class IntegralTaskServiceImpl implements IIntegralTaskService {
         int inviteCount = countTodayLog(userId, 18);
         tasks.add(buildDailyTask(IntegralTaskConstants.TASK_INVITE, "邀好友享积分",
                 config.getIntegralInvite(), inviteCount, config.getIntegralInviteDailyLimit(), taskDisplayScope));
+
+        int invitedCount = hasLogType(userId, 19) ? 1 : 0;
+        tasks.add(buildDailyTask(IntegralTaskConstants.TASK_INVITED, "填写朋友邀请码",
+                config.getIntegralInvited(), invitedCount, 1, taskDisplayScope));
         return tasks;
     }
 
@@ -379,8 +381,6 @@ public class IntegralTaskServiceImpl implements IIntegralTaskService {
                 return FsUserIntegralLogTypeEnum.TYPE_28.getValue();
             case IntegralTaskConstants.TASK_FIRST_PURCHASE:
                 return FsUserIntegralLogTypeEnum.TYPE_32.getValue();
-            case IntegralTaskConstants.TASK_INVITED:
-                return FsUserIntegralLogTypeEnum.TYPE_19.getValue();
             default:
                 return null;
         }

+ 16 - 4
fs-service/src/main/java/com/fs/his/utils/IntegralTaskScopeHelper.java

@@ -101,12 +101,18 @@ public final class IntegralTaskScopeHelper {
             return true;
         }
         String normalizedPlatform = normalizePlatform(platform);
+        if (!scopes.containsKey(code)) {
+            return true;
+        }
         String scope = scopes.get(code);
-        if (StringUtils.isBlank(scope)) {
+        if (scope == null) {
             return true;
         }
+        if (scope.isEmpty()) {
+            return false;
+        }
         List<String> platforms = Arrays.asList(scope.split(","));
-        return platforms.contains(normalizedPlatform);
+        return platforms.stream().anyMatch(item -> normalizedPlatform.equals(StringUtils.trimToEmpty(item)));
     }
 
     public static boolean shouldFilterIntegralLogType(String dictType, String platform) {
@@ -129,12 +135,18 @@ public final class IntegralTaskScopeHelper {
     }
 
     public static String getLogTypeDisplayScope(Map<String, String> scopes, String logType) {
+        if (!scopes.containsKey(logType)) {
+            return "app,mini";
+        }
         String scope = scopes.get(logType);
-        return StringUtils.isBlank(scope) ? "app,mini" : scope;
+        return scope == null ? "app,mini" : scope;
     }
 
     public static String getTaskDisplayScope(Map<String, String> scopes, String taskCode) {
+        if (!scopes.containsKey(taskCode)) {
+            return "app,mini";
+        }
         String scope = scopes.get(taskCode);
-        return StringUtils.isBlank(scope) ? "app,mini" : scope;
+        return scope == null ? "app,mini" : scope;
     }
 }