Commit 14f2fdab authored by wangxiaoshuang's avatar wangxiaoshuang

wxs

parent f466cb4c
package http.cases.GoodsAndTradeTest;
import base.Config;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.Test;
import java.text.SimpleDateFormat;
import java.util.Date;
@ContextConfiguration(classes = Config.class)
public class 自有卡券库 extends AbstractTestNGSpringContextTests {
@Test
public void t333(){
Date date=new Date();
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM--dd");
simpleDateFormat.format(date);
System.out.println("---------"+simpleDateFormat.format(date));
}
}
package http.service.goods;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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 DevCards {
@Value("${hdserver.host}")
String hdHost;
@Autowired
Authorization authorization;
//添加券码
public Response cardsSave(String appId,String type,String name) throws Exception {
String url="http://"+hdHost+"/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.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 list(String appId,String name) throws Exception {
String url="http://"+hdHost+"/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","");
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 delete(String appId,String id) throws Exception {
String url="http://"+hdHost+"/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.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;
}
}
package http.service.goods;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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 DevDoUpdateCoupon {
@Value("${hdserver.host}")
String hdHost;
@Autowired
Authorization authorization;
//添加普通券码
public Response doupdateCouponPT(String appId, String classifyIds,String title,String type) throws Exception {
String url="http://"+hdHost+"/devItemNew/doUpdateCoupon";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);//应用ID
map.put("classifyIds",classifyIds);//商品分组
map.put("arealimitAreas"," [{provinceCode: \"340000\", provinceName: \"安徽省\", cityName: \"全省范围\", cityCode: \"all\"}]");
map.put("arealimitSwitch","true");//是否勾选地域限制 true 勾选,false 未勾选
map.put("arealimitType","1");//类型 1白名单 2 黑名单
map.put("attributes","[\n" +
"{\n" +
"\"skuInfo\": {\n" +
"\"remaining\": 10000,\n" +
"\"salePrice\": \"9.32\",\n" +
"\"facePrice\": \"9.20\",\n" +
"\"merchantCoding\": \"232323\"\n" +
"},\n" +
"\"children\": null\n" +
"}\n" +
"]");
map.put("isOwner","true");//是否自有商品
map.put("multiImage","[\n" +
"\"//yun.dui88.com/images/201812/fjwhiijs6j.jpg\",\n" +
"\"//yun.dui88.com/images/201812/243svyhvv0.png\"\n" +
"]");
map.put("multiSku","false");
map.put("levelLimitType","1");
map.put("levelCheckbox","[]");
map.put("validDaterange","[]");
map.put("showJumpButton","true");
map.put("cardLibraryId","46");//关联卡券
map.put("cardLibraryName","卡券");//关联卡券名称
map.put("showBarCode","true");
map.put("linkUrl","http://www.baidu.com");//跳转链接
map.put("title",title);
map.put("sellingPoint","卖点描述");
map.put("smallImage","//yun.dui88.com/images/201812/bqrfryl2bd.png");
map.put("devAudit","true");
map.put("weixinShareDesc","这是分享描述文案,分享后可以查看");
map.put("usageRule","<p>这是使用规则:</p><p>1、附近考虑到税费就是;</p><p>2、反馈的是浪费就开始;</p><p>3、风刀霜剑发了第三方市领导反馈</p>");
map.put("description","<p>这是图文详情信息,反馈代理商房间</p><p>1反馈到洛杉矶福克斯代理费收代理费水电费疯狂夺金发牢骚的</p>");
map.put("type",type);
map.put("subType","0");
map.put("limitType","forever");
map.put("expressType","free");
//json 格式转成form表单
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).body(jsonParam).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 doupdateCouponLianjie(String appId, String classifyIds,String title,String type) throws Exception {
String url="http://"+hdHost+"/devItemNew/doUpdateCoupon";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);//应用ID
map.put("classifyIds",classifyIds);//商品分组
map.put("arealimitSwitch","true");//是否勾选地域限制 true 勾选,false 未勾选
map.put("arealimitType","2");//类型 1白名单 2 黑名单
map.put("attributes","[\n" +
" {\n" +
" \"skuInfo\":{\n" +
" \"remaining\":\"10\",\n" +
" \"salePrice\":\"80\",\n" +
" \"facePrice\":\"20\",\n" +
" \"merchantCoding\":\"STREE001\"\n" +
" },\n" +
" \"children\":null\n" +
" }\n" +
" ]");
map.put("isOwner","true");//是否自有商品
map.put("multiImage","[\n" +
"\"//yun.dui88.com/images/201812/fjwhiijs6j.jpg\",\n" +
"\"//yun.dui88.com/images/201812/243svyhvv0.png\"\n" +
"]");
map.put("multiSku","false");
map.put("levelLimitType","1");
map.put("levelCheckbox","[]");
map.put("validDaterange","[\n" +
" \"2018-12-11\",\n" +
" \"2018-12-13\"\n" +
" ]");
map.put("showJumpButton","");
map.put("cardLibraryId","");//关联卡券
map.put("cardLibraryName","");//关联卡券名称
map.put("showBarCode","");
map.put("linkUrl","https://hz.58.com");//跳转链接
map.put("couponCode","");
map.put("couponCount","10");//数量
map.put("title",title);
map.put("sellingPoint","卖点描述");
map.put("smallImage","//yun.dui88.com/images/201812/bqrfryl2bd.png");
map.put("devAudit","true");
map.put("arealimitAreas","[\n" +
" {\n" +
" \"provinceCode\":\"360000\",\n" +
" \"provinceName\":\"江西省\",\n" +
" \"cityName\":\"全省范围\",\n" +
" \"cityCode\":\"all\"\n" +
" }\n" +
" ]");
map.put("weixinShareDesc","这是分享描述文案,分享后可以查看");
map.put("autoOffDate","2025-12-27 00:00");
map.put("usageRule","<p>这是使用规则:</p><p>1、附近考虑到税费就是;</p><p>2、反馈的是浪费就开始;</p><p>3、风刀霜剑发了第三方市领导反馈</p>");
map.put("description","<p>这是图文详情信息,反馈代理商房间</p><p>1反馈到洛杉矶福克斯代理费收代理费水电费疯狂夺金发牢骚的</p>");
map.put("type",type);
map.put("subType","1");
map.put("limitType","forever");
map.put("expressType","free");
map.put("validStartDay","2018-12-11");
map.put("validEndDay","2018-12-13");
//json 格式转成form表单
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).body(jsonParam).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 doupdateCouponChongfu(String appId, String classifyIds,String title,String type) throws Exception {
String url="http://"+hdHost+"/devItemNew/doUpdateCoupon";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);//应用ID
map.put("classifyIds",classifyIds);//商品分组
map.put("arealimitSwitch","true");//是否勾选地域限制 true 勾选,false 未勾选
map.put("arealimitType","2");//类型 1白名单 2 黑名单
map.put("attributes","[\n" +
" {\n" +
" \"skuInfo\":{\n" +
" \"remaining\":\"10\",\n" +
" \"salePrice\":\"80\",\n" +
" \"facePrice\":\"20\",\n" +
" \"merchantCoding\":\"STREE001\"\n" +
" },\n" +
" \"children\":null\n" +
" }\n" +
" ]");
map.put("isOwner","true");//是否自有商品
map.put("multiImage","[\n" +
"\"//yun.dui88.com/images/201812/fjwhiijs6j.jpg\",\n" +
"\"//yun.dui88.com/images/201812/243svyhvv0.png\"\n" +
"]");
map.put("multiSku","false");
map.put("levelLimitType","1");
map.put("levelCheckbox","[]");
map.put("validDaterange","[\n" +
" \"2018-12-11\",\n" +
" \"2022-12-13\"\n" +
" ]");
map.put("showJumpButton","");
map.put("cardLibraryId","");//关联卡券
map.put("cardLibraryName","");//关联卡券名称
map.put("showBarCode","");
map.put("linkUrl","https://hz.58.com");//跳转链接
map.put("couponCode","TTT0001");//券码
map.put("couponCount","10");//数量
map.put("title",title);
map.put("sellingPoint","卖点描述");
map.put("smallImage","//yun.dui88.com/images/201812/bqrfryl2bd.png");
map.put("devAudit","true");
map.put("arealimitAreas","[\n" +
" {\n" +
" \"provinceCode\":\"360000\",\n" +
" \"provinceName\":\"江西省\",\n" +
" \"cityName\":\"全省范围\",\n" +
" \"cityCode\":\"all\"\n" +
" }\n" +
" ]");
map.put("weixinShareDesc","这是分享描述文案,分享后可以查看");
map.put("autoOffDate","2025-12-27 00:00");
map.put("usageRule","<p>这是使用规则:</p><p>1、附近考虑到税费就是;</p><p>2、反馈的是浪费就开始;</p><p>3、风刀霜剑发了第三方市领导反馈</p>");
map.put("description","<p>这是图文详情信息,反馈代理商房间</p><p>1反馈到洛杉矶福克斯代理费收代理费水电费疯狂夺金发牢骚的</p>");
map.put("type",type);
map.put("subType","1");
map.put("limitType","forever");
map.put("expressType","free");
map.put("validStartDay","2018-12-11");
map.put("validEndDay","2022-12-13");
//json 格式转成form表单
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).body(jsonParam).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;
}
}
......@@ -84,33 +84,5 @@ public class DevDoUpdateObject {
}
return response;
}
//保存积分配置
public Response doUpdateCredits(String appId,String appItemId) throws Exception{
String url="http://"+hdHost+"/devItemNew/doUpdateCredits";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);//appid
map.put("appItemId",appItemId);//商品ID
map.put("buttonText","");
map.put("creditsInfos","[{skuId: \"0\"}]");//自定义
map.put("dateRage","[\"2018-11-29\", \"2019-05-31\"]");
map.put("exchangeType","1");//兑换类型,1:自动 2:自定义
map.put("indexHidden","true");//是否在首页商品区隐藏,true:隐藏 false:显示
map.put("limitDate","2018-11-29,2019-05-31");//兑换日期限制
map.put("limitEverydayQuantity","6");//每日限量
map.put("multiSku","false");
map.put("onSale","false");//是否上架 true:立即上架 false:放入仓库
map.put("originalPriceBuy","true");//是否支持原价购买 ,true:支持 false:不支持
//json 格式转成form表单
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).body(jsonParam).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;
}
}
package http.service.goods;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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 DoUpdateCredits {
@Value("${hdserver.host}")
String hdHost;
@Autowired
Authorization authorization;
//获取商品ID
public Response getCreditsDetail(String appId,String appItemId) throws Exception{
String url="http://"+hdHost+"devItemNew/getCreditsDetail";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);//appid
map.put("appItemId",appItemId);//商品ID
//json 格式转成form表单
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).body(jsonParam).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 doUpdateCredits(String appId, String appItemId,String creditsInfos) throws Exception{
String url="http://"+hdHost+"/devItemNew/doUpdateCredits";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);//appid
map.put("appItemId",appItemId);//商品ID
map.put("buttonText","");
map.put("creditsInfos",creditsInfos);//自定义
map.put("dateRage","[\"2018-11-29\", \"2019-05-31\"]");
map.put("exchangeType","1");//兑换类型,1:自动 2:自定义
map.put("indexHidden","true");//是否在首页商品区隐藏,true:隐藏 false:显示
map.put("limitDate","2018-11-29,2019-05-31");//兑换日期限制
map.put("limitEverydayQuantity","6");//每日限量
map.put("multiSku","false");
map.put("onSale","false");//是否上架 true:立即上架 false:放入仓库
map.put("originalPriceBuy","true");//是否支持原价购买 ,true:支持 false:不支持
//json 格式转成form表单
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).body(jsonParam).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