From cd7767932dddeaf6d9c73a83d4a9b38f0341b77f Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 28 一月 2022 12:46:17 +0800 Subject: [PATCH] bug修复 --- src/main/java/com/yeshi/buwan/controller/parser/UserParser.java | 96 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 94 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java b/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java index 59e6af2..f41aa54 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java @@ -15,8 +15,10 @@ import com.yeshi.buwan.dto.search.SolrShortVideoSearchFilter; import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; import com.yeshi.buwan.dto.user.LoginInfoDto; +import com.yeshi.buwan.exception.SMSException; import com.yeshi.buwan.exception.user.LoginUserException; import com.yeshi.buwan.exception.user.RegisterUserException; +import com.yeshi.buwan.service.inter.SMSService; import com.yeshi.buwan.videos.pptv.PPTVUtil; import com.yeshi.buwan.service.imp.*; import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; @@ -96,6 +98,9 @@ @Resource private RedisManager redisManager; + @Resource + private SMSService smsService; + public void getUid(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); String uid = userService.getUid(acceptData.getDevice(), acceptData.getSystem(), acceptData.getImei(), acceptData.getMac(), acceptData.getLat(), acceptData.getLng()); @@ -105,7 +110,7 @@ out.print(JsonUtil.loadFalseJson("鑾峰彇uid澶辫触")); return; } else { - Map<String, String> map = configService.getConfigAsMap(detailSystem, acceptData.getVersion()); + Map<String, String> map = configService.getConfigAsMap(acceptData.getChildDetailSystem(), acceptData.getVersion()); ShareContent share = shareService.getShareContent(detailSystem.getId()); JSONObject object = new JSONObject(); object.put("Uid", uid); @@ -1168,13 +1173,41 @@ content = title; } - boolean isS = MailSenderUtil.sendEmail(account, "ysyz17784739772@126.com", "weikou2014", title, + boolean isS = MailSenderUtil.sendEmail(account, "app_yzm_zc@163.com", "KZKSRTEMDWEQRAQR", title, content); // } // }).start(); out.print(JsonUtil.loadTrueJson("楠岃瘉鐮佸彂閫佹垚鍔�")); } + + + public void sendSMSCode(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { + String phone = request.getParameter("phone"); + + if (StringUtil.isNullOrEmpty(phone)) { + out.print(JsonUtil.loadFalseJson("鐢佃瘽鍙风爜涓嶈兘涓虹┖")); + return; + } + + if (!StringUtil.isMobile(phone)) { + out.print(JsonUtil.loadFalseJson("鐢佃瘽鍙风爜鏍煎紡涓嶆纭�")); + return; + } + + try { + smsService.sendLoginVCode(phone, 6,acceptData.getDetailSystem().getId(),acceptData.getVersion()); + } catch (SMSException e) { + e.printStackTrace(); + out.print(JsonUtil.loadFalseJson(e.getMessage())); + return; + } catch (Exception e) { + out.print(JsonUtil.loadFalseJson("鐭俊鍙戦�佸嚭閿欙紝璇风◢鍚庡啀璇�")); + return; + } + out.print(JsonUtil.loadTrueJson("")); + } + /** * 鐧诲綍 @@ -1204,6 +1237,7 @@ loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId()); loginInfoDto.setEmail(account); loginInfoDto.setPwd(StringUtil.Md5(pwd)); + loginInfoDto.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort()); try { LoginUser user = userService.login(loginInfoDto); out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(user))); @@ -1212,6 +1246,64 @@ } } + + /** + * 鐧诲綍 + * + * @param request + * @param out + */ + public void phoneLogin(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { + String account = request.getParameter("phone");// 閭 + String vcode = request.getParameter("code");// 瀵嗙爜 + if (StringUtil.isNullOrEmpty(account)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼犳墜鏈哄彿")); + return; + } + + if (StringUtil.isNullOrEmpty(vcode)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼犻獙璇佺爜")); + return; + } + + if (!smsService.verifyLoginVCode(account, vcode,acceptData.getDetailSystem().getId(),acceptData.getVersion())) { + out.print(JsonUtil.loadFalseJson("楠岃瘉鐮侀敊璇�")); + return; + } + + LoginInfoDto loginInfoDto = new LoginInfoDto(); + loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_PHONE); + loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId()); + loginInfoDto.setPhone(account); + loginInfoDto.setSmsCode(vcode); + loginInfoDto.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort()); + try { + LoginUser user = userService.login(loginInfoDto); + out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(user))); + } catch (LoginUserException e) { + //鐢ㄦ埛涓嶅瓨鍦� + if (e.getCode() == LoginUserException.CODE_NO_USER) { + //娉ㄥ唽鐢ㄦ埛 + try { + userService.register(loginInfoDto); + //娉ㄥ唽鎴愬姛锛屽紑濮嬬櫥褰� + try { + LoginUser user = userService.login(loginInfoDto); + out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(user))); + } catch (LoginUserException e2) { + out.print(JsonUtil.loadFalseJson("鐧诲綍鍑洪敊锛岃绋嶅悗鍐嶈瘯")); + } + + } catch (RegisterUserException e1) { + e1.printStackTrace(); + out.print(JsonUtil.loadFalseJson("鐧诲綍鍑洪敊锛岃绋嶅悗鍐嶈瘯")); + } + } else { + out.print(JsonUtil.loadFalseJson(e.getMessage())); + } + } + } + /** * 鏇存敼鐢ㄦ埛淇℃伅 * -- Gitblit v1.8.0