|
|
@@ -28,6 +28,18 @@ public class TaobaoController {
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
return ResponseEntity.noContent().build();
|
|
|
}
|
|
|
+
|
|
|
+ // 将外部系统返回的 code 从 200 改为 0,以符合前端 request 函数的期望
|
|
|
+ try {
|
|
|
+ JSONObject jsonObject = new JSONObject(result);
|
|
|
+ if (jsonObject.has("code") && jsonObject.getInt("code") == 200) {
|
|
|
+ jsonObject.put("code", 0);
|
|
|
+ result = jsonObject.toString();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("解析外部系统响应JSON失败,使用原始响应: {}", e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
return ResponseEntity.ok()
|
|
|
.contentType(MediaType.APPLICATION_JSON)
|
|
|
.body(result);
|