f
This commit is contained in:
@@ -27,18 +27,15 @@ func ProcessQCXG9P1CRequest(ctx context.Context, params []byte, deps *processors
|
|||||||
null := ""
|
null := ""
|
||||||
// 构建请求参数
|
// 构建请求参数
|
||||||
reqData := map[string]interface{}{
|
reqData := map[string]interface{}{
|
||||||
"id_card": paramsDto.IDCard,
|
"idNum": paramsDto.IDCard,
|
||||||
"name": null,
|
"name": null,
|
||||||
"userType": null,
|
"userType": "1",
|
||||||
"vehicleType": null,
|
|
||||||
"encryptionType": null,
|
|
||||||
"encryptionContent": null,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用极光API
|
// 调用极光API
|
||||||
// apiCode: vehicle-person-vehicles (用于请求头)
|
// apiCode: vehicle-inquiry-under-name (用于请求头)
|
||||||
// apiPath: vehicle/person-vehicles (用于URL路径)
|
// apiPath: vehicle/inquiry-under-name (用于URL路径)
|
||||||
respBytes, err := deps.JiguangService.CallAPI(ctx, "vehicle-person-vehicles", "vehicle/person-vehicles", reqData)
|
respBytes, err := deps.JiguangService.CallAPI(ctx, "vehicle-inquiry-under-name", "vehicle/inquiry-under-name", reqData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// 根据错误类型返回相应的错误
|
// 根据错误类型返回相应的错误
|
||||||
if errors.Is(err, jiguang.ErrNotFound) {
|
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 字段
|
// 使用 gjson 检查并转换 vehicleCount 字段
|
||||||
vehicleCountResult := gjson.GetBytes(respBytes, "vehicleCount")
|
vehicleCountResult := gjson.GetBytes(respBytes, "vehicleCount")
|
||||||
if vehicleCountResult.Exists() && vehicleCountResult.Type == gjson.String {
|
if vehicleCountResult.Exists() && vehicleCountResult.Type == gjson.String {
|
||||||
|
|||||||
Reference in New Issue
Block a user