ONLYOFFICE Historical Version Development Technology - No. 3
This thing really took a lot of effort to go from idea to code. But it's not perfect, it doesn't have a prompt comparison function, or really didn't try it out.
The difficulty is that the data is messy.
Two sets of data, one is historical data history, mainly keys and users; one is the change data storage address changesurl.
Each group of historical data corresponds to a changesurl. There is also the key of the document in changesurl, and the key and url of the document in previous and previous.
changesurl
This thing really took a lot of effort to go from idea to code. But it's not perfect, it doesn't have a prompt comparison function, or really didn't try it out.
The difficulty is that the data is messy.
Two sets of data, one is historical data history, mainly keys and users; one is the change data storage address changesurl.
Each group of historical data corresponds to a changesurl. There is also the key of the document in changesurl, and the key and url of the document in previous and previous.
There are also changes data in each group of historical data, and user user and userid in the change data.
"history"
:
[
// {
// "changes": changes,//[{{.changes1}}], //the changes from the history object returned after saving the document
// "created": "2018-03-9 10:15:55",
// "key": "1522427166608304100",
// "serverVersion": "5.07", //the serverVersion from the history object returned after saving the document
// "user": {
// "id": "9",
// "name": "qin.xc"
// },
// "version": 1
// },
// {
// "changes": changes,
// "created": "2018-03-10 14:11:35",
// "key": "1522465759378671300",//
// "user": {
// "id": "9",
// "name": "qin.xc"
// },
// "version": 2
// },
docEditor
.
setHistoryData
({
// The location of the change is stored here
// "changesUrl":"http://192.168.99.100:9000/carned a document
"changesUrl"
:
string2
,
"key"
:
""
,
"previous"
:
{
"key"
:
""
,
// This does not affect version switching
}
,
"url"
:
""
,
"version"
:
version
})
changes
history数据库
"changes"
:
[{
"created"
:
"2018-03-25 05:23:25"
,
"user"
:
{
"id"
:
"127.0 .0.1"
,
"name"
:
"127.0.0.1"
}
}]
changes数据库
代码见github吧。