Commit 87c4f601 authored by 钱雯君's avatar 钱雯君

add

parent baf1ca9b
......@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import utils.MatcherString;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -303,6 +304,79 @@ public class PkActivityService {
}
//创建pk开奖的插件活动id
public Response pluginSave(String pkActivityId) throws Exception {
String saveUrl = ManagerHost + "/plugin/save";
String configUrl = ManagerHost + "/plugin/editConfig.htm";
//获取创建活动的token
Response response=given().contentType("text/html;charset=UTF-8").cookies(authorization.ssoLogin()).get("http://"+configUrl);
String token = MatcherString.getString(response.asString(), "token: '(.*?)'", 1);
List<Map<String,String>> listPrizes = new ArrayList<>();
Map<String,String> award = new HashMap<>();
award.put("type","coupon");
award.put("description","优惠券");
award.put("logo","//yun.duiba.com.cn/developer/img/activityTool/slotMachine/coupon.png");
award.put("valid","true");
award.put("rate","100");
award.put("arealimit","false");
award.put("stockBeforeChange","0");
award.put("rewardFalg","false");
award.put("prizeTag","");
award.put("winLimitScope","1");
award.put("prizesLimitScope","daily");
award.put("itemId","27097");
award.put("name","LV优惠券自动化测试链接券");
award.put("stockAfterChange","10");
award.put("remaining","10");
listPrizes.add(award);
String prizes = JSON.toJSONString(listPrizes);
Map<String, String> map = new HashMap<>();
map.put("title", "【自动化】pk开奖插件");
map.put("brickId", "0");
map.put("ruleDescription", "自动化活动规则");
map.put("rateDescription", "自动化概率说明");
map.put("multiSkinsMode", "false");
map.put("multiSkinIds","[]");
map.put("triggerTime","[]");
map.put("limitCount","1");
map.put("exitDays", "7");
map.put("anticheatExchangeLimit", "false");
map.put("limitScope", "forever");
map.put("prizes",prizes);
map.put("tag","[]");
map.put("triggerType", "1");
map.put("hiddenForDeveloper", "false");
map.put("joinVerificy", "false");
map.put("duibaRelateMode", "false");
map.put("channelType","0");
map.put("token",token);
map.put("copy", "false");
map.put("subType","plugdraw");
map.put("joinVerificyMode","15");
map.put("pkId",pkActivityId);
logger.info("请求保存插件活动接口:" + saveUrl);
Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.ssoLogin()).params(map).post("http://"+saveUrl);
saveResponse.prettyPrint();
try{
Assert.assertEquals(saveResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("创建插件活动接口失败,返回信息:"+saveResponse.asString());
}catch(Error er){
throw new Exception("创建插件活动接口失败,返回信息:"+saveResponse.asString());
}
return saveResponse;
}
// public static void main(String[] args) throws Exception{
// String endTime = "2021-12-31 23:55:00";
// PkActivityService pkActivityService = new PkActivityService();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment