你好,今天在测试API时发现
而且在应用首页看到并未有超过3W调用api的量,不知你们是如何计算的?
AVQuery avQuery = new AVQuery<>(Progress.NAME);
avQuery.whereEqualTo(Progress.USER_ID, userInfo.getWechatID())
avQuery.findInBackground(new FindCallback() {
@Override
public void done(List list, AVException e) {
List recordList = recordDao.findStudyRecordList(mCurrentCourseIndex, true, true);
if (null != list && list.size() > 0) {
if(null != recordList && recordList.size() > 0){
List progressList = new ArrayList<>();
for (int i = recordList.size() - (chunkid - leancloudChunkid); i < recordList.size(); i++) {
StudyRecord studyRecord = recordList.get(i);
AVObject progress = addAVObject(studyRecord, userInfo.getWechatID());
progressList.add(progress);
}
AVObject.saveAllInBackground(progressList, new SaveCallback() {
@Override
public void done(AVException e) {
LogUtils.d("data migration success");
}
});
}
} else {
if (null != recordList && recordList.size() > 0) {
LogUtil.d(TAG, "recordList.size() = " + recordList.size());
List progressList = new ArrayList<>();
for (StudyRecord studyRecord : recordList) {
AVObject progress = addAVObject(studyRecord, userID());
progressList.add(progress);
}
AVObject.saveAllInBackground(progressList, new SaveCallback() {
@Override
public void done(AVException e) {
LogUtils.d("data migration success");
}
});
}
}
}
});
请问在这样的情况下,会调用多少次API? 还有AVOSCloud.setDebugLogEnabled(true);开启debug日志会不会算次数?
我的代码里只有这段代码是用了saveAllInBackground(list, SaveCallback)方法,其他的都是单次调用, 例如:
AVQuery avQuery = new AVQuery<>(UserInfo.NAME);
avQuery.whereEqualTo(UserInfo.USER_ID, platform.getDb().getUserId());
avQuery.getFirstInBackground(new GetCallback() {
@Override
public void done(AVObject userInfo, AVException e) {
if (userInfo == null) {
userInfo = new AVObject(UserInfo.NAME);
}
LogUtils.d("userInfo.toString() = " + userInfo.toString());
......
userInfo.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
handler.sendEmptyMessage(MSG_AUTH_COMPLETE);
}
});
}
});
-
创建时间
17年5月12日
-
最后回复
17年5月12日
-
4
回复
-
1.2K
浏览
-
2
用户