Commit 820ddd56 authored by 赵然's avatar 赵然

Merge branch 'develop'

parents cc16761a 4a22a911
......@@ -168,7 +168,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase {
String orderId = openResponse.jsonPath().getString("orderId");
Response statusResponse = newActivityService.getOrderStatus31(orderId,uid);
// logger.info("开奖结果如下1:");
// statusResponse.prettyPrint();
statusResponse.prettyPrint();
String playResult = String.valueOf(statusResponse.jsonPath().getString("result"));
int i = 8;
while (i > 0 && (playResult.equals("0"))) {
......@@ -177,7 +177,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase {
playResult = String.valueOf(statusResponse.jsonPath().getString("result"));
i--;
// logger.info("开奖结果如下2:");
// statusResponse.prettyPrint();
statusResponse.prettyPrint();
}
return statusResponse;
......
......@@ -267,7 +267,6 @@ public class 创建自有活动_DuibaTest extends DuibaTestBase {
}
//删除自有活动
public void 删除自有活动(String title) throws Exception{
//开发者删除自有活动
......
......@@ -32,6 +32,7 @@ import static io.restassured.RestAssured.given;
* @create 2018/10/27
* @since 1.0.0
*/
//3个case
public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase {
......
......@@ -30,6 +30,7 @@ import java.util.Map;
* @create 2018/10/17
* @since 1.0.0
*/
//5个case
public class 新集卡_开奖异常_DuibaTest extends DuibaTestBase {
......
......@@ -35,6 +35,7 @@ import java.util.Map;
* @create 2018/10/15
* @since 1.0.0
*/
//16个case
public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
@Autowired
......
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包测试
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
*/
package http.cases.PkTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.model.BetMobileVo;
import http.service.Activity.PkService;
import http.service.Manager.PkActivityService;
import io.restassured.response.Response;
import org.joda.time.format.DateTimeFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.MatcherString;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.DateTime;
import java.util.ArrayList;
import java.util.List;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_开奖_瓜分红包测试 extends DuibaTestBase {
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
private static DuibaLog logger = DuibaLog.getLogger();
private String groupId = "7";
private Integer user01 = 3445;
private Integer user02 = 3446;
private Integer user03 = 3447;
private Integer user04 = 3448;
private String newBetId = "";
private List<String> optionsIds = new ArrayList<>();
@BeforeMethod
public void beforeMethod() {
try {
createPk("2","2020-08-12 00:00:00",groupId);
}catch (Exception e){
e.printStackTrace();
}
}
@Test
public void 瓜分红包_两个选项_押注人数相同_开奖测试() throws Exception{
Response betList = pkService.getBetList(3445);
List<BetMobileVo> betMobileVoList = betList.jsonPath().getList("data.unbetList",BetMobileVo.class);
for (BetMobileVo bet:betMobileVoList){
if (bet.getBetConfig().getId().equals(newBetId)){
for (int i=0;i<bet.getOptions().size();i++){
optionsIds.add(bet.getOptions().get(i).getOptionId());
}
}
}
//押注第一个选项:user01,user02
//押注第二个选项:user03,user04
Response res1 = pkService.doJoin(user01,newBetId,optionsIds.get(0));
Response res2 = pkService.doJoin(user02,newBetId,optionsIds.get(0));
Response res3 = pkService.doJoin(user03,newBetId,optionsIds.get(1));
Response res4 = pkService.doJoin(user04,newBetId,optionsIds.get(1));
//修改开奖时间
this.modifyOpenPrizeTime();
int i=8;
}
public void createPk(String bounsType,String endTime,String groupId) throws Exception {
Response betResponse = pkActivityService.bet(bounsType,endTime);
String betId = MatcherString.getString(betResponse.asString(),"\"data\": (\\w*)",1);
newBetId = betId;
logger.info("newBetId的信息为"+newBetId);
Response betRelation = pkActivityService.betGroupRelation(betId,endTime,groupId);
Response modifyStatusResponse = pkActivityService.modifySatus(betId);
}
public String modifyOpenPrizeTime() throws Exception{
DateTime time1 = new DateTime();
DateTime endTime = time1.minusMillis(10);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
String endTimeStr = format.print(endTime.getMillis()).toString();
logger.info("\ntime1="+ format.print(time1.getMillis())+"\n设置的开奖时间endTime="+ endTimeStr);
Boolean result1 = jdbc.update("update act_com_conf.tb_bet_config set end_time = ? where id = \"229\"\n",endTimeStr);
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = \"229\"\n",endTimeStr);
return endTimeStr;
}
public static void main(String[] args) {
DateTime time1 = DateTime.now();
DateTime time2 = time1.plusMinutes(1);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
logger.info("\ntime1="+ format.print(time1.getMillis())+"\ntime2="+ format.print(time2.getMillis()));
logger.info("\nendTimeStr="+format.print(time1.getMillis()).toString());
}
}
\ No newline at end of file
......@@ -124,6 +124,44 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
}
@Test
public void 创建pk活动_瓜分优惠券测试() {
try {
Response oldBetList = pkActivityService.getMngBetList();
String oldTotal = oldBetList.jsonPath().getString("data.params.total");
logger.info("创建之前的列表中条数为:"+oldTotal);
createPk("3");
Response newBetList = pkActivityService.getMngBetList();
String newTotal = newBetList.jsonPath().getString("data.params.total");
logger.info("创建之前的列表中条数为:"+oldTotal+"创建之后的列表中条数为:"+newTotal);
Assert.assertEquals(String.valueOf(Long.valueOf(newTotal)-1L),oldTotal,"新建之后列表获取数据校验失败");
List<BetMngVo> betList = newBetList.jsonPath().getList("data.page",BetMngVo.class);
logger.info("betIds"+JSON.toJSONString(betIds));
for (BetMngVo bet:betList){
if (bet.getId().equals(betIds.get("3"))){
logger.info("bet的信息为="+JSON.toJSONString(bet));
Assert.assertEquals(bet.getBetType(),"1","校验pk活动单选单次类型失败");
Assert.assertEquals(bet.getBonusType(),"3","校验pk活动瓜分类型失败");
Assert.assertEquals(bet.getBonusAmount(),"0.00","校验pk活动瓜分类型失败");
Assert.assertEquals(bet.getTitle(),"【自动化】新建pk活动-瓜分优惠券","校验pk活动名称失败");
Assert.assertEquals(bet.getConfigStatus(),"3","校验pk活动状态失败");
Assert.assertEquals(bet.getEndTime(),"2021-12-31 23:55","校验pk活动结束时间失败");
Assert.assertEquals(bet.getPluginId(),"12","校验插件id失败");
Assert.assertEquals(bet.getPrizeLimit(),"1000","校验奖品发放上限失败");
}else{
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void 创建pk活动组_无投放渠道(){
......@@ -211,8 +249,8 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
public void tearDown() {
try {
Boolean result = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\")\n");
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\"\n");
Boolean result = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\" OR title = \"【自动化】新建pk活动-瓜分红包\")\n");
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\" OR title = \"【自动化】新建pk活动-瓜分优惠券\"\n");
Boolean result2 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组')");
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组'");
......@@ -220,6 +258,10 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
Boolean result4 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放')");
Boolean result5 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放'");
Boolean result6 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title = '【自动化】新建pk活动-瓜分红包')");
Boolean result7 = jdbc.update("delete from act_com_conf.tb_bet_config where title = '【自动化】新建pk活动-瓜分红包'");
} catch (SQLException e) {
e.printStackTrace();
}
......
......@@ -13,6 +13,9 @@ import com.alibaba.fastjson.JSONObject;
import http.model.BetOptionVo;
import http.service.Authorization;
import io.restassured.response.Response;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -46,6 +49,7 @@ public class PkActivityService {
public Response bet(String bonusType,String endTime) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/bet";
List<BetOptionVo> betOptionVoList = new ArrayList<>();
BetOptionVo betOptionVo1 = new BetOptionVo();
BetOptionVo betOptionVo2 = new BetOptionVo();
......@@ -58,12 +62,18 @@ public class PkActivityService {
Map<String,Object> para = new HashMap<>();
para.put("betOptionDtoList",betOptionVoList);
para.put("betType","1");//1-单选单次;
para.put("bonusType",bonusType);//1-经验;2-红包
para.put("bonusType",bonusType);//1-经验;2-红包;3-优惠券
if (bonusType.equals("2")){
para.put("bonusAmount","0.1");//实际瓜分红包金额
para.put("title","【自动化】新建pk活动-瓜分红包");
}else {
}else if (bonusType.equals("1")){
para.put("title","【自动化】新建pk活动-瓜分经验");
}else {
para.put("title","【自动化】新建pk活动-瓜分优惠券");
para.put("bonusAmount","");
para.put("pluginId","12");//插件id
para.put("prizeLimit","1000");//发放上限
}
para.put("configStatus","1");
para.put("creditsValue","1");
......@@ -87,6 +97,52 @@ public class PkActivityService {
}
public Response betForSetUp(String bonusType,String endTime) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/bet";
DateTime date = new DateTime();
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
String time = formatter.print(date.getMillis()).toString();
List<BetOptionVo> betOptionVoList = new ArrayList<>();
BetOptionVo betOptionVo1 = new BetOptionVo();
BetOptionVo betOptionVo2 = new BetOptionVo();
betOptionVo1.setOptionImg("//yun.dui88.com/images/201807/6pyca34t5e.jpeg");
betOptionVo1.setOptionName("【自动化】选项A1");
betOptionVo2.setOptionImg("//yun.dui88.com/images/201807/kcrl1q7hkt.jpeg");
betOptionVo2.setOptionName("【自动化】选项A2");
betOptionVoList.add(betOptionVo1);
betOptionVoList.add(betOptionVo2);
Map<String,Object> para = new HashMap<>();
para.put("betOptionDtoList",betOptionVoList);
para.put("betType","1");//1-单选单次;
para.put("bonusType",bonusType);//1-经验;2-红包
if (bonusType.equals("2")){
para.put("bonusAmount","0.1");//实际瓜分红包金额
para.put("title","【自动化】瓜分红包"+time);
}else {
para.put("title","【自动化】瓜分经验"+time);
}
para.put("configStatus","1");
para.put("creditsValue","1");
para.put("endTime",endTime);
para.put("shareExp","13");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(para));
Response betResponse = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonParam).post(url);
betResponse.prettyPrint();
try{
Assert.assertEquals(betResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("创建pk活动接口失败,返回信息:"+betResponse.asString());
}catch(Error er){
throw new Exception("创建pk活动接口失败,返回信息:"+betResponse.asString());
}
return betResponse;
}
public Response betGroupRelation(String betId,String endTime,String groupId) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betGroupRelation";
......@@ -225,9 +281,28 @@ public class PkActivityService {
return groupListResponse;
}
public Response doDraw() throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betOpenPrize/doDraw";
Map<String,Object> para = new HashMap<>();
// para.put("pageNo","1");
// para.put("pageSize","20");
Response doDrawResponse = given().cookies(authorization.ssoLogin()).params(para).get(url);
try{
Assert.assertEquals(doDrawResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("pk活动开奖接口失败,返回信息:"+doDrawResponse.asString());
}catch(Error er){
throw new Exception("pk活动开奖接口失败,返回信息:"+doDrawResponse.asString());
}
return doDrawResponse;
}
// public static void main(String[] args) throws Exception{
// String endTime = "2021-12-31 23:55:00";
// PkActivityService pkActivityService = new PkActivityService();
......
package http.service.hd;
import cn.com.duiba.activity.center.api.params.MainmeetActivityParams;
import com.alibaba.fastjson.JSON;
import http.service.Authorization;
import base.DuibaLog;
......@@ -15,6 +16,7 @@ import java.util.List;
import java.util.Map;
import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.post;
@Service
public class DeveloperService {
......@@ -912,4 +914,144 @@ public class DeveloperService {
return response;
}
//创建自有活动工具-所有字段
public Response saveHdAll(String id,String creditsType,String title,String limitCount,String limitScope,String freeLimit,String freeScope,String awards,String bannerImgNew) throws Exception {
String url=hdHost+"/launch/save";
Map<String,String> map = new HashMap<>();
map.put("id",id);
map.put("subType","turntable_circle");
map.put("creditsType",creditsType);
map.put("title",title);
map.put("credits","10");
map.put("limitCount",limitCount);
map.put("limitScope",limitScope);
map.put("freeLimit",freeLimit);
map.put("freeScope",freeScope);
map.put("optionNum","");
map.put("anticheatExchangeLimit","true");
map.put("autoOffDate","2030-12-01 00:00");
map.put("banner","//yun.duiba.com.cn/upload/r1u3O1460639179556.png");
map.put("thumbnail","//yun.duiba.com.cn/upload/R8Hac1467009242903.png");
map.put("questionRecord","[]");
map.put("awards",awards);
map.put("appId","2239");
map.put("bannerImgNew",bannerImgNew);
logger.info("请求创建自有活动工具url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建自有活动接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建自有活动接口失败,返回信息:"+response.asString());
}
return response;
}
//开发者后台编辑自有活动
public Response editData(String actId,String type,String appId) throws Exception {
String url=hdHost+"/launch/editData";
Map<String,String> map = new HashMap<>();
map.put("actId",actId);
map.put("type",type);
map.put("appId",appId);
logger.info("请求编辑自有活动url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("编辑自有活动接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("编辑自有活动接口失败,返回信息:"+response.asString());
}
return response;
}
//创建保存自有单品抽奖
public Response saveDpAll(String id,String title,String mainAppItemId,String appItemTitle,String appItemType, String mainAppItemRemaining,String freeDrawLimit,String freeDrawLimitScope,String bannerImgNew,String vipLimitType,String vipLimits) throws Exception {
String url=hdHost+"/appSingleLottery/saveOrUpdate";
Map<String,String> map = new HashMap<>();
map.put("appId","2239");
map.put("id",id);
map.put("appItemTitle",appItemTitle);
map.put("title",title);
map.put("mainAppItemRemaining",mainAppItemRemaining);
map.put("preMainAppItemRemaining","0");
map.put("credits","50");
map.put("mainAppItemRate","66.66");
map.put("minComein","100");
map.put("autoOffDate","2020-11-01 00:00");
map.put("introduction","自动化测试单品抽奖 奖品说明");
map.put("vipLimitType",vipLimitType);
map.put("vipLimits",vipLimits);
map.put("moreExchangeLimit","true");
map.put("freeDrawLimit",freeDrawLimit);
map.put("freeDrawLimitScope",freeDrawLimitScope);
map.put("consumerDrawLimit","2");
map.put("consumerDrawLimitScope","everyday");
map.put("consumerWinLimit","1");
map.put("everydayWinLimit","10");
map.put("startDay","2018-11-26");
map.put("endDay","2020-02-01");
map.put("startHours","6");
map.put("startTminute","0");
map.put("endThours","22");
map.put("endTminute","0");
map.put("exchangeLimit","false");
map.put("appItemType",appItemType);
map.put("mainAppItemId",mainAppItemId);
map.put("mainAppItemDegree","");
map.put("appItemId",mainAppItemId);
map.put("logo","//yun.dui88.com/images/201610/dczuwpckbw.png");
map.put("smallImage","//yun.dui88.com/images/201610/2tvxvbhj3x.jpg");
map.put("image","//yun.dui88.com/images/201610/sk21di3uia.jpg");
map.put("bannerImgNew",bannerImgNew);
logger.info("请求创建单品抽奖url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建自有单品抽奖接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建自有单品抽奖接口失败,返回信息:"+response.asString());
}
return response;
}
//开发者后台编辑自有单品抽奖活动
public Response editDetail(String appId,String singleLotteryId) throws Exception {
String url=hdHost+"/appSingleLottery/editDetail";
Map<String,String> map = new HashMap<>();
map.put("appId",appId);
map.put("singleLotteryId",singleLotteryId);
logger.info("请求编辑自有单品抽奖活动url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).get("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("编辑自有单品抽奖活动接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("编辑自有单品抽奖活动接口失败,返回信息:"+response.asString());
}
return response;
}
}
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