条件查询批次列表API接口 返回的数据: class Stock {
stockId: 19534288
stockCreatorMchid: 1659714450
stockName: 满0.15减0.1
status: running
createTime: 2024-09-24T14:07:24 08:00
description: 限制日料店使用
stockUseRule: class StockUseRule {
maxCoupons: 5
maxAmount: 50
maxAmountByDay: 0
fixedNormalCoupon: class FixedValueStockMsg {
couponAmount: 10
transactionMinimum: 15
}
maxCouponsPerUser: 4
couponType: NORMAL
goodsTag: []
tradeType: []
combineUse: false
}
availableBeginTime: 2024-09-24T00:00:00 08:00
availableEndTime: 2024-09-26T23:59:59 08:00
distributedCoupons: 0
noCash: false
startTime: null
stopTime: null
cutToMessage: null
singleitem: false
stockType: NORMAL
cardId: pX2-vjjASScvtFCGeuQn9jW0XGsE
}
查询可用户商户请求参数: "url" : "https://api.mch.weixin.qq.com/v3/marketing/favor/stocks/19534288/merchants?stock_creator_mchid=1659714450&offset=1&limit=50",
查询 接口响应结果:httpResponseBody[{"code":"MCH_NOT_EXISTS","message":"商户号不合法"}]
{
"http_method": "GET",
"url": "https://api.mch.weixin.qq.com/v3/marketing/favor/stocks/19534288/merchants?stock_creator_mchid=1659714450&offset=1&limit=50",
"uri": "https://api.mch.weixin.qq.com/v3/marketing/favor/stocks/19534288/merchants?stock_creator_mchid=1659714450&offset=1&limit=50",
"headers": {
"headers": {
"Authorization": "WECHATPAY2-SHA256-RSA2048 mchid=\"1659714450\",nonce_str=\"bBhAcHtqLQxVMlvon2Amf8o4551eEigJ\",timestamp=\"1727255514\",serial_no=\"14DE529F8760C67ECEF673D714DFB290FDB95D0A\",signature=\"H+2HJSNC6ZOIMwIrJytSjtXmXmucF9xP2PcoFZKKuAxmWWwWBg1bq7Njwdeu5GKz8Glky9fn8U9dbZsUMx9U+pB5UBhM7ZSLsNKTvW9p/cs7okbNNBdLXmKHFtpx+4nH/acAqtXK7EnwcebcNPOa1hv79Ay7K5QXkooVFd7sV1CnDBwwTXZQ8qS5vBwq5r5zZoFaGFqIr/NDuJrLo4ZQmqIBbJjI5qeos3Gda4WnJIS0VU4d8uXCx1pEEOwSOEHlaROfK+dgrqifFdw7rK2HzbfJEQJhPqx+vUN4Xj3NCWkqg1qnFWKJgJkfNHxSQkiTC1OplYa9gdgSgvU+01VUQw==\"",
"Accept": "application/json",
"User-Agent": "WechatPay-Java/0.2.12 (Windows 10/10.0) Java/1.8.0_202 Credential/WechatPay2Credential Validator/WechatPay2Validator okhttp3/null",
"Content-Type": "application/json"
}
}
}
这个是完整的请求参数,商户号和批次号,我是从 service.listAvailableMerchants(listAvailableMerchantsRequest);这个结果里,获取的, // 查询可用商户 ListAvailableMerchantsRequest listAvailableMerchantsRequest = new ListAvailableMerchantsRequest(); listAvailableMerchantsRequest.setLimit(50); Integer listAvailableMerchantsOffset = 1; listAvailableMerchantsRequest.setStockId("19534288"); listAvailableMerchantsRequest.setStockCreatorMchid("1659714450"); AvailableMerchantCollection availableMerchantCollection = null; try { listAvailableMerchantsRequest.setOffset(listAvailableMerchantsOffset); availableMerchantCollection = service.listAvailableMerchants(listAvailableMerchantsRequest); System.out.println(availableMerchantCollection); } catch (Exception e) { throw new RuntimeException(e); }
更新:你offset没有按要求传,所以报错了
看起来应该是你接口请求的时候参数出现问题了,可以打印日志比对或者也可以复制参数到postman验证,我测试查询是ok的