Giter VIP home page Giter VIP logo

Comments (4)

xuexiangjys avatar xuexiangjys commented on May 27, 2024

返回的数据必须是下面的格式:

{
    "Code":0,
    "Msg":"",
    "Data":{ //数据内容
     }
}

from xhttp2.

xuexiangjys avatar xuexiangjys commented on May 27, 2024

Code、Msg、Data必须都是大写

from xhttp2.

xuexiangjys avatar xuexiangjys commented on May 27, 2024

自定义返回体的格式:https://github.com/xuexiangjys/XHttp2#%E8%87%AA%E5%AE%9A%E4%B9%89api%E8%AF%B7%E6%B1%82

from xhttp2.

ivalimmb avatar ivalimmb commented on May 27, 2024

数据返回格式:
{
status: "1",
message: "OK",
result: "663046792267785498951364"
}

bean实体类:
public class User extends ApiResult {

private String status;
private String message;
private T result;


@Override
public int getCode() {
    return Integer.parseInt(status);
}

@Override
public String getMsg() {
    return message;
}

@Override
public boolean isSuccess() {
    return true;
}

@Override
public T getData() {
    return result;
}

public String getStatus() {
    return status;
}

public void setStatus(String status) {
    this.status = status;
}

public String getMessage() {
    return message;
}

public void setMessage(String message) {
    this.message = message;
}

public T getResult() {
    return result;
}

public void setResult(T result) {
    this.result = result;
}

}

请求:
XHttp.get("/api?module=account&action=balance&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&tag=latest")
.execute(new CallBackProxy<User, String>(new TipRequestCallBack() {
@OverRide
public void onSuccess(String response) throws Throwable {
Log.e("test","返回的response--->"+response.toString());
}
}));

报错:
E/XHttp: --> Subscriber is onError
E/XHttp: --> e instanceof ApiException, message:ApiResult.class.isAssignableFrom(cls) err!!

你好 请问一下这是什么原因呢? 我调试了挺久 看不出问题

from xhttp2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.