public static User login(Properties props, String email, String phone, String pwd) throws AuthException { StringBuilder url = new StringBuilder(props.getProperty("zteurl")).append(addaccontUrl).append("?"); if (phone != null) { url.append("phone=").append(phone); } else if (email != null) { url.append("email=").append(email); } url.append("&pwd=").append(pwd); String requestUrl = url.toString(); HttpsGet https; try { https = new HttpsGet(requestUrl, props).request(); } catch (Exception e) { e.printStackTrace(); throw new AuthException.BadNetworkException(); } Log.warn("login getStatus():" + https.getStatus()); if (https.getStatus() == 200) { String resp = https.getResp(); User user = User.create(resp); return user; } else { // CommonErrcode.raise(https.getStatus()); throw new AuthException(https.getStatus()); } }
public static User tokenLogin(Properties props, String token) throws AuthException { StringBuilder url = new StringBuilder(props.getProperty("zteurl")) .append(tokenloginUrl) .append("?") .append("token=") .append(token); HttpsGet https; try { https = new HttpsGet(url.toString(), props).request(); } catch (Exception e) { e.printStackTrace(); throw new AuthException.BadNetworkException(); } if (https.getStatus() == 200) { String resp = https.getResp(); User user = User.create(resp); return user; } else { // CommonErrcode.raise(https.getStatus()); throw new AuthException(https.getStatus()); } }