From 24a8d17e007545f7426c48352109aa1a9c6587ee Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 06 五月 2020 12:02:09 +0800
Subject: [PATCH] IOS上线隐藏我的界面的banner与超级会员升级信息

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java |  329 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 272 insertions(+), 57 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 fee5ff4..ad66192 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
@@ -13,9 +13,9 @@
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
-import org.yeshi.utils.DateUtil;
 import org.yeshi.utils.JsonUtil;
 
+import com.yeshi.fanli.dto.vip.UserVIPLevel;
 import com.yeshi.fanli.dto.wx.WXAccountInfoDTO;
 import com.yeshi.fanli.entity.accept.AcceptData;
 import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
@@ -24,9 +24,12 @@
 import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
 import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
-import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
+import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
+import com.yeshi.fanli.entity.bus.user.UserInviteValidRecord;
 import com.yeshi.fanli.entity.bus.user.WeiXinUser;
+import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
 import com.yeshi.fanli.entity.system.BusinessSystem;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
 import com.yeshi.fanli.entity.system.SystemClientParams;
 import com.yeshi.fanli.exception.user.UserAccountException;
 import com.yeshi.fanli.exception.user.UserInfoExtraException;
@@ -39,15 +42,19 @@
 import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
 import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
 import com.yeshi.fanli.service.inter.user.UserInfoService;
-import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
 import com.yeshi.fanli.service.inter.user.invite.ThreeSaleExtraInfoSerivce;
 import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
+import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
+import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
+import com.yeshi.fanli.service.inter.user.invite.UserInviteValidRecordService;
 import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
 import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.RedisKeyEnum;
 import com.yeshi.fanli.util.RedisManager;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.VersionUtil;
 import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
+import com.yeshi.fanli.util.user.UserLevelUtil;
 import com.yeshi.fanli.util.wx.WXLoginUtil;
 
 import net.sf.json.JSONArray;
@@ -83,9 +90,6 @@
 
 	@Resource
 	private UserVIPInfoService userVIPInfoService;
-	
-	@Resource
-	private UserInviteSeparateService userInviteSeparateService;
 
 	@Resource
 	private SpreadImgService spreadImgService;
@@ -96,6 +100,14 @@
 	@Resource
 	private SystemClientParamsService systemClientParamsService;
 	
