Commit ddd1ea13 authored by 赵然's avatar 赵然

Merge branch 'zr' into develop

parents ceff8e00 3b54eeef
...@@ -36,9 +36,9 @@ public class 瓜分积分_作弊瓜分 extends DuibaTestBase { ...@@ -36,9 +36,9 @@ public class 瓜分积分_作弊瓜分 extends DuibaTestBase {
private DuibaLog logger = DuibaLog.getLogger(); private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid1 = 5029; private static Integer uid1 = 5080;
private static Integer uid2 = 5058; private static Integer uid2 = 5081;
private static Integer uid3 = 5059; private static Integer uid3 = 5086;
private static String betId; private static String betId;
private static String optionId1; private static String optionId1;
private static String optionId2; private static String optionId2;
...@@ -46,7 +46,7 @@ public class 瓜分积分_作弊瓜分 extends DuibaTestBase { ...@@ -46,7 +46,7 @@ public class 瓜分积分_作弊瓜分 extends DuibaTestBase {
@Test @Test
public void 创建PK活动() throws Exception{ public void 创建PK活动() throws Exception{
Response response = pkDevelopService.betEditor("21771","4",null,"30"); Response response = pkDevelopService.betEditor("21827","4","1","1","30");
Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk活动失败"); Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk活动失败");
response = pkService.getBetList(uid1); response = pkService.getBetList(uid1);
...@@ -129,9 +129,9 @@ public class 瓜分积分_作弊瓜分 extends DuibaTestBase { ...@@ -129,9 +129,9 @@ public class 瓜分积分_作弊瓜分 extends DuibaTestBase {
logger.info("用户2开奖前积分:"+credits2); logger.info("用户2开奖前积分:"+credits2);
logger.info("用户3开奖前积分:"+credits3); logger.info("用户3开奖前积分:"+credits3);
//增加积分: 30/(2+2) //增加积分:设置实际每人瓜分1积分
credits1 = String.valueOf(Integer.valueOf(credits1)+7); credits1 = String.valueOf(Integer.valueOf(credits1)+1);
credits2 = String.valueOf(Integer.valueOf(credits2)+7); credits2 = String.valueOf(Integer.valueOf(credits2)+1);
//修改开奖时间 //修改开奖时间
this.modifyOpenPrizeTime(betId,60); this.modifyOpenPrizeTime(betId,60);
...@@ -170,9 +170,9 @@ public class 瓜分积分_作弊瓜分 extends DuibaTestBase { ...@@ -170,9 +170,9 @@ public class 瓜分积分_作弊瓜分 extends DuibaTestBase {
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败"); Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString()); logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0661 where consumer_id = '100112021' and duiba_activity_id = ?\n",betId); Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0723 where consumer_id = '100112083' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"7","开奖后发奖值校验失败"); Assert.assertEquals(user01_order.get("add_credits").toString(),"1","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0691 where consumer_id = '100112051' and duiba_activity_id = ?\n",betId); Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0724 where consumer_id = '100112084' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败"); Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的积分值为:"+user01_order.get("add_credits").toString()+",用户03获取的积分值为:"+user02_order.get("add_credits").toString()); logger.info("用户01获取的积分值为:"+user01_order.get("add_credits").toString()+",用户03获取的积分值为:"+user02_order.get("add_credits").toString());
......
...@@ -48,7 +48,7 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase { ...@@ -48,7 +48,7 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
@Test @Test
public void 创建PK活动() throws Exception{ public void 创建PK活动() throws Exception{
Response response = pkDevelopService.betEditor("21771","4",null,"30"); Response response = pkDevelopService.betEditor("21771","4",null,"1","30");
Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk活动失败"); Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk活动失败");
response = pkService.getBetList(uid1); response = pkService.getBetList(uid1);
......
/**
* Copyright (C), 2015-2018
* FileName: 瓜分积分测试_AccessTest
* Author: zhaoran
* Date: 2018/12/10 19:45
* Description:
*/
package http.cases.PkMoudleTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
import http.service.Activity.PkService;
import http.service.Manager.PkActivityService;
import http.service.hd.PkDevelopService;
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.testng.Assert;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Map;
public class 瓜分红包_作弊瓜分 extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid1 = 5144;
private static Integer uid2 = 5145;
private static Integer uid3 = 5146;
private static String betId;
private static String optionId1;
private static String optionId2;
@Test
public void 创建PK活动() throws Exception{
Response response = pkDevelopService.betEditor("21829","2","0.01","0","10");
Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk_分红包活动失败");
response = pkService.getBetList(uid1);
response.print();
int i= 30;
while(i>0&&(response.jsonPath().getString("data.unbetList").equals("[]"))){
Thread.sleep(5000);
response = pkService.getBetList(uid1);
response.print();
i--;
}
betId = response.jsonPath().getString("data.unbetList[0].betConfig.id");
optionId1 = response.jsonPath().getString("data.unbetList[0].options[0].optionId");
optionId2 = response.jsonPath().getString("data.unbetList[0].options[1].optionId");
if(betId.equals(null)){
throw new Exception("楼层查询pk组件活动失败!");
}else {
logger.info("pk活动id 为:" + betId + ",投注id1为:" + optionId1 + ",投注id2为:" + optionId2);
}
}
@Test(dependsOnMethods = { "创建PK活动" })
public void 投注() throws Exception {
//查询数据库,投注前积分(抽奖扣积分流程校验)
Map<String,Object> mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
Map<String,Object> mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
Map<String,Object> mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits1 = String.valueOf(mapuser1.get("credits"));
String credits2 = String.valueOf(mapuser2.get("credits"));
String credits3 = String.valueOf(mapuser3.get("credits"));
logger.info("用户1投注前积分:"+credits1);
logger.info("用户2投注前积分:"+credits2);
logger.info("用户3投注前积分:"+credits3);
Response res1 = pkService.doJoin(uid1,betId,optionId1);
Response res2 = pkService.doJoin(uid2,betId,optionId1);
Response res3 = pkService.doJoin(uid3,betId,optionId2);
//查询数据库,投注后积分(抽奖扣积分流程校验)
mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits4 = String.valueOf(mapuser1.get("credits"));
String credits5 = String.valueOf(mapuser2.get("credits"));
String credits6 = String.valueOf(mapuser3.get("credits"));
logger.info("用户1投注后积分:"+credits4);
logger.info("用户2投注后积分:"+credits5);
logger.info("用户3投注后积分:"+credits6);
Assert.assertEquals(credits4,credits1);
Assert.assertEquals(credits5,credits2);
Assert.assertEquals(credits6,credits3);
}
@Test(dependsOnMethods = { "投注" })
public void 开奖() throws Exception {
//查询数据库,开奖前红包余额
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0830 where consumer_id = '100112190' and account_type = '6'\n");
String use1_Acc1 = user01_account1.get("balance_amount").toString();
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0838 where consumer_id = '100112198' and account_type = '6'\n");
String use2_Acc1 = user02_account1.get("balance_amount").toString();
Map<String,Object> user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0839 where consumer_id = '100112199' and account_type = '6'\n");
String use3_Acc1 = user03_account1.get("balance_amount").toString();
logger.info("用户1开奖前红包余额:"+use1_Acc1);
logger.info("用户2开奖前红包余额:"+use2_Acc1);
logger.info("用户3开奖前红包余额:"+use3_Acc1);
//预期增加红包: 750
DecimalFormat decimalFormat = new DecimalFormat("###################.###########");
use1_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use1_Acc1),1));
use2_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use2_Acc1),1));
//修改开奖时间
this.modifyOpenPrizeTime(betId,60);
//调用开奖接口
Response doDrowRresponse = pkActivityService.doDraw();
Assert.assertEquals(doDrowRresponse.jsonPath().getString("success"),"true","开奖结果校验失败");
Assert.assertEquals(doDrowRresponse.jsonPath().getString("data"),"开奖中。。。","开奖messag校验失败");
Thread.sleep(8000);
//查询数据库,开奖后红包余额
user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0830 where consumer_id = '100112190' and account_type = '6'\n");
String use1_Acc2 = user01_account1.get("balance_amount").toString();
user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0838 where consumer_id = '100112198' and account_type = '6'\n");
String use2_Acc2 = user02_account1.get("balance_amount").toString();
user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0839 where consumer_id = '100112199' and account_type = '6'\n");
String use3_Acc2 = user03_account1.get("balance_amount").toString();
logger.info("用户1开奖后积分:"+use1_Acc2);
logger.info("用户2开奖后积分:"+use2_Acc2);
logger.info("用户3开奖后积分:"+use3_Acc2);
Assert.assertEquals(use1_Acc2,use1_Acc1);
Assert.assertEquals(use2_Acc2,use2_Acc1);
Assert.assertEquals(use3_Acc2,use3_Acc1);
logger.info("投注者瓜分金额校验正确");
//校验点
//1、pk活动表配置的状态更新为4;2、订单表的addCredits字段为瓜分的红包值;3、先押注 的选项为胜方,胜负的额押注人数>负方的押注人数
Map<String,Object> betConfig = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_config where id = ?",betId);
logger.info("betConfig的信息为:"+ JSONObject.toJSONString(betConfig));
Assert.assertEquals(betConfig.get("config_status").toString(),"4","配置表状态更新失败");
Map<String,Object> betGroupRelation = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_group_relation where bet_id = ?\n",betId);
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0830 where consumer_id = '100112190' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"1","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0839 where consumer_id = '100112199' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的积分值为:"+user01_order.get("add_credits").toString()+",用户03获取的积分值为:"+user02_order.get("add_credits").toString());
Map<String,Object> bet1Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",betId,optionId1);
Assert.assertEquals(bet1Result.get("rank").toString(),"1","开始押注的选项获胜校验失败");
Map<String,Object> bet2Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",betId,optionId2);
Assert.assertEquals(bet2Result.get("rank").toString(),"2","开始押注的选项获胜校验失败");
Long bet1Times = Long.valueOf(bet1Result.get("bet_times").toString());
Long bet2Times = Long.valueOf(bet2Result.get("bet_times").toString());
Assert.assertTrue(bet1Times>bet2Times,"活动获胜人数比失败人数多校验失败");
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
// int x=20+(int)(Math.random()*100);
DateTime endTime = time1.minusMillis(x);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
// String endTimeStr = format.print(endTime.getMillis()).toString();
String endTimeStr = "2018-11-26 20:24:39";
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 = ?\n",endTimeStr,betId);
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n",endTimeStr,betId);
}
/**
* 提供精确的加法运算。
* @param v1
* @param v2
* @return 两个参数的和
*/
public static double sub(double v1,double v2){
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.add(b2).doubleValue();
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: 瓜分积分测试_AccessTest
* Author: zhaoran
* Date: 2018/12/10 19:45
* Description:
*/
package http.cases.PkMoudleTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
import http.service.Activity.PkService;
import http.service.Manager.PkActivityService;
import http.service.hd.PkDevelopService;
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.testng.Assert;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Map;
public class 瓜分红包_实际瓜分 extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid1 = 5088;
private static Integer uid2 = 5089;
private static Integer uid3 = 5090;
private static String betId;
private static String optionId1;
private static String optionId2;
@Test
public void 创建PK活动() throws Exception{
Response response = pkDevelopService.betEditor("21828","2",null,"1","30");
Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk_分红包活动失败");
response = pkService.getBetList(uid1);
response.print();
int i= 30;
while(i>0&&(response.jsonPath().getString("data.unbetList").equals("[]"))){
Thread.sleep(5000);
response = pkService.getBetList(uid1);
response.print();
i--;
}
betId = response.jsonPath().getString("data.unbetList[0].betConfig.id");
optionId1 = response.jsonPath().getString("data.unbetList[0].options[0].optionId");
optionId2 = response.jsonPath().getString("data.unbetList[0].options[1].optionId");
if(betId.equals(null)){
throw new Exception("楼层查询pk组件活动失败!");
}else {
logger.info("pk活动id 为:" + betId + ",投注id1为:" + optionId1 + ",投注id2为:" + optionId2);
}
}
@Test(dependsOnMethods = { "创建PK活动" })
public void 投注() throws Exception {
//查询数据库,投注前积分(抽奖扣积分流程校验)
Map<String,Object> mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
Map<String,Object> mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
Map<String,Object> mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits1 = String.valueOf(mapuser1.get("credits"));
String credits2 = String.valueOf(mapuser2.get("credits"));
String credits3 = String.valueOf(mapuser3.get("credits"));
logger.info("用户1投注前积分:"+credits1);
logger.info("用户2投注前积分:"+credits2);
logger.info("用户3投注前积分:"+credits3);
//扣去1积分
credits1 = String.valueOf(Integer.valueOf(credits1)-1);
credits2 = String.valueOf(Integer.valueOf(credits2)-1);
credits3 = String.valueOf(Integer.valueOf(credits3)-1);
Response res1 = pkService.doJoin(uid1,betId,optionId1);
Response res2 = pkService.doJoin(uid2,betId,optionId1);
Response res3 = pkService.doJoin(uid3,betId,optionId2);
//查询数据库,投注前积分(抽奖扣积分流程校验)
mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits4 = String.valueOf(mapuser1.get("credits"));
String credits5 = String.valueOf(mapuser2.get("credits"));
String credits6 = String.valueOf(mapuser3.get("credits"));
logger.info("用户1投注后积分:"+credits4);
logger.info("用户2投注后积分:"+credits5);
logger.info("用户3投注后积分:"+credits6);
Assert.assertEquals(credits4,credits1);
Assert.assertEquals(credits5,credits2);
Assert.assertEquals(credits6,credits3);
}
@Test(dependsOnMethods = { "投注" })
public void 开奖() throws Exception {
//查询数据库,开奖前红包余额
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0788 where consumer_id = '100112148' and account_type = '6'\n");
String use1_Acc1 = user01_account1.get("balance_amount").toString();
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0824 where consumer_id = '100112184' and account_type = '6'\n");
String use2_Acc1 = user02_account1.get("balance_amount").toString();
Map<String,Object> user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0825 where consumer_id = '100112185' and account_type = '6'\n");
String use3_Acc1 = user03_account1.get("balance_amount").toString();
logger.info("用户1开奖前红包余额:"+use1_Acc1);
logger.info("用户2开奖前红包余额:"+use2_Acc1);
logger.info("用户3开奖前红包余额:"+use3_Acc1);
//预期增加红包: 750
DecimalFormat decimalFormat = new DecimalFormat("###################.###########");
use1_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use1_Acc1),750));
use2_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use2_Acc1),750));
//修改开奖时间
this.modifyOpenPrizeTime(betId,60);
//调用开奖接口
Response doDrowRresponse = pkActivityService.doDraw();
Assert.assertEquals(doDrowRresponse.jsonPath().getString("success"),"true","开奖结果校验失败");
Assert.assertEquals(doDrowRresponse.jsonPath().getString("data"),"开奖中。。。","开奖messag校验失败");
Thread.sleep(8000);
//查询数据库,开奖后红包余额
user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0788 where consumer_id = '100112148' and account_type = '6'\n");
String use1_Acc2 = user01_account1.get("balance_amount").toString();
user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0824 where consumer_id = '100112184' and account_type = '6'\n");
String use2_Acc2 = user02_account1.get("balance_amount").toString();
user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0825 where consumer_id = '100112185' and account_type = '6'\n");
String use3_Acc2 = user03_account1.get("balance_amount").toString();
logger.info("用户1开奖后积分:"+use1_Acc2);
logger.info("用户2开奖后积分:"+use2_Acc2);
logger.info("用户3开奖后积分:"+use3_Acc2);
Assert.assertEquals(use1_Acc2,use1_Acc1);
Assert.assertEquals(use2_Acc2,use2_Acc1);
Assert.assertEquals(use3_Acc2,use3_Acc1);
logger.info("投注者瓜分金额校验正确");
//校验点
//1、pk活动表配置的状态更新为4;2、订单表的addCredits字段为瓜分的红包值;3、先押注 的选项为胜方,胜负的额押注人数>负方的押注人数
Map<String,Object> betConfig = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_config where id = ?",betId);
logger.info("betConfig的信息为:"+ JSONObject.toJSONString(betConfig));
Assert.assertEquals(betConfig.get("config_status").toString(),"4","配置表状态更新失败");
Map<String,Object> betGroupRelation = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_group_relation where bet_id = ?\n",betId);
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0788 where consumer_id = '100112148' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"750","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0825 where consumer_id = '100112185' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的积分值为:"+user01_order.get("add_credits").toString()+",用户03获取的积分值为:"+user02_order.get("add_credits").toString());
Map<String,Object> bet1Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",betId,optionId1);
Assert.assertEquals(bet1Result.get("rank").toString(),"1","开始押注的选项获胜校验失败");
Map<String,Object> bet2Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",betId,optionId2);
Assert.assertEquals(bet2Result.get("rank").toString(),"2","开始押注的选项获胜校验失败");
Long bet1Times = Long.valueOf(bet1Result.get("bet_times").toString());
Long bet2Times = Long.valueOf(bet2Result.get("bet_times").toString());
Assert.assertTrue(bet1Times>bet2Times,"活动获胜人数比失败人数多校验失败");
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
// int x=20+(int)(Math.random()*100);
DateTime endTime = time1.minusMillis(x);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
// String endTimeStr = format.print(endTime.getMillis()).toString();
String endTimeStr = "2018-11-26 20:24:39";
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 = ?\n",endTimeStr,betId);
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n",endTimeStr,betId);
}
/**
* 提供精确的加法运算。
* @param v1
* @param v2
* @return 两个参数的和
*/
public static double sub(double v1,double v2){
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.add(b2).doubleValue();
}
}
\ No newline at end of file
...@@ -13,7 +13,7 @@ import static io.restassured.RestAssured.given; ...@@ -13,7 +13,7 @@ import static io.restassured.RestAssured.given;
*/ */
@Service @Service
public class SupplierExchangeTemplateService { public class SupplierExchangeTemplateService {
private String dafuwengHost = "47.97.214.108"; private String dafuwengHost = "dafuweng.duibatest.com.cn";
public Response use(String id){ public Response use(String id){
String url = "http://"+dafuwengHost+"/supplierExchangeTemplate/use"; String url = "http://"+dafuwengHost+"/supplierExchangeTemplate/use";
......
...@@ -42,7 +42,7 @@ public class PkDevelopService { ...@@ -42,7 +42,7 @@ public class PkDevelopService {
private DuibaLog logger = DuibaLog.getLogger(); private DuibaLog logger = DuibaLog.getLogger();
public Response betEditor(String appId,String bonusType,String bonusAmount,String shareExp) throws Exception{ public Response betEditor(String appId,String bonusType,String bonusAmount,String creditsValue,String shareExp) throws Exception{
String data = PublicMethod.data(); String data = PublicMethod.data();
String url = "http://" + hdHost + "/visual-editor/bet/post"; String url = "http://" + hdHost + "/visual-editor/bet/post";
...@@ -74,7 +74,7 @@ public class PkDevelopService { ...@@ -74,7 +74,7 @@ public class PkDevelopService {
} }
betDevelopVo.setBonusAmount(bonusAmount); betDevelopVo.setBonusAmount(bonusAmount);
betDevelopVo.setConfigStatus("3"); betDevelopVo.setConfigStatus("3");
betDevelopVo.setCreditsValue("1"); betDevelopVo.setCreditsValue(creditsValue);
betDevelopVo.setEndTime("2029-12-31 00:00"); betDevelopVo.setEndTime("2029-12-31 00:00");
betDevelopVo.setShareExp(shareExp); betDevelopVo.setShareExp(shareExp);
......
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