ONLYOFFICE历史版本功能的开发

发布时间:2020-07-26 00:38:29 作者:3xxxx
来源:网络 阅读:1059

https://api.onlyoffice.com/editors/history

上面的页面介绍如何进行历史版本功能的开发。

https://api.onlyoffice.com/editors/howitworks

上面介绍了onlyoffice document server所包含的功能,


The client side includes:

The server side includes:

Please note, that ONLYOFFICE Document Server includes the document editordocument editing servicedocument 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 editordocument editing servicedocument command service(文档编辑器、文档编辑服务、文档命令服务和文档转换服务)。文档管理器文档存储服务要么包含在社区服务器上,要么必须由在自己的服务器上仅使用office文档服务器的软件集成商实现。

我用golang就是开发了文档管理器和文档存储。

ONLYOFFICE历史版本功能的开发

类似可道云的那种云盘的资料管理。

ONLYOFFICE历史版本功能的开发

但相比可道云,对于我们工程设计人员来说,更容易管理文档,比如编号和名称分开,文件作为附件放到成果下面,而不像可道云这样直接看到的就是附件,一个成果下可以放多个附件。还可以发布文章,可以设置成果间的关联,可以设置目录的权限,可以根据附件扩展名来设置权限,比如只运行看pdf文件,不运行看dwg,dgn等图纸文件。

回到正题,历史版本的开发必须从onlyoffice document server的返回值里找到数据结构。

[html] view plain copy

  1. {  

  2.     "key":"1520696086733383100",  

  3.     "status":2,  

  4.       

  5.     "url":"http://192.168.99.100:9000/cache/files/1520696086733383100_1849/outpu  

  6.     t.docx/output.docx?md5=CSBXuCfKbp1zaA2C-IoB2g==&expires=1523288157&  

  7.     disposition=attachment&ooname=output.docx",  

  8.     "changesurl":"http://192.168.99.100:9000/cache/files/  

  9.     1520696086733383100_1849/changes.zip/changes.zip?  

  10.     md5=eQOOXry8Spob255EtEi7QA==&expires=1523288157&  

  11.     disposition=attachment&ooname=output.zip",  

  12. "history":{  

  13.     "serverVersion":"5.0.7",  

  14.     "changes":[  

  15.         {  

  16.             "created":"2018-03-10 15:34:57",  

  17.             "user":  

  18.             {  

  19.                 "id":"9",  

  20.                 "name":"qin.xc"  

  21.             }  

  22.         },  

  23.         {  

  24.             "created":"2018-03-10 15:35:29",  

  25.             "user":  

  26.             {  

  27.                 "id":"8",  

  28.                 "name":"qin8.xc"  

  29.             }  

  30.         }  

  31.     ]  

  32. },  

  33. "users":["8"],  

  34. "actions":[{"type":0,"userid":"9"}],  

  35. "lastsave":"2018-03-10T15:35:37.823Z",  

  36. "notmodified":false  

  37. }  

官网上的例子:

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

  1. {  

  2.     "actions": [{"type": 0, "userid": "78e1e841"}],  

  3.     "changesurl": "https://documentserver/url-to-changes.zip",  

  4.     "history": {  

  5.         "changes": changes,  

  6.         "serverVersion": serverVersion  

  7.     },  

  8.     "key": "Khirz6zTPdfd7",  

  9.     "status": 2,  

  10.     "url": "https://documentserver/url-to-edited-document.docx",  

  11.     "users": ["6d5a81d0"]  

  12. }  

所以用beego开发先设置数据结构,然后解析到结构体就行了。

[plain] view plain copy

  1. type Callback struct {  

  2.     Key         string   `json:"key"`  

  3.     Status      int      `json:"status"`  

  4.     Url         string   `json:"url"`  

  5.     Changesurl  string   `json:"changesurl"`  

  6.     History     history1 `json:"history"`  

  7.     Users       []string `json:"users"`  

  8.     Actions     []action `json:"actions"`  

  9.     Lastsave    string   `json:"lastsave"`  

  10.     Notmodified bool     `json:"notmodified"`  

  11. }  

  12.   

  13. type action struct {  

  14.     Type   int    `json:"type"`  

  15.     Userid string `json:"userid"`  

  16. }  

  17.   

  18. type history1 struct {  

  19.     ServerVersion string   `json:"serverVersion"`  

  20.     Changes       []change `json:"changes"`  

  21. }  

  22.   

  23. type change struct {  

  24.     Created string `json:"created"` //time.Time  

  25.     User    User1  `json:"user"`  

  26. }  

  27.   

  28. type User1 struct {  

  29.     Id   string `json:"id"` //必须大写才能在tpl中显示{{.json}}  

  30.     Name string `json:"name"`  

  31. }  

ONLYOFFICE历史版本功能的开发


推荐阅读:
  1. 1.3 Swift 版本历史记录
  2. OnlyOffice基础实践

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

onlyoffice 文档协作 engineercms

上一篇:今天手动编写了一个简易的 ajax 发起器(JavaScript)

下一篇:php 实现根据证件获取精准年龄

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》