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

Java类型Long的值请求和响应的时候会被改变 #2299

Open
InterEsea opened this issue Dec 7, 2024 · 2 comments
Open

Java类型Long的值请求和响应的时候会被改变 #2299

InterEsea opened this issue Dec 7, 2024 · 2 comments

Comments

@InterEsea
Copy link

InterEsea commented Dec 7, 2024

当前使用的版本

  • runapi版本: 3.1.0
  • showdoc版本: v3.3.0

问题一

  • 接口请求时 "id": 3468728614613176320
    image
  • 后端接口接收到的时候值已被改变
    image
  • 一样的接口和参数在Postman和Hoppscotch都没有问题
    image

问题二

  • 接口响应结果Long类型的值会被改变
    image
    image
  • 一样的接口和参数在Postman和Hoppscotch都没有问题
    image
@star7th
Copy link
Owner

star7th commented Dec 7, 2024

这个我也需要看下。这个应该是框架层面的问题了,它应该不支持这样的大数,不知道其他工具是怎么绕过去的

@star7th
Copy link
Owner

star7th commented Jan 22, 2025

今天空闲看了下此问题,这是js的固有缺陷 https://juejin.cn/post/7461985445209604123 ,其实要解决不容易。业务代码引用太多了。
我比较建议,对于大整数,统一使用字符串。你这个id大整数,如果后面跟网站或者移动端网页交互,但凡经过js,都有可能丢精度的。为了兼容考虑,我也推荐使用字符串的做法。

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

2 participants