|
@@ -68,7 +68,7 @@ public class KuaishouOpenPhotoListServiceImpl implements IKuaishouOpenPhotoListS
|
|
|
@Override
|
|
|
public void insertKuaishouOpenPhotoListByPromoter(Long promoterId) {
|
|
|
JYAccessToken jyTokenInfo = accessTokenMapper.getJYTokenInfoByPromoter(promoterId);
|
|
|
- if(Check.isNull(jyTokenInfo)){
|
|
|
+ if (Check.isNull(jyTokenInfo)) {
|
|
|
return;
|
|
|
}
|
|
|
insertInfo(jyTokenInfo, null);
|
|
@@ -99,19 +99,21 @@ public class KuaishouOpenPhotoListServiceImpl implements IKuaishouOpenPhotoListS
|
|
|
if ("1".equals(code)) {
|
|
|
List<KuaishouOpenPhotoList> list = new ArrayList<>();
|
|
|
JSONArray jsonArray = resultJson.getJSONObject("data").getJSONArray("videoList");
|
|
|
- Long min = jsonArray.getJSONObject(0).getLong("createTime");
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- JSONObject obj = jsonArray.getJSONObject(i);
|
|
|
- KuaishouOpenPhotoList photo = JSONObject.parseObject(obj.toJSONString(), KuaishouOpenPhotoList.class);
|
|
|
- //获取最小
|
|
|
- if (obj.getLong("createTime") < min) {
|
|
|
- min = obj.getLong("createTime");
|
|
|
- minPhotoId = photo.getPhotoId();
|
|
|
+ if (!Check.isNull(jsonArray)) {
|
|
|
+ Long min = jsonArray.getJSONObject(0).getLong("createTime");
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject obj = jsonArray.getJSONObject(i);
|
|
|
+ KuaishouOpenPhotoList photo = JSONObject.parseObject(obj.toJSONString(), KuaishouOpenPhotoList.class);
|
|
|
+ //获取最小
|
|
|
+ if (obj.getLong("createTime") < min) {
|
|
|
+ min = obj.getLong("createTime");
|
|
|
+ minPhotoId = photo.getPhotoId();
|
|
|
+ }
|
|
|
+ photo.setPromoterId(Long.valueOf(token.getPromoterId()));
|
|
|
+ photo.setPhotoCreateTime(Long.valueOf(DateUtils.timestamptoStr(obj.getLong("createTime"))));
|
|
|
+ photo.setPending(String.valueOf(obj.getBoolean("pending") ? 1 : 0));
|
|
|
+ list.add(photo);
|
|
|
}
|
|
|
- photo.setPromoterId(Long.valueOf(token.getPromoterId()));
|
|
|
- photo.setPhotoCreateTime(Long.valueOf(DateUtils.timestamptoStr(obj.getLong("createTime"))));
|
|
|
- photo.setPending(String.valueOf(obj.getBoolean("pending") ? 1 : 0));
|
|
|
- list.add(photo);
|
|
|
}
|
|
|
if (list.size() > 0) {
|
|
|
kuaishouOpenPhotoListMapper.replaceBatchKuaishouOpenPhotoList(list);
|