From a087156247e7508e4fb0242aefc80b236c384f5b Mon Sep 17 00:00:00 2001 From: baohanddd Date: Wed, 4 May 2016 10:46:06 +0800 Subject: [PATCH] =?UTF-8?q?add=20data=20import=20:=E6=9C=BA=E6=9E=84?= =?UTF-8?q?=E3=80=81=E9=83=A8=E9=97=A8=E3=80=81=E7=94=A8=E6=88=B7(?= =?UTF-8?q?=E5=8C=BB=E7=94=9F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lyms/platform/common/utils/LoginUtil.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java b/platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java index a406f17..16c1691 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java +++ b/platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java @@ -5,6 +5,7 @@ import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.lang.*; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -66,14 +67,14 @@ public class LoginUtil { public static String loginHospitalUser(String phone, String pwd, String typeId, String token) { HttpClient client = new HttpClient(); PostMethod post = new MessageUtil.UTF8PostMethod("http://passport.healthbaby.com.cn/v1/userLogin.action"); - NameValuePair[] data = { - new NameValuePair("phone", phone), - new NameValuePair("typeId", typeId), - new NameValuePair("password", pwd) - }; - post.setRequestBody(data); - post.setRequestHeader("Authorization", token); try { + NameValuePair[] data = { + new NameValuePair("phone", phone), + new NameValuePair("typeId", typeId), + new NameValuePair("password", org.apache.commons.lang.StringUtils.isBlank(pwd)?"p":md5(pwd)) + }; + post.setRequestBody(data); + post.setRequestHeader("Authorization", token); client.executeMethod(post); int statusCode = post.getStatusCode(); String result = new String(post.getResponseBodyAsString()); -- 1.8.3.1