+	@Resource
+	private UserInviteService userInviteService;
+	
+	@Resource
+	private UserInviteValidRecordService userInviteValidRecordService;
+	
+	@Resource
+	private UserInviteValidNumService userInviteValidNumService;
 	
 	
 	/**
@@ -135,8 +147,8 @@
 			if (wxUnionId == null || wxUnionId.trim().length() == 0)
 				throw new UserInfoExtraException(1, "寰俊鎺堟潈澶辫触");
 
-			String activeWX = StringUtil.Md5("activeWX:" + weiXinUser.getUnionid());
-			redisManager.cacheCommonString(activeWX, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
+			String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5("activeWX:" + weiXinUser.getUnionid()));
+			redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
 
 			// 閭�璇峰叧绯荤敤鎴蜂俊鎭�
 			UserInfo userInfo = userInfoExtraService.getInviterInfo(uid, wxUnionId);
@@ -145,7 +157,7 @@
 			data.put("nickName", userInfo.getNickName());
 			data.put("portrait", userInfo.getPortrait());
 			data.put("tips", "纭瑕佹垚涓篢A鐨勭洿鎺ョ矇涓濆悧锛熼個璇峰叧绯讳竴鏃﹀缓绔嬩笉鍙洿鏀广��");
-			data.put("key", activeWX);
+			data.put("key", key);
 			out.print(JsonUtil.loadTrueResult(data));
 		} catch (UserInfoExtraException e) {
 			out.print(JsonUtil.loadFalseResult(e.getMsg()));
@@ -199,19 +211,24 @@
 			out.print(JsonUtil.loadFalseResult("绮変笣绫诲瀷涓嶆纭�"));
 			return;
 		}
+		
+		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+			getMyTeamNew(acceptData, page, uid, type, out);
+			return;
+		}
 
 		long count = 0;
 		List<ThreeSale> listTeam = null;
 		if (type == 1) {
-			listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, 1);
-			count = threeSaleSerivce.countFirstTeam(uid, 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, 1);
-			count = threeSaleSerivce.countSecondTeam(uid, 1);
+			listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
+			count = threeSaleSerivce.countSecondTeam(uid);
 		}
 
 		boolean needVIPInfo = false;
-		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()))
+		if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
 			needVIPInfo = true;
 
 		// 缁勭粐鏁版嵁
@@ -275,35 +292,6 @@
 			// 娣诲姞鏄惁涓篤IP
 			if (vipMap != null && vipMap.get(worker.getId()) != null) {
 				object.put("vip", vipMap.get(worker.getId()));
-				if (vipMap.get(worker.getId())) {
-					UserInviteSeparate separate = userInviteSeparateService.selectByWorkerIdAndBossId(worker.getId(), uid);
-					if (separate != null && separate.getEndTime() != null) {
-						try {
-							
-						
-							JSONObject contentJson1 = new JSONObject();
-							contentJson1.put("color", "#888888");
-							contentJson1.put("content", "灏嗕簬");
-
-							JSONObject contentJson2 = new JSONObject();
-							contentJson2.put("color", "#F14242");
-							contentJson2.put("content", DateUtil.dateDiff4(new Date(), separate.getEndTime()));
-
-							JSONObject contentJson3 = new JSONObject();
-							contentJson3.put("color", "#888888");
-							contentJson3.put("content", "鍚庤劚绂婚個璇峰叧绯�");
-							
-							JSONArray array = new JSONArray();
-							array.add(contentJson1);
-							array.add(contentJson2);
-							array.add(contentJson3);
-							object.put("vipBreakTime",array);
-						
-						} catch (Exception e) {
-							e.printStackTrace();
-						}
-					}
-				}
 			}
 			String fontColor1 = "#888888";
 			JSONArray array = new JSONArray();
@@ -343,7 +331,7 @@
 					} else {
 						if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
 							object.put("weiXinState", 1);
-							object.put("weiXinTip", "鐐瑰嚮鎻愰啋TA锛岀郴缁熶細鍙戦�佷竴灏佺珯鍐呬俊锛屾彁閱掑叾娣诲姞寰俊鍙枫��");
+							object.put("weiXinTip", "鐐瑰嚮鎻愰啋锛岀郴缁熶細鍙戦�佷竴灏佺珯鍐呬俊锛屾彁閱掑叾娣诲姞寰俊鍙枫��");
 						} else {
 							object.put("weiXinState", 2);
 							object.put("weiXinTip", "绯荤粺宸插彂閫佹彁閱掞紝閭�璇蜂汉娣诲姞寰俊鍚庝綘鍙鍒讹紝濡傚鏂硅繜杩熶笉娣诲姞锛屼綘鍙仈绯讳汉宸ュ鏈嶅姹傚府鍔�");
@@ -361,6 +349,186 @@
 		return result;
 	}
 
+	
+	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));
+	}
+	
+	/**
+	 *  鍔犲伐鏁版嵁
+	 * @param count
+	 * @param list
+	 * @param uid
+	 * @param type 鏌ヨ绮変笣绫诲瀷 1鐩存帴 2闂存帴
+	 * @param wxtip 鏄渶瑕佸井淇℃彁绀�
+	 * @return
+	 */
+	private JSONArray organizeTeamNew(long count, List<ThreeSale> list, Long uid, int type, boolean wxtip) {
+		JSONArray resultArray = new JSONArray();
+		if (list == null || list.size() == 0) {
+			return resultArray;
+		}
+
+		Date todayTime = new Date();
+		SimpleDateFormat sdf = new SimpleDateFormat("MM.dd HH:mm");
+		SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
+		SimpleDateFormat formatYears = new SimpleDateFormat("yyyy");
+
+		List<Long> listWid = new ArrayList<>();
+		for (ThreeSale threeSale : list) {
+			listWid.add(threeSale.getWorker().getId());
+		}
+		
+		// 鏌ヨ鏈夋晥绮変笣id
+		int validType = UserInviteValidRecord.TYPE_TWO;
+		if (type == 1) {
+			validType = UserInviteValidRecord.TYPE_ONE;
+		}
+		
+		List<Long> listVid = userInviteValidRecordService.getValidWorkerIdsByUid(uid, listWid, validType);
+	
+		for (ThreeSale threeSale : list) {
+			UserInfo worker = threeSale.getWorker();
+			Long workerId = worker.getId();
+
+			// 閭�璇锋垚鍔熸椂闂�
+			Long succeedTime = threeSale.getSucceedTime(); 
+			if (succeedTime == null) {
+				succeedTime = threeSale.getCreateTime();
+			}
+			
+			// 鏈夋晥绮変笣
+			boolean validFans = false; 
+			if (listVid != null && listVid.size() > 0 && listVid.contains(workerId)) {
+				validFans = true;
+			}
+			
+			// 鏈�杩戠矇涓濈櫥褰曟椂闂�
+			Date lastLoginTime = new Date(threeSale.getCreateTime());
+			UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(workerId);
+			if (userInfoExtra != null && userInfoExtra.getActiveTime() != null) {
+				lastLoginTime = userInfoExtra.getActiveTime();
+			} 
+			JSONObject loginJson = new JSONObject();
+			if (formatYears.format(todayTime).equals(formatYears.format(lastLoginTime))) {
+				loginJson.put("content", "鏈�杩戠櫥褰� " + sdf.format(lastLoginTime)); // 鏈勾
+			} else {
+				loginJson.put("content", "鏈�杩戠櫥褰� " + format.format(lastLoginTime)); // 寰�骞�
+			}
+			loginJson.put("color", "#888888");
+			
+			JSONArray array = new JSONArray();
+			array.add(loginJson);
+
+			// 鏌ヨ绮変笣绛夌骇
+			UserLevelEnum level = null;
+			UserVIPLevel vipLevel = userInviteService.getVIPLevelByUid(workerId);
+			if (vipLevel != null && vipLevel.getLevel() != null) {
+				level = UserLevelUtil.getByLevel(vipLevel.getLevel());
+			}
+			if(level == null) {
+				level = UserLevelEnum.daRen;
+			}
+			level = UserLevelUtil.getShowLevel(level);
+			
+			JSONObject object = new JSONObject();
+			object.put("workerId", workerId);
+			object.put("nickName", worker.getNickName());
+			object.put("portrait", worker.getPortrait());
+			object.put("inviteId", threeSale.getId());
+			object.put("inviteTime", format.format(new Date(succeedTime)) + " 鍔犲叆");
+			object.put("state", 1);
+			object.put("recentMsg", array);
+			object.put("level", level.name());
+			object.put("validFans", validFans);
+			
+			if (wxtip && type == 1 && threeSale.getState() != null && threeSale.getState()) {
+				// 涓�绾ч槦鍛� 鏌ヨ鏄电О澶囨敞
+				String memoName = null;
+				ThreeSaleExtraInfo threeSaleExtraInfo = threeSale.getThreeSaleExtraInfo();
+				if (threeSaleExtraInfo != null) {
+					if (!StringUtil.isNullOrEmpty(threeSaleExtraInfo.getNickname())) {
+						memoName = threeSaleExtraInfo.getNickname();
+					}
+				}
+				object.put("memoName", memoName);
+				
+				// 娣诲姞寰俊淇℃伅
+				if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
+					object.put("weiXin", userInfoExtra.getWeiXin());
+					object.put("weiXinState", 3);
+					object.put("weiXinTip", "娣诲姞TA鐨勫井淇★紝浣犲彲鏁欐巿TA濡備綍閫氳繃鏉挎牀蹇渷璧氶挶鎶�宸с��");
+				} else {
+					if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
+						object.put("weiXinState", 1);
+						object.put("weiXinTip", "鐐瑰嚮鎻愰啋锛岀郴缁熶細鍙戦�佷竴灏佺珯鍐呬俊锛屾彁閱掑叾娣诲姞寰俊鍙枫��");
+					} else {
+						object.put("weiXinState", 2);
+						object.put("weiXinTip", "绯荤粺宸插彂閫佹彁閱掞紝閭�璇蜂汉娣诲姞寰俊鍚庝綘鍙鍒讹紝濡傚鏂硅繜杩熶笉娣诲姞锛屼綘鍙仈绯讳汉宸ュ鏈嶅姹傚府鍔�");
+					}
+				}
+			}
+			resultArray.add(object);
+		}
+		return resultArray;
+	}
+	
+	
+	/**
+	 * 鏌ョ湅涓嬬骇鐨勭洿鎺ョ矇涓�
+	 * @param acceptData
+	 * @param page
+	 * @param uid 褰撳墠UId
+	 * @param tid 涓嬬骇UId
+	 * @param out
+	 */
+	@RequestMapping(value = "getOthersTeam", method = RequestMethod.POST)
+	public void getOthersTeam(AcceptData acceptData, long page, Long uid, Long tid,  PrintWriter out) {
+		if (tid == null) {
+			out.print(JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
+			return;
+		}
+		
+		List<ThreeSale> listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, tid);
+		long count = threeSaleSerivce.countFirstTeam(tid);
+
+		JSONObject result = new JSONObject();
+		result.put("count", count);
+		result.put("list", organizeTeamNew(count, listTeam, tid, 1, false));
+		out.print(JsonUtil.loadTrueResult(result));
+	}
+	
+	
 	/**
 	 * 鐢ㄦ埛闃熷憳缁熻- IOS
 	 * 
@@ -370,21 +538,22 @@
 	 */
 	@RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
 	public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
