Commit 871f2ba4 authored by wangxiaoshuang's avatar wangxiaoshuang

wxs

parent 66b83e56
package http.cases.GoodsAndTradeTest;
import base.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.Test;
......@@ -10,6 +11,11 @@ import java.util.Date;
@ContextConfiguration(classes = Config.class)
public class 自有卡券库 extends AbstractTestNGSpringContextTests {
@Value("${hdserver.host}")
String hdHost;
@Test
public void t333(){
Date date=new Date();
......
......@@ -63,7 +63,6 @@ public class DevCards {
}
return response;
}
//导入批次
//删除
public Response delete(String appId,String id) throws Exception {
......@@ -82,5 +81,4 @@ public class DevCards {
return response;
}
}
package http.service.goods;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
@Service
public class DevCardsKaquanDetails {
@Value("${hdserver.host}")
String hdHost;
@Autowired
Authorization authorization;
//查询指定卡券库批次列表信息
public Response getBatchList(String id) throws Exception {
String url="http://"+hdHost+"/cardLibrary/getBatchList";
Map<String,Object> map = new HashMap<>();
map.put("id",id);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).get(url);
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 getDetail(String appId,String id,String batchId) throws Exception {
String url="http://"+hdHost+"/cardLibrary/getDetail";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);
map.put("id",id);//卡券库ID
map.put("pageNo","1");
map.put("pageSize","15");
map.put("status","");
map.put("batchId",batchId);//批次ID
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).get(url);
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 deleteCouponBatch(String appId,String batchId,String cardLibraryId) throws Exception {
String url="http://"+hdHost+"/cardLibrary/deleteCouponBatch";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);
map.put("batchId",batchId);//批次ID
map.put("cardLibraryId",cardLibraryId);//卡券库ID
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).post(url);
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 deleteCoupon(String appId,String id,String batchId,String cardLibraryId) throws Exception {
String url="http://"+hdHost+"/cardLibrary/deleteCoupon";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);
map.put("id",id);//卡券ID
map.put("pageNo","1");
map.put("pageSize","15");
map.put("status","");
map.put("batchId",batchId);//批次ID
map.put("cardLibraryId",cardLibraryId);//卡券库ID
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).post(url);
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 importCoupon(String appId,String id,String batchId,String cardLibraryId,String type) throws Exception {
String url="http://"+hdHost+"/cardLibrary/importCoupon";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);
map.put("id",id);
map.put("status","");
map.put("batchId",batchId);//批次ID
map.put("cardLibraryId",cardLibraryId);//卡券库ID
map.put("type",type);
map.put("fileUrl","http://yun.dui88.com/coupons/1545731089854.txt");
map.put("startDay","2019-12-26");
map.put("endDay","2044-12-26");
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).post(url);
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 getImportStatus(String appId,String importId) throws Exception {
String url="http://"+hdHost+"/cardLibrary/getImportStatus";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);
map.put("importId",importId);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).get(url);
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;
}
}
package http.service.goods;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
@Service
public class DuibaCards {
@Value("${manager.host}")
String ManagerHost;//ManagerHost = mng.duibatest.com.cn
@Autowired
Authorization authorization;
//添加券码
public Response cardsSave(String appId,String type,String name) throws Exception {
String url="http://"+ManagerHost+"/cardLibrary/save";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);//应用ID
map.put("type",type);//类型
map.put("name",name);//名称
map.put("fileUrl","http%3A%2F%2Fyun.dui88.com%2Fcoupons%2F1544497069778.txt");//文件地址
map.put("startDay","");//有效期--开始时间
map.put("endDay","");//有效期--结束时间
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.ssoLogin()).post(url);
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 list(String appId,String name,String type,String excludeRelated) throws Exception {
String url="http://"+ManagerHost+"/cardLibrary/list";
Map<String,Object> map = new HashMap<>();
map.put("name",name);//名称
map.put("pageNo","1");
map.put("pageSize","15");
map.put("appId",appId);
map.put("type",type);//类型:0:券码 1:链接 2:重复 3:卡密
map.put("excludeRelated",excludeRelated);//true:排查已关联的 false:不排除
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.ssoLogin()).get(url);
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 delete(String appId,String id) throws Exception {
String url="http://"+ManagerHost+"/cardLibrary/delete";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);
map.put("id",id);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.ssoLogin()).post(url);
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