|
@@ -135,11 +135,12 @@ public class BytedanceReportController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @ApiOperation(value="投放数据-更新计划出价", notes="投放数据-更新计划出价")
|
|
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="投放数据-更新计划出价-bid", notes="投放数据-更新计划出价")
|
|
@GetMapping(value = "/updateADBid")
|
|
@GetMapping(value = "/updateADBid")
|
|
public Result updateADBid(@RequestParam("accountId") String accountId,
|
|
public Result updateADBid(@RequestParam("accountId") String accountId,
|
|
- @RequestParam("adId") String adId,
|
|
|
|
- @RequestParam("bid") BigDecimal bid) {
|
|
|
|
|
|
+ @RequestParam("adId") String adId,
|
|
|
|
+ @RequestParam("bid") BigDecimal bid) {
|
|
try {
|
|
try {
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
List<Map<String, Object>> listMap = new ArrayList<>();
|
|
List<Map<String, Object>> listMap = new ArrayList<>();
|
|
@@ -156,9 +157,53 @@ public class BytedanceReportController {
|
|
byteDanceAdvertisePlan.setBid(bid);
|
|
byteDanceAdvertisePlan.setBid(bid);
|
|
//更新 表 定向包id
|
|
//更新 表 定向包id
|
|
byteDanceAdvertisePlanService.updatePlanOrPackage(byteDanceAdvertisePlan);
|
|
byteDanceAdvertisePlanService.updatePlanOrPackage(byteDanceAdvertisePlan);
|
|
- return Result.successMsg("修改成功。",null);
|
|
|
|
|
|
+ return Result.successMsg("修改bid成功。",null);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.error("投放数据-更新计划出价-bid异常",e);
|
|
|
|
+ return Result.error("请求失败,请联系开发人员!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="投放数据-更新计划出价-cpaBid", notes="投放数据-更新计划出价")
|
|
|
|
+ @GetMapping(value = "/updateADCpaBid")
|
|
|
|
+ public Result updateADCpaBid(@RequestParam("accountId") String accountId,
|
|
|
|
+ @RequestParam("adId") String adId,
|
|
|
|
+ @RequestParam("cpaBid") BigDecimal cpaBid) {
|
|
|
|
+ try {
|
|
|
|
+ CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
|
|
+ PlanSearchVo planSearchVo = new PlanSearchVo();
|
|
|
|
+ String[] ids = adId.split(",");
|
|
|
|
+ planSearchVo.setIds(ids);
|
|
|
|
+ //2 获取广告计划
|
|
|
|
+ Result result = marketingService.getPlanList(token,planSearchVo,1,1000);
|
|
|
|
+ if (!result.isSuccess()){
|
|
|
|
+ return Result.errorMsg(result.getMessage());
|
|
|
|
+ }
|
|
|
|
+ JSONObject jsonObject =JSONObject.parseObject(result.getResult().toString());
|
|
|
|
+ JSONArray array = jsonObject.getJSONArray("list");
|
|
|
|
+ List<Map<String,Object>> dataList = JSONArray.parseObject(array.toJSONString(),List.class);
|
|
|
|
+
|
|
|
|
+ for (Map<String, Object> map : dataList) {
|
|
|
|
+ String modifyTime = map.get("modify_time").toString();
|
|
|
|
+ AiBytedanceAdvertiserStrategy strategy = new AiBytedanceAdvertiserStrategy();
|
|
|
|
+ strategy.setAccountId(Long.valueOf(accountId));
|
|
|
|
+ strategy.setAdCpaBid(cpaBid);
|
|
|
|
+ //3 修改广告计划 中的 cpaBid
|
|
|
|
+ Result resultUpd = marketingService.updateAdvertiserPlan(token,adId,modifyTime,strategy);
|
|
|
|
+ if (!resultUpd.isSuccess()){
|
|
|
|
+ return Result.errorMsg(resultUpd.getMessage());
|
|
|
|
+ }
|
|
|
|
+ ByteDanceAdvertisePlan byteDanceAdvertisePlan = new ByteDanceAdvertisePlan();
|
|
|
|
+ byteDanceAdvertisePlan.setId(Long.valueOf(adId));
|
|
|
|
+ byteDanceAdvertisePlan.setCpaBid(cpaBid);
|
|
|
|
+ //更新 表 bid || 定向包id || 状态
|
|
|
|
+ byteDanceAdvertisePlanService.updatePlanOrPackage(byteDanceAdvertisePlan);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Result.successMsg("修改cpaBid成功。",null);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- log.error("投放数据-更新计划出价异常",e);
|
|
|
|
|
|
+ log.error("投放数据-更新计划出价-cpaBid异常",e);
|
|
return Result.error("请求失败,请联系开发人员!");
|
|
return Result.error("请求失败,请联系开发人员!");
|
|
}
|
|
}
|
|
}
|
|
}
|