-		JSONObject bossData = getBossInfo(acceptData, uid, threeSaleSerivce.getMyBoss(uid));
+		JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid));
 		JSONObject resultData = new JSONObject();
 
-		long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
+		long firstTeam = threeSaleSerivce.countFirstTeam(uid);
+		long countSecond = threeSaleSerivce.countSecondTeam(uid);
 		resultData.put("boss", bossData);
-		resultData.put("helpLink", configService.get("team_help_url"));
 		resultData.put("firstTeam", firstTeam);
-		resultData.put("firstTeamTotal", threeSaleSerivce.countFirstTeam(uid, null));
-		resultData.put("secondTeam", threeSaleSerivce.countSecondTeam(uid, 1));
-		resultData.put("secondTeamTotal", threeSaleSerivce.countSecondTeam(uid, null));
+		resultData.put("firstTeamTotal", firstTeam);
+		resultData.put("secondTeam", countSecond);
+		resultData.put("secondTeamTotal", countSecond);
+		resultData.put("helpLink", configService.get(ConfigKeyEnum.teamHelpUrl.getKey()));
 
 		boolean hasTeam = true;
 		if (firstTeam <= 0) {
 			hasTeam = false;
-			resultData.put("invitelink", configService.get("invite_activation_url"));
+			resultData.put("invitelink", configService.get(ConfigKeyEnum.inviteActivationUrl.getKey()));
 		}
 		resultData.put("hasTeam", hasTeam);
 
