From a338d86bcaf17f2ba9296a601cdbda4d3e9baae0 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期三, 06 五月 2020 09:27:09 +0800
Subject: [PATCH] 队员

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java |   89 +++++++++++++-------------------------------
 1 files changed, 27 insertions(+), 62 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
index ad66192..9e59c03 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
@@ -199,7 +199,7 @@
 	}
 
 	/**
-	 * 鐢ㄦ埛闃熷憳鍒楄〃鏌ヨ 1.5.3鏌ヨ鏈夋晥闃熷憳
+	 * 鐢ㄦ埛闃熷憳鍒楄〃鏌ヨ 
 	 * 
 	 * @param acceptData
 	 * @param id
@@ -212,29 +212,33 @@
 			return;
 		}
 		
-		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
-			getMyTeamNew(acceptData, page, uid, type, out);
-			return;
-		}
-
+		List<Long> listId = new ArrayList<Long>();
 		long count = 0;
 		List<ThreeSale> listTeam = null;
 		if (type == 1) {
-			listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
+			listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, listId);
 			count = threeSaleSerivce.countFirstTeam(uid);
 		} else if (type == 2) {
-			listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
+			listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, listId);
 			count = threeSaleSerivce.countSecondTeam(uid);
 		}
 
-		boolean needVIPInfo = false;
-		if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
-			needVIPInfo = true;
-
-		// 缁勭粐鏁版嵁
-		JSONObject resultData = organizeTeam(count, listTeam, uid, type,needVIPInfo);
-
-		// 绗竴椤靛垽鏂槸鍚︽縺娲� 鏄惁鏈夐槦鍛�
+		// 鏁版嵁鍔犲伐
+		JSONArray array = null;
+		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+			array = organizeTeamNew(listTeam, uid, type, true);
+		} else {
+			boolean needVIPInfo = false;
+			if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
+				needVIPInfo = true;
+			array =  organizeTeam(listTeam, uid, type,needVIPInfo);
+		}
+		
+		
+		JSONObject result = new JSONObject();
+		result.put("count", count);
+		result.put("list", array);
+		
 		if (type == 1 && page == 1) {
 			boolean hasCode = false;
 			UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
@@ -242,10 +246,10 @@
 				if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
 					hasCode = true;
 			}
-			resultData.put("hasCode", hasCode);
-			resultData.put("hasTeam", count > 0 ? true : false);
+			result.put("hasCode", hasCode);
+			result.put("hasTeam", count > 0 ? true : false);
 		}
-		out.print(JsonUtil.loadTrueResult(resultData));
+		out.print(JsonUtil.loadTrueResult(result));
 	}
 
 	/**
@@ -257,10 +261,8 @@
 	 * @param type
 	 * @return
 	 */
-	private JSONObject organizeTeam(long count, List<ThreeSale> list, Long uid, int type, boolean needVipInfo) {
-		JSONObject result = new JSONObject();
+	private JSONArray organizeTeam(List<ThreeSale> list, Long uid, int type, boolean needVipInfo) {
 		JSONArray resultArray = new JSONArray();
-
 		Date todayTime = new Date();
 		SimpleDateFormat sdf = new SimpleDateFormat("MM.dd HH:mm");
 		SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
@@ -343,46 +345,9 @@
 			object.put("recentMsg", array);
 			resultArray.add(object);
 		}
-
-		result.put("count", count);
-		result.put("list", resultArray);
-		return result;
+		return resultArray;
 	}
-
 	
-	private void getMyTeamNew(AcceptData acceptData, long page, long uid, int type, PrintWriter out) {
-		if (type != 1 && type != 2) {
-			out.print(JsonUtil.loadFalseResult("绮変笣绫诲瀷涓嶆纭�"));
-			return;
-		}
-
-		long count = 0;
-		List<ThreeSale> listTeam = null;
-		if (type == 1) {
-			listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
-			count = threeSaleSerivce.countFirstTeam(uid);
-		} else if (type == 2) {
-			listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
-			count = threeSaleSerivce.countSecondTeam(uid);
-		}
-		
-		JSONObject result = new JSONObject();
-		result.put("count", count);
-		result.put("list", organizeTeamNew(count, listTeam, uid, type, true));
-		
-		// 绗竴椤靛垽鏂槸鍚︽縺娲� 鏄惁鏈夐槦鍛�
-		if (type == 1 && page == 1) {
-			boolean hasCode = false;
-			UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
-			if (userInfoExtra != null) {
-				if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
-					hasCode = true;
-			}
-			result.put("hasCode", hasCode);
-			result.put("hasTeam", count > 0 ? true : false);
-		}
-		out.print(JsonUtil.loadTrueResult(result));
-	}
 	
 	/**
 	 *  鍔犲伐鏁版嵁
@@ -393,7 +358,7 @@
 	 * @param wxtip 鏄渶瑕佸井淇℃彁绀�
 	 * @return
 	 */
-	private JSONArray organizeTeamNew(long count, List<ThreeSale> list, Long uid, int type, boolean wxtip) {
+	private JSONArray organizeTeamNew(List<ThreeSale> list, Long uid, int type, boolean wxtip) {
 		JSONArray resultArray = new JSONArray();
 		if (list == null || list.size() == 0) {
 			return resultArray;
@@ -524,7 +489,7 @@
 
 		JSONObject result = new JSONObject();
 		result.put("count", count);
-		result.put("list", organizeTeamNew(count, listTeam, tid, 1, false));
+		result.put("list", organizeTeamNew(listTeam, tid, 1, false));
 		out.print(JsonUtil.loadTrueResult(result));
 	}
 	

--
Gitblit v1.8.0