def get_delivery_type(pid=None, env='QA', storeId=None, deliveryType=1, goodsId=""): opera = OperationIni(fileName='config.ini', pathName='config') get_access_token = GetAccessToken(env=env, pid=pid) print(pid) # env字符串转小写 x_env = env.lower() key = x_env + '_url' base_url = opera.read_ini(section='goods', key=key) path = opera.read_ini(section='goods', key='deliveryType') access_token = get_access_token.get_ini_access_token() url = base_url.format(path, access_token) json_data = {"pid": pid, "storeId": storeId, "goodsId": goodsId} log.info('开始:调用get_delivery_type方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) requests.packages.urllib3.disable_warnings() r = requests.post(url=url, json=json_data, verify=False) # 如果access_token无效 if r.json()['data'] == 'invalid accesstoken': # 获取最新的token并存入ini文件 log.warning('提示:ini文件中的accesstoken失效,开始获取新的accesstoken') get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = get_access_token.get_ini_access_token() url = base_url.format(path, new_access_token) log.warning('开始:调用get_delivery_type方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) requests.packages.urllib3.disable_warnings() res = requests.post(url=url, json=json_data, verify=False) try: deliveryTypeId = delivery_type(result=res.json(), deliveryType=deliveryType) log.warning( '结束:调用get_delivery_type方法,返回数据为:{0},返回deliveryTypeId为:{1}'. format(res.json(), deliveryTypeId)) return res.json(), deliveryTypeId except Exception as f: log.error('调用查询配送方式接口失败,错误日志为:{0}'.format(f)) return r.json() elif r.json()['code']['errmsg'] == '根据Pid查询storeId失败,此商家不存在此门店': # 获取最新的token并存入ini文件 log.warning('提示:根据Pid查询storeId失败,此商家不存在此门店,尝试开始获取新的accesstoken') get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = get_access_token.get_ini_access_token() url = base_url.format(path, new_access_token) log.warning('开始:调用get_delivery_type方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) requests.packages.urllib3.disable_warnings() res = requests.post(url=url, json=json_data, verify=False) try: deliveryTypeId = delivery_type(result=res.json(), deliveryType=deliveryType) log.warning( '结束:调用get_delivery_type方法,返回数据为:{0},返回deliveryTypeId为:{1}'. format(res.json(), deliveryTypeId)) return res.json(), deliveryTypeId except Exception as f: log.error('调用查询配送方式接口失败,错误日志为:{0}'.format(f)) return res.json() else: deliveryTypeId = delivery_type(result=r.json(), deliveryType=deliveryType) log.info( '结束:调用get_delivery_type方法,返回数据为:{0},返回deliveryTypeId为:{1}'.format( r.json(), deliveryTypeId)) # print('ddddd:',deliveryTypeId) return r.json(), deliveryTypeId
class updateGoodsPrice: def __init__(self, env='QA'): self.log = Logger("debug") self.opera = OperationIni(fileName='config.ini', pathName='config') self.get_skuId = GetGoodsDetail(env=env) self.get_access_token = GetAccessToken(env=env) # env字符串转小写 env = env.lower() key = env + '_url' self.base_url = self.opera.read_ini(section='goods', key=key) self.path = self.opera.read_ini(section='goods', key='updatePrice') self.access_token = self.get_access_token.get_ini_access_token() def update_goods_price(self, storeId, goodsId, originalPrice, salePrice): ''' 修改商品价格 :param storeId: 门店id :param goodsId: 商品id :param originalPrice: 市场价 :param salePrice: 商家统一价 :return: rsq ''' url = self.base_url.format(self.path, self.access_token) # 获取skuId try: self.skuId = self.get_skuId.get_goods_detail(goodsId, storeId)[1] json_data = { 'goodsId': goodsId, 'skuList': [{ 'skuId': self.skuId, 'originalPrice': originalPrice, 'salePrice': salePrice, }], 'storeId': storeId } self.log.info('开始:调用update_goods_price方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) r = requests.post(url=url, json=json_data) # 如果access_token无效 if r.json()['data'] == 'invalid accesstoken': self.log.warning('提示:ini文件中的accesstoken失效,开始获取新的accesstoken') # 获取最新的token并存入ini文件 self.get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = self.get_access_token.get_ini_access_token() url = self.base_url.format(self.path, new_access_token) self.log.warning( '开始:调用update_goods_price方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) res = requests.post(url=url, json=json_data) self.log.warning('结束:调用update_goods_price方法,返回数据为:{0}'.format( res.json())) return res.json() else: self.log.info('结束:调用update_goods_price方法,返回数据为:{0}'.format( r.json())) return r.json() except Exception as f: self.log.error('修改商品失败,错误日志为:{0}'.format(f)) return {'msg': '底层接口请求失败,请检查所传字段的数据是否正确'}
class updateGoodsShelfStatus: def __init__(self, pid, env='QA'): self.log = Logger("debug") opera = OperationIni(fileName='config.ini', pathName='config') self.get_skuId = GetGoodsDetail(env=env, pid=pid) self.get_access_token = GetAccessToken(env=env, pid=pid) # env字符串转小写 env = env.lower() key = env + '_url' self.base_url = opera.read_ini(section='goods', key=key) self.path = opera.read_ini(section='goods', key='updateGoodsShelfStatus') self.access_token = self.get_access_token.get_ini_access_token() def update_goods_shelf_status(self, goodsIdList, isPutAway, storeId=None): ''' 批量修改商品上下架状态 :param goodsIdList: 商品id,限制50个,list类型 :param isPutAway: 商品上、下架0:上架 1:下架 :param storeId: 门店id :return: rsq ''' url = self.base_url.format(self.path, self.access_token) # 把goodsIdList中的多个goodsId转成list类型,并保证list中的元素类型为int goodsIdLists = list(map(int, goodsIdList.split(','))) json_data = { 'storeId': storeId, 'goodsIdList': goodsIdLists, 'isPutAway': isPutAway } self.log.info( '开始:调用update_goods_shelf_status方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) requests.packages.urllib3.disable_warnings() r = requests.post(url=url, json=json_data, verify=False) # 如果access_token无效 if r.json()['data'] == 'invalid accesstoken': # 获取最新的token并存入ini文件 self.log.warning('提示:ini文件中的accesstoken失效,开始获取新的accesstoken') self.get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = self.get_access_token.get_ini_access_token() url = self.base_url.format(self.path, new_access_token) self.log.warning( '开始:调用update_goods_shelf_status方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) requests.packages.urllib3.disable_warnings() res = requests.post(url=url, json=json_data, verify=False) self.log.warning( '结束:调用update_goods_shelf_status方法,返回数据为:{0}'.format( res.json())) return res.json() else: self.log.info('结束:调用update_goods_shelf_status方法,返回数据为:{0}'.format( r.json())) return r.json()
class updateGoodsStock: def __init__(self, env='QA'): self.log = Logger("debug") opera = OperationIni(fileName='config.ini', pathName='config') self.get_skuId = GetGoodsDetail(env=env) self.get_access_token = GetAccessToken(env=env) # env字符串转小写 env = env.lower() key = env + '_url' self.base_url = opera.read_ini(section='goods', key=key) self.path = opera.read_ini(section='goods', key='wholeUpdateStock') self.access_token = self.get_access_token.get_ini_access_token() # if env == 'QA': # self.access_token = opera.read_ini(section='access_token', key='qa_access_token') # if env == 'DEV': # self.access_token = opera.read_ini(section='access_token', key='dev_access_token') def update_goods_stock(self, goodsId, editStockNum, storeId=None): ''' 修改商品库存 :param goodsId: 商品id :param editStockNum: 需要修改的库存 :param storeId: 门店id :return: rsq ''' url = self.base_url.format(self.path, self.access_token) # 获取skuId try: self.skuId = self.get_skuId.get_goods_detail(goodsId, storeId)[1] json_data = { 'goodsId': goodsId, 'storeId': storeId, 'skuList': [{ 'skuId': self.skuId, 'editStockNum': editStockNum }] } self.log.info('开始:调用update_goods_stock方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) r = requests.post(url=url, json=json_data) # 如果access_token无效 if r.json()['data'] == 'invalid accesstoken': # 获取最新的token并存入ini文件 self.log.warning('提示:ini文件中的accesstoken失效,开始获取新的accesstoken') self.get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = self.get_access_token.get_ini_access_token() url = self.base_url.format(self.path, new_access_token) self.log.warning( '开始:调用update_goods_stock方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) res = requests.post(url=url, json=json_data) self.log.warning('结束:调用update_goods_stock方法,返回数据为:{0}'.format( res.json())) return res.json() else: self.log.info('结束:调用update_goods_stock方法,返回数据为:{0}'.format( r.json())) return r.json() except Exception as f: self.log.error('调用获取商品详情接口失败,错误日志为:{0}'.format(f)) return {'msg': '底层接口请求失败,请检查所传字段的数据是否正确'}
class GetGoodsDetail: def __init__(self, env='QA'): self.log = Logger("debug") opera = OperationIni(fileName='config.ini', pathName='config') self.env = env self.get_access_token = GetAccessToken(env=env) # env字符串转小写 env = env.lower() key = env + '_url' self.url = opera.read_ini(section='goods', key=key) self.path = opera.read_ini(section='goods', key='queryGoodsDetail') self.access_token = self.get_access_token.get_ini_access_token() # if env == 'QA': # self.access_token = opera.read_ini(section='access_token', key='qa_access_token') # if env == 'DEV': # self.access_token = opera.read_ini(section='access_token', key='dev_access_token') def get_goods_detail(self, goodsId, storeId=None): ''' 获取商品详情 :param goodsId: 商品id :param storeId: 门店id :return: rsq, 商品skuId ''' url = self.url.format(self.path, self.access_token) # json_data = None if storeId == None: json_data = {'goodsId': goodsId} else: json_data = {'goodsId': goodsId, 'storeId': storeId} self.log.info('开始:调用get_goods_detail方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) r = requests.post(url=url, json=json_data) # 如果access_token无效 if r.json()['data'] == 'invalid accesstoken': # 获取最新的token并存入ini文件 self.log.warning('提示:ini文件中的accesstoken失效,开始获取新的accesstoken') self.get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = self.get_access_token.get_ini_access_token() self.log.warning( '开始:调用get_goods_detail方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) url = self.url.format(self.path, new_access_token) res = requests.post(url=url, json=json_data) # print(res.json(), url, json_data) try: skuId = res.json()['data']['goods']['skuList'][0]['skuId'] self.log.warning( '结束:调用get_goods_detail方法,返回数据为:{0},返回skuId为:{1}'.format( res.json(), skuId)) return res.json(), skuId except Exception as f: # print(f) self.log.error('调用获取商品详情接口失败,错误日志为:{0}'.format(f)) # return {'msg': '底层接口请求失败,请检查所传字段的数据是否正确'} return res.json() elif r.json()['code']['errmsg'] == '根据Pid查询storeId失败,此商家不存在此门店': # print(r.json()['code']['errmsg']) # return r.json()['code']['errmsg'] # 获取最新的token并存入ini文件 self.log.warning( '提示:根据Pid查询storeId失败,此商家不存在此门店,尝试开始获取新的accesstoken') self.get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = self.get_access_token.get_ini_access_token() url = self.url.format(self.path, new_access_token) self.log.warning( '开始:调用get_goods_detail方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) res = requests.post(url=url, json=json_data) # print(res.json(), url, json_data) try: skuId = res.json()['data']['goods']['skuList'][0]['skuId'] self.log.warning( '结束:调用get_goods_detail方法,返回数据为:{0},返回skuId为:{1}'.format( res.json(), skuId)) return res.json(), skuId except Exception as f: # print(f) self.log.error('调用获取商品详情接口失败,错误日志为:{0}'.format(f)) # return {'msg': '底层接口请求失败,请检查所传字段的数据是否正确'} return res.json() else: try: skuId = r.json()['data']['goods']['skuList'][0]['skuId'] self.log.info( '结束:调用get_goods_detail方法,返回数据为:{0},返回skuId为:{1}'.format( r.json(), skuId)) return r.json(), r.json( )['data']['goods']['skuList'][0]['skuId'] except Exception as f: # print(f) self.log.error('调用获取商品详情接口失败1,错误日志为:{0}'.format(f)) # return {'msg': '底层接口请求失败,请检查所传字段的数据是否正确'} return r.json()
class addGoods: def __init__(self, pid, env='QA'): self.log = Logger("debug") opera = OperationIni(fileName='config.ini', pathName='config') self.env = env self.pid = pid self.get_access_token = GetAccessToken(env=env, pid=pid) # env字符串转小写 env = env.lower() key = env + '_url' self.url = opera.read_ini(section='goods', key=key) self.path = opera.read_ini(section='goods', key='addgoods') self.access_token = self.get_access_token.get_ini_access_token() def add_goods(self, storeId=None, outerGoodsCode=None, outerSkuCode=None, deliveryTypeIdList=None, title=None, salePrice=None, originalPrice=None, adviseSalePriceMin=None, adviseSalePriceMax=None, goodsImageUrl=None): """ 新增商品 :param storeId: 门店id :param outerGoodsCode: 外部spu编码 :param outerSkuCode: 商家编码 :param deliveryTypeIdList: 配送类型列表,可传多个配送类型,用,隔开(1.同城限时达;2.全城配;3.包含1和2) :param title: 商品标题 :param salePrice: 售价 :param originalPrice: 市场价 :param adviseSalePriceMin: 门店售价范围开始值 :param adviseSalePriceMax: 门店售价范围结束值 :param goodsImageUrl: 商品图片 :return: """ url = self.url.format(self.path, self.access_token) pid = self.pid if self.pid == None: if self.env == 'QA': pid = 1 if self.env == 'DEV': pid = 17 # TODO 预留prod环境 if self.env == 'PROD': pid = 17 # print(pid) if storeId == None: if self.env == "QA": storeId = 1001 if self.env == "DEV": storeId = 3017 # TODO 预留prod环境 if self.env == "PROD": storeId = 3017 if outerGoodsCode == None: # 使用秒级时间戳自动拼接spu t = int(time.time()) d = 'spu' + str(t) outerGoodsCode = d # 商家编码 if outerSkuCode != None: outerSkuCode = outerSkuCode deliveryTypeId = None if deliveryTypeIdList != None: if deliveryTypeIdList == '3': deliveryTypeId = get_delivery_type( env=self.env, pid=pid, storeId=storeId, deliveryType=int(deliveryTypeIdList))[1] if deliveryTypeId == None: return {"status": 103, "message": "当前门店该配送方式不存在"} elif len(deliveryTypeId) < 2: return { "status": 104, "message": "当前门店只有一种配送方式,请重新传递配送方式ID" } else: deliveryTypeId = deliveryTypeId else: deliveryType = get_delivery_type( env=self.env, pid=self.pid, storeId=storeId, deliveryType=int(deliveryTypeIdList))[1] if deliveryType == None: return {"status": 103, "message": "当前门店该配送方式不存在"} else: deliveryTypeId = [] deliveryTypeId.append(deliveryType) if deliveryTypeIdList == None: if self.env == "QA": deliveryTypeId = [2] if self.env == "DEV": deliveryTypeId = [209435] # TODO 预留prod环境 if self.env == "PROD": deliveryTypeId = [209435] if salePrice == None: salePrice = 0.01 # if originalPrice == None: # originalPrice = 1 if adviseSalePriceMin == None: adviseSalePriceMin = 0.01 if adviseSalePriceMax == None: adviseSalePriceMax = 1 if goodsImageUrl == None: goodsImageUrl = "https://image-c.weimobmxd.com/saas-wxbiz/a016cb2de441406289433fd0c71c56bd.png" json_data = { "storeId": storeId, "goods": { "b2cGoods": { "deliveryTypeIdList": deliveryTypeId, "b2cGoodsType": 0 }, "categoryId": 274, "title": title, "isMultiSku": 0, "outerGoodsCode": outerGoodsCode, "goodsTagId": "", "goodsDesc": "", "goodsTemplateId": -1, "isMemberShipDiscount": 0, "deductStockType": 1, "isCanSell": 1, "isAutoCanSell": 0, "isAutoForbidSell": 0, "startSellTime": None, "startForbidTime": None, "categoryNameTree": "食品,零食/坚果/特产,其他休闲零食", "skuList": [{ "outerSkuCode": outerSkuCode, "productType": 1, "singleProductId": 116130117, "combineProduct": {}, "salePrice": salePrice, "adviseSalePriceMin": adviseSalePriceMin, "adviseSalePriceMax": adviseSalePriceMax, "originalPrice": originalPrice, "b2cSku": { "weight": None, "volume": None }, "isDisabled": False, "editStockNum": 0 }], "selectedGoodsAttrList": [], "selectedSaleAttrList": [], "goodsVideoUrl": None, "goodsVideoImageUrl": None, "limitBuyNum": 0, "isPutAway": 0, "saleChannelType": 3, "selectedGoodsPropList": [], "selectedInnerGoodsPropList": [], "goodsImageUrl": [goodsImageUrl], "goodsBrandId": "" } } self.log.info('开始:调用add_goods方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) requests.packages.urllib3.disable_warnings() r = requests.post(url=url, json=json_data, verify=False) # print(r.json()) # 如果access_token无效 if r.json()['data'] == 'invalid accesstoken': # 获取最新的token并存入ini文件 self.log.warning('提示:ini文件中的accesstoken失效,开始获取新的accesstoken') self.get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = self.get_access_token.get_ini_access_token() url = self.url.format(self.path, new_access_token) self.log.warning('开始:调用add_goods方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) requests.packages.urllib3.disable_warnings() res = requests.post(url=url, json=json_data, verify=False) # print(res.json(), url, json_data) try: goodsId = res.json()['data']['goodsId'] skuId = res.json()['data']['skuList'][0]['skuId'] self.log.warning( '结束:调用add_goods方法,返回数据为:{0},返回goodsId为:{1},返回skuId为:{2}'. format(res.json(), goodsId, skuId)) return res.json(), goodsId, skuId except Exception as f: # print(f) self.log.error('调用新增商品接口失败,错误日志为:{0}'.format(f)) # return {'msg': '底层接口请求失败,请检查所传字段的数据是否正确'} return res.json() elif r.json()['code']['errmsg'] == '根据Pid查询storeId失败,此商家不存在此门店': # print(r.json()['code']['errmsg']) # return r.json()['code']['errmsg'] # 获取最新的token并存入ini文件 self.log.warning( '提示:根据Pid查询storeId失败,此商家不存在此门店,尝试开始获取新的accesstoken') self.get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = self.get_access_token.get_ini_access_token() url = self.url.format(self.path, new_access_token) self.log.warning('开始:调用add_goods方法,请求地址为:{0},入参为:{1}'.format( url, json_data)) requests.packages.urllib3.disable_warnings() res = requests.post(url=url, json=json_data, verify=False) # print(res.json(), url, json_data) try: goodsId = res.json()['data']['goodsId'] skuId = res.json()['data']['skuList'][0]['skuId'] self.log.warning( '结束:调用add_goods方法,返回数据为:{0},返回goodsId为:{1},返回skuId为:{2}'. format(res.json(), goodsId, skuId)) return res.json(), goodsId, skuId except Exception as f: # print(f) self.log.error('调用新增商品接口失败,错误日志为:{0}'.format(f)) return {'msg': '根据Pid查询storeId失败,此商家不存在此门店,请检查storeId是否正确'} else: try: goodsId = r.json()['data']['goodsId'] skuId = r.json()['data']['skuList'][0]['skuId'] self.log.warning( '结束:调用add_goods方法,返回数据为:{0},返回goodsId为:{1},返回skuId为:{2}'. format(r.json(), goodsId, skuId)) return r.json(), goodsId, skuId except Exception as f: # print(f) self.log.error('调用新增商品接口失败1,错误日志为:{0}'.format(f)) # return {'msg': '底层接口请求失败,请检查所传字段的数据是否正确'} return r.json()
class GetOrderDetail: def __init__(self, pid, env='QA'): self.log = Logger("debug") opera = OperationIni(fileName='config.ini', pathName='config') self.env = env self.get_access_token = GetAccessToken(env=env, pid=pid) # env字符串转小写 env = env.lower() key = env + '_url' self.url = opera.read_ini(section='goods', key=key) self.path = opera.read_ini(section='goods', key='queryOrderDetail') self.access_token = self.get_access_token.get_ini_access_token() def get_order_detail(self, orderNo): ''' 获取订单详情 :param orderNo: 订单id :return: rsq ''' url = self.url.format(self.path, self.access_token) json_data = {'orderNo': orderNo} self.log.info('开始:调用get_order_detail方法,请求地址为:{0},入参为:{1}'.format(url, json_data)) requests.packages.urllib3.disable_warnings() r = requests.post(url=url, json=json_data, verify=False) # 如果access_token无效 if r.json()['data'] == 'invalid accesstoken': # 获取最新的token并存入ini文件 self.log.warning('提示:ini文件中的accesstoken失效,开始获取新的accesstoken') self.get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = self.get_access_token.get_ini_access_token() self.log.warning('开始:调用get_order_detail方法,请求地址为:{0},入参为:{1}'.format(url, json_data)) url = self.url.format(self.path, new_access_token) requests.packages.urllib3.disable_warnings() res = requests.post(url=url, json=json_data, verify=False) # print(res.json(), url, json_data) try: self.log.warning('结束:调用get_order_detail方法,返回数据为:{0}'.format(res.json())) return res.json() except Exception as f: # print(f) self.log.error('调用获取商品详情接口失败,错误日志为:{0}'.format(f)) # return {'msg': '底层接口请求失败,请检查所传字段的数据是否正确'} return res.json() elif r.json()['code']['errmsg'] == '根据Pid查询storeId失败,此商家不存在此门店': # print(r.json()['code']['errmsg']) # return r.json()['code']['errmsg'] # 获取最新的token并存入ini文件 self.log.warning('提示:根据Pid查询storeId失败,此商家不存在此门店,尝试开始获取新的accesstoken') self.get_access_token.set_access_token() # 注意:这里一定要重新获取一次ini文件中的access_token new_access_token = self.get_access_token.get_ini_access_token() url = self.url.format(self.path, new_access_token) self.log.warning('开始:调用get_order_detail方法,请求地址为:{0},入参为:{1}'.format(url, json_data)) requests.packages.urllib3.disable_warnings() res = requests.post(url=url, json=json_data, verify=False) # print(res.json(), url, json_data) try: self.log.warning('结束:调用get_order_detail方法,返回数据为:{0}'.format(res.json())) return res.json() except Exception as f: # print(f) self.log.error('调用获取商品详情接口失败,错误日志为:{0}'.format(f)) # return {'msg': '底层接口请求失败,请检查所传字段的数据是否正确'} return res.json() else: try: self.log.info('结束:调用get_order_detail方法,返回数据为:{0}'.format(r.json())) return r.json() except Exception as f: # print(f) self.log.error('调用获取商品详情接口失败1,错误日志为:{0}'.format(f)) # return {'msg': '底层接口请求失败,请检查所传字段的数据是否正确'} return r.json() def get_order_item_id_skuNum(self, orderNo): ''' 获取订单pickingPackageList,storeId,wid :param orderNo: 订单号 :return: 返回pickingPackageList,storeId,wid ''' # 调用get_order_detail方法获取返回订单详情数据 result = self.get_order_detail(orderNo=orderNo) try: itemList = result['data']['itemList'] # 获取该笔订单下的storeId storeId = result['data']['merchantInfo']['storeId'] # 获取该笔订单下的wid wid = result['data']['buyerInfo']['wid'] pickingPackageList = [] for i in itemList: # 获取itemId itemId = i['id'] # 获取pickSkuNum pickSkuNum = i['skuNum'] d = {"itemId": itemId, "pickSkuNum": pickSkuNum} pickingPackageList.append(d) return pickingPackageList, storeId, wid except Exception as f: self.log.error('获取订单详情中的字段失败,错误日志为:{0}'.format(f))