Commit d9bf3ead authored by 别湘灵's avatar 别湘灵

代理人首页

parent e346f781
package com.kjj.bean;
import lombok.Data;
import java.util.Date;
@Data
public class AgentBean {
private String liveId;
private int liveStatus;
private Date noticeTime;
private String picUrl;
private String title;
private Date broadcastTime;
private int ranking;
private int inviteNum;
private int presentNum;
private String companyName;
private String companyId;
private String companyLogo;
private Long appointmentNum;
private int inviteAuthStatus;
}
package com.kjj.bean;
import lombok.Data;
import java.util.List;
@Data
public class AgentCard {
private String sellerName;
private String companyName;
private int companyId;
private String phoneNumber;
private String jobNumber;
private String wechatQrCode;
private String avatar;
private String teamId;
private String teamName;
private List<CompanyList> companyList;
@Data
class CompanyList{
private String companyId;
private String teamId;
private int companyLevel;
}
}
package com.kjj.bean;
import lombok.Data;
import java.util.Date;
@Data
public class AgentEndList {
private String liveId;
private String picUrl;
private String title;
private Date startTime;
private String hasPlayBack;
private String liveEndNeedShowRank;
private int liveStatus;
private int clueCount;
private int notFollowedClueCount;
private String companyName;
private String companyId;
private String companyLogo;
private int inviteAuthStatus;
}
......@@ -22,4 +22,15 @@ public interface AdminAuthorization {
System.out.println("用户AUTH_KEY:"+AUTH_KEY);
}
/**
* 代理人授权
*/
default void agentAuth(){
// 创建用户 并传到network里
BasicConfig.AUTH_KEY = BaseUtils.agentAuthKey();
network.agentCookies.put("authKey",AUTH_KEY);
System.out.println("用户AUTH_KEY:"+AUTH_KEY);
}
}
package com.kjj.cases.live;
import com.kjj.bean.AnswerBean;
import com.kjj.bean.AnswerListBean;
import com.kjj.bean.RewardPkBean;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.AgentBean;
import com.kjj.bean.AgentCard;
import com.kjj.bean.AgentEndList;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.RandomUtils;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.*;
import static com.kjj.config.BasicConfig.ISVIPSUBSCRIBE;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/*代理人端*/
public class Procurator implements AdminAuthorization{
@BeforeClass
public void setUp() {
adminAuth();
agentAuth();
}
public String liveID;
/*代理人端*/
/*代理人首页*/
/*代理人首页直播列表*/
@Test(description = "代理人首页", priority = 1)
public void Agent() {
Map<String, Object> params = new HashMap<>();
params.put("liveId", liveID);
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params, BasicConfig.MOBILE_Procurator);
List<AgentBean> agentBeans = JsonUtil.parseResponseToListBean(response, AgentBean.class);
if (agentBeans.size() > 0) {
AgentBean bean = agentBeans.get(0);
System.out.println(JSON.toJSONString(agentBeans));
Assert.assertNotNull(bean, network.message(params, BasicConfig.MOBILE_Procurator, "查询直播列表失败", response.body().asString()));
}
Response response = network.getResponse(params, BasicConfig.MANAGER_Procurator);
Object data = response.jsonPath().getJsonObject("data.list.[0].liveid");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MANAGER_Procurator, "查询代理人直播列表", response.body().asString()));
}
/*代理人首页已结束的直播列表*/
@Test(description = "代理人首页已结束的直播列表", priority = 2)
public void AgentLiveEndList() {
Map<String, Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params, BasicConfig.MOBILE_AgentEndList);
List<AgentEndList> agentBeans = JsonUtil.parseResponseToListBean(response, AgentEndList.class);
if (agentBeans.size() > 0) {
AgentEndList bean = agentBeans.get(0);
System.out.println(JSON.toJSONString(agentBeans));
Assert.assertNotNull(bean, network.message(params, BasicConfig.MOBILE_AgentEndList, "查询直播结束列表失败", response.body().asString()));
}
}
/*代理人个人信息*/
/*代理人信息*/
@Test(description = "代理人信息", priority = 3)
public void AgentCardInfo() {
Map<String, Object> params = new HashMap<>();
Response response = network.getResponse(params, BasicConfig.MOBILE_AgentCardInfo);
AgentCard agentBeans = JsonUtil.parseResponseToBean(response, AgentCard.class);
System.out.println(JSON.toJSONString(agentBeans));
Assert.assertNotNull(agentBeans, network.message(params, BasicConfig.MOBILE_AgentCardInfo, "查询代理人信息失败", response.body().asString()));
}
/*代理人信息*/
@Test(description = "代理人修改信息", priority = 4)
public void AgentEditCardInfo() {
Map<String, Object> params = new HashMap<>();
params.put("sellerName", "你好测试"+ RandomUtils.nextInt(1, 100));
params.put("phoneNumber", "15258890691");
params.put("jobNumber", "TTTTTT");
params.put("wechatQrCode", "//yun.dui88.com/kjy/nc/qrcode1/1981ec88d22fe37041feac4724c627670817.png");
Response response = network.postResponse(params, BasicConfig.MOBILE_AgentEditCardInfo);
Boolean agentBeans = JsonUtil.parseResponseToBean(response, Boolean.class);
System.out.println(JSON.toJSONString(agentBeans));
Assert.assertNotNull(agentBeans, network.message(params, BasicConfig.MOBILE_AgentEditCardInfo, "修改代理人信息失败", response.body().asString()));
}
}
......@@ -4,7 +4,7 @@ public class BasicConfig {
public static int apiCount; //接口数量统计
// 是否开启钉钉机器人推送
public static final boolean isPushReport =false; //true
public static final boolean isPushReport =true; //true
// 代理人微信昵称
public static final String WECHAT_NAME = "客集集-梦晨"; //true
......@@ -39,6 +39,9 @@ public class BasicConfig {
public static final String MANAGER_HOST = "https://kjj-mng.duibatest.com.cn";
//手机端地址
public static final String MOBILE_HOST = "https://live.duibatest.com.cn";
// *************** 直播 ***************
public static final String MANAGER_SAVEANDUPDATE = MANAGER_HOST + "/kjy/manager/live/pre/conf/saveAndUpdate";
......@@ -76,13 +79,14 @@ public class BasicConfig {
// *************** 代理人 ***************
//用户信息//
public static final String MANAGER_ISProcurator = MANAGER_HOST + "/kjy/live/userInfo";
public static final String MANAGER_Procurator = MANAGER_HOST + "/kjy/live/agent/liveList";
//代理人列表//
public static final String MOBILE_Procurator = MOBILE_HOST + "/kjy/live/agent/liveList";
public static final String MOBILE_AgentEndList = MOBILE_HOST + "/kjy/live/agent/liveEndList";
public static final String MOBILE_AgentCardInfo = MOBILE_HOST + "/kjy/live/agent/card/info";
public static final String MOBILE_AgentEditCardInfo = MOBILE_HOST + "/kjy/live/agent/card/edit";
......
......@@ -3,19 +3,21 @@ package com.kjj.utils;
import io.restassured.response.Response;
import org.testng.Assert;
import static com.kjj.config.BasicConfig.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static com.kjj.config.BasicConfig.*;
public class BaseUtils {
private static final NetworkUtils network = NetworkUtils.getInstance();
public static String createAuthKey(){
return "LEH7epeHVDJWzhZ6DiexTHnsxraeviLJA9bNdknyzwR7cXT557KHZA1Q7zWnN9N2E3vHcFrt8S3xhGApKa3NmE7oaxyXz";
}
public static String agentAuthKey(){
return "LEH7epeHVDJWzhZ6DiexTHnsxs8JtX5mzCVwq1X5TSe6JEJMzL51umD812fWb8P5rLt5mw9SfPzLp6uwthsFnXAhKCYLq";
}
/**
* 登录管理后台
......
package com.kjj.utils;
import io.restassured.response.Response;
import static com.kjj.config.BasicConfig.*;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import static com.kjj.config.BasicConfig.isPushReport;
public class DingTalkUtils {
private static final NetworkUtils network = NetworkUtils.getInstance();
......
package com.kjj.utils;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.WelfareListBean;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import groovy.json.JsonBuilder;
import io.restassured.response.Response;
import java.util.List;
public class JsonUtil {
private JsonUtil() {
}
/**
* 将响应转换成对象
* @param response
* @param tClass
* @param <T>
* @return
*/
public static <T> T parseResponseToBean(Response response, Class<T> tClass){
Object data = response.jsonPath().getJsonObject("data");
String str = new JsonBuilder(data).toString();
return JSON.parseObject(str, tClass);
}
/**
* 分页接口专用-将响应转换成对象
* @param response
* @param tClass
* @param <T>
* @return
*/
public static <T> List<T> parseResponseToListBean(Response response, Class<T> tClass){
Object data = response.jsonPath().getJsonObject("data");
String str = new JsonBuilder(data).toString();
JSONObject jsonObject = JSON.parseObject(str);
JSONArray array = jsonObject.getJSONArray("list");
return array.toJavaList(tClass);
}
}
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