From 64a8f7a3be0a5584fe2164a2474b189c79cfab5c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 28 十二月 2019 18:15:39 +0800 Subject: [PATCH] 小程序接口初步建立 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java | 94 ++++++++++++++++++++++++++-------------------- 1 files changed, 53 insertions(+), 41 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java index ac7861a..c9e966a 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java @@ -631,7 +631,9 @@ welfareCenterNews = userInfoExtra.getCouponNews(); } - if (userInfoExtra.getInviteCode() != null && userInfoExtra.getInviteCode().trim().length() > 0) { + if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCodeVip())) { + invitCode = userInfoExtra.getInviteCodeVip(); + } else { invitCode = userInfoExtra.getInviteCode(); } } @@ -645,13 +647,8 @@ final UserInfo uuser = user; ThreadUtil.run(new Runnable() { public void run() { - - try { - // 鑾峰彇閭�璇风爜锛氳嫢鏃犻個璇风爜涓斿瓨鍦ㄦ湁鏁堢殑闃熷憳鍏崇郴 鍒欒嚜鍔ㄧ敓鎴愰個璇风爜 - userInfoExtraService.getUserInviteCode(uuser.getId()); - } catch (UserInfoExtraException e) { - e.printStackTrace(); - } + // 鑾峰彇閭�璇风爜锛氳嫢鏃犻個璇风爜涓斿瓨鍦ㄦ湁鏁堢殑闃熷憳鍏崇郴 鍒欒嚜鍔ㄧ敓鎴愰個璇风爜 + userInfoExtraService.getInviteCodeByUid(uuser.getId()); LogHelper.userInfo(GsonUtil.toJsonExpose(uuser)); uuser.setLastLoginIp(remotIP); @@ -1706,7 +1703,7 @@ } boolean hasCode = false; - String inviteCode = userInfoExtraService.getUserInviteCode(uid); + String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); if (inviteCode != null && inviteCode.trim().length() > 0) { hasCode = true; // 宸叉湁閭�璇风爜 } else { @@ -1723,8 +1720,6 @@ 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(); @@ -1781,7 +1776,7 @@ } boolean hasCode = false; - String inviteCode = userInfoExtraService.getUserInviteCode(uid); + String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); if (inviteCode != null && inviteCode.trim().length() > 0) { hasCode = true; // 宸叉湁閭�璇风爜 } else { @@ -1796,8 +1791,6 @@ 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(); @@ -1848,7 +1841,7 @@ resultData.put("boss", bossData); boolean hasCode = false; - String inviteCode = userInfoExtraService.getUserInviteCode(uid); + String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); if (inviteCode != null && inviteCode.trim().length() > 0) { hasCode = true; // 宸叉湁閭�璇风爜 } else { @@ -1859,8 +1852,6 @@ out.print(JsonUtil.loadTrueResult(resultData)); - } catch (UserInfoExtraException e) { - out.print(JsonUtil.loadFalseResult(e.getMsg())); } catch (Exception e) { out.print(JsonUtil.loadFalseResult("缁熻澶辫触")); e.printStackTrace(); @@ -2036,7 +2027,7 @@ try { - String inviteCode = userInfoExtraService.getUserInviteCode(uid); + String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); JSONObject inviteData = new JSONObject(); if (inviteCode == null || inviteCode.trim().length() == 0) { @@ -2054,8 +2045,6 @@ out.print(JsonUtil.loadTrueResult(data)); - } catch (UserInfoExtraException e) { - out.print(JsonUtil.loadFalseResult(e.getMsg())); } catch (Exception e) { out.print(JsonUtil.loadFalseResult("鑾峰彇澶辫触")); e.printStackTrace(); @@ -2138,6 +2127,7 @@ } data.put("moduleState", mySettings); + boolean tailor = false; int welfareCenterNews = 0; String invitCode = null; UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); @@ -2145,11 +2135,14 @@ if (userInfoExtra.getCouponNews() != null) { welfareCenterNews = userInfoExtra.getCouponNews(); } - - if (userInfoExtra.getInviteCode() != null && userInfoExtra.getInviteCode().trim().length() > 0) { + // vip閭�璇风爜浼樺厛 + if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCodeVip())) { + invitCode = userInfoExtra.getInviteCodeVip(); + } else if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) { + tailor = true; invitCode = userInfoExtra.getInviteCode(); } - + if (userInfoExtra.getUserRank() != null) { String picture = userInfoExtra.getUserRank().getPicture(); String icon = userInfoExtra.getUserRank().getIcon(); @@ -2168,20 +2161,28 @@ if (!StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) userInfo.setWeiXin(userInfoExtra.getWeiXin()); } + + // 浜岀淮鐮� + userInfo.setErCode(userInfoExtra.getErCode()); } + // 鏄剧ず閭�璇风爜鐗瑰埗鍏ュ彛 + data.put("tailor", tailor); + // 1.6.5 涔嬪悗杩斿洖 寰俊鍙锋彁绀� if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) - userInfo.setWeiXinTip("娣诲姞寰俊鍙峰悗锛屼綘鐨勯個璇蜂汉鍜屼竴绾ч槦鍛樺彲浠ラ�氳繃寰俊涓庝綘寤虹珛鑱旂郴銆�"); + userInfo.setWeiXinTip("娣诲姞寰俊鍙峰悗锛屼綘鐨勯個璇蜂汉鍜岀洿鎺ョ矇涓濆彲浠ラ�氳繃寰俊涓庝綘寤虹珛鑱旂郴銆�"); // 鏌ヨ鏄惁涓篤IP - if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { + if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) { userInfo.setVip(userVIPInfoService.isVIP(uid)); + + boolean verifyForbid = redPackForbidService.verifyForbid(uid); + data.put("redPackLock", verifyForbid); } data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(userInfo)); data.put("invitCode", invitCode); // 閭�璇风爜 - if (userInfoExtra.getInviteCodeState() != null - && userInfoExtra.getInviteCodeState() == UserInfoExtra.INVITE_CODE_SATTE_VALID_UPDATED) + if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCodeVip())) data.put("invitCodeUpdated", true);// 閭�璇风爜鏄惁宸茬粡淇敼杩� else data.put("invitCodeUpdated", false); @@ -2195,24 +2196,27 @@ bindPhone = bindRemindService.bindRemind(uid, BindRemind.TYPE_PHONE); data.put("bindPhone", bindPhone); } - - // 2.0.2 鐗堟湰 - if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { - boolean verifyForbid = redPackForbidService.verifyForbid(uid); - data.put("redPackLock", verifyForbid); + + if (!StringUtil.isNullOrEmpty(invitCode)) { + // 2.0.6 杩斿洖閭�璇蜂汉 + if (VersionUtil.greaterThan_2_0_6(acceptData.getPlatform(), acceptData.getVersion())) { + String bossName = ""; + ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid); + if (threeSale != null && threeSale.getBoss() != null) { + bossName = threeSale.getBoss().getNickName(); + } + data.put("bossName", bossName); + } } - + + out.print(JsonUtil.loadTrueResult(data)); final UserInfo uuser = userInfo; ThreadUtil.run(new Runnable() { public void run() { - try { - // 鑾峰彇閭�璇风爜锛氳嫢鏃犻個璇风爜涓斿瓨鍦ㄦ湁鏁堢殑闃熷憳鍏崇郴 鍒欒嚜鍔ㄧ敓鎴愰個璇风爜 - userInfoExtraService.getUserInviteCode(uuser.getId()); - } catch (UserInfoExtraException e) { - e.printStackTrace(); - } + // 鑾峰彇閭�璇风爜锛氳嫢鏃犻個璇风爜涓斿瓨鍦ㄦ湁鏁堢殑闃熷憳鍏崇郴 鍒欒嚜鍔ㄧ敓鎴愰個璇风爜 + userInfoExtraService.getInviteCodeByUid(uuser.getId()); // 鏇存柊鐢ㄦ埛闄勫姞淇℃伅锛岃�佺敤鎴蜂笉瀛樺湪鐨勯渶瑕佹坊鍔� try { @@ -2318,7 +2322,7 @@ */ @RequestMapping(value = "saveInfo") public void saveInfo(AcceptData acceptData, String nickName, String weiXin, Integer sex, Long uid, - String inviteCode, PrintWriter out) { + String inviteCode, MultipartFile qrCodeFile, HttpServletRequest request, PrintWriter out) { try { if (uid == null) { out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�")); @@ -2382,7 +2386,7 @@ } try { - userInfoExtraService.updateInviteCode(inviteCode, uid); + userInfoExtraService.updateInviteCodeVip(inviteCode, uid); out.print(JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); return; } catch (UserInfoExtraException e) { @@ -2393,6 +2397,14 @@ return; } } + + // 浜岀淮鐮� + if (qrCodeFile != null) { + userInfoExtraService.uploadERCode(qrCodeFile, uid); + } + + + out.print(JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); } catch (UserInfoException e) { out.print(JsonUtil.loadFalseResult(e.getMsg())); -- Gitblit v1.8.0