def test_028_api_78dk_platform_om_trans_findTransLogList_now(self): """ 交易流水列表 今天 :return: """ res = json.loads(WebAction.test_api_78dk_platform_om_trans_findTransLogList( pagesize=10, pagecurrent=1, enddate=TimeFormat.get_now_time_13(), transstate='', begindate=TimeFormat.string_toTimestamp_13(TimeFormat.get_day_start_time(0)), searchwhere='', transtype='')) Assertion.verity(res['code'], '10000') Assertion.verity(res['msg'], '成功')
def test_005_api_78dk_platform_sys_user_saveSystemUser_now_days(self): """ 合同列表查询(申请列表) 最近30天 :return: """ res = json.loads( WebAction.test_api_78dk_platform_om_contract_viewContracts( pagecurrent=1, orderstate='', enddate=TimeFormat.get_now_time_13(), begindate=TimeFormat.string_toTimestamp_13(TimeFormat.get_day_start_time(0)), pagesize=10, name='')) Assertion.verity(res['code'], '10000') Assertion.verity(res['msg'], '成功')
def get_days(month, premise, params): """ 几月距离今天的天数 :param month: 几月 :param premise: 请求参数 :param params: 请求参数 :return: """ calls_items = list() for items in params['calls']: calls_items.extend(items['items']) calls_days = list() if premise == 'no_dial_day': dial_calls_days = list( filter(lambda x: x['dial_type'] == 'dial', calls_items)) calls_days = [t['time'] for t in dial_calls_days] elif premise == 'no_call_day': calls_days = [t['time'] for t in calls_items] elif premise in ('power_off_day', 'continue_power_off_days'): calls_days = [t['time'] for t in calls_items] smses_items = list() for items in params['smses']: smses_items.extend(items['items']) smses_days = [ '-'.join(t['time'].split('-')[:3]) + ' ' + t['time'].split('-')[-1] for t in smses_items ] calls_days.extend(smses_days) on_days = list(set(calls_days)) now, times = TimeFormat.getnow().split(' ') now_time = TimeFormat.get_now_time_13() if month == '7': day = TimeFormat.get_day_around(-7) else: time_day = TimeFormat.get_month_ago(int(month)) day = time_day.split(' ')[0] day_time = TimeFormat.string_toTimestamp_13(day + ' ' + times) days_num = len( list( filter( lambda x: day_time < int(TimeFormat.string_toTimestamp_13(x)) <= now_time, on_days))) return str(TimeFormat.time_between_day(day, now) - days_num)
def test_api_78dk_sht_mm_saveMerchantImg(uuid, key, image_path): """ 商户通商户信息接口,保存单张图片 :param uuid: 商户UUID :param key: 图片分类 :param image_path: 图片地址 :return: response.text """ start_time = time.time() ms.update(ms.get_conn(), 't_rap', 'is_exe = "Y"', 'id = 1401') requesturl = ShtAction.baseUrl + "/api/78dk/sht/mm/saveMerchantImg" LOGGER.info("商户通商户信息接口,保存单张图片请求地址:【{}】".format(requesturl)) params = dict() params["uuid"] = uuid params["key"] = key params["token"] = ShtAction.LICENCES fl = open(image_path, 'rb') API_TEST_HEADERS = {"Cache-Control": "no-cache"} multipart_encoder = MultipartEncoder(fields={ 'file': (image_path, fl, 'image/jpg'), 'key': key, 'token': ShtAction.LICENCES }, boundary=TimeFormat.get_now_time_13()) API_TEST_HEADERS['Content-Type'] = multipart_encoder.content_type API_TEST_HEADERS['token'] = ShtAction.LICENCES LOGGER.info("商户通商户信息接口,保存单张图片请求头参数:【{}】".format(API_TEST_HEADERS)) LOGGER.info("商户通商户信息接口,保存单张图片请求参数:【{0}】,请求文件地址:【{1}】".format( params, image_path)) response = rq.post(requesturl, params=params, data=multipart_encoder, headers=API_TEST_HEADERS) fl.close() LOGGER.info("请求结果参数:【{}】".format(response.text)) Assertion.verity(response.status_code, 200, "状态码检查") LOGGER.info("请求接口耗时:【{}】".format(time.time() - start_time)) return response.text
def get_jgPushId(): # 手机号 + 毫秒级时间戳(13位) jgPushId = "{0}{1}".format(app_phone, TimeFormat.get_now_time_13()) return jgPushId