|
@@ -3340,37 +3340,34 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
if (!Check.isNull(resultJson)) {
|
|
|
Integer code = resultJson.getInteger("code");
|
|
|
if (code == 0) {
|
|
|
- if (page == 1) { //分页保存数据,如果页数为1,删除之前的数据重新入库
|
|
|
- Map<String, Object> deleteMap = new HashMap<>();
|
|
|
- deleteMap.put("account_id", advertiserId);
|
|
|
- appListMapper.deleteByMap(deleteMap);
|
|
|
- }
|
|
|
JSONObject data = resultJson.getJSONObject("data");
|
|
|
- if (!Check.isNull(data)) {
|
|
|
- Integer totalCount = data.getInteger("total_count");
|
|
|
- JSONArray dataArr = data.getJSONArray("details");
|
|
|
- for (int i = 0; i < dataArr.size(); i++) {
|
|
|
- JSONObject dataJson = JSONObject.parseObject(dataArr.get(i).toString());
|
|
|
- if (!Check.isNull(dataJson)) {
|
|
|
- KuaiShouAppList appList = new KuaiShouAppList();
|
|
|
- appList.setAccountId(advertiserId);
|
|
|
- appList.setPlatform(dataJson.getInteger("platform"));
|
|
|
- appList.setUrl(dataJson.getString("url"));
|
|
|
- appList.setAppId(dataJson.getLong("app_id"));
|
|
|
- appList.setAppVersion(dataJson.getString("app_version"));
|
|
|
- appList.setAppName(dataJson.getString("app_name"));
|
|
|
- appList.setAppIconUrl(dataJson.getString("app_icon_url"));
|
|
|
- appList.setImageToken(dataJson.getString("image_token"));
|
|
|
- appList.setPackageName(dataJson.getString("package_name"));
|
|
|
- appList.setReturnTime(DateUtils.timeStamp2Date(dataJson.getTimestamp("update_time")));
|
|
|
- appListMapper.insert(appList);
|
|
|
- }
|
|
|
- }
|
|
|
- Integer totalPage = (totalCount - 1) / pageSize + 1;
|
|
|
- if (page < totalPage) {
|
|
|
- getAppList2ByPage(advertiserId, accessToken, page + 1, pageSize);
|
|
|
+ if (Check.isNull(data)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONArray dataArr = data.getJSONArray("details");
|
|
|
+ if (Check.isNull(dataArr)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<KuaiShouAppList> addList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < dataArr.size(); i++) {
|
|
|
+ JSONObject dataJson = JSONObject.parseObject(dataArr.get(i).toString());
|
|
|
+ if (!Check.isNull(dataJson)) {
|
|
|
+ KuaiShouAppList appList = new KuaiShouAppList();
|
|
|
+ appList.setAccountId(advertiserId);
|
|
|
+ appList.setPlatform(dataJson.getInteger("platform"));
|
|
|
+ appList.setUrl(dataJson.getString("url"));
|
|
|
+ appList.setAppId(dataJson.getLong("app_id"));
|
|
|
+ appList.setAppVersion(dataJson.getString("app_version"));
|
|
|
+ appList.setAppName(dataJson.getString("app_name"));
|
|
|
+ appList.setAppIconUrl(dataJson.getString("app_icon_url"));
|
|
|
+ appList.setImageToken(dataJson.getString("image_token"));
|
|
|
+ appList.setPackageName(dataJson.getString("package_name"));
|
|
|
+ appList.setReturnTime(DateUtils.timeStamp2Date(dataJson.getTimestamp("update_time")));
|
|
|
+ addList.add(appList);
|
|
|
}
|
|
|
}
|
|
|
+ appListMapper.replaceBatch(addList);
|
|
|
+ getAppList2ByPage(advertiserId, accessToken, page + 1, pageSize);
|
|
|
} else {
|
|
|
log.error("获取应用列表失败,返回信息:{}", resultJson);
|
|
|
}
|