swagger上请求
在android studio请求
复制android studio打印出来的url,放在apifox上请求
但是当请求参数为改变时,android和前两者返回结果一致
附上请求代码
private void check(String s, String s1) {
new Thread(new Runnable() {
@Override
public void run() {
OkHttpClient okHttpClient = new OkHttpClient();
FormBody build = new FormBody.Builder()
.add("password", s1)
.add("phone", s)
.build();
Log.d("user","http://47.102.185.215/user/login?password="+s1+"&phone="+s);
Request build1 = new Request.Builder()
//http://47.102.185.215/user/login?password=xxx&phone=xxx
.url("http://47.102.185.215/user/login?password="+s1+"&phone="+s)
.post(build)
.build();
okHttpClient.newCall(build1).enqueue(new Callback() {
@Override
public void onFailure(@NonNull Call call, @NonNull IOException e) {
// runOnUiThread(() ->Toast.makeText(MainActivity.this, "短路了喵喵喵~~~~", Toast.LENGTH_SHORT).show());
}
@Override
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
// runOnUiThread(() -> Toast.makeText(Register.this, "正在发送验证码", Toast.LENGTH_SHORT).show());
String result=response.body().string();
Log.d("login",result);
try {
JSONObject j = new JSONObject(result);
String message = j.getString("message");
if (message.equals("成功")){
// Toast.makeText(InForLogin.this,"账号已存在",Toast.LENGTH_SHORT).show();
runOnUiThread(() -> Toast.makeText(MainLogin.this,"登录成功",Toast.LENGTH_SHORT).show());
Intent intent=new Intent(MainLogin.this, MainActivity.class);
startActivity(intent);
}else {
runOnUiThread(() -> Toast.makeText(MainLogin.this,"账户不存在",Toast.LENGTH_SHORT).show());
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
}).start();
}
请问各位uu们,为什么会出现这种情况,直接导致项目运行与预期不同,找不到错误