Ver código fonte

Merge branch 'master' of http://192.168.20.122:3000/root/qiyewechatApp

pzc 4 anos atrás
pai
commit
4159373591

+ 37 - 46
ymall/src/main/java/com/liangjian11/ymall/controller/common/WechatController.java

@@ -116,65 +116,56 @@ public class WechatController {
 		redirectCodeCoookie.setMaxAge(3600);
 		response.addCookie(redirectCodeCoookie);
 
-    if (netLoginVideoAccess.contains(redirectCode)) {
-      JSONObject userInfoJson = WechatHandle.getUserInfo(openid, appid, secret, code);
-      UserAccount userAccount = userAccountService.checkAccountByUnionid(userInfoJson);
-      Document document = MongoDBUtil.queryVLoginToken(userAccount.getId());
-      Calendar calendar = Calendar.getInstance();
-      calendar.add(Calendar.DAY_OF_YEAR,30);
-      String loginToken = UUID.randomUUID().toString();
-      if( Objects.isNull(document)){
-        MongoDBUtil.insertVLoginToken(calendar.getTime(),userAccount.getId(),loginToken,1);
-      }else{
-        MongoDBUtil.updateVLoginTOken(calendar.getTime(),userAccount.getId(),loginToken);
-      }
-      Cookie cookie0 = new Cookie("loginTokenAccount", userAccount.getId());
-      cookie0.setPath("/");
-      cookie0.setMaxAge(24 * 60 * 60);
-      cookie0.setDomain("360lj.com");
-      response.addCookie(cookie0);
-      Cookie cookie1 = new Cookie("LoginToken", loginToken);
-      cookie1.setPath("/");
-      cookie1.setMaxAge(24 * 60 * 60);
-      cookie1.setDomain("360lj.com");
-      response.addCookie(cookie1);
-      if (identity.equals(0)) {  //用户授权
-        if (StringUtils.isBlank(userAccount.getNickname())) {
-		  String url = redirectPathSource.getRedirectPath(redirectCode, userAccount, id);
-		  logger.debug("将跳转至:"+url);
-          response.sendRedirect(url);
-          return;
-        }
-	    String url = redirectPathSource.getRedirectPath(redirectCode, null, "");
-	    logger.debug("将跳转至:"+url);
-        response.sendRedirect(url);
-        return;
-      }
-      return;
+    JSONObject userInfoJson = WechatHandle.getUserInfo(openid, appid, secret, code);
+    UserAccount userAccount = userAccountService.checkAccountByUnionid(userInfoJson);
+    Document document = MongoDBUtil.queryVLoginToken(userAccount.getId());
+    Calendar calendar = Calendar.getInstance();
+    calendar.add(Calendar.DAY_OF_YEAR,30);
+    String loginToken = UUID.randomUUID().toString();
+    if( Objects.isNull(document)){
+      MongoDBUtil.insertVLoginToken(calendar.getTime(),userAccount.getId(),loginToken,1);
+    }else{
+      MongoDBUtil.updateVLoginTOken(calendar.getTime(),userAccount.getId(),loginToken);
     }
-
-    //原.net授权
-    JSONObject userInfoJson1 = WechatHandle.getUserInfo(openid, appid, secret, code);
-    UserAccount user = userAccountService.checkAccountByUnionid(userInfoJson1);
-    Cookie cookie1 = new Cookie("loginTokenAccount", user.getId());
+    Cookie cookie0 = new Cookie("loginTokenAccount", userAccount.getId());
+    cookie0.setPath("/");
+    cookie0.setMaxAge(24 * 60 * 60);
+    cookie0.setDomain("360lj.com");
+    response.addCookie(cookie0);
+    Cookie cookie1 = new Cookie("LoginToken", loginToken);
     cookie1.setPath("/");
     cookie1.setMaxAge(24 * 60 * 60);
     cookie1.setDomain("360lj.com");
     response.addCookie(cookie1);
+//    if (netLoginVideoAccess.contains(redirectCode)) {
+//      if (identity.equals(0)) {  //用户授权
+//        if (StringUtils.isBlank(userAccount.getNickname())) {
+//          String url = redirectPathSource.getRedirectPath(redirectCode, userAccount, id);
+//          logger.debug("将跳转至:" + url);
+//          response.sendRedirect(url);
+//          return;
+//        }
+//      }
+//      String url = redirectPathSource.getRedirectPath(redirectCode, null, "");
+//      logger.debug("将跳转至:"+url);
+//      response.sendRedirect(url);
+//      return;
+//    }
+
     if (identity.equals(0)) {  //用户授权
-      if (StringUtils.isBlank(user.getNickname())) {
-        response.sendRedirect(redirectPathSource.getRedirectPath(redirectCode, user, id));
+      if (StringUtils.isBlank(userAccount.getNickname())) {
+        response.sendRedirect(redirectPathSource.getRedirectPath(redirectCode, userAccount, id));
         return;
       }
       response.sendRedirect(redirectPathSource.getRedirectPath(redirectCode, null, ""));
       return;
     } else if(identity.equals(1) || identity.equals(2)){ //医生合伙人授权
-      userRoleService.checkRole(identity, user, id, redirectCode, response);
+      userRoleService.checkRole(identity, userAccount, id, redirectCode, response);
       return;
     }
 
 		// 判断是否有该用户,如果有跳转个人中心,没有则跳转注册页面
-		if (user == null) {
+		if (userAccount == null) {
 			JSONObject userInfo = WechatHandle.getUserInfo(openid, appid, secret, code);
 			userAccountService.create(userInfo);
 			logger.info("将跳转至: " + fillInfoPath);
@@ -182,13 +173,13 @@ public class WechatController {
 			response.getWriter().print(html);
 			return;
 		}
-		if (StringUtils.isBlank(user.getMobile())) {
+		if (StringUtils.isBlank(userAccount.getMobile())) {
 			logger.info("将跳转至: " + fillInfoPath);
 			String html = "<script type='text/javascript'>location.href='" + fillInfoPath + "';</script>";
 			response.getWriter().print(html);
 			return;
 		}
-		String otherRedirectPath = redirectPathSource.getRedirectPath(redirectCode, user, id);
+		String otherRedirectPath = redirectPathSource.getRedirectPath(redirectCode, userAccount, id);
 		logger.info("将跳转至: " + otherRedirectPath);
 		String html = "<script type='text/javascript'>" +
 				"location.href='" + otherRedirectPath + "';" +

+ 19 - 19
ymall/src/main/resources/application-pgtest.properties

@@ -42,27 +42,27 @@ domain.mpcpzuul= http://192.168.50.32:13001
 # \u91CD\u5B9A\u5411\u8DEF\u5F84
 ymall.appid= wx4f8c9fef3896ad71
 ymall.secret= ea186d9f2941b5cd88004e339a4ec479
-ymall.path.fillInfo= https://mem.360lj.com/ui/#/doctorRegister
-ymall.path.doctorFlow= https://mem.360lj.com/ui/#/doctorFlow
-ymall.path.personalInfo= https://mem.360lj.com/ui/#/doctorMine
+ymall.path.fillInfo= https://mem.360lj.com/ui2/#/doctorRegister
+ymall.path.doctorFlow= https://mem.360lj.com/ui2/#/doctorFlow
+ymall.path.personalInfo= https://mem.360lj.com/ui2/#/doctorMine
 ymall.path.queryExpress= https://m.360lj.com/nhome/express
-ymall.path.guideFlow= https://mem.360lj.com/ui/#/h5Flow
-ymall.path.activityhelpPage= https://mem.360lj.com/ui/#/friendsHelp
-ymall.path.activityIndex= https://mem.360lj.com/ui/#/myHelp
-ymall.path.specialist= https://mem.360lj.com/ui/#/specialist
-ymall.path.shortVideo=https://mem.360lj.com/ui/#/shortVideo
-ymall.path.selectRoles= https://mem.360lj.com/ui/#/selectRoles
-ymall.path.signUp= https://mem.360lj.com/ui/#/SignUp
-ymall.path.doctorDeactivation= https://mem.360lj.com/ui/#/doctorMine
-ymall.path.doctorToBeCertified= https://mem.360lj.com/ui/#/doctorFlow
+ymall.path.guideFlow= https://mem.360lj.com/ui2/#/h5Flow
+ymall.path.activityhelpPage= https://mem.360lj.com/ui2/#/friendsHelp
+ymall.path.activityIndex= https://mem.360lj.com/ui2/#/myHelp
+ymall.path.specialist= https://mem.360lj.com/ui2/#/specialist
+ymall.path.shortVideo=https://mem.360lj.com/ui2/#/shortVideo
+ymall.path.selectRoles= https://mem.360lj.com/ui2/#/selectRoles
+ymall.path.signUp= https://mem.360lj.com/ui2/#/SignUp
+ymall.path.doctorDeactivation= https://mem.360lj.com/ui2/#/doctorMine
+ymall.path.doctorToBeCertified= https://mem.360lj.com/ui2/#/doctorFlow
 #ymall.path.doctorHome= https://mem.360lj.com/ui/#/DoctorHome
-ymall.path.doctorHome= https://mem.360lj.com/ui/#/doctorMine
-ymall.path.partnerDeactivation= https://mem.360lj.com/ui/#/PartnerDeactivation
-ymall.path.partnerToBeCertified= https://mem.360lj.com/ui/#/PartnerToBeCertified
-ymall.path.partnerHome= https://mem.360lj.com/ui/#/PartnerHome
-ymall.path.noFollow= https://mem.360lj.com/ui/#/NoFollow
-ymall.path.myProfitIndex= https://mem.360lj.com/ui/#/MyProfitIndex
-ymall.path.frontHost= https://mem.360lj.com/ui
+ymall.path.doctorHome= https://mem.360lj.com/ui2/#/doctorMine
+ymall.path.partnerDeactivation= https://mem.360lj.com/ui2/#/PartnerDeactivation
+ymall.path.partnerToBeCertified= https://mem.360lj.com/ui2/#/PartnerToBeCertified
+ymall.path.partnerHome= https://mem.360lj.com/ui2/#/PartnerHome
+ymall.path.noFollow= https://mem.360lj.com/ui2/#/NoFollow
+ymall.path.myProfitIndex= https://mem.360lj.com/ui2/#/MyProfitIndex
+ymall.path.frontHost= https://mem.360lj.com/ui2
 
 #\u5C0F\u7A0B\u5E8Fappid\u548C\u5BC6\u94A5
 ymall.miniappid= wxa9fef05eee8dae34