The String url="http://58.254.212.142:4080/HRApi/api/attendance/list";//request link \
OkHttpClient client=new OkHttpClient ();
HashMapParamsMap=new HashMap<> (a);
ParamsMap. Put (" startTime ", "1614896124");
ParamsMap. Put (" endTime ", "1614909624");
FormBody. Builder formBodyBuilder=new FormBody. Builder ();
For (String key: paramsMap keySet ()) {
FormBodyBuilder. Add (key, paramsMap. Get (key));
}
Request the Request=new Request. Builder ()
Url (url)
.post (formBodyBuilder. The build ())
.build();
Call Call=client. NewCall (request);
Call. The enqueue (new Callback () {//Callback
Public void onResponse (Call the Call, the Response Response) throws IOException {
The String result=response. The body (). The String ();
CodePudding user response:
There should be a call is successful, is the caller did not return the correct data