Compare commits
2 Commits
d6b78a5d6d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e246271a24 | |||
| a1024ed4b2 |
@@ -47,8 +47,6 @@ func ProcessJRZQO7L1Request(ctx context.Context, params []byte, deps *processors
|
|||||||
"city": null,
|
"city": null,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用 WithSkipCode201Check 不跳过 201 错误检查,当 Code == "201" 时返回错误
|
|
||||||
// ctx = zhicha.WithSkipCode201Check(ctx)
|
|
||||||
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI080", reqData)
|
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI080", reqData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, zhicha.ErrDatasource) {
|
if errors.Is(err, zhicha.ErrDatasource) {
|
||||||
|
|||||||
@@ -212,11 +212,12 @@ func (z *ZhichaService) CallAPI(ctx context.Context, proID string, params map[st
|
|||||||
|
|
||||||
// 201 表示查询为空,兼容其它情况如果data也为空,则返回空对象
|
// 201 表示查询为空,兼容其它情况如果data也为空,则返回空对象
|
||||||
if zhichaResp.Code == "201" {
|
if zhichaResp.Code == "201" {
|
||||||
// 先做类型断言
|
|
||||||
dataMap, ok := zhichaResp.Data.(map[string]interface{})
|
dataMap, ok := zhichaResp.Data.(map[string]interface{})
|
||||||
if ok && len(dataMap) > 0 {
|
if ok {
|
||||||
|
// 即使是 {},也原样返回
|
||||||
return dataMap, nil
|
return dataMap, nil
|
||||||
}
|
}
|
||||||
|
// 兜底:防止解密异常
|
||||||
return map[string]interface{}{}, nil
|
return map[string]interface{}{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user