|
@@ -0,0 +1,39 @@
|
|
|
|
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
|
|
|
|
+
|
|
|
|
+import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
|
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
|
|
|
|
+import cn.com.ctop.common.module.utils.PropertiesUtils;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouRealTimeDataService;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class KuaishouRealTimeDataServiceImpl implements IKuaishouRealTimeDataService {
|
|
|
|
+ @Override
|
|
|
|
+ public JSONObject getCampaignDate(Long accountId, String token, Long campaignId, String startDate, String endDate) {
|
|
|
|
+ String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CAMPAIGN_REPORT;
|
|
|
|
+ Map<String, String> headers = new HashMap<>();
|
|
|
|
+ headers.put("Content-Type", "application/json");
|
|
|
|
+ headers.put("Access-Token", token);
|
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
|
+ param.put("start_date", startDate);
|
|
|
|
+ param.put("end_date", endDate);
|
|
|
|
+ param.put("advertiser_id", accountId);
|
|
|
|
+ param.put("temporal_granularity", "DAILY");
|
|
|
|
+ param.put("page_size", 500);
|
|
|
|
+ param.put("page", 1);
|
|
|
|
+ KuaishouResult<KuaishouReportDailyCampaign> kuaishouResult = null;
|
|
|
|
+ try {
|
|
|
|
+ String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
|
+
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+}
|