@@ -403,7 +572,7 @@
 		resultData.put("hasCode", hasCode);
 		if (!hasCode) {
 			List<String> tipCode = new ArrayList<String>();
-			resultData.put("helpLinkActivate", configService.get("team_help_url"));
+			resultData.put("helpLinkActivate", configService.get(ConfigKeyEnum.teamHelpUrl.getKey()));
 			tipCode.add("婵�娲婚個璇峰姛鑳藉悗鎵嶅彲浠ラ個璇风矇涓濓紝鐩存帴绮変笣鏄敱浣犵洿鎺ラ個璇凤紝闂存帴绮変笣鏄敱浣犵殑鐩存帴绮変笣閭�璇枫��");
 			tipCode.add("閭�璇锋縺娲诲姛鑳斤紝蹇呴』瑕佹湁閭�璇风爜锛岄個璇风爜鍙互閫氳繃閲戝竵鍏戞崲锛屼篃鍙互鍏ㄧ綉鎼滅储銆�");
 			resultData.put("tipCode", tipCode);
@@ -423,6 +592,23 @@
 	}
 
 	/**
+	 * 鑾峰彇鐢ㄦ埛淇℃伅
+	 * @param acceptData
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "getBossInfo", method = RequestMethod.POST)
+	public void getBossInfo(AcceptData acceptData, Long uid, PrintWriter out) {
+		if (uid == null || uid <= 0) {
+			out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�"));
+			return;
+		}
+		JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid));
+		out.print(JsonUtil.loadTrueResult(bossData));
+	}
+	
+	
+	/**
 	 * 涓婄骇淇℃伅缁勭粐
 	 * 
 	 * @param acceptData
@@ -430,7 +616,7 @@
 	 * @param threeSale
 	 * @return
 	 */
