From 6b31dd8398fadda38d785ad7190151cb06aa9bd6 Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期二, 29 一月 2019 15:49:40 +0800
Subject: [PATCH] 队员-邀请码状态返回+邀请消息

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java |   93 ++++++++++++++++++++++++++++------------------
 1 files changed, 56 insertions(+), 37 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
index cb81a1d..27a2b16 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
@@ -1832,52 +1832,71 @@
 	@RequestMapping(value = "getMyTeam", method = RequestMethod.POST)
 	public void getMyTeam(AcceptData acceptData, long page, long uid, long type, PrintWriter out) {
 
-		int pageSize = Constant.PAGE_SIZE;
+		try {
+			int pageSize = Constant.PAGE_SIZE;
+ 
+			JSONObject resultData = new JSONObject();
+			if (type == 1) {
+				resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
+			} else if (type == 2) {
+				resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
+			}
 
-		JSONObject resultData = new JSONObject();
-		if (type == 1) {
-			resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
-		} else if (type == 2) {
-			resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
-		}
+			// 瀹夊崜绯荤粺杩斿洖鎵�鏈夋暟鎹�
+			String platform = acceptData.getPlatform();
+			if ("android".equalsIgnoreCase(platform)) {
+				long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
+				long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
 
-		// 瀹夊崜绯荤粺杩斿洖鎵�鏈夋暟鎹�
-		String platform = acceptData.getPlatform();
-		if ("android".equalsIgnoreCase(platform)) {
-			long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
-			long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
+				long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
+				long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
 
-			long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
-			long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
+				JSONObject bossData = null;
+				ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
+				if (threeSale != null) {
+					bossData = new JSONObject();
+					UserInfo boss = threeSale.getBoss();
+					if (boss != null) {
+						bossData.put("nickName", boss.getNickName());
+						bossData.put("portrait", boss.getPortrait());
+					}
 
-			JSONObject bossData = null;
-			ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
-			if (threeSale != null) {
-				bossData = new JSONObject();
-				UserInfo boss = threeSale.getBoss();
-				if (boss != null) {
-					bossData.put("nickName", boss.getNickName());
-					bossData.put("portrait", boss.getPortrait());
+					SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
+					Long createTime = threeSale.getCreateTime();
+					Date inviteTime = new Date(createTime);
+					bossData.put("inviteTime", "閭�璇锋椂闂�: " + sdf.format(inviteTime));
 				}
 
-				SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
-				Long createTime = threeSale.getCreateTime();
-				Date inviteTime = new Date(createTime);
-				bossData.put("inviteTime", "閭�璇锋椂闂�: " + sdf.format(inviteTime));
-			}
+				String helpLink = configService.get("team_help_url");
+				if (helpLink == null) {
+					helpLink = "";
+				}
 
-			String helpLink = configService.get("team_help_url");
-			if (helpLink == null) {
-				helpLink = "";
+				boolean hasCode = false;
+				String inviteCode = userInfoExtraService.getUserInviteCode(uid);
+				if (inviteCode != null && inviteCode.trim().length() > 0) {
+					hasCode = true; // 宸叉湁閭�璇风爜
+				} else {
+					// 閭�璇锋縺娲婚摼鎺�
+					resultData.put("activationlink", configService.get("invite_activation_url"));
+				}
+				resultData.put("hasCode", hasCode);
+
+				resultData.put("helpLink", helpLink);
+				resultData.put("firstTeam", firstTeam);
+				resultData.put("firstTeamTotal", firstTeamTotal);
+				resultData.put("secondTeam", secondTeam);
+				resultData.put("secondTeamTotal", secondTeamTotal);
+				resultData.put("boss", bossData);
 			}
-			resultData.put("helpLink", helpLink);
-			resultData.put("firstTeam", firstTeam);
-			resultData.put("firstTeamTotal", firstTeamTotal);
-			resultData.put("secondTeam", secondTeam);
-			resultData.put("secondTeamTotal", secondTeamTotal);
-			resultData.put("boss", bossData);
+			out.print(JsonUtil.loadTrueResult(resultData));
+		} catch (UserInfoExtraException e) {
+			out.print(JsonUtil.loadFalseResult(e.getMsg()));
+		} catch (Exception e) {
+			out.print(JsonUtil.loadFalseResult("缁熻澶辫触"));
+			e.printStackTrace();
 		}
-		out.print(JsonUtil.loadTrueResult(resultData));
+
 	}
 
 	/**

--
Gitblit v1.8.0