|
@@ -3,7 +3,9 @@ package cn.com.ctop.alarm.modules.service.impl;
|
|
|
import cn.com.ctop.alarm.modules.service.ExternalLinkService;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
@@ -15,14 +17,17 @@ import java.math.BigDecimal;
|
|
|
@Service
|
|
|
public class ExternalLinkServiceImpl implements ExternalLinkService {
|
|
|
//修改头条CPABID出价,投放时间
|
|
|
- private static final String URL_UPDATE_CPABID = "http://118.24.244.213:8808/bytedance-api/advertiser/bytedanceReportController/updateADCpaBid";
|
|
|
+// private static final String URL_UPDATE_CPABID = "http://139.186.165.84:8808/bytedance-api/advertiser/bytedanceReportController/updateADCpaBid";
|
|
|
//线上IP http://118.24.244.213:8808/bytedance-api/advertiser/bytedanceReportController/updateADCpaBid
|
|
|
//测试IP http://139.186.165.84:8808/bytedance-api/advertiser/bytedanceReportController/updateADCpaBid
|
|
|
+ @Value("${rule.bytedanceUrl}")
|
|
|
+ private String URL_UPDATE_CPABID;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
- public String editBytedancePlanCpaBidOrBudget(Long accountId, String adId, BigDecimal cpaBid, String adScheduleTime, Long budget) {
|
|
|
+ public Integer editBytedancePlanCpaBidOrBudget(Long accountId, String adId, BigDecimal cpaBid, String adScheduleTime, Long budget) {
|
|
|
StringBuffer buf = new StringBuffer();
|
|
|
- buf.append("?accountId=").append(accountId).append("&adId=").append(adId);
|
|
|
+ buf.append("bytedance-api/advertiser/bytedanceReportController/updateADCpaBid?accountId=").append(accountId).append("&adId=").append(adId);
|
|
|
if (!Check.isNull(cpaBid)) {
|
|
|
buf.append("&cpaBid=").append(cpaBid);
|
|
|
}
|
|
@@ -33,9 +38,19 @@ public class ExternalLinkServiceImpl implements ExternalLinkService {
|
|
|
buf.append("&budget=").append(budget);
|
|
|
}
|
|
|
log.info("调用微服务接口,修改头条计划出价、预算、投放时间段。。。。。。start");
|
|
|
- HttpUtils.httpGet(URL_UPDATE_CPABID + buf.toString(), null, null);
|
|
|
+ String result = HttpUtils.httpGet(URL_UPDATE_CPABID + buf.toString(), null, null);
|
|
|
log.info("调用微服务接口,修改头条计划出价、预算、投放时间段。。。。。。end");
|
|
|
- return null;
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+ Integer code = -1;
|
|
|
+ if (!Check.isNull(jsonObject)) {
|
|
|
+ code = jsonObject.getInteger("code");
|
|
|
+ if (code != 0) {
|
|
|
+ log.error("调用微服务接口,修改头条计划失败,入参={};-------------------message={}", buf.toString(), jsonObject.getString("message"));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.error("调用微服务接口,修改头条计划失败,入参={};-------------------返回结果:{}", result);
|
|
|
+ }
|
|
|
+ return code;
|
|
|
}
|
|
|
|
|
|
|