+28
-12
@@ -85,7 +85,7 @@ public class UserController {
|
||||
try {
|
||||
if(StringUtils.isNotBlank(weiXinId) && StringUtils.isNotBlank(cacheWeiXinId)){
|
||||
System.out.println("cookie weiXinId:"+weiXinId);
|
||||
response.sendRedirect("reqCityChoicePage?type=b&code="+model.getCode());
|
||||
response.sendRedirect("reqCityChoicePage?type=bh&code="+model.getCode());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -127,33 +127,49 @@ public class UserController {
|
||||
if(weiXinId != null && !weiXinId.equals("")){
|
||||
CookieUtils.setCookie("we_chat_open_id", weiXinId, "/", 60 * 60 * 24 *7, response);
|
||||
}
|
||||
System.out.println("微信OPEN_ID:" + weiXinId);
|
||||
System.out.println("reqCityChoicePage 微信OPEN_ID:" + weiXinId);
|
||||
//企业用户入口查询企业账户开通的城市
|
||||
if(type.equals("b")){
|
||||
if(type.equals("b") || type.equals("bh")){
|
||||
//Boolean isLogin = usersInfoService.checkEnterpriseWeiXinUserIsLogin(weiXinId);
|
||||
String cacheWeiXinId = CookieUtils.getCookieValue(request,"login_enterpriseuser_weixinid");
|
||||
if(cacheWeiXinId != null) {
|
||||
Long userId = Long.parseLong(CookieUtils.getCookieValue(request,"login_user_id"));
|
||||
String loginUserIdstr = CookieUtils.getCookieValue(request,"login_user_id");
|
||||
if(cacheWeiXinId != null && StringUtils.isNotBlank(loginUserIdstr)) {
|
||||
Long userId = Long.parseLong(loginUserIdstr);
|
||||
CookieUtils.setCookie("login_user_id", userId + "", "/", 60 * 60 * 24 *7, response);
|
||||
try {
|
||||
FjtUsers users = fjtUsersService.findById(userId);
|
||||
List<String> citys = userCityService.findSupportCityByUserId(userId);
|
||||
if(citys == null || citys.isEmpty()){
|
||||
citys = Arrays.asList("上海");
|
||||
}
|
||||
|
||||
if(users.getRole()==17 && type.equals("b")){
|
||||
CookieUtils.removeCookie(request, response, "login_enterpriseuser_weixinid");
|
||||
response.sendRedirect("reqLoginPage");
|
||||
}else if(users.getRole()==12 && type.equals("bh")){
|
||||
CookieUtils.removeCookie(request, response, "login_enterpriseuser_weixinid");
|
||||
response.sendRedirect("bhydLoginPage?code="+model.getCode());
|
||||
}else{
|
||||
List<String> citys = userCityService.findSupportCityByUserId(userId);
|
||||
if(citys == null || citys.isEmpty()){
|
||||
citys = Arrays.asList("上海");
|
||||
}
|
||||
// if(users!=null && users.getRole() == 12){
|
||||
// citys = Arrays.asList("上海");
|
||||
// }else{
|
||||
// citys = userCityService.findSupportCityByUserId(userId);
|
||||
// }
|
||||
model.setCitys(citys);
|
||||
model.setCitys(citys);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
model.setCitys(new ArrayList<String>());
|
||||
}
|
||||
|
||||
} else {
|
||||
CookieUtils.removeCookie(request, response, "login_enterpriseuser_weixinid");
|
||||
try {
|
||||
response.sendRedirect("bhydLoginPage?code="+model.getCode());
|
||||
if(type.equals("bh")){
|
||||
response.sendRedirect("bhydLoginPage?code="+model.getCode());
|
||||
}else{
|
||||
response.sendRedirect("reqLoginPage");
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
@@ -368,7 +384,7 @@ public class UserController {
|
||||
return resultModel;
|
||||
}
|
||||
CookieUtils.setCookie("login_user_id", user.getId() + "", "/", 60 * 60 * 24 *7, response);
|
||||
CookieUtils.setCookie("login_user_type", "b", "/", 60 * 60 * 24 *7, response);
|
||||
CookieUtils.setCookie("login_user_type", "bh", "/", 60 * 60 * 24 *7, response);
|
||||
CookieUtils.setCookie("login_enterpriseuser_weixinid", weiXinId, "/", 60 * 60 * 24 *7, response);
|
||||
resultModel.setResult(Message.RESULT_SUCCESS);
|
||||
return resultModel;
|
||||
|
||||
+1
-1
@@ -454,7 +454,7 @@ public class WeiXinEvaluationController {
|
||||
System.out.println("渤海地址搜索 "+evaluation.getAddress());
|
||||
List<JSONObject> bhDists = BHBankUtils.getDistrictByBhbank(evaluation.getAddress());
|
||||
JSONObject o = null;
|
||||
if(bhDists.size()<1){
|
||||
if(bhDists.size()<1 && bhDists.size()>0){
|
||||
bhDists = BHBankUtils.getDistrictByBhbank(district.getName());
|
||||
o = bhDists.get(0);
|
||||
}else if(bhDists.size()>1){
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
if(re.result == "fail"){
|
||||
$.toast(re.msg);
|
||||
} else {
|
||||
window.location.href = "reqCityChoicePage?type=b";
|
||||
window.location.href = "reqCityChoicePage?type=bh";
|
||||
}
|
||||
},error:function (data, status) {
|
||||
$.toast("发送失败,请重试");
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="city">
|
||||
<#if type?? && type == 'b' && (citys??&&citys?size>0)>
|
||||
<#if type?? && (type == 'b' || type == 'bh') && (citys??&&citys?size>0)>
|
||||
<div class="city-list">
|
||||
<#list citys as bo>
|
||||
<p onclick="req2(this)">${bo}</p>
|
||||
@@ -54,7 +54,7 @@
|
||||
</#list>
|
||||
</div>
|
||||
</#if>
|
||||
<#if type?? && type == 'c' || type == 'b' && (citys??&&citys?size=0)>
|
||||
<#if type?? && type == 'c' || type == 'b' || type=='bh' && (citys??&&citys?size=0)>
|
||||
<div class="city-list curCity">
|
||||
<span class="city-letter" id="Cur">当前定位城市</span>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.fangjia.service.util;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -29,6 +31,29 @@ public class CookieUtils {
|
||||
}
|
||||
|
||||
|
||||
public static boolean removeCookie(HttpServletRequest request, HttpServletResponse response, String name) {
|
||||
if(request.getCookies() == null){
|
||||
return false;
|
||||
}
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return false;
|
||||
}
|
||||
Cookie[] cookies = request.getCookies();
|
||||
if (null != cookies) {
|
||||
for (Cookie cookie : cookies) {
|
||||
if (name.equals(cookie.getName())) {
|
||||
cookie.setValue(null);
|
||||
cookie.setMaxAge(0);
|
||||
cookie.setPath("/");
|
||||
response.addCookie(cookie);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static void setCookie(String name, String value, String path,int maxAge, HttpServletResponse response){
|
||||
Cookie cookie = new Cookie(name, value);
|
||||
if(path != null){
|
||||
|
||||
Reference in New Issue
Block a user