diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/UserController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/UserController.java index 0b4541194..460a95e78 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/UserController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/UserController.java @@ -267,11 +267,22 @@ public class UserController { try { FjtUsers user = usersInfoService.getUser(mobile); if(user == null) { - long userId = usersInfoService.addUser(mobile, "", weiXinId); - if(userId == 0){ - return resultModel; + String cookieUserId = CookieUtils.getCookieValue(request, "login_user_id"); + if(StringUtils.isNotBlank(cookieUserId)){ + long userId = Long.valueOf(cookieUserId); + user = fjtUsersService.findById(Long.valueOf(userId)); } - CookieUtils.setCookie("login_user_id", userId + "", "/", 60 * 60 * 24 *7, response); + if(user!=null){ + usersInfoService.bindWeiXin(weiXinId, user.getId()); + CookieUtils.setCookie("login_user_id", user.getId() + "", "/", 60 * 60 * 24 *7, response); + }else{ + long userId = usersInfoService.addUser(mobile, "", weiXinId); + if(userId == 0){ + return resultModel; + } + CookieUtils.setCookie("login_user_id", userId + "", "/", 60 * 60 * 24 *7, response); + } + } else { usersInfoService.bindWeiXin(weiXinId, user.getId()); CookieUtils.setCookie("login_user_id", user.getId() + "", "/", 60 * 60 * 24 *7, response); diff --git a/projects/fangjia-open/src/main/webapp/static/js/autoCompletion.js b/projects/fangjia-open/src/main/webapp/static/js/autoCompletion.js index 607f70dfb..25543e105 100644 --- a/projects/fangjia-open/src/main/webapp/static/js/autoCompletion.js +++ b/projects/fangjia-open/src/main/webapp/static/js/autoCompletion.js @@ -54,7 +54,7 @@ $(function () { if ($("#t").val() != "c") { saveCookie(id, name, addr, region) } - if ($("#t").val() == "b") { + if ($("#t").val() == "b" || $("#t").val() == "gb") { location.href = "districtDetail?id=" + id+"&city="+city } else if ($("#t").val() == "c") { $('#districtSearch').val(name) @@ -122,7 +122,7 @@ function resumeHistory() { $("#searchSpan ul").empty().append(content).find("li>a.item-link").click(function () { var li = $(this).parent() var id = $(li).attr("data-id") - if ($("#t").val() == "b") { + if ($("#t").val() == "b"||$("#t").val() == "gb") { location.href = "districtDetail?id=" + id+"&city="+city } else if ($("#t").val() == "c") { location.href = "../ccbRent/index?city="+city