CN-121996724-A - Document synchronization method and device, storage medium and electronic equipment
Abstract
The disclosure provides a document synchronization method, a document synchronization device, a storage medium and electronic equipment. The method comprises the steps of obtaining first document content of a target local document to be synchronized, obtaining a document content version of a target cloud document corresponding to the target local document in a current cloud storage, determining second document content based on the document content version, determining a first document change operation set according to differences between the first document content and the second document content, generating a first document synchronization instruction according to the first document change operation set, and sending the first document synchronization instruction to a target server so that the target server can update the content of the target cloud document based on the first document synchronization instruction. And only transmitting the change data to the server, reducing redundant data generated by full-scale synchronization and meaningless time consumption, and redefining the change operation based on the document content indicated by Yun Wendang version, so that the data loss or coverage error of the cloud document is avoided, and the data consistency and integrity in the data synchronization process are improved.
Inventors
- ZHANG RONG
- TAN RUIQI
Assignees
- 腾讯科技(深圳)有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241104
Claims (20)
- 1.A document synchronization method, comprising: acquiring first document content of a target local document to be synchronized, and acquiring a document content version of a target cloud document corresponding to the target local document in a current cloud storage; Determining second document content based on the document content version, and determining a first document change operation set according to the difference between the first document content and the second document content; Generating a first document synchronization instruction according to the first document change operation set; And sending the first document synchronization instruction to a target server, so that the target server updates the content of the target cloud document based on the first document synchronization instruction.
- 2. The method of claim 1, wherein prior to obtaining the first document content of the target local document to be synchronized, the method further comprises: Displaying a first document page of a target local document; and responding to the received document synchronization triggering operation in the first document page, generating a document synchronization request, wherein the document synchronization request indicates that the target local document is synchronized to cloud storage.
- 3. The method of claim 2, wherein generating a document synchronization request in response to a document synchronization trigger operation received in the first document page comprises: Displaying a document synchronization area in the first document page; and generating a document synchronization request in response to the received document synchronization instruction in the document synchronization area.
- 4. The method of claim 3, wherein generating a document synchronization request in response to a document synchronization instruction received in the document synchronization area comprises: Displaying a first document synchronization control in the document synchronization area; And responding to the triggering operation of the first document synchronization control, and generating a document synchronization request.
- 5. The method of claim 3, wherein generating a document synchronization request in response to a document synchronization instruction received in the document synchronization area comprises: Displaying a document tag corresponding to the target local document in the first document page; A document synchronization request is generated in response to a drag operation that drags the document tag into the document synchronization area.
- 6. The method of claim 2, wherein generating a document synchronization request in response to a document synchronization trigger operation received in the first document page comprises: Displaying a file menu control in the first document page; responding to the triggering operation of the file menu control, displaying a file menu list, wherein the file menu list comprises a second document synchronization control; and responding to the triggering operation of the second document synchronization control, and generating a document synchronization request.
- 7. The method of claim 2, wherein the generating a document synchronization request is in response to a document synchronization trigger operation received in the first document page: acquiring a keyboard operation instruction received in the first document page; And when the keyboard operation instruction is matched with a preset operation instruction corresponding to the document synchronization, generating a document synchronization request.
- 8. The method of any of claims 1 to 7, wherein the determining second document content based on the document content version comprises: acquiring a plurality of version information of the target local document stored locally, and determining a target version with latest update time according to update time corresponding to the plurality of version information; and determining second document content according to the document content version and the target version.
- 9. The method of claim 8, wherein the determining the second document content from the document content version and the target version comprises: When the document content version is the same as the target version, determining the document content corresponding to the target version as the second document content; And when the document content version is different from the target version, acquiring difference data between the document content version and the document content of the target version, and determining second document content based on the difference data and the document content of the target version.
- 10. The method of claim 9, wherein the obtaining difference data between the document content version and the target version of the document content and determining second document content based on the difference data and the target version of the document content comprises: Sending a document update request to a target server, wherein the document update request comprises the target version; Receiving difference data returned by the target server based on the document updating request; And determining second document content based on the difference data and the document content of the target version.
- 11. The method of any of claims 9 or 10, wherein the determining a first set of document change operations from a difference of the first document content and the second document content comprises: When the difference data conflict with the first document content, conflict processing is carried out on the difference data and the first document content, and third document content is generated; Determining a first document change operation set according to the difference between the third document content and the second document content; And when the difference data does not conflict with the first document content, determining a first document change operation set according to the difference between the first document content and the second document content.
- 12. The method of claim 11, wherein when the difference data conflicts with the first document content, conflict processing is performed on the difference data and the first document content to generate a third document content, comprising: when the difference data conflict with the first document content, displaying a conflict content display interface; And acquiring a selection operation received in the conflict content display interface, and generating third document content based on the selection operation.
- 13. The method of claim 1, wherein the first document page is displayed based on a target document application, and wherein the sending the first document synchronization instruction to a target server causes the target server to update the content of the target cloud document based on the first document synchronization instruction, the method further comprising: Acquiring a document link of the target cloud document; And displaying a cloud document editing interface according to the document links, and displaying the first document content in the cloud document editing interface.
- 14. The method of claim 13, wherein after displaying a cloud document editing interface according to the link and displaying the first document content in the cloud document editing interface, the method further comprises: Displaying a sharing control in the cloud document editing interface; And responding to the triggering operation of the sharing control in the cloud document editing interface, displaying a sharing interface, wherein the sharing interface is used for selecting a sharing mode of the target cloud document.
- 15. The method according to claim 1, wherein the method further comprises: receiving a second document synchronization instruction sent by the target server, wherein the second document synchronization instruction comprises a second document change set; and updating the first document content according to the second document change set.
- 16. The method of claim 1, wherein the sending the first document synchronization instruction to a target server comprises: Carrying out serialization processing on the first document synchronization instruction to obtain first coded data; and sending the first coded data to a target server.
- 17. The method of claim 16, wherein serializing the first document synchronization instruction to obtain the first encoded data comprises: Converting the first document synchronization instruction into first structure data of a preset data structure; compiling the first structure data into code data; and serializing the code data to obtain the first coded data.
- 18. A document synchronization apparatus, comprising: The device comprises an acquisition unit, a storage unit and a storage unit, wherein the acquisition unit is used for acquiring first document content of a target local document to be synchronized and acquiring a document content version of a target cloud document corresponding to the target local document in a current cloud storage; A determining unit, configured to determine second document content based on the document content version, and determine a first document change operation set according to a difference between the first document content and the second document content; The generating unit is used for generating a first document synchronization instruction according to the first document change operation set; And the sending unit is used for sending the first document synchronization instruction to a target server so that the target server updates the content of the target cloud document based on the first document synchronization instruction.
- 19. A storage medium storing a computer program which, when executed by a processor, implements the document synchronization method of any one of claims 1 to 17.
- 20. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the document synchronization method of any one of claims 1 to 17 when executing the computer program.
Description
Document synchronization method and device, storage medium and electronic equipment Technical Field The disclosure relates to the field of data synchronization, and in particular relates to a document synchronization method, a device, a storage medium and electronic equipment. Background With the rapid development of internet cloud computing technology, cloud services have become a core content of contemporary information services. Cloud services are various computing resources and services provided through the internet, and can be accessed anytime and anywhere without installing software on a local device. Synchronization of data to a cloud server refers to the process of uploading and storing data (e.g., files, photos, documents, etc.) on a local device on the cloud server. The purpose of this is to enable backup, sharing and cross-device access of data. However, the data transmission efficiency of synchronizing the current local document to the cloud server is low, and the requirement of the object on efficient and rapid synchronization cannot be met. Disclosure of Invention The embodiment of the disclosure provides a document synchronization method, a device, a storage medium and electronic equipment, wherein the method can improve the document synchronization efficiency. The first aspect of the present disclosure provides a document synchronization method, including: Acquiring first document content of a target local document to be synchronized, and acquiring a document content version of a target cloud document corresponding to the target local document in the current cloud storage; determining second document content based on the document content version, and determining a first document change operation set according to the difference between the first document content and the second document content; Generating a first document synchronization instruction according to the first document change operation set; And sending a first document synchronization instruction to the target server so that the target server updates the content of the target cloud document based on the first document synchronization instruction. A second aspect of the present disclosure provides a document synchronization apparatus, including: the acquisition unit is used for acquiring first document content of a target local document to be synchronized and acquiring a document content version of a target cloud document corresponding to the target local document in the current cloud storage; A determining unit for determining second document content based on the document content version, and determining a first document change operation set according to a difference between the first document content and the second document content; a generating unit for generating a first document synchronization instruction according to the first document change operation set; And the sending unit is used for sending the first document synchronization instruction to the target server so that the target server updates the content of the target cloud document based on the first document synchronization instruction. Optionally, the acquiring unit includes: A first display subunit, configured to display a first document page of the target local document; And the first generation subunit is used for responding to the received document synchronization triggering operation in the first document page and generating a document synchronization request which indicates that the target local document is synchronized to the cloud storage. Optionally, the generating subunit includes: The first display module is used for displaying a document synchronization area in a first document page; The first generation module is used for responding to the received document synchronization instruction in the document synchronization area and generating a document synchronization request. Optionally, the first generating module includes: the first display sub-module is used for displaying a first document synchronization control in the document synchronization area; and the first generation sub-module is used for responding to the triggering operation of the first document synchronization control and generating a document synchronization request. Optionally, the first generating module includes: the second display sub-module is used for displaying a document tag corresponding to the target local document in the first document page; And the second generation sub-module is used for responding to the dragging operation of dragging the document label into the document synchronization area and generating a document synchronization request. Optionally, the first generating subunit comprises: Responding to the triggering operation of the file menu control, displaying a file menu list which contains a second file synchronous control; and the second generation module is used for responding to the triggering operation of the second document synchronization control and generating a