|
@@ -259,31 +259,18 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|
|
|
|
|
// 执行请求操作,并拿到结果(同步阻塞)
|
|
// 执行请求操作,并拿到结果(同步阻塞)
|
|
response = httpClient.execute(httpPost);
|
|
response = httpClient.execute(httpPost);
|
|
- // 获取结果实体
|
|
|
|
- HttpEntity entity = response.getEntity();
|
|
|
|
- if (entity != null) {
|
|
|
|
- String strTmp= EntityUtils.toString(response.getEntity(),"UTF-8");
|
|
|
|
- //返回字符串
|
|
|
|
- String res = unicodeToString(strTmp);
|
|
|
|
- JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
|
|
|
|
- Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
|
|
|
|
- if(status){
|
|
|
|
- List<org.apache.http.cookie.Cookie> cookielist = store.getCookies();
|
|
|
|
- String nCookie = "";
|
|
|
|
- for(org.apache.http.cookie.Cookie cookie: cookielist){
|
|
|
|
- String name=cookie.getName();
|
|
|
|
- String value=cookie.getValue();
|
|
|
|
- nCookie += name + "="+value+";";
|
|
|
|
- }
|
|
|
|
- System.out.println("nCookie:" + nCookie);
|
|
|
|
- shopAccount.setFuziCookie(nCookie);
|
|
|
|
- shopAccountMapper.updateById(shopAccount);
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
- System.out.println("登录返回值:" + res);
|
|
|
|
|
|
+ if(response.getStatusLine().getStatusCode() == 302){
|
|
|
|
+ List<org.apache.http.cookie.Cookie> cookielist = store.getCookies();
|
|
|
|
+ String nCookie = "";
|
|
|
|
+ for(org.apache.http.cookie.Cookie cookie: cookielist){
|
|
|
|
+ String name=cookie.getName();
|
|
|
|
+ String value=cookie.getValue();
|
|
|
|
+ nCookie += name + "="+value+";";
|
|
}
|
|
}
|
|
|
|
+ System.out.println("nCookie:" + nCookie);
|
|
|
|
+ shopAccount.setFuziCookie(nCookie);
|
|
|
|
+ shopAccountMapper.updateById(shopAccount);
|
|
}
|
|
}
|
|
- EntityUtils.consume(entity);
|
|
|
|
// 释放链接
|
|
// 释放链接
|
|
response.close();
|
|
response.close();
|
|
|
|
|