Commit 779009ba authored by 钱雯君's avatar 钱雯君

Merge branch 'qwj_181029' into mabo

parents 3a3520eb fccb45cf
...@@ -168,7 +168,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase { ...@@ -168,7 +168,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase {
String orderId = openResponse.jsonPath().getString("orderId"); String orderId = openResponse.jsonPath().getString("orderId");
Response statusResponse = newActivityService.getOrderStatus31(orderId,uid); Response statusResponse = newActivityService.getOrderStatus31(orderId,uid);
// logger.info("开奖结果如下1:"); // logger.info("开奖结果如下1:");
// statusResponse.prettyPrint(); statusResponse.prettyPrint();
String playResult = String.valueOf(statusResponse.jsonPath().getString("result")); String playResult = String.valueOf(statusResponse.jsonPath().getString("result"));
int i = 8; int i = 8;
while (i > 0 && (playResult.equals("0"))) { while (i > 0 && (playResult.equals("0"))) {
...@@ -177,7 +177,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase { ...@@ -177,7 +177,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase {
playResult = String.valueOf(statusResponse.jsonPath().getString("result")); playResult = String.valueOf(statusResponse.jsonPath().getString("result"));
i--; i--;
// logger.info("开奖结果如下2:"); // logger.info("开奖结果如下2:");
// statusResponse.prettyPrint(); statusResponse.prettyPrint();
} }
return statusResponse; return statusResponse;
......
...@@ -122,7 +122,7 @@ public class 集卡规则_中奖属性配置_DuibaTest extends DuibaTestBase { ...@@ -122,7 +122,7 @@ public class 集卡规则_中奖属性配置_DuibaTest extends DuibaTestBase {
//校验修改内容 //校验修改内容
Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId); Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId);
Assert.assertEquals(selectResult.get("deleted").toString(),"true","删除中奖条件失败"); Assert.assertEquals(selectResult.get("deleted").toString(),"1","删除中奖条件失败");
logger.info("校验删除属性配置成功"); logger.info("校验删除属性配置成功");
} }
......
...@@ -299,7 +299,7 @@ public class 集卡规则_中奖配置测试_DuibaTest extends DuibaTestBase { ...@@ -299,7 +299,7 @@ public class 集卡规则_中奖配置测试_DuibaTest extends DuibaTestBase {
//校验修改内容 //校验修改内容
Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId); Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId);
Assert.assertEquals(selectResult.get("deleted").toString(),"true","删除中奖条件失败"); Assert.assertEquals(selectResult.get("deleted").toString(),"1","删除中奖条件失败");
} }
......
...@@ -158,7 +158,7 @@ public class 集卡规则_助力规则配置测试_DuibaTest extends DuibaTestBa ...@@ -158,7 +158,7 @@ public class 集卡规则_助力规则配置测试_DuibaTest extends DuibaTestBa
//校验修改内容 //校验修改内容
Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config_goods_rules where id =?",newGoodsRuleId); Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config_goods_rules where id =?",newGoodsRuleId);
Assert.assertEquals(selectResult.get("deleted").toString(),"true","删除中奖条件失败"); Assert.assertEquals(selectResult.get("deleted").toString(),"1","删除中奖条件失败");
logger.info("删除集卡助力规则成功"); logger.info("删除集卡助力规则成功");
} }
......
...@@ -267,7 +267,6 @@ public class 创建自有活动_DuibaTest extends DuibaTestBase { ...@@ -267,7 +267,6 @@ public class 创建自有活动_DuibaTest extends DuibaTestBase {
} }
//删除自有活动 //删除自有活动
public void 删除自有活动(String title) throws Exception{ public void 删除自有活动(String title) throws Exception{
//开发者删除自有活动 //开发者删除自有活动
......
...@@ -11,6 +11,7 @@ import base.DuibaLog; ...@@ -11,6 +11,7 @@ import base.DuibaLog;
import base.DuibaTestBase; import base.DuibaTestBase;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.model.CollectGoodsInfo; import http.model.CollectGoodsInfo;
import http.service.Activity.NewCollectActivityService; import http.service.Activity.NewCollectActivityService;
import http.service.Manager.EditManagerInfoService; import http.service.Manager.EditManagerInfoService;
...@@ -18,6 +19,7 @@ import io.restassured.response.Response; ...@@ -18,6 +19,7 @@ import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import utils.GetCookieUtil;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -32,6 +34,7 @@ import static io.restassured.RestAssured.given; ...@@ -32,6 +34,7 @@ import static io.restassured.RestAssured.given;
* @create 2018/10/27 * @create 2018/10/27
* @since 1.0.0 * @since 1.0.0
*/ */
//3个case
public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase { public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase {
...@@ -46,7 +49,7 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase { ...@@ -46,7 +49,7 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase {
@Test @Test
public void 助力_发集卡() throws Exception{ public void 助力_发集卡() throws Exception{
//助力规则 //助力规则git
int userId = 3934; int userId = 3934;
String consumerId = "100092114"; String consumerId = "100092114";
String collectRuleId = "4795"; String collectRuleId = "4795";
...@@ -241,15 +244,11 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase { ...@@ -241,15 +244,11 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase {
Response response = editManagerInfoService.createUser("新用户助力",appId); Response response = editManagerInfoService.createUser("新用户助力",appId);
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '新用户助力' and app_id = ?\n",appId); Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '新用户助力' and app_id = ?\n",appId);
String uid = user.get("id").toString(); String uid = user.get("id").toString();
String url = "http://47.97.214.108/user/loginDuiba?uid=" + uid; String url = GetCookieUtil.genUrl(uid,"2wGQc3MZaQsqYFWcX4gguya5PnnS");
Response login = given().get(url); JSONObject cookie = GetCookieUtil.getConsumerIdFromCookie(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = ?\n",uid,app_id);
String consumerId = consumer.get("id").toString();
Boolean res = jdbc.update("UPDATE new_consumer.consumer_0010 set addr_name = 'qwj' , addr_phone = '18143476563' ,addr_province = '浙江省' ,addr_city = '杭州市' " +
", addr_area = '西湖区' , addr_detail = '奖池花印' where partner_user_id = ? and app_id = ?\n",uid,app_id);
map.put("uid",uid); map.put("uid",uid);
map.put("consumerId",consumerId); map.put("consumerId",cookie.get("cid").toString());
logger.info("用户信息为,uid="+uid+"consumerId="+consumerId); logger.info("用户信息为,uid="+uid+"consumerId="+cookie.get("cid").toString());
return map; return map;
} }
......
...@@ -30,6 +30,7 @@ import java.util.Map; ...@@ -30,6 +30,7 @@ import java.util.Map;
* @create 2018/10/17 * @create 2018/10/17
* @since 1.0.0 * @since 1.0.0
*/ */
//5个case
public class 新集卡_开奖异常_DuibaTest extends DuibaTestBase { public class 新集卡_开奖异常_DuibaTest extends DuibaTestBase {
......
...@@ -35,6 +35,7 @@ import java.util.Map; ...@@ -35,6 +35,7 @@ import java.util.Map;
* @create 2018/10/15 * @create 2018/10/15
* @since 1.0.0 * @since 1.0.0
*/ */
//16个case
public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase { public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
@Autowired @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 { ...@@ -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 @Test
public void 创建pk活动组_无投放渠道(){ public void 创建pk活动组_无投放渠道(){
...@@ -211,8 +249,8 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase { ...@@ -211,8 +249,8 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
public void tearDown() { public void tearDown() {
try { 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 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活动-瓜分红包\"\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 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组'"); 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 { ...@@ -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 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 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) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -13,6 +13,9 @@ import com.alibaba.fastjson.JSONObject; ...@@ -13,6 +13,9 @@ import com.alibaba.fastjson.JSONObject;
import http.model.BetOptionVo; import http.model.BetOptionVo;
import http.service.Authorization; import http.service.Authorization;
import io.restassured.response.Response; 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.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -46,6 +49,7 @@ public class PkActivityService { ...@@ -46,6 +49,7 @@ public class PkActivityService {
public Response bet(String bonusType,String endTime) throws Exception{ public Response bet(String bonusType,String endTime) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/bet"; String url = "http://" + ManagerHost + "/newmanager/bet";
List<BetOptionVo> betOptionVoList = new ArrayList<>(); List<BetOptionVo> betOptionVoList = new ArrayList<>();
BetOptionVo betOptionVo1 = new BetOptionVo(); BetOptionVo betOptionVo1 = new BetOptionVo();
BetOptionVo betOptionVo2 = new BetOptionVo(); BetOptionVo betOptionVo2 = new BetOptionVo();
...@@ -58,12 +62,18 @@ public class PkActivityService { ...@@ -58,12 +62,18 @@ public class PkActivityService {
Map<String,Object> para = new HashMap<>(); Map<String,Object> para = new HashMap<>();
para.put("betOptionDtoList",betOptionVoList); para.put("betOptionDtoList",betOptionVoList);
para.put("betType","1");//1-单选单次; para.put("betType","1");//1-单选单次;
para.put("bonusType",bonusType);//1-经验;2-红包 para.put("bonusType",bonusType);//1-经验;2-红包;3-优惠券
if (bonusType.equals("2")){ if (bonusType.equals("2")){
para.put("bonusAmount","0.1");//实际瓜分红包金额 para.put("bonusAmount","0.1");//实际瓜分红包金额
para.put("title","【自动化】新建pk活动-瓜分红包"); para.put("title","【自动化】新建pk活动-瓜分红包");
}else { }else if (bonusType.equals("1")){
para.put("title","【自动化】新建pk活动-瓜分经验"); 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("configStatus","1");
para.put("creditsValue","1"); para.put("creditsValue","1");
...@@ -87,6 +97,52 @@ public class PkActivityService { ...@@ -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{ public Response betGroupRelation(String betId,String endTime,String groupId) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betGroupRelation"; String url = "http://" + ManagerHost + "/newmanager/betGroupRelation";
...@@ -225,9 +281,28 @@ public class PkActivityService { ...@@ -225,9 +281,28 @@ public class PkActivityService {
return groupListResponse; 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{ // public static void main(String[] args) throws Exception{
// String endTime = "2021-12-31 23:55:00"; // String endTime = "2021-12-31 23:55:00";
// PkActivityService pkActivityService = new PkActivityService(); // PkActivityService pkActivityService = new PkActivityService();
......
package http.service.hd; package http.service.hd;
import cn.com.duiba.activity.center.api.params.MainmeetActivityParams;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import http.service.Authorization; import http.service.Authorization;
import base.DuibaLog; import base.DuibaLog;
...@@ -15,6 +16,7 @@ import java.util.List; ...@@ -15,6 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.post;
@Service @Service
public class DeveloperService { public class DeveloperService {
...@@ -912,4 +914,144 @@ public class DeveloperService { ...@@ -912,4 +914,144 @@ public class DeveloperService {
return response; 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,String exchangeLimit) 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",exchangeLimit);
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;
}
} }
/**
* Copyright (C), 2015-2018
* FileName: BASE64
* Author: qianwenjun
* Date: 2018/9/11 10:02
* Description:
*/
package utils;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/9/11
* @since 1.0.0
*/
public class BASE64 {
/**
* BASE64解密
*
* @param key
* @return
* @throws Exception
*/
public static byte[] decryptBASE64(String key) throws Exception {
return (new BASE64Decoder()).decodeBuffer(key);
}
/**
* BASE64加密
*
* @param key
* @return
* @throws Exception
*/
public static String encryptBASE64(byte[] key) throws Exception {
return (new BASE64Encoder()).encodeBuffer(key);
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: GetCookieUtil
* Author: qianwenjun
* Date: 2018/11/28 13:34
* Description:
*/
package utils;
import base.DuibaLog;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.restassured.response.Response;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/11/28
* @since 1.0.0
*/
public class GetCookieUtil {
private static DuibaLog logger = DuibaLog.getLogger();
public static JSONObject getConsumerIdFromCookie(String url) throws Exception{
// Response response = given().get(url);
Response response=given().redirects().follow(false).get(url);
response.prettyPrint();
Map<String,String> cookies = response.getCookies();
String cookieValue = response.getCookie("_ac");
byte[] bytes = BASE64.decryptBASE64(cookieValue);
JSONObject userCookie = JSON.parseObject(new String(bytes,"utf-8"));
// Headers allHeaders = response.getHeaders();
// String headerName = response.getHeader("Set-Cookie");
logger.info("userCookie="+JSONObject.toJSONString(userCookie));
logger.info("aid="+userCookie.get("aid")+",cid="+userCookie.get("cid"));
return userCookie;
}
public static String genUrl(String uid,String appkey) throws Exception{
String res = null;
String url = "http://home.m.duibatest.com.cn/test/generateSign";
Map<String,String> para = new HashMap<>();
para.put("appKey",appkey);
para.put("uid",uid);
Response response = given().params(para).get(url);
response.prettyPrint();
res = response.jsonPath().getString("url").toString();
return res;
}
}
\ No newline at end of file
...@@ -4,8 +4,8 @@ proxyserver.ip=172.16.80.203 ...@@ -4,8 +4,8 @@ proxyserver.ip=172.16.80.203
proxyserver.port=22 proxyserver.port=22
proxyserver.user=dev proxyserver.user=dev
proxyserver.prvkey=key/hzlId_rsa proxyserver.prvkey=key/hzlId_rsa
dafuweng.host=dafuweng.duibatest.com.cn dafuweng.host=47.97.214.108
dafuweng.port=80 dafuweng.port=9002
uid=2707 uid=2707
appId=2239 appId=2239
hdserver.host=hd.dlp.duibatest.com.cn hdserver.host=hd.dlp.duibatest.com.cn
...@@ -24,47 +24,47 @@ trade.host = activity.m.duibatest.com.cn ...@@ -24,47 +24,47 @@ trade.host = activity.m.duibatest.com.cn
//\u6570\u636E\u5E93\u914D\u7F6E //\u6570\u636E\u5E93\u914D\u7F6E
db.name = duiba_test db.name = duiba_test
db.password= svbP3KUw2PurAnBb2rbs3vohF db.password= svbP3KUw2PurAnBb2rbs3vohF
db.url = jdbc:mysql://47.97.127.67:13001/?tinyInt1isBit=false db.url = jdbc:mysql://rdswy2b9wy53044250u1o.mysql.rds.aliyuncs.com:3306/?tinyInt1isBit=false
db.driver= com.mysql.cj.jdbc.Driver db.driver= com.mysql.cj.jdbc.Driver
db.maxtotal = 6 db.maxtotal = 6
//钉钉报告配置 //\u9489\u9489\u62A5\u544A\u914D\u7F6E
pluginTest.project=插件 pluginTest.project=\u63D2\u4EF6
pluginTest.names=zhaoran,qianwenjun pluginTest.names=zhaoran,qianwenjun
pluginTest.group=插件-接口自动化 pluginTest.group=\u63D2\u4EF6-\u63A5\u53E3\u81EA\u52A8\u5316
pluginTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_Report/suite1_test1_results.html pluginTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_Report/suite1_test1_results.html
signTest.project=签到 signTest.project=\u7B7E\u5230
signTest.names=zhousongbo signTest.names=zhousongbo
signTest.group=签到-接口自动化 signTest.group=\u7B7E\u5230-\u63A5\u53E3\u81EA\u52A8\u5316
signTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_Report/suite1_test1_results.html signTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_Report/suite1_test1_results.html
FloorTest.project=楼层 FloorTest.project=\u697C\u5C42
FloorTest.names=zhaoran,qianwenjun FloorTest.names=zhaoran,qianwenjun
FloorTest.group=楼层-接口自动化 FloorTest.group=\u697C\u5C42-\u63A5\u53E3\u81EA\u52A8\u5316
FloorTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_Report/suite1_test1_results.html FloorTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_Report/suite1_test1_results.html
DuibaTest.project=活动工具 DuibaTest.project=\u6D3B\u52A8\u5DE5\u5177
DuibaTest.names=zhaoran,qianwenjun DuibaTest.names=zhaoran,qianwenjun
DuibaTest.group=活动工具-接口自动化 DuibaTest.group=\u6D3B\u52A8\u5DE5\u5177-\u63A5\u53E3\u81EA\u52A8\u5316
DuibaTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_Report/suite1_test1_results.html DuibaTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_Report/suite1_test1_results.html
AccessTest.project=综合业务(单品抽奖/秒杀/游戏) AccessTest.project=\u7EFC\u5408\u4E1A\u52A1(\u5355\u54C1\u62BD\u5956/\u79D2\u6740/\u6E38\u620F)
AccessTest.names=zhaoran,qianwenjun AccessTest.names=zhaoran,qianwenjun
AccessTest.group=综合业务-接口自动化 AccessTest.group=\u7EFC\u5408\u4E1A\u52A1-\u63A5\u53E3\u81EA\u52A8\u5316
AccessTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html AccessTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html
JenkinsTest.project=综合业务(单品抽奖/秒杀/游戏) JenkinsTest.project=\u7EFC\u5408\u4E1A\u52A1(\u5355\u54C1\u62BD\u5956/\u79D2\u6740/\u6E38\u620F)
JenkinsTest.names=zhaoran,qianwenjun JenkinsTest.names=zhaoran,qianwenjun
JenkinsTest.group=综合业务-接口自动化 JenkinsTest.group=\u7EFC\u5408\u4E1A\u52A1-\u63A5\u53E3\u81EA\u52A8\u5316
JenkinsTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html JenkinsTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html
ExchangeTest.project=普兑业务 ExchangeTest.project=\u666E\u5151\u4E1A\u52A1
ExchangeTest.names=panyuli ExchangeTest.names=panyuli
ExchangeTest.group=普兑业务-接口自动化 ExchangeTest.group=\u666E\u5151\u4E1A\u52A1-\u63A5\u53E3\u81EA\u52A8\u5316
ExchangeTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_Report/suite1_test1_results.html ExchangeTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_Report/suite1_test1_results.html
SeckillTest.project=秒杀业务 SeckillTest.project=\u79D2\u6740\u4E1A\u52A1
SeckillTest.names=qianwenjun SeckillTest.names=qianwenjun
SeckillTest.group=秒杀业务-接口自动化 SeckillTest.group=\u79D2\u6740\u4E1A\u52A1-\u63A5\u53E3\u81EA\u52A8\u5316
SeckillTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_Report/suite1_test1_results.html SeckillTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_Report/suite1_test1_results.html
\ No newline at end of file
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