From fc56832f76ffd34d50d8f25d0a9ef3cb44da2a45 Mon Sep 17 00:00:00 2001 From: LG_lai Date: Fri, 14 Jun 2024 16:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A9=E5=8A=9B=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0-Login/phone-test.txt | 2 +- 1-Applet/6-Activity/ActivityResource.robot | 50 +- 1-Applet/6-Activity/Avtivity.robot | 4 + 1-Applet/6-Activity/LoginResource.robot | 80 + 1-Applet/6-Activity/phone.txt | 2 + Phone.txt | 1 + output/log.html | 8 +- output/output.xml | 3587 +++++--------------- output/report.html | 8 +- 9 files changed, 994 insertions(+), 2748 deletions(-) create mode 100644 1-Applet/6-Activity/LoginResource.robot create mode 100644 1-Applet/6-Activity/phone.txt diff --git a/0-Login/phone-test.txt b/0-Login/phone-test.txt index f7bd761..ed8605a 100644 --- a/0-Login/phone-test.txt +++ b/0-Login/phone-test.txt @@ -1,2 +1,2 @@ 手机号 -13168550964 \ No newline at end of file +15675143029 \ No newline at end of file diff --git a/1-Applet/6-Activity/ActivityResource.robot b/1-Applet/6-Activity/ActivityResource.robot index 13e380f..850a4c2 100644 --- a/1-Applet/6-Activity/ActivityResource.robot +++ b/1-Applet/6-Activity/ActivityResource.robot @@ -5,6 +5,7 @@ Library DateTime Library Collections Library RequestsLibrary Library DatabaseLibrary +Resource LoginResource.robot *** Keywords *** 查询${dating}用户资料 @@ -51,8 +52,8 @@ Library DatabaseLibrary ${Number2} Set Variable If ${genderCode}==0 ${manNumber} ${womanNumber} #当用户性别为男,输出男士已参与人数,否则输出女生已参与人数 ${totalNum} Evaluate ${manNumber}+${womanNumber} #总参与人数 ${registrationPopulation} Get From Dictionary ${records} registrationPopulation #已报名总数 - Run Keyword If ${status}!=1 Continue For Loop #跳过此次循环 - ... ELSE Exit For Loop If ${status}==1 and ${Number1}!=${Number2} #活动状态,1报名中,2待开始,3进行中,4已取消,5已结束 + Run Keyword If ${status}!=1 Continue For Loop + ... ELSE Exit For Loop If ${status}==1 and ${Number1}!=${Number2} #跳过此次循环 #活动状态,1报名中,2待开始,3进行中,4已取消,5已结束 END Set Global Variable ${AvtivityId} @@ -67,13 +68,13 @@ Library DatabaseLibrary END 遍历活动已报名列表 - FOR ${phone} ${nickName} ${participantData} IN ZIP ${phoneList} ${nickNameList} ${participantListList} - Set Global Variable ${nickName} + FOR ${phone} ${participantData} IN ZIP ${phoneList} ${participantListList} + LOG ${phone} ${sapId} Get From Dictionary ${participantData} sapId #参与活动id ${Userphone} Get From Dictionary ${participantData} phone #参与用户手机号 ${UsernickName} Get From Dictionary ${participantData} nickName #参与用户昵称 - Run Keyword If ${Userphone}==${phone} Continue For Loop #如果手机号相等跳出此次循环 - Run Keyword If ${Userphone}==${phone} log 该用户已报名 + Run Keyword If ${Userphone}==${phone} Continue For Loop #如果手机号不相等跳出此次循环 + Run Keyword If ${Userphone}==${phone} Log To Console 用户已报名活动 ... ELSE 数据库新增活动参与人 END @@ -91,7 +92,42 @@ Library DatabaseLibrary 数据库新增活动参与人 FOR ${userid} ${miId} ${genderCode} IN ZIP ${userid_list} ${miId_list} ${genderCodeList} ${dataTime} Get Current Date result_format=%Y-%m-%d %H:%M:%S - Connect To Database Using Custom Params pymysql database='dating_agency_service',user='root',password='qniaothreetwoonego',host='8.135.8.221' + #Connect To Database Using Custom Params pymysql database='dating_agency_service',user='root',password='qniaothreetwoonego',host='8.135.8.221' #测试数据库 + Connect To Database Using Custom Params pymysql database='dating_agency_service',user='jxh_user',password='jxh@2024db',host='rm-wz94koti4awpbd5t3ro.mysql.rds.aliyuncs.com' #生产数据库 ${insert} Execute Sql String INSERT INTO `dating_agency_service`.`da_site_activity_participant`(`id`, `site_activity_id`, `mi_id`, `user_id`, `gender_code`, `status`, `is_delete`, `create_time`, `update_time`) VALUES (NULL, ${AvtivityId}, ${miId}, ${userid}, ${genderCode}, 0, 0, '${dataTime}', '${dataTime}') #活动参与表插入一条用户数据 Disconnect From Database END + +查看${dating}活动详情 + #活动详情 + FOR ${client-header} IN @{Cheader_list} + Create Session dating ${${dating}.dating域名} ${client-header} + ${reps} GET On Session dating dating-agency-service/user/get/site/activity/details params=id=998286299716784128 + ${assistNumber} Get From Dictionary ${reps.json()['data']['participationAllocation']} assistNumber #参数配置:助力人数 + ${openedAssistanceId} Get From Dictionary ${reps.json()['data']} openedAssistanceId #活动助力id + Run Keyword If ${assistNumber}>0 Log To Console 可发起助力 + Set Global Variable ${openedAssistanceId} + END + +用户发起${dating}平台活动助力 + #用户发起助力 + FOR ${client-header} IN @{Cheader_list} + Create Session dating ${${dating}.dating域名} ${client-header} + ${reps} GET On Session dating dating-agency-service/user/get/assistance/details params=openedAssistanceId=${openedAssistanceId} + ${message} Get From Dictionary ${reps.json()} message + Should Be Equal As Strings ${message} successful + END + +用户助力${dating}活动 + #其他用户助力活动 + 读取TXT文件 + 用户手机号验证码登录婚介平台-888888 + 查询用户的婚介组织 + 获取婚介平台用户baseinfo + FOR ${client_header} IN @{Cheader_list} + Create Session dating ${${dating}.dating域名} ${client_header} + ${data} Set Variable {"openedAssistanceId":"${openedAssistanceId}"} + ${reps} POST On Session dating dating-agency-service/user/assistance/participant ${data.encode('utf-8')} + ${message} Get From Dictionary ${reps.json()} message + Should Be Equal As Strings ${message} successful + END diff --git a/1-Applet/6-Activity/Avtivity.robot b/1-Applet/6-Activity/Avtivity.robot index aef751a..be4e291 100644 --- a/1-Applet/6-Activity/Avtivity.robot +++ b/1-Applet/6-Activity/Avtivity.robot @@ -9,3 +9,7 @@ Resource ActivityResource.robot Then 用户报名婚介活动 用户邀请助力 + Given 查询婚介用户资料 + And 查看婚介活动详情 + When 用户发起婚介平台活动助力 + Then 用户助力婚介活动 diff --git a/1-Applet/6-Activity/LoginResource.robot b/1-Applet/6-Activity/LoginResource.robot new file mode 100644 index 0000000..7619196 --- /dev/null +++ b/1-Applet/6-Activity/LoginResource.robot @@ -0,0 +1,80 @@ +*** Settings *** +Library urllib3 +Library String +Library DateTime +Library Collections +Library RequestsLibrary +Library DatabaseLibrary +Library OperatingSystem + +*** Keywords *** +读取TXT文件 + #读取TXT文件 + ${file} Get File ${CURDIR}\\phone.txt #读取文件 + ${skip-line} Set Variable 1 #跳过第一行 + ${lines} Set Variable -1 #读取整个文件,从第二行开始 + ${content} Get Lines Containing String ${file} ${skip-line} ${lines} + FOR ${id} IN ${content} + ${id} String.Split String ${id} \n + END + Set Global Variable ${id} + +用户手机号验证码登录${dating}平台-888888 + #用户手机号验证码登录婚介平台 + ${userid_list} Create List + ${Cheader_list} Create List + ${Aheader_list} Create List + ${phoneList} Create List + FOR ${account} IN @{id} + Disable Warnings + Create Session dating ${${dating}.dating域名} ${${dating}.AHeader} + ${data} Set Variable { \ \ "account":"${account}", \ \ "accountType":2, \ \ "captcha":888888 } #手机号验证码登录参数 + ${reps} POST On Session dating /dating-agency-uec/authorize/by-captcha ${data.encode('utf-8')} + ${code} Get From Dictionary ${reps.json()} code #获取相应状态码 + ${token} Get From Dictionary ${reps.json()['data']} token #获取token + ${userId} Get From Dictionary ${reps.json()['data']} userId #获取用户id + ${message} Get From Dictionary ${reps.json()} message + ${login_header} Set Variable {'Content-Type':'application/json','X-APP-ID':'50325897884795881','Authorization':'QNT ${token}','X-Organization-Id':'963432943739605555'} #更新header + log ${login_header} + ${client_header} Set Variable {'Content-Type':'application/json','X-APP-ID':'50325897884795880','Authorization':'QNT ${token}'} + Append To List ${userid_list} ${userId} + Append To List ${Cheader_list} ${client_header} + Append To List ${Aheader_list} ${login_header} + Append To List ${phoneList} ${account} + Run Keyword If ${code}==0 Should Be Equal As Strings ${message} successful + ... ELSE Should Be Equal As Strings ${message} 验证码错误或无效验证码,请重试! + END + Set Global Variable ${phoneList} + Set Global Variable ${userid_list} + Set Global Variable ${Aheader_list} + Set Global Variable ${Cheader_list} + Set Global Variable ${login_header} + Set Global Variable ${client_header} + +查询用户的${dating}组织 + #查询用户在婚介的组织数据 + ${Aheader} Create List + FOR ${userId} ${login_header} IN ZIP ${userid_list} ${Aheader_list} + Disable Warnings + Create Session dating ${${dating}.dating域名} ${login_header} + ${reps} GET On Session dating /dating-agency-uec/user/list/own-organization params=userId=${userid} + ${data} Get From Dictionary ${reps.json()} data #获取用户组织数据 + ${message} Get From Dictionary ${reps.json()} message + Should Be Equal As Strings ${message} successful + Run Keyword If ${data}==[] log 未获取到组织信息! + ... ELSE log ${data} + END + +获取${dating}平台用户baseinfo + #获取baseinfo + ${matchmakerFlagList} Create List + FOR ${admin_header} IN @{Aheader_list} + Create Session dating ${${dating}.dating域名} ${admin_header} + ${reps} GET On Session dating dating-agency-uec/user/get/base-info + ${phone} Get From Dictionary ${reps.json()['data']} phone #登录用户手机号 + ${matchmakerFlag} Get From Dictionary ${reps.json()['data']} matchmakerFlag #登录用户是否是红娘 + Append To List ${matchmakerFlagList} ${matchmakerFlag} + END + Set Global Variable ${phone} + Set Global Variable ${matchmakerFlag} + Set Global Variable ${matchmakerFlagList} diff --git a/1-Applet/6-Activity/phone.txt b/1-Applet/6-Activity/phone.txt new file mode 100644 index 0000000..5e06aa7 --- /dev/null +++ b/1-Applet/6-Activity/phone.txt @@ -0,0 +1,2 @@ +手机号 +15014242835 \ No newline at end of file diff --git a/Phone.txt b/Phone.txt index d5e5d07..ab3da64 100644 --- a/Phone.txt +++ b/Phone.txt @@ -119,3 +119,4 @@ 18783540726,888888 13537209187,888888 18545198367,888888 +18831249056,888888 diff --git a/output/log.html b/output/log.html index ca4ebe0..eb0da01 100644 --- a/output/log.html +++ b/output/log.html @@ -1806,13 +1806,13 @@ function stopPropagation(event) { window.output = {};