|
@@ -222,11 +222,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
|
|
var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
|
|
kuaiShouVideoGet.setId(token.getAccountId() + kuaiShouVideoGet.getPhotoId());
|
|
kuaiShouVideoGet.setId(token.getAccountId() + kuaiShouVideoGet.getPhotoId());
|
|
|
|
|
|
- Date videoTime = videoTimeService.getVideoTime(kuaiShouVideoGet.getPhotoId(), token.getAccountId());
|
|
|
|
- if (!Check.isNull(videoTime)) {
|
|
|
|
- kuaiShouVideoGet.setUploadDate(videoTime);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
kuaiShouVideoGet.setAccountId(token.getAccountId());
|
|
kuaiShouVideoGet.setAccountId(token.getAccountId());
|
|
kuaiShouVideoGet.setStatDate(DateUtils.parseDate(statDate, "yyyy-MM-dd"));
|
|
kuaiShouVideoGet.setStatDate(DateUtils.parseDate(statDate, "yyyy-MM-dd"));
|
|
kuaiShouVideoGet.setUpdateTime(new Date());
|
|
kuaiShouVideoGet.setUpdateTime(new Date());
|
|
@@ -2861,18 +2856,22 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
* @param page
|
|
* @param page
|
|
*/
|
|
*/
|
|
@Autowired
|
|
@Autowired
|
|
- private IKuaiShouVideoTimeService videoTimeService;
|
|
|
|
|
|
+ private IKuaiShouVideoGetService videoGetService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void getSuZaoList(String token, Long accountId, int page) {
|
|
|
|
- String url = "https://ad.e.kuaishou.com/rest/openapi/v1/file/ad/video/su_zao/list";
|
|
|
|
|
|
+ public void getSuZaoList(String token, Long accountId, int page, String startDate, String endDate) {
|
|
|
|
+ String url = "https://ad.e.kuaishou.com/rest/openapi/v1/ad_creator/video/list";
|
|
Map<String, String> headers = new HashMap<String, String>();
|
|
Map<String, String> headers = new HashMap<String, String>();
|
|
headers.put("Content-Type", "application/json");
|
|
headers.put("Content-Type", "application/json");
|
|
headers.put("Access-Token", token);
|
|
headers.put("Access-Token", token);
|
|
Map<String, Object> param = new HashMap<String, Object>();
|
|
Map<String, Object> param = new HashMap<String, Object>();
|
|
param.put("advertiser_id", accountId);
|
|
param.put("advertiser_id", accountId);
|
|
param.put("page", page);
|
|
param.put("page", page);
|
|
- param.put("page_size", 500);
|
|
|
|
|
|
+ param.put("page_size", 200);
|
|
|
|
+ if (!Check.isNull(startDate) && !Check.isNull(startDate)) {
|
|
|
|
+ param.put("start_date", startDate);
|
|
|
|
+ param.put("end_date", 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);
|
|
Integer code = resultJson.getInteger("code");
|
|
Integer code = resultJson.getInteger("code");
|
|
@@ -2883,40 +2882,42 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
}
|
|
}
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
if (!Check.isNull(dataJson)) {
|
|
if (!Check.isNull(dataJson)) {
|
|
- Integer total_count = dataJson.getInteger("total_count");
|
|
|
|
- /* if (total_count > 2000) {
|
|
|
|
- return;
|
|
|
|
- }*/
|
|
|
|
JSONArray details = dataJson.getJSONArray("details");
|
|
JSONArray details = dataJson.getJSONArray("details");
|
|
if (Check.isNull(details)) {
|
|
if (Check.isNull(details)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
for (int i = 0; i < details.size(); i++) {
|
|
for (int i = 0; i < details.size(); i++) {
|
|
- var detailJson = details.getJSONObject(i);
|
|
|
|
-
|
|
|
|
- KuaiShouVideoGet byId = kuaiShouVideoGetService.getById(accountId + detailJson.getString("photo_id"));
|
|
|
|
- if (!Check.isNull(byId)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
|
|
|
|
- /* Date videoTime = videoTimeService.getVideoTime(kuaiShouVideoGet.getPhotoId(), accountId);
|
|
|
|
- if (!Check.isNull(videoTime)) {
|
|
|
|
- kuaiShouVideoGet.setUploadDate(videoTime);
|
|
|
|
- }*/
|
|
|
|
- kuaiShouVideoGet.setStatDate(new Date());
|
|
|
|
- kuaiShouVideoGet.setAccountId(accountId);
|
|
|
|
- kuaiShouVideoGet.setId(accountId + kuaiShouVideoGet.getPhotoId());
|
|
|
|
- kuaiShouVideoGet.setCreateTime(new Date());
|
|
|
|
- kuaiShouVideoGet.setUpdateTime(new Date());
|
|
|
|
- Integer type = MaterialEnum.getTypeBySize(kuaiShouVideoGet.getWidth(), kuaiShouVideoGet.getHeight());
|
|
|
|
- if (!Check.isNull(type)) {
|
|
|
|
- kuaiShouVideoGet.setMaterialType(type);
|
|
|
|
|
|
+ JSONObject jsonObject = details.getJSONObject(i);
|
|
|
|
+ if (!Check.isNull(jsonObject)) {
|
|
|
|
+ KuaiShouVideoGet kuaiShouVideoGet = new KuaiShouVideoGet();
|
|
|
|
+ Long photo_id = jsonObject.getLong("photo_id");
|
|
|
|
+ kuaiShouVideoGet.setId(accountId + photo_id + "");
|
|
|
|
+ kuaiShouVideoGet.setPhotoId(String.valueOf(photo_id));
|
|
|
|
+ kuaiShouVideoGet.setUrl(jsonObject.getString("watermark_url"));
|
|
|
|
+ kuaiShouVideoGet.setWidth(jsonObject.getInteger("width"));
|
|
|
|
+ kuaiShouVideoGet.setHeight(jsonObject.getInteger("height"));
|
|
|
|
+ kuaiShouVideoGet.setCoverUrl(jsonObject.getString("cover_url"));
|
|
|
|
+ kuaiShouVideoGet.setAccountId(accountId);
|
|
|
|
+ String md5 = jsonObject.getString("md5");
|
|
|
|
+ kuaiShouVideoGet.setSignature(md5);
|
|
|
|
+ kuaiShouVideoGet.setStatDate(jsonObject.getDate("sync_date"));
|
|
|
|
+ kuaiShouVideoGet.setChannelType(1);
|
|
|
|
+ Integer type = MaterialEnum.getTypeBySize(kuaiShouVideoGet.getWidth(), kuaiShouVideoGet.getHeight());
|
|
|
|
+ if (!Check.isNull(type)) {
|
|
|
|
+ kuaiShouVideoGet.setMaterialType(type);
|
|
|
|
+ }
|
|
|
|
+ kuaiShouVideoGetService.saveOrUpdate(kuaiShouVideoGet);
|
|
|
|
+ Thread thread = new Thread() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ videoGetService.getKeyFrame(token, accountId, md5, String.valueOf(photo_id));
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ thread.start();
|
|
}
|
|
}
|
|
- kuaiShouVideoGet.setChannelType(1);
|
|
|
|
- kuaiShouVideoGetService.saveOrUpdate(kuaiShouVideoGet);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- getSuZaoList(token, accountId, page + 1);
|
|
|
|
|
|
+ getSuZaoList(token, accountId, page + 1, startDate, endDate);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|