def setup_class(self): self.url = config.get_url() self.log = MyLog().logger() self.rand = random_param.Random_param() self.word = ParseWord.ParseWord(config.get_word()) self.web = web.Web() self.db = db_query.DBQuery() # 客服登录 self.service_login_result = self.web.user_login_web( 19900000001, '123456') # 车队登录 self.fleet_login_result = self.web.user_login_web( 19933334444, '123456') self.fleet_id = self.web.get_user_info(*self.fleet_login_result) # 管理员登录 self.admin_user_id = self.web.user_login_web(19999999999, '123456')
def __init__(self): # 初始化 self.web = web.Web() self.url = config.get_url() self.log = MyLog().logger() self.rand = random_param.Random_param() self.word = ParseWord.ParseWord(config.get_word()) self.library = cdll.LoadLibrary(config.get_library()) self.app = app.Common() self.app.initSDK(library=self.library, init_info=config.get_app_url()) # 客服登录 self.service_login_result = self.web.user_login_web( 19900000001, '123456') self.service_headers = { "token": self.service_login_result[0], "user_id": self.service_login_result[1], "cpy_id": "0", "dt_type": "1", "user_type": "4", "product_id": "2020", } # 小五登录 self.xiaowu_login_result = self.web.user_login_web( 19900000002, '123456') self.xiaowu_headers = { "token": self.xiaowu_login_result[0], "user_id": self.xiaowu_login_result[1], "cpy_id": "0", "dt_type": "1", "user_type": "5", "product_id": "2020" } # 调度登录 login_info = self.app.app_login(library=self.library, username=19933330000, password=123456) self.dispatch_user_id = eval(login_info["pBody"])["i"]
# _*_ coding: utf-8 _*_ # @Author : XuTusheng # @Time : 2020/3/5 # @PROJECT : di5cheng-IT-AUV # @File : add_capacity.py import random import asyncio import requests from common import config from common import provide_data from common.logger import MyLog null = None fleet_url = config.get_url() def user_login_web(username, password): password_md5 = config.get_md5(password) url = fleet_url + 'paas/mm/userlogin?md=10&cmd=01' param = {"a": username, "b": password_md5} r = requests.post(url=url, json=param) response = eval(r.text) MyLog().logger().info(response) token, user_id = response['k'], response['b'] return token, str(user_id) def get_user_info(*args): url = fleet_url + 'saas/res/org/userInfo'
# _*_ coding: utf-8 _*_ # @Author : XuTusheng # @Time : 2020/3/6 # @PROJECT : di5cheng-IT-AUV # @File : service.py import requests from common.logger import MyLog from common import config null = None url_service = config.get_url() class Service: global null def userlogin(self, a, b): # 登录 url = url_service + "paas/mm/userlogin?md=10&cmd=01" # 给密码进行MD5加密 b_md5 = config.get_md5(b) param = {"a": a, "b": b_md5} r = requests.post(url=url, json=param) response = eval(r.text) MyLog().logger().info(response) return response def queryUserBasicInfo(self, user_id):
def __init__(self): self.url = config.get_url()