Giter VIP home page Giter VIP logo

Comments (2)

xuexiangjys avatar xuexiangjys commented on May 27, 2024

通常来说,对于网络框架来说,为了简化使用,所有的成功的数据应该都放在data里面,ApiResult里面只存放msg,code和data这三个数据,保证一个结果输出源。
我的建议是,你把其他字段作为基类,都放到data里面,通过data获取,这样最简单,也最规范。
如果你实在修改不了api的结构,可以使用retrofit的接口定义,调用call,不进行拆包请求。具体可以参考demo中的代码:

https://github.com/xuexiangjys/XHttp2/blob/bb244fb8c851ca83b2fcc8d9dba87f7a29c9c804/xhttp2demo/src/main/java/com/xuexiang/xhttp2demo/fragment/CustomRequestFragment.java#L117C1-L117C1

from xhttp2.

thisfeng avatar thisfeng commented on May 27, 2024

感謝回答
确实是的,后台不规范导致。 已经让其建议写入 data 内。

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.