Fix when update note createdTime or publicTime field content error

This commit is contained in:
xingxing
2019-01-16 19:42:28 +08:00
parent 1a8332bbe9
commit 1c5fef088e

View File

@@ -270,6 +270,16 @@ public class NoteService {
note.setContent(modifiedNote.getContent());
handleFile(modifiedNote.getId(), note.getNoteFiles());
updateTagsToLocal(modifiedNote.getId(), note.getTagData());
if (!modifiedNote.isLocalNote()) {//noteId已经存在代表是更新操作,服务端updateNote接口存在bug,所以特殊处理下createdTime, publicTime
if (modifiedNote.getCreatedTimeVal() == -62135596800000L || modifiedNote.getPublicTimeVal() == -62135596800000L) {
Note remoteNote = RetrofitUtils.excuteWithException(ApiProvider.getInstance().getNoteApi().getNoteAndContent(modifiedNote.getNoteId()));
note.setCreatedTimeVal(remoteNote.getCreatedTimeVal());
note.setPublicTimeVal(remoteNote.getPublicTimeVal());
} else {
note.setCreatedTimeVal(modifiedNote.getCreatedTimeVal());
note.setPublicTimeVal(modifiedNote.getPublicTimeVal());
}
}
note.save();
updateNoteUsnIfNeed(note.getUsn());
} else {