f
This commit is contained in:
@@ -210,16 +210,18 @@ func (z *ZhichaService) CallAPI(ctx context.Context, proID string, params map[st
|
|||||||
return nil, ErrDatasource
|
return nil, ErrDatasource
|
||||||
}
|
}
|
||||||
|
|
||||||
// 201 表示查询为空,返回空对象
|
// 201 表示查询为空,兼容其它情况如果data也为空,则返回空对象
|
||||||
if zhichaResp.Code == "201" {
|
if zhichaResp.Code == "201" {
|
||||||
|
// 先做类型断言
|
||||||
|
dataMap, ok := zhichaResp.Data.(map[string]interface{})
|
||||||
|
if ok && len(dataMap) > 0 {
|
||||||
|
return dataMap, nil
|
||||||
|
}
|
||||||
return map[string]interface{}{}, nil
|
return map[string]interface{}{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回data字段,如果为空则返回空对象
|
// 返回data字段
|
||||||
if zhichaResp.Data != nil && len(zhichaResp.Data) > 0 {
|
return zhichaResp.Data, nil
|
||||||
return zhichaResp.Data, nil
|
|
||||||
}
|
|
||||||
return map[string]interface{}{}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encrypt 使用配置的加密密钥对数据进行AES-128-CBC加密
|
// Encrypt 使用配置的加密密钥对数据进行AES-128-CBC加密
|
||||||
|
|||||||
Reference in New Issue
Block a user