This commit is contained in:
Mrx
2026-05-21 10:27:05 +08:00
parent 9fb5db56e3
commit 1dfe688db7

View File

@@ -27,18 +27,15 @@ func ProcessQCXG9P1CRequest(ctx context.Context, params []byte, deps *processors
null := ""
// 构建请求参数
reqData := map[string]interface{}{
"id_card": paramsDto.IDCard,
"name": null,
"userType": null,
"vehicleType": null,
"encryptionType": null,
"encryptionContent": null,
"idNum": paramsDto.IDCard,
"name": null,
"userType": "1",
}
// 调用极光API
// apiCode: vehicle-person-vehicles (用于请求头)
// apiPath: vehicle/person-vehicles (用于URL路径)
respBytes, err := deps.JiguangService.CallAPI(ctx, "vehicle-person-vehicles", "vehicle/person-vehicles", reqData)
// apiCode: vehicle-inquiry-under-name (用于请求头)
// apiPath: vehicle/inquiry-under-name (用于URL路径)
respBytes, err := deps.JiguangService.CallAPI(ctx, "vehicle-inquiry-under-name", "vehicle/inquiry-under-name", reqData)
if err != nil {
// 根据错误类型返回相应的错误
if errors.Is(err, jiguang.ErrNotFound) {
@@ -50,6 +47,9 @@ func ProcessQCXG9P1CRequest(ctx context.Context, params []byte, deps *processors
}
}
// 极光服务已经返回了 data 字段的 JSON直接返回即可
return respBytes, nil
// 使用 gjson 检查并转换 vehicleCount 字段
vehicleCountResult := gjson.GetBytes(respBytes, "vehicleCount")
if vehicleCountResult.Exists() && vehicleCountResult.Type == gjson.String {