Commit dc7b8e48 authored by Su-Yi's avatar Su-Yi

修改管理后台部分

parent 9f66fedd
...@@ -223,4 +223,6 @@ public class BasicConfig { ...@@ -223,4 +223,6 @@ public class BasicConfig {
public static final String MANAGER_CHANGECOMPANY = "/kjy/manager/seller/changeCompany"; public static final String MANAGER_CHANGECOMPANY = "/kjy/manager/seller/changeCompany";
public static final String MANAGER_UPDATETYPEORDATE = "/kjy/manager/seller/updateTypeOrDate"; public static final String MANAGER_UPDATETYPEORDATE = "/kjy/manager/seller/updateTypeOrDate";
public static final String MANAGER_SETINTERALSELLER = "/kjy/manager/seller/setInternalSeller";
} }
...@@ -17,7 +17,7 @@ import static io.restassured.RestAssured.given; ...@@ -17,7 +17,7 @@ import static io.restassured.RestAssured.given;
public class ManagerUtil { public class ManagerUtil {
private static final NetworkUtil network = NetworkUtil.getInstance(); private static final NetworkUtil network = NetworkUtil.getInstance();
// 管理后台登录 // 登录管理后台
public static void ssologin(){ public static void ssologin(){
network.host = SSO_HOST; network.host = SSO_HOST;
//1.先进入SSO登录框 登入管理后台 //1.先进入SSO登录框 登入管理后台
...@@ -40,18 +40,26 @@ public class ManagerUtil { ...@@ -40,18 +40,26 @@ public class ManagerUtil {
network.agentHeaders.put("X-Csrf-Token",ssoCookies.get("csrf_token")); network.agentHeaders.put("X-Csrf-Token",ssoCookies.get("csrf_token"));
} }
// 拿到sellerId
public static String getSellerId (){
network.host = HOST;
Response response = network.getResponse(USER_INFO);
return response.jsonPath().getString("data.sellerId");
}
// 切换vip // 切换vip
public static void switchvip(String sellerId){ public static void switchvip(String sellerId) {
network.host = MANAGER_HOST; network.host = MANAGER_HOST;
// 2.切换公司为客集集 // 1.切换公司为客集集
Map<String, Object> switchCompanyParams = new HashMap<String, Object>(); Map<String, Object> changeParams = new HashMap<String, Object>();
switchCompanyParams.put("id",sellerId); changeParams.put("id",sellerId);
switchCompanyParams.put("companyId",6); changeParams.put("companyId",6);
Response response = network.getResponse(switchCompanyParams,MANAGER_CHANGECOMPANY); Response response = network.getResponse(changeParams,MANAGER_CHANGECOMPANY);
response.body().prettyPrint(); response.body().prettyPrint();
// 3.切换为保险版vip // 2.切换为保险版vip
Map<String, Object> switchVipParams = new HashMap<String, Object>(); Map<String, Object> switchVipParams = new HashMap<String, Object>();
switchVipParams.put("reason","1"); switchVipParams.put("reason","1");
switchVipParams.put("sellerId",sellerId); switchVipParams.put("sellerId",sellerId);
...@@ -62,33 +70,31 @@ public class ManagerUtil { ...@@ -62,33 +70,31 @@ public class ManagerUtil {
response = network.postResponse(switchVipParams,MANAGER_UPDATETYPEORDATE); response = network.postResponse(switchVipParams,MANAGER_UPDATETYPEORDATE);
response.body().prettyPrint(); response.body().prettyPrint();
// 4.切换公司为空 // 3.切换公司为空
switchCompanyParams.remove("companyId",6); //去掉公司 changeParams.remove("companyId",6); //去掉公司
response = network.getResponse(switchCompanyParams,MANAGER_CHANGECOMPANY); response = network.getResponse(changeParams,MANAGER_CHANGECOMPANY);
response.body().prettyPrint(); response.body().prettyPrint();
network.host = HOST; network.host = HOST;
} }
// 切换为内部人员 // 切换为内部人员
public static void switchInsider(String sellerId) { public static void switchInsider(String sellerId){
// https://kjj-mng.duibatest.com.cn/kjy/manager/seller/setInternalSeller?id=2163&internalSeller=1 network.host = MANAGER_HOST;
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("id",sellerId); params.put("id",sellerId);
params.put("internalSeller",1); params.put("internalSeller",1);//1 内部 0 非内部
Response response = network.getResponse(params,MANAGER_SETINTERALSELLER);
response.body().prettyPrint();
} }
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
// 1.拿到sellerId String sellerId = getSellerId();
Response response = network.getResponse(USER_INFO);
String sellerId = response.jsonPath().getString("data.sellerId");
ssologin(); ssologin();
switchvip(sellerId); switchvip(sellerId);
switchInsider(sellerId);
} }
} }
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