getLookupList.py 1.84 KB
# -*- coding: utf-8 -*-

# @Time    : 2021/8/10 17:40
# @Author  : Ljq
# @File    : getLookupList.py
# @Software: PyCharm

"""
进门列表基础数据获取接口
"""

import json,time,random,re
from commons.scripts import dealContentType as dct
from commons.scripts import jsonToUrlcode
from commons.MySession import my

def get_LookupList(host="",providerName="车型"):
    """基础数据获取接口
    :param  providerName:
    :return:
            [{'text': '蔬菜', 'value': '14152'}]
    """
    providerDict = {"车型": "carTypeForJmsfProvider", "货物品类": "categoryProvider", "接车部门": "authDepartmentProvider",
                    "称重类型": "entranceFeeBillTypeProvider", "状态": "entranceFeeBillStateProvider",
                    "交易类型": "tradeTypeProvider"}
    url = host + "/provider/getLookupList.action"
    # print(providerName)
    data = {"provider":providerDict[providerName]}
    headers = dct.urlCode()
    res = my.useHeadersRequests(method="POST", url=url, data=data, headers=headers)
    return res

def get_reach(host="",depId="56"):
    """通过部门编号获取区域"""
    url = host + "/api/jmsf/ajax/district/search.action"
    data = {"depId":depId}
    headers = dct.urlCode()
    res = my.useHeadersRequests(method="POST", url=url, data=data, headers=headers)
    return res

def get_product(host="",productName="蔬菜"):
    """通过部门编号获取区域"""
    url = host + f"/category/search.action?name={productName}"
    data = {"name":productName,"keyword":productName}
    headers = dct.urlCode()
    res = my.useHeadersRequests(method="get", url=url, params=data, headers=headers)
    return res

# host="http://test.jmsf.diligrp.com:8385"
# print(get_LookupList(host=host,providerName="货物品类").json())
# print(get_reach(host).json())
# print(get_category(host=host,productName="蔬菜").json())