|
@@ -218,8 +218,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
param.put("page_size", 500);
|
|
param.put("page_size", 500);
|
|
param.put("page", page);
|
|
param.put("page", page);
|
|
if(startDate != null && endDate != null){
|
|
if(startDate != null && endDate != null){
|
|
- param.put("start_date", DateUtils.formatDate(new Date()));
|
|
|
|
- param.put("end_date", DateUtils.formatDate(new Date()));
|
|
|
|
|
|
+ param.put("start_date", DateUtils.formatDate(startDate));
|
|
|
|
+ param.put("end_date", DateUtils.formatDate(endDate));
|
|
}
|
|
}
|
|
String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
@@ -2718,4 +2718,52 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
kuaiShouImageGetService.replaceBatch(imageGets);
|
|
kuaiShouImageGetService.replaceBatch(imageGets);
|
|
getImageList(token, accountId, startDate, endDate, page+1 );
|
|
getImageList(token, accountId, startDate, endDate, page+1 );
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取全量视频素材数据--测试使用
|
|
|
|
+ * @param token
|
|
|
|
+ * @param startDate
|
|
|
|
+ * @param endDate
|
|
|
|
+ * @param page
|
|
|
|
+ */
|
|
|
|
+ public void getVideoList(String token, Long accountId, Date startDate, Date endDate, int page) {
|
|
|
|
+ String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_LIST;
|
|
|
|
+ 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("advertiser_id", accountId);
|
|
|
|
+ param.put("page_size", 500);
|
|
|
|
+ param.put("page", page);
|
|
|
|
+ if(startDate != null && endDate != null){
|
|
|
|
+ param.put("start_date", DateUtils.formatDate(startDate));
|
|
|
|
+ param.put("end_date", DateUtils.formatDate(endDate));
|
|
|
|
+ }
|
|
|
|
+ String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
|
+ JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
|
+ Integer code = resultJson.getInteger("code");
|
|
|
|
+ String message = resultJson.getString("message");
|
|
|
|
+ if (null == code || code != 0) {
|
|
|
|
+ log.error("获取快手视频列表数据异常:{},accountId:{}", message, accountId);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
|
|
|
|
+ if (null == details || details.size() <= 0) {
|
|
|
|
+ log.info("快手视频列表信息为空=》accountId:{}", accountId);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<KuaiShouVideoGet> videoGets = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < details.size(); i++) {
|
|
|
|
+ var detailJson = details.getJSONObject(i);
|
|
|
|
+ var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
|
|
|
|
+ kuaiShouVideoGet.setAccountId(accountId);
|
|
|
|
+ kuaiShouVideoGet.setId("" + accountId + kuaiShouVideoGet.getPhotoId());
|
|
|
|
+ kuaiShouVideoGet.setCreateTime(new Date());
|
|
|
|
+ kuaiShouVideoGet.setUpdateTime(new Date());
|
|
|
|
+ videoGets.add(kuaiShouVideoGet);
|
|
|
|
+ }
|
|
|
|
+ kuaiShouVideoGetService.replaceBatch(videoGets);
|
|
|
|
+ getVideoList(token, accountId, startDate, endDate, page + 1);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|