You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

137 lines
9.5 KiB

*** Settings ***
Library urllib3
Library String
Library DateTime
Library Collections
Library RequestsLibrary
Library DatabaseLibrary
*** Keywords ***
获取${dating}平台社群信息
#社群列表
FOR ${admin_header} IN @{Aheader_list}
Create Session dating ${${dating}.dating域名} ${admin_header}
${reps} GET On Session dating dating-agency-service/user/get/association/page params=pageSize=100&enable=true&pageNum=1
${records} Get From Dictionary ${reps.json()['data']} records #社群数组
Set Global Variable ${records} #设置全局变量
${communityData} Evaluate random.choice(${records}) random #随机获取一个社群
${communityId} Get From Dictionary ${communityData} id #社群id
${communityName} Get From Dictionary ${communityData} name #社群name
Set Global Variable ${communityId}
Set Global Variable ${communityName}
${reps} GET On Session dating dating-agency-service/user/get/association/detail params=id=${communityId}
${contactPictureUrlList} Get From Dictionary ${reps.json()['data']} contactPictureUrlList #联系人图片列表
${communityQrCodeUrlList} Get From Dictionary ${reps.json()['data']} communityQrCodeUrlList #社群二维码图片列表
${contactPictureUrl} Evaluate random.choice(${contactPictureUrlList}) random #随机获取联系人图片
${communityQrCodeUrl} Evaluate random.choice(${communityQrCodeUrlList}) random #随机获取社群二维码图片
Set Global Variable ${contactPictureUrl}
Set Global Variable ${communityQrCodeUrl}
END
遍历社群列表
FOR ${records} IN @{records}
${enable} Get From Dictionary ${records} enable #社群状态
${communityId} Get From Dictionary ${records} id #社群id
${communityName} Get From Dictionary ${records} name #社群name
Exit For Loop If ${communityId}==995313929934737408 and ${enable}==true #社群id和状态为启用
Set Global Variable ${communityId}
Set Global Variable ${communityName}
END
查询${dating}平台商品定价列表
#商品定价列表
FOR ${admin_header} IN @{Aheader_list}
Create Session dating ${${dating}.dating域名} ${admin_header}
${reps} GET On Session dating dating-agency-mall/user/page/product/by/operator params=pageSize=100&enable=true&pageNum=1
${records} Get From Dictionary ${reps.json()['data']} records #商品数组
Set Global Variable ${records}
${productData} Evaluate random.choice(${records}) random #随机获取商品定价
${productId} Get From Dictionary ${productData} productId #商品id
${productSpecUnit} Get From Dictionary ${productData} productSpecUnit #商品规格分类
Set Global Variable ${productId}
Set Global Variable ${productSpecUnit}
END
遍历商品列表
FOR ${product} IN @{records}
${status} Get From Dictionary ${product} status #商品状态
${productId} Get From Dictionary ${product} productId #商品id
${productTitle} Get From Dictionary ${product} productTitle #商品标题
${productSpecId} Get From Dictionary ${product} productSpecId #商品规格id
${productSpecUnit} Get From Dictionary ${product} productSpecUnit #商品规格分类
Set Global Variable ${status}
Set Global Variable ${productId}
Set Global Variable ${productTitle}
Set Global Variable ${productSpecId}
Set Global Variable ${productSpecUnit}
END
查询${dating}平台会员活动
#查询会员活动
FOR ${admin_header} IN @{Aheader_list}
Create Session dating ${${dating}.dating域名} ${admin_header}
${reps} GET On Session dating dating-agency-mall/user/get/activity/by/operator/page params=pageSize=100&enable=true&pageNum=1
${records} Get From Dictionary ${reps.json()['data']} records #会员数组
Set Global Variable ${records}
遍历会员活动列表
END
遍历会员活动列表
FOR ${activity} IN @{records}
${status} Get From Dictionary ${activity} status #会员活动状态
${activityId} Get From Dictionary ${activity} id #会员活动id
${activeState} Get From Dictionary ${activity} activeState #会员活动启停
Exit For Loop If ${activityId}==978382562932166656 and ${status}==1 and ${activeState}==1
END
Set Global Variable ${activityId}
Set Global Variable ${activeState}
region
#获取户口所在地
Disable Warnings
Create Session region http://qncloud.oss-cn-shenzhen.aliyuncs.com
${reps} GET On Session region address.json
${local_data} Get From Dictionary ${reps.json()} data
#随机获取省
${province} Evaluate random.choice(${local_data}) random #随机获取省区域
${provinceCode} Get From Dictionary ${province} value #获取省编码
${provinceName} Get From Dictionary ${province} label #获取省名称
${Children} Get From Dictionary ${province} children #获取省市
#随机获取市
${city_data} Evaluate random.choice(${Children}) random #随机获取市区域
${cityCode} Get From Dictionary ${city_data} value #获取市编码
${cityName} Get From Dictionary ${city_data} label #获取市名称
${Children} Get From Dictionary ${city_data} children #获取省市
#随机获取区
${district} Evaluate random.choice(${Children}) random
${districtCode} Get From Dictionary ${district} value #随机获取区编码
${districtName} Get From Dictionary ${district} label #随机获取区名称
Set Global Variable ${cityCode}
Set Global Variable ${cityName}
Set Global Variable ${districtCode}
Set Global Variable ${districtName}
Set Global Variable ${provinceCode}
Set Global Variable ${provinceName}
创建${dating}平台活动
#创建活动
region
FOR ${admin_header} IN @{Aheader_list}
Create Session dating ${${dating}.dating域名} ${admin_header}
${DateTime} Get Current Date result_format=%Y-%m-%d #获取当天日期
${applyStartTime} Get Current Date result_format=%Y-%m-%d %H:%M:%S #获取当前时间,报名开始时间
${applyEndTime} Add Time To Date ${applyStartTime} 1 day #报名结束时间
${applyEndTime} Get Substring ${applyEndTime} 0 19
${beginTime} Add Time To Date ${applyStartTime} 2 days #活动开始时间
${beginTime} Get Substring ${beginTime} 0 19
${endTime} Add Time To Date ${applyStartTime} 5 days #活动结束时间
${endTime} Get Substring ${endTime} 0 19
${participationAllocations} Set Variable [{"enable":true,"validTime":0,"assistNumber":0,"originalPrice":1,"genderCode":0,"userType":0,"discountAmount":0,"genderValue":"男","transactionPrice":0,"assistRule":0},{"enable":true,"validTime":0,"assistNumber":0,"originalPrice":0.8,"genderCode":0,"userType":1,"discountAmount":0,"genderValue":"男","transactionPrice":0,"assistRule":0},{"enable":true,"validTime":0,"assistNumber":0,"originalPrice":0.8,"genderCode":1,"userType":0,"discountAmount":0,"genderValue":"女","transactionPrice":0,"assistRule":0},{"enable":true,"validTime":0,"assistNumber":0,"originalPrice":0.6,"genderCode":1,"userType":1,"discountAmount":0,"genderValue":"女","transactionPrice":0,"assistRule":0}] #用户参数配置
${numberWoman} Evaluate random.randint(1,25) random #女士数随机获取~25间的正整数
${numberMan} Evaluate random.randint(1,25) random #男士随机获取1~25间的正整数
${numberParticipants} Evaluate ${numberWoman}+${numberMan} #总人数=女士人数+男士人数
${AvtivityData} Set Variable {"applyStartTime":"${applyStartTime}","name":"${DateTime}测试活动","activityType":1,"applyEndTime":"${applyEndTime}","beginTime":"${beginTime}","endTime":"${endTime}","detailedAddress":"报名后拉群发详细地址","communityId":"${communityId}","communityName":"${communityName}","imgList":[{"url":"https://dating-agency-test.oss-accelerate.aliyuncs.com/微信图片_20240412144009.png"}],"depict":"${DateTime}测试活动","contactPictureUrl":"${contactPictureUrl}","communityQrCodeUrl":"${communityQrCodeUrl}","provinceCode":${provinceCode},"cityCode":${cityCode},"districtCode":${districtCode},"provinceName":"${provinceName}","cityName":"${districtName}","districtName":"${cityName}","mutualAssistanceLimit":0,"numberParticipants":${numberParticipants},"numberMan":${numberMan},"numberWoman":${numberWoman},"participationAllocations":${participationAllocations}} #活动数据
${reps} POST On Session dating dating-agency-service/user/save/site/activity ${AvtivityData.encode('utf-8')}
${AvtivityId} Get From Dictionary ${reps.json()} data #活动id
Set Global Variable ${AvtivityId}
END