From 0329b0de336a2664603424a4eec3f33bb8f29446 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 18 五月 2020 18:14:45 +0800
Subject: [PATCH] H5统计bug
---
fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java | 39 +++++++++++++++++++++++++++++++++++----
1 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java b/fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java
index 48e529f..5afb74e 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java
@@ -9,12 +9,13 @@
import com.yeshi.fanli.entity.xinge.PushRecord;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.push.PushService;
+import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import net.sf.json.JSONObject;
public class PushUtils {
-
+
@Resource
private PushService pushService;
@@ -29,7 +30,9 @@
*/
public static int allPushXiaoMi(MessageInfo info, JSONObject json, PushRecord pushRecord) throws Exception {
-
+ if (Constant.IS_TEST)
+ return 1;
+
JSONObject mapXm = JSONObject.fromObject(json);
String android = XiaoMiPushUtil.allPushAndroidForXM(info, mapXm);
@@ -63,6 +66,9 @@
* Constant.systemCommonConfig.getIosBundleId());
*/
+ if (Constant.IS_TEST)
+ return 1;
+
String IOS = IOSPushUtil.allPushIOS(deviceTokenList, info, url, type);
LogHelper.userInfo("IOS鐨勬帹閫佹棩蹇楋細" + IOS);
pushRecord.setIosPushId(IOS);
@@ -81,11 +87,34 @@
* @param json
* @return
*/
- public static int singlePushXiaoMi(MessageInfo info, JSONObject json, PushRecord pushRecord) {
+ public static int singlePushXiaoMi(MessageInfo info, JSONObject json,List<String> regIds, PushRecord pushRecord) {
+// if (Constant.IS_TEST)
+// return 1;
JSONObject mapXm = JSONObject.fromObject(json);
- String android = XiaoMiPushUtil.singlePushAndroidForXM(info, mapXm, null);
+ String android = XiaoMiPushUtil.singlePushAndroidForXM(info, mapXm,regIds, null);
+
+ LogHelper.userInfo("瀹夊崜鎺ㄩ�佹祴璇曪細" + android);
+ pushRecord.setAndroidPushId(android);
+
+ if (android != null) {
+ return 1;
+ } else {
+ return 4;
+ }
+ }
+
+ public static int singlePushXiaoMiByRegisterId(MessageInfo info, JSONObject json, PushRecord pushRecord,
+ String regId) {
+ if (Constant.IS_TEST)
+ return 1;
+
+ JSONObject mapXm = JSONObject.fromObject(json);
+
+ List<String> regIdList = new ArrayList<>();
+ regIdList.add(regId);
+ String android = XiaoMiPushUtil.pushBatchAndroidForXM(info, mapXm, regIdList);
LogHelper.userInfo("瀹夊崜鎺ㄩ�佹祴璇曪細" + android);
pushRecord.setAndroidPushId(android);
@@ -108,6 +137,8 @@
*/
public static String singlePushIOS(MessageInfo info, PushRecord pushRecord, String url, int type,
List<String> deviceTokenList) {
+ if (Constant.IS_TEST)
+ return null;
if (deviceTokenList != null && deviceTokenList.size() > 0) {
for (String deviceToken : deviceTokenList) {
if (!StringUtil.isNullOrEmpty(deviceToken)) {
--
Gitblit v1.8.0