From 45f35a348c6d19f954888bf3e595bdf9d6016bb8 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 12 四月 2019 16:00:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java
index c66766e..f26fd57 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java
@@ -16,7 +16,6 @@
 import com.yeshi.fanli.entity.push.PushGoodsGroup;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.exception.PushException;
-import com.yeshi.fanli.exception.push.PushCouponException;
 import com.yeshi.fanli.exception.push.PushGoodsException;
 import com.yeshi.fanli.service.inter.config.ConfigService;
 import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
@@ -26,6 +25,8 @@
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.factory.CommonGoodsFactory;
 import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
+
+import net.sf.json.JSONObject;
 
 @Service
 public class PushGoodsServiceImpl implements PushGoodsService {
@@ -232,12 +233,29 @@
 			throw new PushException(1, "鎺ㄩ�佹棤鍟嗗搧,璇峰畬鍠勬暟鎹�");
 		}
 		
-		List<String> listVersion = null;
 		String versions = pushGoods.getVersions();
-		if (versions != null && versions.trim().length() > 0) {
-			listVersion  = Arrays.asList(versions.split(","));
-			if (listVersion == null || listVersion.size() == 0) {
-				throw new PushCouponException(1, "鐗堟湰鍙锋牸寮忎笉姝g‘\"");
+		if (versions == null || versions.trim().length() == 0) {
+			throw new PushException(1, "鎺ㄩ�佺増鏈笉鑳戒负绌�");
+		}
+		
+		List<String> listIOS = new ArrayList<String>();
+		JSONObject json = JSONObject.fromObject(versions);
+		String versionsIOS = json.getString("IOS");
+		if (versionsIOS != null && versionsIOS.trim().length() > 0) {
+			if (versionsIOS.contains("鍏ㄦ帹")) {
+				listIOS = null;
+			} else {
+				listIOS = Arrays.asList(versionsIOS.split(","));
+			}
+		}
+		
+		List<String> listAndroid = new ArrayList<String>();
+		String versionsAndroid  = json.getString("Android");
+		if (versionsAndroid != null && versionsAndroid.trim().length() > 0) {
+			if (versionsAndroid.contains("鍏ㄦ帹")) {
+				listAndroid = null;
+			} else {
+				listAndroid = Arrays.asList(versionsAndroid.split(","));
 			}
 		}
 		
@@ -252,7 +270,7 @@
 			Long goodsId = commonGoods.getGoodsId();
 			String url = "https://item.taobao.com/item.htm?id=" + goodsId;
 		
-			pushService.pushGoods(pushGoods.getUid(), url, alertTitle, alertContent, listVersion);
+			pushService.pushGoods(pushGoods.getUid(), alertTitle, alertContent, url,listIOS, listAndroid);
 			
 		} else {
 			/*   澶氫釜鍟嗗搧鎺ㄩ��    */
@@ -263,7 +281,7 @@
 			// 鐢熸垚閾炬帴
 			url = url + "?id=" + id;
 
-			pushService.pushUrl(pushGoods.getUid(), url, alertTitle, alertContent, listVersion);
+			pushService.pushUrl(pushGoods.getUid(), alertTitle, alertContent, url, listIOS, listAndroid);
 		}
 		
 		// 宸叉帹閫�
@@ -274,7 +292,6 @@
 		pushGoods.setUpdateTime(new Date());
 		
 		updateByPrimaryKeySelective(pushGoods);
-
 	}
 
 }

--
Gitblit v1.8.0