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());