createAndTrade.py
3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
"""
@Time : 2021/8/31 14:43
@Auth : wlm
@File :createAndTrade.py
@IDE :PyCharm
"""
"""
大客户模式——新增交易单
"""
from commons.basic.registerRecord_save import registerRecord_save
from commons.MySession import hg
class createAndTrade():
def __init__(self):
self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/createAndTrade"
self.header = {
"UAP_accessToken":"demo",
"UAP_refreshToken":"demo",
"Content-Type":"application/json;charset=utf-8"}
# 大客户body
self.body = {"sellerId":141992,"sellerName":"特朗普vip","sellerAccountId":107792,"sellerCardNo":"888810026785","buyerId":141995,"buyerName":"拜登","buyerAccountId":107791,"buyerCardNo":"888810043394","posCode":"666","tradePassword":"111111","orderItemList":[{"number":0,"batchCode":"2109000067","productId":125,"productCode":"374690","productName":"苹果","categoryId":374690,"weightType":1,"quantity":1,"pieceWeight":1,"grossWeight":0,"tareWeight":0,"weight":1,"price":2000,"PriceStr":"20","amount":2000,"amountStr":20.0,"originId":510100,"originName":"成都市","feeItemList":[{"type":1,"chargeItemId":521,"chargeItemName":"买家手续费","amount":550.0},{"type":2,"chargeItemId":522,"chargeItemName":"卖家手续费","amount":989.00}]}]}
#普通客户body
self.body1={"sellerId":141995,"sellerName":"拜登","sellerAccountId":107791,"sellerCardNo":"888810043394","buyerId":141992,"buyerName":"特朗普vip","buyerAccountId":107792,"buyerCardNo":"888810026785","posCode":"666","tradePassword":"111111","orderItemList":[{"number":0,"batchCode":"2109000073","productId":125,"productCode":"374690","productName":"苹果","categoryId":374690,"weightType":1,"quantity":1,"pieceWeight":1,"grossWeight":0,"tareWeight":0,"weight":1,"price":2000,"PriceStr":"20","amount":2000,"amountStr":20.0,"originId":510100,"originName":"成都市","feeItemList":[{"type":1,"chargeItemId":521,"chargeItemName":"买家手续费","amount":550.0},{"type":2,"chargeItemId":522,"chargeItemName":"卖家手续费","amount":989.00}]}]}
#大客户-有装卸费和其他费,pos机号已经改变
self.body2= {"sellerId":141992,"sellerName":"特朗普vip","sellerAccountId":107792,"sellerCardNo":"888810026785","buyerId":141995,"buyerName":"拜登","buyerAccountId":107791,"buyerCardNo":"888810043394","posCode":"111666","tradePassword":"111111","orderItemList":[{"number":0,"batchCode":"2109000522","productId":632,"productCode":"374690","productName":"苹果","categoryId":374690,"weightType":1,"quantity":50,"pieceWeight":1,"grossWeight":0,"tareWeight":0,"weight":50,"price":100,"PriceStr":"1","amount":5000,"amountStr":50.0,"originId":100000000,"originName":"安提瓜和巴布达","feeItemList":[{"type":1,"chargeItemId":521,"chargeItemName":"买家手续费","amount":1122.00},{"type":2,"chargeItemId":522,"chargeItemName":"卖家手续费","amount":356.00},{"type":2,"chargeItemId":527,"chargeItemName":"卖家仓储服务费","amount":522.00}]}]}
# dd=registerRecord_save()
# tt = createAndTrade()
#
# #进门
# re1 = hg.post(url = dd.url,json = dd.body2,headers = dd.header,proxies=hg.myproxies)
# print(re1.json())
#
# #创建交易单
# tt.body2["orderItemList"][0]["batchCode"]=re1.json()["data"]["batchCode"]
# re2 = hg.post(url = tt.url,json = tt.body2,headers = tt.header,proxies=hg.myproxies)
# print(re2.json())