https://api.onlyoffice.com/editors/history
创新互联专注于白沙黎族企业网站建设,成都响应式网站建设公司,电子商务商城网站建设。白沙黎族网站建设公司,为白沙黎族等地区提供建站服务。全流程按需求定制开发,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务上面的页面介绍如何进行历史版本功能的开发。
https://api.onlyoffice.com/editors/howitworks
上面介绍了onlyoffice document server所包含的功能,
The client side includes:
Document manager - the list of the documents displayed in the user browser where the user can select the necessary document and perform some actions with it (depending on the provided rights, the user can open the document to view it or edit, share the document with other users).
Document editor - the document viewing and editing interface with all the most known document editing features available, used as a medium between the user and the document editing service.
The server side includes:
Document storage service - the server service which stores all the documents available to the users with the appropriate access rights. It provides the document IDs and links to these documents to the document manager which the user sees in the browser.
Document editing service - the server service which allows to perform the document viewing and editing (in case the user has the appropriate rights to do that). The document editor interface is used to access all the document editing service features.
Document command service - the server service which allows to perfom additional commands with document editing service.
Document conversion service - the server service which allows to convert the document file into the appropriate Office Open XML format (docx for text documents, xlsx for spreadsheets and pptx for presentations) for their editing or downloading.
Please note, that ONLYOFFICE Document Server includes the document editor, document editing service, document command service and document conversion service. The document manager and document storage service are either included to Community Server or must be implemented by the software integrators who use ONLYOFFICE Document Server on their own server.
请注意,onlyoffice document server包括document editor, document editing service, document command service(文档编辑器、文档编辑服务、文档命令服务和文档转换服务)。文档管理器和文档存储服务要么包含在社区服务器上,要么必须由在自己的服务器上仅使用office文档服务器的软件集成商实现。
我用golang就是开发了文档管理器和文档存储。
类似可道云的那种云盘的资料管理。
但相比可道云,对于我们工程设计人员来说,更容易管理文档,比如编号和名称分开,文件作为附件放到成果下面,而不像可道云这样直接看到的就是附件,一个成果下可以放多个附件。还可以发布文章,可以设置成果间的关联,可以设置目录的权限,可以根据附件扩展名来设置权限,比如只运行看pdf文件,不运行看dwg,dgn等图纸文件。
回到正题,历史版本的开发必须从onlyoffice document server的返回值里找到数据结构。
[html] view plain copy
{
"key":"1520696086733383100",
"status":2,
"url":"http://192.168.99.100:9000/cache/files/1520696086733383100_1849/outpu
t.docx/output.docx?md5=CSBXuCfKbp1zaA2C-IoB2g==&expires=1523288157&
disposition=attachment&ooname=output.docx",
"changesurl":"http://192.168.99.100:9000/cache/files/
1520696086733383100_1849/changes.zip/changes.zip?
md5=eQOOXry8Spob255EtEi7QA==&expires=1523288157&
disposition=attachment&ooname=output.zip",
"history":{
"serverVersion":"5.0.7",
"changes":[
{
"created":"2018-03-10 15:34:57",
"user":
{
"id":"9",
"name":"qin.xc"
}
},
{
"created":"2018-03-10 15:35:29",
"user":
{
"id":"8",
"name":"qin8.xc"
}
}
]
},
"users":["8"],
"actions":[{"type":0,"userid":"9"}],
"lastsave":"2018-03-10T15:35:37.823Z",
"notmodified":false
}
官网上的例子:
Sample of JSON object sent to the "callbackUrl" address by document editing service when the user changed the document and closed it for editing
[html] view plain copy
{
"actions": [{"type": 0, "userid": "78e1e841"}],
"changesurl": "https://documentserver/url-to-changes.zip",
"history": {
"changes": changes,
"serverVersion": serverVersion
},
"key": "Khirz6zTPdfd7",
"status": 2,
"url": "https://documentserver/url-to-edited-document.docx",
"users": ["6d5a81d0"]
}
所以用beego开发先设置数据结构,然后解析到结构体就行了。
[plain] view plain copy
type Callback struct {
Key string `json:"key"`
Status int `json:"status"`
Url string `json:"url"`
Changesurl string `json:"changesurl"`
History history1 `json:"history"`
Users []string `json:"users"`
Actions []action `json:"actions"`
Lastsave string `json:"lastsave"`
Notmodified bool `json:"notmodified"`
}
type action struct {
Type int `json:"type"`
Userid string `json:"userid"`
}
type history1 struct {
ServerVersion string `json:"serverVersion"`
Changes []change `json:"changes"`
}
type change struct {
Created string `json:"created"` //time.Time
User User1 `json:"user"`
}
type User1 struct {
Id string `json:"id"` //必须大写才能在tpl中显示{{.json}}
Name string `json:"name"`
}
创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。