浏览代码

营销系统-手动推送增加配置

wangcl 1 周之前
父节点
当前提交
e7ab66470b

+ 5 - 0
pig-marketing/pig-marketing-biz/src/main/java/com/pig4cloud/pig/marketing/config/PushValidationConfig.java

@@ -33,6 +33,11 @@ public class PushValidationConfig {
      */
     private Boolean enableAppCheck = true;
 
+	/**
+	 * 是否启用应用校验
+	 */
+	private Boolean enableBundleCheck = true;
+
     /**
      * 是否启用域名校验
      */

+ 2 - 2
pig-marketing/pig-marketing-biz/src/main/java/com/pig4cloud/pig/marketing/service/impl/MktMgmtHandPushServiceImpl.java

@@ -149,7 +149,7 @@ public class MktMgmtHandPushServiceImpl implements MktMgmtHandPushService {
                 String matchedType = "";
                 
                 // 检查pushApp(appId匹配)
-                if (globalRule.getPushApp() != null && !globalRule.getPushApp().isEmpty() && appId != null) {
+                if (!pushValidationConfig.getEnableBundleCheck() && globalRule.getPushApp() != null && !globalRule.getPushApp().isEmpty() && appId != null) {
                     // 检查是否为All
                     if (globalRule.getPushApp().stream()
                             .anyMatch(pushApp -> pushApp != null && "All".equals(pushApp.getAppId()))) {
@@ -166,7 +166,7 @@ public class MktMgmtHandPushServiceImpl implements MktMgmtHandPushService {
                 }
                 
                 // 检查pushBundle(bundle匹配)
-                if (!appMatched && globalRule.getPushBundle() != null && !globalRule.getPushBundle().isEmpty() && bundle != null) {
+                if ( !appMatched && pushValidationConfig.getEnableBundleCheck() && globalRule.getPushBundle() != null && !globalRule.getPushBundle().isEmpty() && bundle != null) {
                     if (globalRule.getPushBundle().contains(bundle)) {
                         appMatched = true;
                         matchedType = "bundle";

+ 3 - 2
pig-marketing/pig-marketing-biz/src/main/java/com/pig4cloud/pig/marketing/util/DeviceInfoUtil.java

@@ -74,8 +74,9 @@ public class DeviceInfoUtil {
      */
     public String[] extractBundleAndAppId(String deviceInfoJson) {
         String[] result = new String[2];
-        result[0] = extractBundle(deviceInfoJson);
-        result[1] = extractAppId(deviceInfoJson);
+		String str = deviceInfoJson.substring(deviceInfoJson.indexOf("{"));
+        result[0] = extractBundle(str);
+        result[1] = extractAppId(str);
         return result;
     }
 }