Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requestParams 传参数丢失,后台取不到数据 #36

Open
shiner0 opened this issue Aug 25, 2021 · 0 comments
Open

requestParams 传参数丢失,后台取不到数据 #36

shiner0 opened this issue Aug 25, 2021 · 0 comments

Comments

@shiner0
Copy link

shiner0 commented Aug 25, 2021

@Override
public void post(String url, Map<String, Object> params, final HttpCallBack callBack) {
    params.put("noncestr", getRandomStr());
    params.put("sign", getSign(params));
    RequestParams requestParams = new RequestParams();
    for (String key : params.keySet()) {
        requestParams.put(key, params.get(key));
    }

// XLog.i("post token = " + RxSPTool.getString(BaseApp.getInstance(), BaseConfig.TOKEN)+ " \npost deviceInfo = " + getDeviceInfo());
// XLog.map(params);
client.post(url, requestParams, new AsyncHttpResponseHandler() {
@OverRide
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
String result = new String(responseBody);
XLog.i("token = " + RxSPTool.getString(BaseApp.getInstance(), BaseConfig.TOKEN)+ " \n \ndeviceInfo = " + getDeviceInfo()+"\n\nURL = " + url+" \n\nparams = "+params +" \n\n"+result);
// Class<?> cls = XHttp.analysisClassInfo(callBack);
// //我这里使用的是fastjson,你也可以用gson,jackjson等
// XLog.json(result);
//
// callBack.onSuccess(new Gson().fromJson(result, cls));
callBack.onSuccess(result);
}

        @Override
        public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
            callBack.onFailed(error.toString());
        }
    });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant