Commit 96cb313b authored by 赵然's avatar 赵然

zr

parent 98e1f910
...@@ -25,7 +25,7 @@ import org.testng.annotations.Test; ...@@ -25,7 +25,7 @@ import org.testng.annotations.Test;
import java.util.Map; import java.util.Map;
public class 瓜分积分_作弊瓜分 extends DuibaTestBase { public class 瓜分积分_作弊瓜分_AccessTest extends DuibaTestBase {
@Autowired @Autowired
PkDevelopService pkDevelopService; PkDevelopService pkDevelopService;
......
...@@ -27,7 +27,7 @@ import java.util.List; ...@@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class 瓜分积分_实际瓜分 extends DuibaTestBase { public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
@Autowired @Autowired
PkDevelopService pkDevelopService; PkDevelopService pkDevelopService;
......
...@@ -27,7 +27,7 @@ import java.text.DecimalFormat; ...@@ -27,7 +27,7 @@ import java.text.DecimalFormat;
import java.util.Map; import java.util.Map;
public class 瓜分红包_作弊瓜分 extends DuibaTestBase { public class 瓜分红包_作弊瓜分_AccessTest extends DuibaTestBase {
@Autowired @Autowired
PkDevelopService pkDevelopService; PkDevelopService pkDevelopService;
......
...@@ -27,7 +27,7 @@ import java.text.DecimalFormat; ...@@ -27,7 +27,7 @@ import java.text.DecimalFormat;
import java.util.Map; import java.util.Map;
public class 瓜分红包_实际瓜分 extends DuibaTestBase { public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
@Autowired @Autowired
PkDevelopService pkDevelopService; PkDevelopService pkDevelopService;
......
...@@ -56,6 +56,7 @@ public class Authorization { ...@@ -56,6 +56,7 @@ public class Authorization {
private static Map<String,String> hdCookiesMabo; private static Map<String,String> hdCookiesMabo;
private static Map<String,String> hdCookiesSaas; private static Map<String,String> hdCookiesSaas;
private static Map<String,Map> hdCookiesSaasByApp = new ConcurrentHashMap<>(); private static Map<String,Map> hdCookiesSaasByApp = new ConcurrentHashMap<>();
private static Map<String,Map> hdCookiesSaasNew = new ConcurrentHashMap<>();
private static Map<String,Map> hdCookiesCommon = new ConcurrentHashMap<>(); private static Map<String,Map> hdCookiesCommon = new ConcurrentHashMap<>();
private static Map<String,String> openbsCookies; private static Map<String,String> openbsCookies;
private Map<String,String> ssoCookies =null; private Map<String,String> ssoCookies =null;
...@@ -241,6 +242,7 @@ public class Authorization { ...@@ -241,6 +242,7 @@ public class Authorization {
return hdCookiesMabo; return hdCookiesMabo;
} }
//密码为wxs123456 (支持账号 wxs@duiba.com.cn,尽量不要用)
public Map hdLoginSaas(){ public Map hdLoginSaas(){
int i=10; int i=10;
while((hdCookiesSaas==null||hdCookiesSaas.size()==0)&&i>0) { while((hdCookiesSaas==null||hdCookiesSaas.size()==0)&&i>0) {
...@@ -261,6 +263,7 @@ public class Authorization { ...@@ -261,6 +263,7 @@ public class Authorization {
return hdCookiesSaas; return hdCookiesSaas;
} }
//密码为wxs123456 (支持 账号为wxs@duiba.com.cn 下的任意appId)
public Map hdLoginSaas(String appId){ public Map hdLoginSaas(String appId){
int i=10; int i=10;
logger.info("hdCookiesSaasByApp cookies:"+hdCookiesSaasByApp.toString()); logger.info("hdCookiesSaasByApp cookies:"+hdCookiesSaasByApp.toString());
...@@ -292,7 +295,44 @@ public class Authorization { ...@@ -292,7 +295,44 @@ public class Authorization {
logger.info("hdCookiesSaasByApp cookies集合:"+hdCookiesSaasByApp.toString()); logger.info("hdCookiesSaasByApp cookies集合:"+hdCookiesSaasByApp.toString());
return hdCookies; return hdCookies;
} }
//密码为duibaduiba123
//密码为duibaduiba123(支持任意手机账号下的任意APPId)
public Map hdLoginSaasNew(String account,String appId){
String path = "/doLoginNew";
int i=10;
logger.info("hdCookiesSaasByApp cookies:"+hdCookiesSaasNew.toString());
Map<String,String> hdCookies = hdCookiesSaasNew.get(appId);
while((hdCookies==null||hdCookies.size()==0)&&i>0) {
Response token=this.hdGetToken();
String url = PROTOCOL + hdHost + path;
Map<String,String> cookies=token.getCookies();
Map<String, String> paras = new HashMap<>();
paras.put("account", account);
paras.put("password", SecurityUtils.getMD5("Dct7xTdGPvbUL1eOtSWoB9ySZNY="+from(token.asString()).getString("data.loginsToken")));
paras.put("redirect", "/redirectApp");
paras.put("isAutoLogin", "true");
paras.put("validate","22");
Response response = given().cookies(cookies).params(paras).post(url);
response.prettyPrint();
Map<String,String> map = response.getCookies();
logger.info("cookies:"+map.toString());
hdCookies=new HashMap<>(response.getCookies());
if(hdCookies!=null||hdCookies.size()!=0) {
//取消安全校验
hdCookies.remove("csrf_token");
hdCookies.put("appId", appId);
hdCookies.put("duibaAppId", appId);
logger.info("cookies2:"+hdCookies.toString());
hdCookiesSaasNew.put(appId,hdCookies);
}
i--;
}
logger.info("hdCookiesSaasByApp cookies集合:"+hdCookiesSaasNew.toString());
return hdCookies;
}
//密码为duibaduiba123 (支持任意邮箱账号)
public Map hdLoginCommon(String email){ public Map hdLoginCommon(String email){
int i=10; int i=10;
Map<String,String> hdCookies = hdCookiesCommon.get(email); Map<String,String> hdCookies = hdCookiesCommon.get(email);
...@@ -344,7 +384,6 @@ public class Authorization { ...@@ -344,7 +384,6 @@ public class Authorization {
i--; i--;
} }
//取消安全校验 //取消安全校验
// logger.info(hdCookies); // logger.info(hdCookies);
return hdCookies; return hdCookies;
} }
......
...@@ -40,8 +40,6 @@ public class PkDevelopService { ...@@ -40,8 +40,6 @@ public class PkDevelopService {
@Autowired @Autowired
Authorization authorization; Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
public Response betEditor(String appId,String bonusType,String bonusAmount,String creditsValue,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();
...@@ -100,6 +98,64 @@ public class PkDevelopService { ...@@ -100,6 +98,64 @@ public class PkDevelopService {
return betResponse; return betResponse;
} }
public Response betEditor_right(String account,String appId,String bonusType,String bonusAmount,String creditsValue,String shareExp,String loser,String winner) throws Exception{
String data = PublicMethod.data();
String url = "http://" + hdHost + "/visual-editor/bet/post";
//创建投注项
List<BetOptionVo> betOptionVoList = new ArrayList<>();
BetOptionVo betOptionVo1 = new BetOptionVo();
BetOptionVo betOptionVo2 = new BetOptionVo();
betOptionVo1.setOptionImg("//yun.dui88.com/images/201812/75j84chnkg.jpg");
betOptionVo1.setOptionName("1");
betOptionVo1.setRightAnswer(loser);
betOptionVo2.setOptionImg("//yun.dui88.com/images/201812/4f51vmzfpu.png");
betOptionVo2.setOptionName("2");
betOptionVo2.setRightAnswer(winner);
betOptionVoList.add(betOptionVo1);
betOptionVoList.add(betOptionVo2);
//创建活动配置
List<BetDevelopVo> betDevelopVoList = new ArrayList<>();
BetDevelopVo betDevelopVo = new BetDevelopVo();
betDevelopVo.setBetOptionDtoList(betOptionVoList);
betDevelopVo.setBetType("1");
betDevelopVo.setBonusType(bonusType);
if (bonusType.equals("2")){
betDevelopVo.setTitle("【自动化】组件pk_瓜分红包"+data);
}else if (bonusType.equals("4")){
betDevelopVo.setTitle("【自动化】组件pk_瓜分积分"+data);
}
betDevelopVo.setBonusAmount(bonusAmount);
betDevelopVo.setConfigStatus("3");
betDevelopVo.setCreditsValue(creditsValue);
betDevelopVo.setEndTime("2029-12-31 00:00");
betDevelopVo.setShareExp(shareExp);
betDevelopVoList.add(betDevelopVo);
Map<String,Object> para = new HashMap<>();
para.put("list",betDevelopVoList);
para.put("rules","自动化规则自动化规则");
para.put("title","组件pk自动化_主胜方");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(para));
Response betResponse = given().contentType("application/json;charset=UTF-8").cookies(authorization.hdLoginSaasNew(account,appId)).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 doDraw() throws Exception{ public Response doDraw() throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betOpenPrize/doDraw"; String url = "http://" + ManagerHost + "/newmanager/betOpenPrize/doDraw";
Map<String,Object> para = new HashMap<>(); Map<String,Object> para = new HashMap<>();
......
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