rpa_JD_searchOrderByIds
通过订单id获取订单信息
1. 函数
rpa_JD_searchOrderByIds(orderIds)
- orderIds:字符串类型,订单id,指定订单id查询,多个订单使用逗号分隔,最多能传50个订单id;
2. 返回值
字符串类型,订单信息JSON串:不为空表示成功,为空表示失败或无订单信息,通过rpa_getLastErrorCode()获取错误码,rpa_getLastErrorMsg()获取错误信息。 可以使用rpa_JD_parseOrderInfo解析成RpaHelper.OrderResult,OrderResult类定义如下:
class OrderInfo:
def __init__(self, jsonInfo):
self.totalPage = jsonInfo['totalPage']
self.orderId = jsonInfo['orderId']
self.orderState = jsonInfo['orderState']
self.skuNames = jsonInfo['skuNames']
self.payType = jsonInfo['payType']
self.orderTotalPrice = jsonInfo['orderTotalPrice']
self.orderSellerPrice = jsonInfo['orderSellerPrice']
self.freightPrice = jsonInfo['freightPrice']
self.orderRemark = jsonInfo['orderRemark']
self.venderRemark = jsonInfo['venderRemark']
self.remarkFlag = jsonInfo['remarkFlag']
self.orderStartTime = jsonInfo['orderStartTime']
self.orderEndTime = jsonInfo['orderEndTime']
self.outBoundDate = jsonInfo['outBoundDate']
consigneeInfo = json.loads(jsonInfo['consigneeInfo'])
self.fullAddress = consigneeInfo['fullAddress']
self.fullname = consigneeInfo['fullname']
self.mobile = consigneeInfo['mobile']
self.telephone = consigneeInfo['telephone']
class OrderResult:
def __init__(self, totalPage, orderList):
self.totalPage = totalPage
self.orderList = orderList
3. 示例
from RpaHelper import OrderInfo
from RpaHelper import OrderResult
def showResult(orderResult):
for orderInfo in orderResult.orderList:
if len(orderInfo.orderId) > 0:
print(orderInfo.orderId)
print(orderInfo.orderState)
print(orderInfo.venderRemark)
print(orderInfo.remarkFlag)
#订单id
orderIds="94954811140,83181606077"
#查询订单
orderJson = rpa_JD_searchOrderByIds(orderIds)
#解析订单信息,返回OrderResult对象
orderResult = rpa_JD_parseOrderInfo(orderJson)
#解析订单查询结果
showResult(orderResult)