修复 WxMaExpressOrderCargo 字段类型以支持小数值 #3802
Merged
+8
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
微信官方 API 文档规定
cargo对象中的weight、space_x、space_y、space_z字段类型为number,支持小数值(如 1.2kg、20.0cm)。但原实现使用Integer类型,导致无法处理小数。变更内容
WxMaExpressOrderCargo.java: 将以下字段类型从
Integer改为Doubleweight- 货物总重量(单位:kg)spaceLength(space_x) - 货物长度(单位:cm)spaceWidth(space_y) - 货物宽度(单位:cm)spaceHeight(space_z) - 货物高度(单位:cm)WxMaExpressServiceImplTest.java: 更新测试用例使用小数值
示例
兼容性
向后兼容。整数值自动装箱为 Double(
5→5.0),现有代码无需修改。Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.