| | |
| | | import com.yeshi.fanli.entity.xinge.MessageInfo;
|
| | | import com.yeshi.fanli.entity.xinge.PushRecord;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | 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 {
|
| | |
|
| | | private static SystemService systemService;
|
| | | @Resource
|
| | | private PushService pushService;
|
| | |
|
| | |
| | | */
|
| | | 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);
|
| | |
|
| | |
| | | * Constant.systemCommonConfig.getIosBundleId());
|
| | | */
|
| | |
|
| | | if (Constant.IS_TEST)
|
| | | return 1;
|
| | |
|
| | | String IOS = IOSPushUtil.allPushIOS(deviceTokenList, info, url, type);
|
| | | LogHelper.userInfo("IOS的推送日志:" + IOS);
|
| | | pushRecord.setIosPushId(IOS);
|
| | |
| | | * @return
|
| | | */
|
| | | public static int singlePushXiaoMi(MessageInfo info, JSONObject json, PushRecord pushRecord) {
|
| | | if (Constant.IS_TEST)
|
| | | return 1;
|
| | |
|
| | | JSONObject mapXm = JSONObject.fromObject(json);
|
| | |
|
| | | String android = XiaoMiPushUtil.singlePushAndroidForXM(info, mapXm, 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);
|
| | |
| | | */
|
| | | 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)) {
|