From 237794cca5d458376a9de0f3590ea850d45e2499 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 01 三月 2019 11:17:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
fanli/src/main/java/com/yeshi/fanli/service/impl/push/XMPushServiceImpl.java | 92 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 87 insertions(+), 5 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/XMPushServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/XMPushServiceImpl.java
index 068c769..df88a07 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/XMPushServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/XMPushServiceImpl.java
@@ -1,7 +1,13 @@
package com.yeshi.fanli.service.impl.push;
+import java.util.List;
+
+import javax.annotation.Resource;
+
import org.springframework.stereotype.Service;
+import com.yeshi.fanli.dao.mybatis.AppVersionInfoMapper;
+import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.bus.user.AccountMessage;
import com.yeshi.fanli.entity.system.SystemZnx;
import com.yeshi.fanli.entity.xinge.MessageInfo;
@@ -16,6 +22,9 @@
@Service
public class XMPushServiceImpl implements XMPushService {
+
+ @Resource
+ private AppVersionInfoMapper appVersionInfoMapper;
@Override
public void pushGoods(Long uid, Long auctionId, String title, String content) throws PushException {
@@ -85,11 +94,6 @@
}
@Override
- public void pushWEEXUrl(Long uid, String weexUrl, String title, String content) throws PushException {
-
- }
-
- @Override
public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX) throws PushException {
MessageInfo info = new MessageInfo();
@@ -154,4 +158,82 @@
}
}
+ @Override
+ public void pushWEEX(Long uid, String title, String content, String weexUrl) throws PushException {
+ // TODO 鎺ㄩ�亀eex椤甸潰
+ JSONObject json = new JSONObject();
+ json.put("url", weexUrl);
+ json.put("type", "weex");
+ // 璁剧疆鍙帹閫佺増鏈�,1.4.8浠ュ悗鐨勭増鏈彲鎺ㄩ��
+ json.put("app_version", getVersionByMinVersionCode(31));
+ MessageInfo info = new MessageInfo();
+ info.setTitle(title);
+ info.setContent(content);
+ info.setDescription(content);
+ // 灏忕背鎺ㄩ�佺綉椤�
+ info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
+ info.setActivty(String.format("%s.ui.mine.weex.WeexApplicationActivity",
+ Constant.systemCommonConfig.getAndroidBaseactivityName()));
+
+ PushRecord pushRecord = new PushRecord();
+
+ // 灏忕背 鍏ㄦ帹
+ if (uid == null || uid == 0) {
+ try {
+ PushUtils.allPushXiaoMi(info, json, pushRecord);
+ } catch (Exception e) {
+ PushLogHelper.xmError(e);
+ }
+ } else {
+ info.setAlias(uid + "");
+ PushUtils.singlePushXiaoMi(info, json, pushRecord);
+ }
+ }
+
+ private String getVersionByMinVersionCode(int versionCode) {
+ List<AppVersionInfo> list = appVersionInfoMapper
+ .listByPlatformAndMinVersionCode(AppVersionInfo.PLATFORM_ANDROID, versionCode);
+ String versions = "";
+ if (list != null)
+ for (AppVersionInfo appVersion : list) {
+ versions += appVersion.getVersion() + ",";
+
+ }
+ if (versions.endsWith(","))
+ versions = versions.substring(0, versions.length() - 1);
+
+ return versions;
+ }
+
+ @Override
+ public void pushBaiChuanUrl(Long uid, String title, String content, String url) throws PushException {
+ JSONObject json = new JSONObject();
+ json.put("url", url);
+ json.put("type", "baichuan");
+ // 璁剧疆鍙帹閫佺増鏈�,1.4.8浠ュ悗鐨勭増鏈彲鎺ㄩ��
+ json.put("app_version", getVersionByMinVersionCode(31));
+
+ MessageInfo info = new MessageInfo();
+ info.setTitle(title);
+ info.setContent(content);
+ info.setDescription(content);
+ // 灏忕背鎺ㄩ�佺綉椤�
+ info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
+
+ PushRecord pushRecord = new PushRecord();
+
+ // 灏忕背 鍏ㄦ帹
+ if (uid == null || uid == 0) {
+ try {
+ PushUtils.allPushXiaoMi(info, json, pushRecord);
+ } catch (Exception e) {
+ PushLogHelper.xmError(e);
+ }
+ } else {
+ info.setAlias(uid + "");
+ PushUtils.singlePushXiaoMi(info, json, pushRecord);
+ }
+
+ }
+
}
--
Gitblit v1.8.0