fix
This commit is contained in:
@@ -2344,7 +2344,7 @@ func (a *ApiRequestService) ProcessG09XM02Request(ctx context.Context, params []
|
||||
}
|
||||
request := map[string]interface{}{
|
||||
"data": map[string]interface{}{
|
||||
"idCard": a.westDexService.Encrypt(idCard.String()),
|
||||
"idcard": a.westDexService.Encrypt(idCard.String()),
|
||||
"name": a.westDexService.Encrypt(name.String()),
|
||||
},
|
||||
}
|
||||
@@ -2352,34 +2352,13 @@ func (a *ApiRequestService) ProcessG09XM02Request(ctx context.Context, params []
|
||||
if err != nil && resp == nil {
|
||||
return nil, fmt.Errorf("婚姻状态查询失败: %v", err)
|
||||
}
|
||||
result := gjson.GetBytes(resp, "data.data")
|
||||
result := gjson.GetBytes(resp, "data")
|
||||
if !result.Exists() {
|
||||
return nil, fmt.Errorf("婚姻状态查询失败")
|
||||
}
|
||||
|
||||
// 获取原始结果
|
||||
rawResult := result.String()
|
||||
|
||||
// 根据结果转换状态码
|
||||
var statusCode string
|
||||
switch {
|
||||
case strings.HasPrefix(rawResult, "INR"):
|
||||
statusCode = "0" // 匹配不成功
|
||||
case strings.HasPrefix(rawResult, "IA"):
|
||||
statusCode = "1" // 结婚
|
||||
case strings.HasPrefix(rawResult, "IB"):
|
||||
statusCode = "2" // 离婚
|
||||
default:
|
||||
return nil, fmt.Errorf("婚姻状态查询失败,未知状态码: %s", statusCode)
|
||||
}
|
||||
|
||||
// 构建新的返回结果
|
||||
response := map[string]string{
|
||||
"status": statusCode,
|
||||
}
|
||||
|
||||
// 序列化为JSON
|
||||
jsonResponse, err := json.Marshal(response)
|
||||
jsonResponse, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("序列化结果失败: %v", err)
|
||||
}
|
||||
@@ -2404,10 +2383,10 @@ func (a *ApiRequestService) ProcessG10XM02Request(ctx context.Context, params []
|
||||
// 构造请求数据
|
||||
request := map[string]interface{}{
|
||||
"data": map[string]interface{}{
|
||||
"idCardMan": a.westDexService.Encrypt(idCardMan.String()),
|
||||
"nameMan": a.westDexService.Encrypt(nameMan.String()),
|
||||
"idCardWoman": a.westDexService.Encrypt(idCardWoman.String()),
|
||||
"nameWoman": a.westDexService.Encrypt(nameWoman.String()),
|
||||
"idcard_man": a.westDexService.Encrypt(idCardMan.String()),
|
||||
"name_man": a.westDexService.Encrypt(nameMan.String()),
|
||||
"idcard_woman": a.westDexService.Encrypt(idCardWoman.String()),
|
||||
"name_woman": a.westDexService.Encrypt(nameWoman.String()),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2417,34 +2396,8 @@ func (a *ApiRequestService) ProcessG10XM02Request(ctx context.Context, params []
|
||||
return nil, callApiErr
|
||||
}
|
||||
|
||||
result := gjson.GetBytes(resp, "data.data")
|
||||
if !result.Exists() {
|
||||
return nil, fmt.Errorf("婚姻状态查询失败")
|
||||
}
|
||||
|
||||
// 获取原始结果
|
||||
rawResult := result.String()
|
||||
|
||||
// 根据结果转换状态码
|
||||
var statusCode string
|
||||
switch {
|
||||
case strings.HasPrefix(rawResult, "INR"):
|
||||
statusCode = "0" // 匹配不成功
|
||||
case strings.HasPrefix(rawResult, "IA"):
|
||||
statusCode = "1" // 结婚
|
||||
case strings.HasPrefix(rawResult, "IB"):
|
||||
statusCode = "2" // 离婚
|
||||
default:
|
||||
return nil, fmt.Errorf("婚姻状态查询失败,未知状态码: %s", statusCode)
|
||||
}
|
||||
|
||||
// 构建新的返回结果
|
||||
response := map[string]string{
|
||||
"status": statusCode,
|
||||
}
|
||||
|
||||
// 序列化为JSON
|
||||
jsonResponse, err := json.Marshal(response)
|
||||
jsonResponse, err := json.Marshal(resp)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("序列化结果失败: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user