参数直接放到RequestParams里
private void check(){ JSONObject object = new JSONObject(); try { object.put("userName", AES.encrypt("1234567890")); object.put("accountPwd", AES.encrypt("123456")); object.put("imei", CommandTools.getMIME(MyApplication.getInstance()));// object.put("clientId", "123"); } catch (Exception e) { e.printStackTrace(); } RequestParams params = new RequestParams(); params.addBodyParameter("data", object.toString()); params.addBodyParameter("appid", MD5.appId); params.addBodyParameter("format", "json"); params.addBodyParameter("version", "1.0"); String strUrl = Constant.DEV_URL + "user/login.htm"; HttpUtils http = new HttpUtils(); http.send(HttpRequest.HttpMethod.POST, strUrl, params, new RequestCallBack<String>() { @Override public void onFailure(HttpException arg0, String arg1) { // TODO Auto-generated method stub } @Override public void onSuccess(ResponseInfo<String> arg0) { // TODO Auto-generated method stub CommandTools.showDialog(mContext, arg0.result); } }); }
时间: 2024-10-09 04:01:05