Skip to content

协商历史查询 ​

更新时间:2026-09-22

接口说明 ​

查询指定投诉单的协商历史记录,包括商户回复、用户反馈、系统操作等所有交互记录。

接口信息

  • 适用对象:间连商户(OpenAPI)
  • 请求 URL: https://webapipay.com/openapi/v1/complaint/history
  • 请求方法:POST
  • Content-Type: application/json
  • 鉴权方式: Sign 签名验证(公共参数 + bizContent)

ℹ️ 公共参数说明详见 通用规则 - API公共参数 部分

请求参数(bizContent) ​

参数名类型必填参数说明
complaintNoStringY投诉单号(渠道侧投诉单号)
limitIntegerN返回条数,默认 100
offsetIntegerN偏移量,默认 0

请求示例 ​

json
{
  "appId": "your_system_appid",
  "subMerchantNo": "your_sub_merchant_no",
  "bizContent": "{\"complaintNo\":\"4567890123456789012\",\"limit\":50,\"offset\":0}",
  "version": "1.0",
  "nonce": "49d55020fa3adf6ed67b253c583ccdaa",
  "contentHash": "your_content_hash",
  "timestamp": "2026-09-22 10:00:00",
  "sign": "your_sign"
}

响应参数 ​

历史记录字段说明(data[n]) ​

参数类型必须参数说明
idIntegerY记录ID
complaintOrderIdIntegerY关联投诉单内部ID
recordTypeStringY操作类型(MERCHANT_REPLY=商户回复/USER_REPLY=用户回复/SYSTEM=系统操作)
operatorTypeStringY操作者类型(MERCHANT=商户/USER=用户/SYSTEM=系统)
contentStringY操作详情内容
imageUrlStringN附件图片URL(取图片列表第一张,无图片时为空字符串)
createTimeStringY记录创建时间

响应示例 ​

成功响应: ​

json
{
  "code": "0000",
  "message": "获取成功",
  "timestamp": "2026-09-22T10:00:00.000Z",
  "data": [
    {
      "id": 1,
      "complaintOrderId": 1,
      "recordType": "MERCHANT_REPLY",
      "operatorType": "MERCHANT",
      "content": "协商内容详情:商户发起的第 1 次沟通",
      "imageUrl": "https://example.com/image_1.jpg",
      "createTime": "2026-09-22 10:04:48"
    },
    {
      "id": 2,
      "complaintOrderId": 1,
      "recordType": "MERCHANT_REPLY",
      "operatorType": "MERCHANT",
      "content": "协商内容详情:商户发起的第 2 次沟通",
      "imageUrl": "https://example.com/image_2.jpg",
      "createTime": "2026-09-22 11:04:48"
    }
  ]
}

代码示例 ​

Java
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSON;

public class ComplaintHistoryExample {
    public static void main(String[] args) {
        Map<String, String> bizContent = new HashMap<>();
        bizContent.put("complaintNo", "4567890123456789012");
        bizContent.put("limit", "50");

        Map<String, String> requestData = new HashMap<>();
        requestData.put("appId", "your_app_id");
        requestData.put("subMerchantNo", "your_sub_merchant_no");
        requestData.put("bizContent", JSON.toJSONString(bizContent));
        requestData.put("version", "1.0");
        requestData.put("timestamp", "2026-09-22 10:00:00");

        requestData.put("sign", SignUtil.generateSign(requestData, "your_sign_key"));

        String response = HttpUtil.post(
            "https://webapipay.com/openapi/v1/complaint/history", requestData);
        System.out.println("协商历史:" + response);
    }
}
Python
import requests, json

def get_complaint_history(complaint_no, limit=100):
    api_url = "https://webapipay.com/openapi/v1/complaint/history"
    request_data = {
        "appId": "your_app_id",
        "subMerchantNo": "your_sub_merchant_no",
        "bizContent": json.dumps({"complaintNo": complaint_no, "limit": limit}),
        "version": "1.0", "timestamp": "2026-09-22 10:00:00",
    }
    request_data["sign"] = generate_sign(request_data, "your_sign_key")
    return requests.post(api_url, json=request_data, timeout=30).json()

result = get_complaint_history("4567890123456789012")
if result.get("code") == "0000":
    for record in result["data"]:
        print(f"[{record['createTime']}] {record['operatorName']}: {record['content']}")
PHP
<?php

$requestData = [
    'appId'          => 'your_app_id',
    'subMerchantNo'  => 'your_sub_merchant_no',
    'bizContent'     => json_encode(['complaintNo' => '4567890123456789012']),
    'version'        => '1.0',
    'timestamp'      => date('Y-m-d H:i:s'),
];
$requestData['sign'] = generateSign($requestData, 'your_sign_key');

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://webapipay.com/openapi/v1/complaint/history');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);

if ($response['code'] === '0000') {
    foreach ($response['data'] as $record) {
        echo "[{$record['createTime']}] {$record['operatorName']}: {$record['content']}\n";
    }
}

注意事项 ​

WARNING

⚠️ 数据范围:

  • 只能查询属于当前商户的投诉单的协商历史
  • 系统会自动校验投诉单归属

TIP

✅ 分页说明:

  • 使用 limit 和 offset 进行分页
  • offset 为跳过的记录数,从 0 开始
  • 历史记录按时间正序排列