ONLYOFFICE曆史版本開發技術—之三
這玩意兒從思路到代碼還着實費了老勁了。但并不完美,它沒有提示對比功能,或者說實在沒試出來。
難在它資料很亂。
2組資料,一組是曆史資料history,主要是key和使用者;一組是變化資料存儲位址changesurl。
每組曆史資料對應一個changesurl。changesurl裡還有文檔的key,和previous,previous裡還有文檔的key和url
每組曆史資料中還有changes資料,change資料中還有使用者user和userid。
"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
// },
changesurl
docEditor . setHistoryData ({
//下面這裡存變化的位置
// "changesUrl":"http://192.168.99.100:9000/carned a document
"changesUrl" : string2 ,
"key" : "" ,
"previous" : {
"key" : "" , //這裡不影響版本切換
"url" : "" //http://192.168.99.100:9000/c?md5=x這裡影響版本
} ,
"url" : "" ,
"version" : version
})
changes
"changes" : [{
"created" : "2018-03-25 05:23:25" ,
"user" : { "id" : "127.0 .0.1" , "name" : "127.0.0.1" }
}]
history資料庫
changes資料庫