Commit 8151fd789db2fdbef8fe667f3168b034a59ce037

Authored by wenleiming
1 parent 2bb52757

大客户模式——新增交易单

commons/api/transaction/createAndTrade.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/8/31 14:43
  4 +@Auth : wlm
  5 +@File :createAndTrade.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +大客户模式——新增交易单
  10 +"""
  11 +
  12 +from commons import common as com
  13 +from commons.MySession import hg
  14 +
  15 +class createAndTrade():
  16 + url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/createAndTrade"
  17 + header = {
  18 + "UAP_accessToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJXRUIiLCJuYmYiOjE2MzAzOTE5MjQsImRhdGEiOiJ7XCJjZWxscGhvbmVcIjpcIjE4ODU5ODk4ODk1XCIsXCJjcmVhdGVkXCI6MTYyOTg1NzY2NDAwMCxcImRlcGFydG1lbnRJZFwiOjE3NixcImVtYWlsXCI6XCJoYW5nZ3Vvamlla3VhbkBkaWxpZ3JwLmNvbVwiLFwiZmlybUNvZGVcIjpcImh6Z3BcIixcImZpcm1JZFwiOjE1LFwiZmlybU5hbWVcIjpcIuadreW3nuaenOWTgeW4guWculwiLFwiaWRcIjo0NTMsXCJsYXN0TG9naW5UaW1lXCI6MTYzMDM5MTkyNDU4NixcIm1ldGFkYXRhXCI6e30sXCJtb2RpZmllZFwiOjE2Mjk5NTkxMTAwMDAsXCJwYXNzd29yZFwiOlwiMTg5NjVFQjcyQzkyQTU0OUREXCIsXCJyZWFsTmFtZVwiOlwi5p2t5p6c5YCf5qy-XCIsXCJzZXJpYWxOdW1iZXJcIjpcIjAwMFwiLFwic3RhdGVcIjoxLFwic3lzdGVtVHlwZVwiOjEsXCJ1c2VyTmFtZVwiOlwiMTExMjIyXCIsXCJ1c2VyVHlwZVwiOjF9IiwiaXNzIjoiVUFQX0FVVEgwIiwiZXhwIjoxNjMwNDA5OTI0LCJpYXQiOjE2MzAzOTE5MjQsImp0aSI6IjU4OWNkZThlLWE3NDItNDk5OC1hYmRiLWQ5NmFkMWM4NzZkNyJ9.j4-_Y2YakS275AjYni_x3aYwHP0G8SVczSeWl4zi7OdP_SOKUpFdKl-sD5vSDeJAH4RDV0_ZwrPLjCWGMaLPVXpdin5NT8_oiJqyovvJt3ZyGO_PB-MtO7-biDuhnARdOAOuI1_-9kd3Bj4PbZ0-PhHw8LGBaKlo4uByp-wbj-Q",
  19 + "UAP_refreshToken":"86ae066b-9446-408f-9bc6-b7ae3550ea7b",
  20 + "Content-Type":"application/json;charset=utf-8",
  21 + "Host":"test.gateway.diligrp.com:8285",
  22 + "Content-Length":"740"
  23 + }
  24 +
  25 + body = {
  26 + "sellerId":141962,
  27 + "sellerName":"云康飞卖",
  28 + "sellerAccountId":107663,
  29 + "sellerCardNo":"888810062816",
  30 + "buyerId":141966,
  31 + "buyerName":"严永志买",
  32 + "buyerAccountId":107675,
  33 + "buyerCardNo":"888810055039",
  34 + "posCode":"111222",
  35 + "tradePassword":"111111",
  36 + "orderItemList":[{
  37 + "number":0,
  38 + "batchCode":"2108000019",
  39 + "productId":44,
  40 + "productCode":"754107",
  41 + "productName":"葡萄",
  42 + "categoryId":754107,
  43 + "weightType":1,
  44 + "quantity":12,
  45 + "pieceWeight":50,
  46 + "grossWeight":0,
  47 + "tareWeight":0,
  48 + "weight":600,
  49 + "price":200,
  50 + "PriceStr":"2",
  51 + "amount":2400,
  52 + "amountStr":24.0,
  53 + "originId":510100,
  54 + "originName":"成都市",
  55 + "feeItemList":[{
  56 + "type":1,
  57 + "chargeItemId":521,
  58 + "chargeItemName":"买家手续费",
  59 + "amount":2
  60 + },{"type":2,
  61 + "chargeItemId":522,
  62 + "chargeItemName":"卖家手续费",
  63 + "amount":12}]}
  64 + ]
  65 + }
  66 +
  67 + def __init__(self):
  68 + self.url = createAndTrade.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") )
  69 + self.header = createAndTrade.header
  70 + self.body = createAndTrade.body
  71 +
  72 +
  73 +crat = createAndTrade()
  74 +print(crat.body)
  75 +re = hg.post(url = crat.url,data = crat.body.encode('utf-8'),headers = crat.header)
  76 +print(re.json())
  77 +print(re.headers)
0 78 \ No newline at end of file
... ...