Commit b11ff4ea authored by 周松波's avatar 周松波

fix

parent c0956140
......@@ -12,6 +12,7 @@ import http.service.Authorization;
import http.service.hd.SigninService;
import io.restassured.response.Response;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -38,6 +39,21 @@ public class ContractSignCommon extends DuibaTestBase{
String activityHost;
private DuibaLog logger = DuibaLog.getLogger();
public Response queryRewardResult(String ContractId, int uid) throws Exception{
Response response = ContractSignService.queryRewardStatus(ContractId, uid);;
String rewardStatus = response.jsonPath().getString("data.rewardStatus");
int num = 10;
while (rewardStatus.equals("0") && num > 0) {
response = ContractSignService.queryRewardStatus(ContractId, uid);
rewardStatus = response.jsonPath().getString("data.rewardStatus");
if (rewardStatus.equals("2")) {
break;
}
num --;
Thread.sleep(1000);
}
return response;
}
public Map<String, String> doJoinResult(String activityId, String betAmount, int uid) throws Exception {
Response doJoinRes = ContractSignService.doJoin(activityId, betAmount, uid);
String contractId = doJoinRes.jsonPath().getString("data.contractId");
......
......@@ -205,7 +205,7 @@ public class ContractSignService {
public Response getReward(String ContractId, int uid) throws Exception{
Map<String, String> map = new HashMap<>();
map.put("contractId", ContractId);
logger.info("请求getReward接口,签到活动id=" + ContractId);
logger.info("请求getReward接口,契约id=" + ContractId);
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).post(activityHost+"/sign/contract/getReward");
try{
Assert.assertEquals(response.jsonPath().getString("success"), "true", "/sign/contract/getReward接口请求失败");
......@@ -216,4 +216,26 @@ public class ContractSignService {
}
return response;
}
/**
* 针对瓜分积分的模式
* @param ContractId
* @param uid
* @return
* @throws Exception
*/
public Response queryRewardStatus(String ContractId, int uid) throws Exception{
Map<String, String> map = new HashMap<>();
map.put("contractId", ContractId);
logger.info("请求queryRewardStatus接口,契约id=" + ContractId);
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).get(activityHost+"/sign/contract/queryRewardStatus");
try{
Assert.assertEquals(response.jsonPath().getString("success"), "true", "/sign/contract/queryRewardStatus接口请求失败");
} catch (Exception e){
throw new Exception("/sign/contract/queryRewardStatus接口失败,返回信息" + response.asString());
} catch (Error er) {
throw new Exception("/sign/contract/queryRewardStatus接口失败,返回信息" + 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