| | |
| | | package com.ks.push.utils; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.huawei.push.util.push.*; |
| | | import com.ks.push.pojo.DO.BPushMessage; |
| | | import com.ks.push.pojo.DO.PushPlatform; |
| | | import com.ks.push.utils.push.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.yeshi.utils.StringUtil; |
| | |
| | | pushVIVO(appInfo, message, tokenList); |
| | | } else if (platform == PushPlatform.mz) { |
| | | pushMZ(appInfo, message, tokenList); |
| | | } else if (platform == PushPlatform.jpush) { |
| | | pushJPush(appInfo, message, tokenList,!pushMessage.isMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 极光推送 |
| | | * |
| | | * @param appInfo |
| | | * @param message |
| | | * @param tokenList |
| | | * @throws Exception |
| | | */ |
| | | private static void pushJPush(PushAppInfo appInfo, PushMessage message, List<String> tokenList, boolean alert) throws Exception { |
| | | if (alert) { |
| | | JpushUtil.pushNotification(appInfo, message, tokenList, null); |
| | | } else { |
| | | JSONObject data = new JSONObject(); |
| | | if (message.getActivityParams() != null) { |
| | | for (Iterator<String> its = message.getActivityParams().keySet().iterator(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | data.put(key, message.getActivityParams().get(key)); |
| | | } |
| | | } |
| | | JpushUtil.pushMessage(appInfo, data, tokenList, null); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |