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.
58 lines
2.7 KiB
58 lines
2.7 KiB
*** Settings ***
|
|
Library urllib3
|
|
Library String
|
|
Library demjson
|
|
Library Collections
|
|
Library HttpLibrary
|
|
Library JSONLibrary
|
|
Library RequestsLibrary
|
|
Library DatabaseLibrary
|
|
Library HttpLibrary.HTTP
|
|
|
|
*** Keywords ***
|
|
查询${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=10&pageNum=1
|
|
${records} Get From Dictionary ${reps.json()['data']} records #获取商品列表数据
|
|
Set Global Variable ${records}
|
|
END
|
|
#获取指定下标数据
|
|
${activityProductList} Create List
|
|
${indexs} Create List 0 1 2 3 4 6
|
|
FOR ${index} IN @{indexs}
|
|
${productData} Set Variable ${records[${index}]}
|
|
${subCategory} Get From Dictionary ${productData} subCategory
|
|
${Data} Add Object To Json ${productData} $.freebie true #将freebie:true塞到商品json中
|
|
#${Data} Evaluate demjson.encode(${Data},encoding='utf-8').decode() demjson
|
|
Set Global Variable ${Data}
|
|
Run Keyword If ${subCategory}==601 更新数据
|
|
... ELSE log ${Data}
|
|
Append To List ${activityProductList} ${Data}
|
|
log ${activityProductList}
|
|
Set Global Variable ${activityProductList}
|
|
END
|
|
#将'转换为"
|
|
${ActivityDataList} Create List
|
|
FOR ${data} IN @{activityProductList}
|
|
${data} Evaluate demjson.encode(${data},encoding='utf-8').decode() demjson
|
|
Append To List ${ActivityDataList} ${data}
|
|
log ${ActivityDataList}
|
|
END
|
|
${ActivityDataList} Evaluate str(${ActivityDataList}).replace("[","").replace("]","").split(",")
|
|
log ${ActivityDataList}
|
|
Set Global Variable ${ActivityDataList}
|
|
|
|
更新数据
|
|
${Data} Update Value To Json ${Data} $.freebie false
|
|
Set Global Variable ${Data}
|
|
|
|
运营创建${dating}活动
|
|
#创建活动
|
|
FOR ${admin_header} IN @{Aheader_list}
|
|
Create Session dating ${${dating}.dating域名} ${admin_header}
|
|
${data} Set Variable { \ \ \ \ "activityName":"测试活动", \ \ \ \ "startTime":"2024-04-11 00:00:00", \ \ \ \ "endTime":"2024-04-11 23:59:59", \ \ \ \ "remark":"创建测试活动2024-04-09", \ \ \ \ "activityProductList":${ActivityDataList} }
|
|
log ${data}
|
|
${reps} POST On Session dating dating-agency-mall/user/save/activity
|
|
END
|