|
@@ -33,9 +33,9 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
|
|
String url = "https://ad.oceanengine.com/pages/login/index.html";
|
|
String url = "https://ad.oceanengine.com/pages/login/index.html";
|
|
// System.getProperties().setProperty("webdriver.chrome.driver", "D:/chromedriver.exe");
|
|
// System.getProperties().setProperty("webdriver.chrome.driver", "D:/chromedriver.exe");
|
|
System.getProperties().setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
|
|
System.getProperties().setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
|
|
|
|
+ ChromeOptions chromeOptions = new ChromeOptions();
|
|
|
|
+ WebDriver webDriver = new ChromeDriver(chromeOptions);
|
|
try {
|
|
try {
|
|
- ChromeOptions chromeOptions = new ChromeOptions();
|
|
|
|
- WebDriver webDriver = new ChromeDriver(chromeOptions);
|
|
|
|
chromeOptions.addArguments("--headless");
|
|
chromeOptions.addArguments("--headless");
|
|
chromeOptions.addArguments("--incognito");
|
|
chromeOptions.addArguments("--incognito");
|
|
chromeOptions.addArguments("--no-sandbox");
|
|
chromeOptions.addArguments("--no-sandbox");
|
|
@@ -44,8 +44,6 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
|
|
chromeOptions.addArguments("--user-agent=" + HttpUtils.USER_AGENT);
|
|
chromeOptions.addArguments("--user-agent=" + HttpUtils.USER_AGENT);
|
|
chromeOptions.setAcceptInsecureCerts(true);
|
|
chromeOptions.setAcceptInsecureCerts(true);
|
|
webDriver.get(url); //获取登录页面
|
|
webDriver.get(url); //获取登录页面
|
|
-
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
for (Cookie cookie : webDriver.manage().getCookies()) {
|
|
for (Cookie cookie : webDriver.manage().getCookies()) {
|
|
BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
|
|
BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
|
|
ck.setDomain("ad.oceanengine.com");
|
|
ck.setDomain("ad.oceanengine.com");
|
|
@@ -112,8 +110,6 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
|
|
param2.put("landing_type", 3);
|
|
param2.put("landing_type", 3);
|
|
param2.put("campaign_type", 1);
|
|
param2.put("campaign_type", 1);
|
|
param2.put("budget", param3);
|
|
param2.put("budget", param3);
|
|
-
|
|
|
|
-// webDriver.get("https://ad.toutiao.com/pages/campaign/create.html");
|
|
|
|
for (Cookie cookie : webDriver.manage().getCookies()) {
|
|
for (Cookie cookie : webDriver.manage().getCookies()) {
|
|
if (cookie.getName().equals("csrftoken")) {
|
|
if (cookie.getName().equals("csrftoken")) {
|
|
csrftoken = cookie.getValue();
|
|
csrftoken = cookie.getValue();
|
|
@@ -174,7 +170,6 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
|
|
param5.put("projectid", "");
|
|
param5.put("projectid", "");
|
|
param5.put("localGeolocation", new ArrayList<String>());
|
|
param5.put("localGeolocation", new ArrayList<String>());
|
|
param5.put("external_action", 4);
|
|
param5.put("external_action", 4);
|
|
-// param5.put("external_url", "");
|
|
|
|
param5.put("open_url", ""); // 应用直达链接
|
|
param5.put("open_url", ""); // 应用直达链接
|
|
param5.put("style_type", 0);
|
|
param5.put("style_type", 0);
|
|
param5.put("location_type", 4); //受众位置类型
|
|
param5.put("location_type", 4); //受众位置类型
|
|
@@ -195,7 +190,6 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
|
|
param5.put("start_time", requestJson.getString("startDate")); //广告投放起始时间
|
|
param5.put("start_time", requestJson.getString("startDate")); //广告投放起始时间
|
|
param5.put("end_time", requestJson.getString("endDate"));//广告投放结束时间
|
|
param5.put("end_time", requestJson.getString("endDate"));//广告投放结束时间
|
|
}
|
|
}
|
|
-
|
|
|
|
param5.put("week_schedule", new ArrayList<String>()); //投放时段
|
|
param5.put("week_schedule", new ArrayList<String>()); //投放时段
|
|
param5.put("week_time", new ArrayList<ArrayList<Integer>>());//投放时段
|
|
param5.put("week_time", new ArrayList<ArrayList<Integer>>());//投放时段
|
|
int pricing = requestJson.getIntValue("pricing");
|
|
int pricing = requestJson.getIntValue("pricing");
|
|
@@ -209,7 +203,6 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
|
|
} else {
|
|
} else {
|
|
param5.put("bid", requestJson.getIntValue("convertPrice"));
|
|
param5.put("bid", requestJson.getIntValue("convertPrice"));
|
|
}
|
|
}
|
|
-
|
|
|
|
param5.put("package", requestJson.getString("packageName"));
|
|
param5.put("package", requestJson.getString("packageName"));
|
|
param5.put("smart_bid_type", requestJson.getIntValue("bidType")); //自动出价类型,OCPM支持
|
|
param5.put("smart_bid_type", requestJson.getIntValue("bidType")); //自动出价类型,OCPM支持
|
|
param5.put("adjust_cpa", 0); //是否调整自动出价 允许值: "0", "1" 默认值: 0
|
|
param5.put("adjust_cpa", 0); //是否调整自动出价 允许值: "0", "1" 默认值: 0
|
|
@@ -220,13 +213,11 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
|
|
String createResult = HttpUtils.httpPostRequest("https://ad.oceanengine.com/overture/ad/create/", param5, header);
|
|
String createResult = HttpUtils.httpPostRequest("https://ad.oceanengine.com/overture/ad/create/", param5, header);
|
|
System.out.println(createResult);
|
|
System.out.println(createResult);
|
|
}
|
|
}
|
|
-// webDriver.close();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ webDriver.quit();
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|