createBatch.py 1.63 KB
# -*- coding: utf-8 -*-

# @Time    : 2021/9/29 10:11
# @Author  : Ljq
# @File    : createBatch.py
# @Software: PyCharm

"""

"""

import sys
from commons.api.hg.CheckIn import CheckInMoreGoods as CIMG
from commons.scripts.readConf import rC
from commons.MySession import sessionHg



class createBat(object):
    def __init__(self):
        data = {i.split("=")[0]: i.split("=")[1] for i in sys.argv if "=" in i}
        print(data)
        if "ic" not in data.keys() or data["ic"] == "":
            self.ic = rC.returnOptionsItems("testInfo", "hg_cardNumRe_01")
        if "goodsName" not in data.keys() or data["goodsName"] == "":
            self.goodsName = "葡萄"
        if "allLevelKeyword" not in data.keys() or data["allLevelKeyword"] == "":
            self.allLevelKeyword = "万州"
        if "nameLike" not in data.keys() or data["nameLike"] == "":
            self.nameLike = "西区"
        if "tradePassword" not in data.keys() or data["tradePassword"] == "":
            self.tradePassword = "111111"
        if "weight" not in data.keys() or data["weight"] == "":
            self.weight = "50"

        # host信息准备
        self.host = rC.returnOptionsItems("host", "gatewayHost")

    def main(self):
        print("main")
        res = CIMG.create_registerRecord(session=sessionHg,ic=self.ic,host=self.host,goodsName=self.goodsName,
                                         allLevelKeyword=self.allLevelKeyword,nameLike=self.nameLike,
                                         tradePassword=self.tradePassword,weight=self.weight)
        print(res.text)
        print(res.json()["data"]["batchCode"])


# 调用
createBat = createBat().main()