def _get_data(self,result={}): ''' 根据product返回result ''' #该接口mouser需要登陆才行 result['is_mouser_login'] = True #调用RealTimePrice rt = RealTimePrice(**result) args = rt.get_remote_data() #获取库存 result['stock'] = args.get('stock',0) #如果欲询价数量大于库存,就以库存为准 if result['qty'] > result['stock'] and not result.get('allow_stock',False): result['qty'] = result['stock'] #分别获取各个地区价格 part_price = args.get('part_price',[])#(price_break,us_hk,rmb_hk,hk_hk,rmb_dl) result['part_price'] = part_price #if str(product.supplier) in '29':# #part_price = args.get('cost_price_list') pc = PriceCalc(supplier=result['supplier'],partno=result['partno'],mfr=result.get('mfr',''),slug=result.get('slug','')) if part_price: price_list = pc.get_source_price_list(part_price,result['qty']) result['price_list'] = [price_list[1],price_list[2],price_list[4]] result['price_list_all'] = [price_list[1],price_list[2],price_list[3],price_list[4]] else: result['price_list'] = [0.0,0.0,0.0] result['price_list_all'] = [0.0,0.0,0.0,0.0] #获取进价 ourprice = pc._get_purch_price(args.get('p_new',[]),result['qty'],args.get('purchases_new',[])) result['category_tax'] = args.get('category_tax',1.0) result['ourprice'] = str(ourprice) #禁运标志 result['ccc_flag'] = args.get('ccc_flag','') #Stock_info # @@ $$ %% && result['stock_info'] = args.get('stock_info','') return result