createAndTrade.py 2.33 KB
# -*- coding: utf-8 -*-
"""
@Time : 2021/8/31 14:43
@Auth : wlm
@File :createAndTrade.py
@IDE :PyCharm
"""
"""
大客户模式——新增交易单
"""

from commons import common as com
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",
                "Host":"test.gateway.diligrp.com:8285",
                "Content-Length":"740"}
        self.body = {
                "sellerId":141962,
                "sellerName":"云康飞卖",
                "sellerAccountId":107663,
                "sellerCardNo":"888810062816",
                "buyerId":141966,
                "buyerName":"严永志买",
                "buyerAccountId":107675,
                "buyerCardNo":"888810055039",
                "posCode":"111222",
                "tradePassword":"111111",
                "orderItemList":[{
                    "number":0,
                    "batchCode":"2108000019",
                    "productId":44,
                    "productCode":"754107",
                    "productName":"葡萄",
                    "categoryId":754107,
                    "weightType":1,
                    "quantity":12,
                    "pieceWeight":50,
                    "grossWeight":0,
                    "tareWeight":0,
                    "weight":600,
                    "price":200,
                    "PriceStr":"2",
                    "amount":2400,
                    "amountStr":24.0,
                    "originId":510100,
                    "originName":"成都市",
                    "feeItemList":[{
                        "type":1,
                        "chargeItemId":521,
                        "chargeItemName":"买家手续费",
                        "amount":2
                    },{"type":2,
                       "chargeItemId":522,
                       "chargeItemName":"卖家手续费",
                       "amount":12}]}
                ]
            }


crat = createAndTrade()
print(crat.body)
re = hg.post(url = crat.url,json = crat.body,headers = crat.header,proxies=hg.myproxies)
print(re.json())
print(re.headers)