|
|
@@ -5,6 +5,7 @@ import cn.com.ctop.job.bytedance.data.entity.ChannelChangdunovelInfo;
|
|
|
import cn.com.ctop.job.bytedance.data.mapper.ChannelMapper;
|
|
|
import cn.com.ctop.job.bytedance.data.service.IChannelService;
|
|
|
import cn.com.ctop.job.bytedance.data.utils.Check;
|
|
|
+import cn.com.ctop.job.bytedance.data.utils.DateUtils;
|
|
|
import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
@@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -25,17 +27,21 @@ public class ChannelServiceImpl implements IChannelService {
|
|
|
private ChannelMapper channelMapper;
|
|
|
|
|
|
@Override
|
|
|
- public void getPromotionIdList(String distributorId, String secretKey, Integer offset) {
|
|
|
+ public void getPromotionIdList(String startDt, String endDt, String distributorId, String secretKey, Integer offset) {
|
|
|
try {
|
|
|
String url = "https://www.changdunovel.com/novelsale/openapi/promotion/list/v1";
|
|
|
String ts = String.valueOf(System.currentTimeMillis()).substring(0, 10);
|
|
|
String sign = getSign(distributorId, secretKey, ts);
|
|
|
Map<String, Object> params = new JSONObject();
|
|
|
+ Long startT = DateUtils.getTimestampFormat("yyyy-MM-dd HH:mm:ss", startDt + " 00:00:00");
|
|
|
+ Long endT = DateUtils.getTimestampFormat("yyyy-MM-dd HH:mm:ss", endDt + " 23:59:59");
|
|
|
params.put("distributor_id", distributorId);
|
|
|
params.put("ts", ts);
|
|
|
params.put("offset", offset);
|
|
|
params.put("limit", 1000);
|
|
|
params.put("sign", sign);
|
|
|
+ params.put("begin", startT);
|
|
|
+ params.put("end", endT);
|
|
|
Boolean has_more = false;
|
|
|
String s = HttpUtils.httpGet(url, params, null);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(s);
|
|
|
@@ -69,7 +75,7 @@ public class ChannelServiceImpl implements IChannelService {
|
|
|
}
|
|
|
|
|
|
if (has_more) {
|
|
|
- getPromotionIdList(distributorId, secretKey, offset);
|
|
|
+ getPromotionIdList(startDt, endDt, distributorId, secretKey, offset);
|
|
|
} else {
|
|
|
log.info("番茄推广链拉取成功,distributorId:{}", distributorId);
|
|
|
}
|