f
This commit is contained in:
@@ -246,7 +246,8 @@ func (s *JiyiService) CallAPI(ctx context.Context, apiKey, apiPath string, body
|
||||
s.logError(transactionID, apiKey, jiyiResp.SeqNo, err, requestPayload)
|
||||
return nil, err
|
||||
}
|
||||
jiyiResp.Data = cleanedData
|
||||
// 去掉 data.result 包装,直接返回最内层业务数据
|
||||
jiyiResp.Data = unwrapResultPayload(cleanedData)
|
||||
|
||||
s.logResponse(transactionID, apiKey, resp.StatusCode, duration, jiyiResp.SeqNo)
|
||||
|
||||
@@ -287,6 +288,20 @@ func stripBusiMetaFromData(data interface{}) (interface{}, error) {
|
||||
return payload, nil
|
||||
}
|
||||
|
||||
// unwrapResultPayload 若载荷为 {"result": <业务数据>},则直接返回业务数据。
|
||||
// 五个集奕产品实测成功响应均为此结构。
|
||||
func unwrapResultPayload(data interface{}) interface{} {
|
||||
payload, ok := data.(map[string]interface{})
|
||||
if !ok {
|
||||
return data
|
||||
}
|
||||
result, exists := payload["result"]
|
||||
if !exists {
|
||||
return data
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// isEmptyBusinessResult 判断业务载荷是否为空(无 result,或 result 无有效内容)
|
||||
func isEmptyBusinessResult(data interface{}) bool {
|
||||
payload, ok := data.(map[string]interface{})
|
||||
|
||||
Reference in New Issue
Block a user