-	private JSONObject getBossInfo(AcceptData acceptData, long uid, ThreeSale threeSale) {
+	private JSONObject getBossInfo(long uid, ThreeSale threeSale) {
 		JSONObject bossData = new JSONObject();
 		if (threeSale != null && threeSale.getBoss() != null) {
 			UserInfo boss = threeSale.getBoss();
@@ -450,7 +636,7 @@
 			} else {
 				if (!threeSaleExtraInfoSerivce.isRemindBoss(boss.getId(), uid)) {
 					bossData.put("weiXinState", 1);
-					bossData.put("weiXinTip", "鐐瑰嚮鎻愰啋TA锛岀郴缁熶細鍙戦�佷竴灏佺珯鍐呬俊锛屾彁閱掑叾娣诲姞寰俊鍙枫��");
+					bossData.put("weiXinTip", "鐐瑰嚮鎻愰啋锛岀郴缁熶細鍙戦�佷竴灏佺珯鍐呬俊锛屾彁閱掑叾娣诲姞寰俊鍙枫��");
 				} else {
 					bossData.put("weiXinState", 2);
 					bossData.put("weiXinTip", "绯荤粺宸插彂閫佹彁閱掞紝閭�璇蜂汉娣诲姞寰俊鍚庝綘鍙鍒讹紝濡傚鏂硅繜杩熶笉娣诲姞锛屼綘鍙仈绯讳汉宸ュ鏈嶅姹傚府鍔�");
@@ -459,7 +645,7 @@
 			bossData.put("inviteTime", "浣犱簬 " + sdf.format(inviteTime) + "鎺ュ彈浜員A鐨勯個璇�");
 		} else {
 			bossData.put("hasBoss", false);
-			bossData.put("helpLink", configService.get("invite_code_hlep_link"));
+			bossData.put("helpLink", configService.get(ConfigKeyEnum.inviteCodeHlepLink.getKey()));
 			bossData.put("weiXinTip", "鎭枩浣狅紝鎴戜滑鐨勪紭璐ㄧ敤鎴凤紱\r\n浣犲苟娌℃湁閭�璇蜂汉锛屼絾浣犵殑閭�璇锋縺娲诲姛鑳芥槸琚粯璁ゅ紑鍚殑锛沑r\n浣犳嫢鏈夌嫭鐗圭殑鏃犻個璇蜂汉婵�娲荤爜銆�");
 		}
 		return bossData;
@@ -598,14 +784,43 @@
 			JSONObject data = new JSONObject();
 			data.put("count", spreadImgService.countAll());
 			data.put("inviteCode", inviteCode);
-			data.put("helpLink", configService.get("invite_help_link"));
+			data.put("helpLink", configService.get(ConfigKeyEnum.inviteHelpLink.getKey()));
 			data.put("inviteRules",  values.getValue().replace("\n", "<br><br>"));
 			data.put("imgUrlList", JsonUtil.getSimpleGsonWithDate().toJson(imgList));
-			data.put("inviteLink", "http://a.app.qq.com/o/simple.jsp?pkgname=com.yeshi.ec.rebate");
+			data.put("inviteLink", Constant.YINGYONGBAO_LINK);
 			out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "鎴愬姛"));
 		} catch (Exception e) {
 			LogHelper.errorDetailInfo(e);
 			out.print(JsonUtil.loadFalseResult("閭�璇蜂俊鎭幏鍙栧け璐�"));
 		}
 	}
+	
+	/**
+	 * 绔欏唴淇℃彁閱掗槦鍛樻坊鍔犲井淇″彿
+	 * 
+	 * @param acceptData
+	 * @param uid
+	 * @param inviteId
+	 * @param out
+	 */
+	@RequestMapping(value = "tailorCode")
+	public void tailorCode(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
+		if (uid == null) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鐢ㄦ埛id缂哄け"));
+			return;
+		}
+
+		// 鏈夋晥绮変笣
+		int doneFirst = 0;
+		UserInviteValidNum userInviteValidNum = userInviteValidNumService.selectByPrimaryKey(uid);
+		if (userInviteValidNum != null) {
+			doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst();
+		}
+				
+		JSONObject data = new JSONObject();
+		data.put("num", doneFirst);
+		data.put("limit", Constant.INVITE_CODRE_TAILOR_LIMIT);
+		JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+	}
+	
 }

--
Gitblit v1.8.0