WO2019228034A1 - Method and apparatus for data synchronization - Google Patents

Method and apparatus for data synchronization Download PDF

Info

Publication number
WO2019228034A1
WO2019228034A1 PCT/CN2019/079739 CN2019079739W WO2019228034A1 WO 2019228034 A1 WO2019228034 A1 WO 2019228034A1 CN 2019079739 W CN2019079739 W CN 2019079739W WO 2019228034 A1 WO2019228034 A1 WO 2019228034A1
Authority
WO
WIPO (PCT)
Prior art keywords
page
data
updated
data identifier
synchronized
Prior art date
Application number
PCT/CN2019/079739
Other languages
French (fr)
Chinese (zh)
Inventor
姚佳
Original Assignee
杭州海康威视数字技术股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州海康威视数字技术股份有限公司 filed Critical 杭州海康威视数字技术股份有限公司
Publication of WO2019228034A1 publication Critical patent/WO2019228034A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Definitions

  • the present application relates to the field of computer technology, and in particular, to a data synchronization method and device.
  • Page display information is limited by the size of the display device.
  • the user needs to switch back and forth between multiple pages when browsing.
  • multiple video sources are output from the computer. This allows users to browse multiple pages at the same time.
  • Each page is an independent process, and data between pages cannot be shared.
  • users mainly synchronize data between different pages through manual operations. For example, users manually import data that needs to be synchronized on one page to other related pages through manual operations to achieve data synchronization between pages.
  • the present application provides a data synchronization method and device to solve the problem of data synchronization between multiple pages through manual operation, thereby improving the efficiency of data synchronization.
  • the specific technical solutions are as follows:
  • an embodiment of the present application provides a data synchronization method, which is applied to a server, and the method includes:
  • the step of determining pages to be synchronized from a plurality of pages logged in by the user includes:
  • the target page is a retrieval page, determining a page to be synchronized from the function page logged in by the user;
  • a page to be synchronized is determined from other function pages registered by the user except the target page.
  • the update information further includes an operation type
  • the step of generating synchronization information for data corresponding to the data identifier to be updated includes:
  • the operation type is an import operation
  • the step of generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list includes:
  • the operation type is a delete operation
  • the step of generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list includes:
  • Second synchronization information for the data to be deleted, where the data to be deleted is data corresponding to the data identifier to be updated, and the second synchronization information is used to remove the data to be deleted from the page to be synchronized Delete.
  • the operation type is a selection operation
  • the step of generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list includes:
  • third synchronization information for the data to be selected, where the data to be selected is data corresponding to the data identifier to be updated, and the third synchronization information is used to select the to be selected in the page to be synchronized data;
  • the pages where the user has logged in include: a function page and a retrieval page; the method further includes:
  • the step of determining a page status of the function page according to the received heartbeat packet includes:
  • next heartbeat packet is received within a preset time period, determining that the page status of the function page is an open state, and the preset time period starts from the time when the heartbeat packet is received;
  • the connection to the function page is terminated, and the page state of the function page is determined to be closed.
  • the heartbeat packet includes the user information
  • the step of determining a page status of the function page according to the received heartbeat packet includes:
  • an embodiment of the present application provides a data synchronization device, which is applied to a server, and the device includes:
  • a first receiving module configured to receive update information sent by a target page, where the update information includes user information and a data identifier to be updated of a user who logs in to the target page;
  • a first determining module configured to determine a page to be synchronized from a plurality of pages logged in by the user
  • a generating module configured to generate synchronization information for data corresponding to the data identifier to be updated
  • a first sending module is configured to send the synchronization information to the page to be synchronized, so that the page to be synchronized updates data corresponding to the data identifier to be updated according to the synchronization information.
  • the first determining module is specifically configured to:
  • the target page is a retrieval page, determining a page to be synchronized from the function page logged in by the user;
  • a page to be synchronized is determined from other function pages registered by the user except the target page.
  • the update information further includes an operation type
  • the generating module includes:
  • An acquisition submodule configured to acquire a target data identifier list corresponding to the page to be synchronized according to a preset correspondence between a page and a data identifier list, wherein the data identifier list is used to record each data included in the corresponding page Identification
  • a generating sub-module is configured to generate synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list.
  • the operation type is an import operation
  • the generating sub-module is specifically configured to:
  • the operation type is a delete operation
  • the generating sub-module is specifically configured to:
  • Second synchronization information for the data to be deleted, where the data to be deleted is data corresponding to the data identifier to be updated, and the second synchronization information is used to remove the data to be deleted from the page to be synchronized Delete.
  • the operation type is a selection operation
  • the generating sub-module is specifically configured to:
  • third synchronization information for data to be selected, where the data to be selected is data corresponding to the data identifier to be updated, and the third synchronization information is used to select the to be selected in the page to be synchronized data;
  • the pages that the user has logged in include: a function page and a retrieval page; the device further includes:
  • a second receiving module configured to receive a heartbeat packet sent by the function page
  • a second determining module configured to determine a page state of the function page according to the received heartbeat packet
  • a second sending module is configured to send information used to indicate the page status to the search page, so that the search page updates the page status of the function page.
  • the second determining module is specifically configured to:
  • next heartbeat packet is received within a preset time period, determining that the page status of the function page is an open state, and the preset time period starts from the time when the heartbeat packet is received;
  • the connection to the function page is terminated, and the page state of the function page is determined to be closed.
  • the heartbeat packet includes the user information; the second determining module is specifically configured to:
  • an embodiment of the present application provides a data synchronization system including a server and at least two pages; a target page of the at least two pages is used to obtain update information input by a user, and the update information is Send to the server, the update information includes user information of the user and an identifier of data to be updated;
  • the server is configured to receive the update information sent by the target page, determine pages to be synchronized from a plurality of pages logged in by the user, generate synchronization information for data corresponding to the data identifier to be updated, and Sending the synchronization information to the page to be synchronized;
  • the page to be synchronized is configured to receive the synchronization information sent by the server, and update data corresponding to the data identifier to be updated according to the synchronization information.
  • the at least two pages include a retrieval page and a function page; when the target page is a retrieval page,
  • the target page is further configured to obtain information of a designated function page input by the user; detect whether a page status of the designated function page is an open state; if not, create the designated function page, and based on the user information To open the specified function page.
  • an embodiment of the present application provides a server including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;
  • the processor is configured to implement any one of the data synchronization method steps described above when executing a program stored in the memory.
  • an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements any one of the data synchronization methods described above. step.
  • the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information.
  • Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information.
  • the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
  • FIG. 1 is a flowchart of a data synchronization method according to an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a data synchronization apparatus according to an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of a data synchronization system according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a server according to an embodiment of the present application.
  • the embodiments of the present application further provide a data synchronization method and device, which are applied to a server.
  • the data synchronization method includes the following steps:
  • the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information.
  • Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information.
  • the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
  • the data synchronization method may be applied to a server.
  • the server may be an HTTP server that provides HTTP protocol and WebSocket protocol communication.
  • the server may also have Other servers with corresponding functions described in the application examples are not limited herein.
  • the data synchronization method includes the following steps.
  • S101 Receive update information sent by a target page.
  • the target page can be a retrieval page or a function page.
  • the retrieval page is a data entry page based on a multi-screen page. After the user logs in to the retrieval page, he can enter the required retrieval information on the retrieval page for retrieval.
  • Function pages are pages other than search pages, and each function page has a corresponding function. In one implementation, the function of each function page may be an independent function.
  • the function page may include a relationship network page, a map analysis page, and a comprehensive research and judgment page.
  • the relationship network page is used to display the relationship diagram of other people who are related to the retrieved target object. For example, if the user searches for suspect A, the relationship network page will show the relationship between the person and the suspect A: family relationship , Friends, colleagues, etc.
  • the map analysis page is used to display the address information associated with the retrieved target object.
  • the comprehensive research and judgement page is used to display the conclusion after comprehensive judgment according to the relevant information of the retrieved target object.
  • connection may be a WebSocket connection.
  • the retrieval page and the function page are connected to the server through WebSocket, so that the page and the server can perform two-way communication.
  • the connection method between the server and the retrieval page and the function page may also be other methods, which are not limited herein.
  • the update information includes user information of a user who logs in to the target page and an identifier of data to be updated.
  • the user information may include at least one of the following: a user name, a user ID, and the like that the user logs in to.
  • the correspondence between the data and the identifier can be preset, that is, for each data, there can be a corresponding identifier.
  • the identifier of the data to be updated is the identifier corresponding to the data updated by the user on the target page, that is, the user who logged in to the target page has updated the data of the identifier of the data to be updated.
  • the page is updated the same. For example, if the user deletes the data of the suspect A on the relationship network page, and the identifier corresponding to the suspect A is A, the A is the identifier of the data to be updated.
  • the user is a user who logs in to the target page.
  • the user can log in to one page or multiple pages. If the user has logged in to other pages in addition to the target page, the pages to be synchronized can be determined from the other pages.
  • the server can monitor the page status of each page where the same user logs in.
  • the page status can be divided into a closed state and an open state.
  • the closed page can be manually closed, or it can be closed abnormally.
  • the closed state of a page means that the connection between the page and the server is broken, and the page cannot be displayed and cannot provide corresponding functions.
  • the open state of the page means that the page is connected to the server, and the page can be displayed to the user and provide corresponding functions.
  • the server determines, from multiple pages logged in by the user, the page whose page status is on as the page to be synchronized.
  • determining the pages to be synchronized can be divided into the following two cases.
  • the page to be synchronized is determined from the function pages logged in by the user.
  • the user is a user who logs in to the target page, and the function page that the user logs in to is a function page in an open state.
  • the target page is a retrieval page
  • a user who logs in to the retrieval page also logs in a function page
  • the function pages that the user logs in include page A, page B, and page C.
  • page A and page B are both on and page C is off, the server determines page A and page B as pages to be synchronized.
  • all function pages logged in by the user may be determined as pages to be synchronized, and some of the function pages logged in by the user may be determined as pages to be synchronized. It is not limited here.
  • the page to be synchronized may be determined from other function pages logged in by the user except the target page.
  • the user is a user who logs in to the target page, and the function pages other than the target page that the user logs in are function pages in an open state.
  • the function page that the user logs in includes page A, page B, and page C, where the target page is page A, and page B and page C are both open, the server determines page B and page C as pages to be synchronized.
  • all the function pages except the target page that the user logs in to may be determined as pages to be synchronized, and some of the function pages logged in by the user other than the target page may be determined as pages to be synchronized. It is not limited here.
  • the synchronization information is used to indicate that the data corresponding to the data identifier to be updated is updated. Updating data includes operations such as importing, deleting, and selecting data. Depending on the type of operation performed by the user on the target page, the update method indicated by the synchronization information generated by the server will be different.
  • the update information may further include an operation type, where the operation type may include an import operation, a delete operation, a selection operation, and the like.
  • the operation type included in the update information is an import operation, it means that the user has imported the data corresponding to the data identifier to be updated into the target page.
  • the server may obtain a target data identifier list corresponding to the page to be synchronized according to a preset correspondence between the pages and the data identifier list.
  • the server can determine whether the data identifier to be updated is stored in the target data identifier list by querying the obtained target data identifier list.
  • Each page may correspond to a data identification list.
  • the data identification list is used to record the identification of each data included in the corresponding page, that is, the identification recorded in the data identification list is consistent with the data included in the page corresponding to the data identification list. .
  • first synchronization information for importing data to be updated into a page to be synchronized may be generated.
  • second synchronization information for deleting data to be deleted from a page to be synchronized may be generated.
  • third synchronization information for selecting data to be selected in a page to be synchronized may be generated.
  • the page to be synchronized may update the data corresponding to the data identifier to be updated according to the synchronization information.
  • the data to be synchronized is updated based on the synchronization information, and the generation of the synchronization information is based on the operation type.
  • the following describes the process of generating and sending synchronization information according to different operation types.
  • the operation type when the operation type is an import operation, it can be considered that the user has performed the data import operation on the target page.
  • the server After obtaining the target data identifier list corresponding to the page to be synchronized, it can be determined whether the target data identifier list stores the data identifier to be updated.
  • the server may not perform data synchronization on the page to be synchronized corresponding to the target data identifier list. . If the data identifier to be updated is not stored in the target data identifier list, the server may obtain data corresponding to the data identifier to be updated from a preset database and use the data as the data to be updated.
  • the preset database is used to store various data and the corresponding relationship between the data and the data identifier. Data corresponding to each data identifier can be obtained from the database.
  • the server may generate first synchronization information including the data to be updated, and send the first synchronization information including the data to be updated to the page to be synchronized.
  • the first synchronization information is used to import the data to be updated into the page to be synchronized.
  • data to be updated may be obtained from the first synchronization information, and the data to be updated may be imported into its own page to achieve data synchronization with the target page.
  • the page to be synchronized is a relational network page.
  • the operation type is an import operation
  • the ID of the data to be updated is A
  • A is not stored in the target data ID list.
  • the server can obtain the data A corresponding to A from the database and generate The first synchronization information of the data A, and the first synchronization information including the data A is sent to the relationship network page.
  • the relational network page imports the data A into the relational network page.
  • the operation type is a delete operation
  • the server may not perform data synchronization on the page to be synchronized corresponding to the target data identifier list. If it is stored, the server generates second synchronization information for the data to be deleted, and sends the second synchronization information to the page to be synchronized.
  • the data to be deleted is data corresponding to the data identifier to be updated, and the second synchronization information is used to delete the data to be deleted from the page to be synchronized.
  • the to-be-deleted data in the own page can be deleted according to the second synchronization information to achieve data synchronization with the target page.
  • the operation type is a selection operation
  • the to-be-updated data identifier is stored in the target data identifier list, it indicates that data corresponding to the to-be-updated data identifier exists in the page to be synchronized.
  • third synchronization information for the data to be selected can be generated, and the third synchronization information Sent to the page to be synchronized.
  • the data to be selected is data corresponding to the data identifier to be updated, and the third synchronization information is used to select the data to be selected in the page to be synchronized.
  • the data to be selected in the own page can be selected according to the third synchronization information to achieve data synchronization with the target page.
  • the server may first obtain the data corresponding to the data identifier to be updated, and the data is to be selected. data.
  • the data to be selected may be obtained from a database preset by the server, or may be obtained by other methods, which is not limited herein.
  • the server may generate third synchronization information including the data to be synchronized, and may send the third synchronization information including the data to be synchronized to the page to be synchronized.
  • the data to be synchronized can be obtained from the third synchronization information, the data to be selected is imported into its own page, and the Select data to synchronize data with the target page.
  • the server can monitor each function page.
  • the pages that the user has logged in may include a function page and a retrieval page.
  • the function pages are connected to the server and can communicate with the server in both directions.
  • a heartbeat packet can be set to be sent to the server at a preset time interval, and the heartbeat packet can include status information of the function page itself.
  • the preset time interval may be customized. For example, it may be set to send a heartbeat packet to the server every half a second.
  • the page status of the function page for sending heartbeat packets is open.
  • the server can receive the heartbeat packet sent by the function page, which is any function page connected to the server.
  • the server can receive the heartbeat packet sent by the function page at a preset interval.
  • the page status of the function page may be determined, which may include at least the following two implementation manners.
  • the page state of the function page is an open state.
  • the preset duration may be set by user.
  • the preset duration starts from the time when the heartbeat packet is received, and the implementation of the preset duration may be controlled by a timer.
  • the timer starts to count.
  • the page status of the function page can be determined as On.
  • the connection to the function page can be interrupted, and the page status of the function page is determined to be closed.
  • the server may interrupt the connection by deleting the WebSocket connection with the function page.
  • the heartbeat packet may include user information, and a user corresponding to the user information is a user who logs in to the function page.
  • the server After the server receives the heartbeat packet sent from the function page, it can obtain user information from the heartbeat packet. According to the user information, the server establishes a connection with the function page. Among them, the established connection corresponds to user information.
  • the page status of the function page is determined to be open, which can include the following two situations: If the function page sends a heartbeat packet for the first time, and the current page status of the function page is closed, then The page state of the function page is determined to be an open state; if the current page state of the function page is already an open state, the page state of the function page is maintained unchanged and remains open.
  • the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information.
  • Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information.
  • the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
  • an embodiment of the present application further provides a data synchronization device.
  • the data synchronization device shown in FIG. 2 may be applied to a server.
  • the data synchronization device includes:
  • the first receiving module 210 is configured to receive update information sent by a target page, where the update information includes user information of a user who logs in to the target page and an identifier of data to be updated;
  • a first determining module 220 configured to determine pages to be synchronized from a plurality of pages logged in by the user
  • a generating module 230 configured to generate synchronization information for data corresponding to the data identifier to be updated
  • the first sending module 240 is configured to send synchronization information to a page to be synchronized, so that the page to be synchronized updates data corresponding to the data identifier to be updated according to the synchronization information.
  • the first determining module 220 is specifically configured to:
  • the target page is a retrieval page, determine the page to be synchronized from the function page logged in by the user;
  • the page to be synchronized is determined from the function pages other than the target page logged in by the user.
  • the update information further includes an operation type;
  • the generating module 230 includes:
  • An acquisition submodule configured to acquire a target data identifier list corresponding to a page to be synchronized according to a preset correspondence between a page and a data identifier list, wherein the data identifier list is used to record identifiers of each data included in the corresponding page;
  • a generating submodule is configured to generate synchronization information for data corresponding to the data identifier to be updated according to an operation type and whether a data identifier to be updated is stored in a target data identifier list.
  • the operation type is an import operation
  • the generation submodule is specifically configured to:
  • the operation type is a delete operation
  • the generating submodule is specifically configured to:
  • second synchronization information is generated for the data to be deleted, the data to be deleted is data corresponding to the data identifier to be updated, and the second synchronization information is used to delete the data to be deleted from the page to be synchronized.
  • the operation type is a selection operation; the generating submodule is specifically configured to:
  • the data to be selected is data corresponding to the data identifier to be updated, and the third synchronization information is used to select the data to be selected in the page to be synchronized;
  • the pages that the user has logged in include: a function page and a retrieval page; the device further includes:
  • a second receiving module configured to receive a heartbeat packet sent by a function page
  • a second determining module configured to determine a page state of the function page according to the received heartbeat packet
  • the second sending module is configured to send information indicating the page status of the user to the search page, so that the search page updates the page status of the function page.
  • the second determining module is specifically configured to:
  • next heartbeat packet is received within a preset time period, determine that the page status of the function page is open, and the preset time period starts from the time when the heartbeat packet is received;
  • the connection to the function page is terminated, and the page state of the function page is determined to be closed.
  • the heartbeat packet includes user information; the second determining module is specifically configured to:
  • the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information.
  • Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information.
  • the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
  • an embodiment of the present application further provides a data synchronization system, such as the data synchronization system 300 shown in FIG. 3, including a server 310 and at least two pages;
  • the target page of the at least two pages is used to obtain update information input by the user and send the update information to the server.
  • the update information includes the user information of the user and an identifier of the data to be updated.
  • the target page can be a retrieval page or a function page.
  • the server 310 is configured to receive update information sent by a target page, determine pages to be synchronized from multiple pages logged in by the user, generate synchronization information for data corresponding to the data identifier to be updated, and send the synchronization information to the pages to be synchronized.
  • the page to be synchronized is used to receive synchronization information sent by the server 310, and update data corresponding to the data identifier to be updated according to the synchronization information.
  • At least two pages include a retrieval page and a function page.
  • the target page is a retrieval page
  • the target page is further used to obtain information of the specified function page input by the user, where the information of the specified function page may be the specified Information such as the identity page and URL of the function page.
  • the designated function page is a user-defined function page to be synchronized.
  • the page status of each function page is stored in the search page.
  • the user who logs in to the search page and the user who logs in to the function page are the same user.
  • the retrieval page can detect whether the page status of the specified function page is open. If it is not, the retrieval page can create and open the specified function page according to the user information.
  • the creation of the designated function page can be created by manually entering the address in the address bar of the browser, or by retrieving the page and importing the data identifier to be updated to the designated function page.
  • the server 310 can obtain user information from the designated function page, and based on the obtained user information, the designated function page establishes a connection with the server 310. That is, for the server 310, the user corresponding to the user information is The user logged in to the specified function page.
  • the server 310 is successfully connected, the synchronization data of the user is sent to the designated function page through the connection.
  • the designated function page After receiving the synchronized data, the designated function page performs corresponding import and synchronization processing. At this time, the designated function page is open.
  • the designated function page After the designated function page is successfully opened, the designated function page sends a heartbeat packet to the server 310 at a preset time interval, so that the server 310 knows the page status of the designated function page in real time. If the designated function page is manually closed or terminated abnormally, the server 310 notifies the retrieval page that the page status of the designated function page is in a closed state, and the retrieval page timely updates the stored page status of the designated function page.
  • the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information.
  • Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information.
  • the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
  • An embodiment of the present application further provides a server.
  • the server includes a processor 410, a communication interface 420, a memory 430, and a communication bus 440.
  • the processor 410, the communication interface 420, and the memory 430 are implemented through the communication bus 440.
  • Mutual communication ;
  • a memory 430 configured to store a computer program
  • the processor 410 is configured to execute the following steps when executing a program stored in the memory 430:
  • the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information.
  • Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information.
  • the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
  • a server provided in the embodiment of the present application may also execute a data synchronization method described in any of the foregoing embodiments. For details, see FIG. 1 and the embodiment corresponding to FIG. 1, and details are not described herein again.
  • a computer-readable storage medium stores instructions, and when the computer-readable storage medium runs on the computer, the computer executes the foregoing FIG. 1 and FIG. 1.
  • a data synchronization method according to any one of the corresponding embodiments.
  • the communication bus mentioned in the above server may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, the figure only uses a thick line, but it does not mean that there is only one bus or one type of bus.
  • the communication interface is used for communication between the server and other devices.
  • the memory may include random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory.
  • NVM non-Volatile Memory
  • the memory may also be at least one storage device located far from the foregoing processor.
  • the above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc .; it may also be a digital signal processor (Digital Signal Processing, DSP), special integration Circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • CPU central processing unit
  • NP network processor
  • DSP Digital Signal Processing
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array

Abstract

Provided in an embodiment of the present application are a method and apparatus for data synchronization, which are applied to a server. The method for data synchronization comprises: receiving update information sent by a target page, and determining a page to be synchronized from among a plurality of pages logged onto by a user; generating synchronization information for data corresponding to a data identifier to be updated; sending the synchronization information to the page to be synchronized, such that the page to be synchronized updates the data corresponding to the data identifier to be updated according to the synchronization information. Thus, the page to be synchronized is determined by a server, and the page to be synchronized is updated according to the synchronization information of the server, which not only achieves data synchronization between a plurality of pages, but also solves the problem of manually operating to carry out updates, and improves the efficiency of data synchronization.

Description

一种数据同步方法及装置Data synchronization method and device
本申请要求于2018年05月30日提交中国专利局、申请号为201810541503.8发明名称为“一种数据同步方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority from a Chinese patent application filed with the Chinese Patent Office on May 30, 2018, with an application number of 201810541503.8, entitled "A Method and Device for Data Synchronization," and the entire contents of which are incorporated herein by reference.
技术领域Technical field
本申请涉及计算机技术领域,特别是涉及一种数据同步方法及装置。The present application relates to the field of computer technology, and in particular, to a data synchronization method and device.
背景技术Background technique
页面展示信息时受限于显示设备的大小,当需要同时展示多个页面时,用户浏览时需要在多个页面之间来回切换。为了解决浏览多个页面时来回切换的问题,从电脑输出多个视频源。这样用户可以同时浏览多个页面。每一个页面均是一个独立的进程,各页面之间的数据不能共享。目前,用户主要通过手动操作的方式在不同的页面之间进行数据同步。例如,用户通过手动操作将一个页面中需要同步的数据,分别导入到相关联的其他页面,实现各页面之间的数据同步。Page display information is limited by the size of the display device. When multiple pages need to be displayed at the same time, the user needs to switch back and forth between multiple pages when browsing. In order to solve the problem of switching back and forth when browsing multiple pages, multiple video sources are output from the computer. This allows users to browse multiple pages at the same time. Each page is an independent process, and data between pages cannot be shared. At present, users mainly synchronize data between different pages through manual operations. For example, users manually import data that needs to be synchronized on one page to other related pages through manual operations to achieve data synchronization between pages.
然而,通过手动操作的方式在所关联的页面之间进行数据同步,不仅浪费人力资源,而且降低了数据同步的效率。However, data synchronization between associated pages by manual operation not only wastes human resources, but also reduces the efficiency of data synchronization.
发明内容Summary of the Invention
本申请提供了一种数据同步方法及装置,以解决通过手动操作的方式实现多页面之间的数据同步的问题,进而提高数据同步的效率。具体技术方案如下:The present application provides a data synchronization method and device to solve the problem of data synchronization between multiple pages through manual operation, thereby improving the efficiency of data synchronization. The specific technical solutions are as follows:
第一方面,本申请实施例提供了一种数据同步方法,应用于服务器,所述方法包括:In a first aspect, an embodiment of the present application provides a data synchronization method, which is applied to a server, and the method includes:
接收目标页面发送的更新信息,其中,所述更新信息包括登录所述目标页面的用户的用户信息和待更新数据标识;Receiving update information sent by a target page, where the update information includes user information and a data identifier to be updated of a user who logs in to the target page;
从所述用户登录的多个页面中,确定待同步页面;Determining a page to be synchronized from a plurality of pages logged in by the user;
生成针对所述待更新数据标识对应的数据的同步信息;Generating synchronization information for data corresponding to the data identifier to be updated;
将所述同步信息发送至所述待同步页面,以使得所述待同步页面根据所述同步信息更新所述待更新数据标识对应的数据。Sending the synchronization information to the page to be synchronized, so that the page to be synchronized updates data corresponding to the to-be-updated data identifier according to the synchronization information.
可选地,所述从所述用户登录的多个页面中,确定待同步页面的步骤,包括:Optionally, the step of determining pages to be synchronized from a plurality of pages logged in by the user includes:
若目标页面为检索页面,从所述用户登录的功能页面中,确定待同步页面;If the target page is a retrieval page, determining a page to be synchronized from the function page logged in by the user;
若目标页面为功能页面,从所述用户登录的除所述目标页面以外的其他功能页面中,确定待同步页面。If the target page is a function page, a page to be synchronized is determined from other function pages registered by the user except the target page.
可选地,所述更新信息还包括操作类型;Optionally, the update information further includes an operation type;
所述生成针对所述待更新数据标识对应的数据的同步信息的步骤,包括:The step of generating synchronization information for data corresponding to the data identifier to be updated includes:
根据预设的页面与数据标识列表的对应关系,获取所述待同步页面对应的目标数据标识列表,其中,所述数据标识列表用于记录所对应的页面包括的各数据的标识;Obtaining a target data identifier list corresponding to the page to be synchronized according to a preset correspondence between a page and a data identifier list, where the data identifier list is used to record identifiers of each data included in the corresponding page;
根据所述操作类型,以及所述目标数据标识列表中是否存储有所述待更新数据标识,生成针对所述待更新数据标识对应的数据的同步信息。Generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list.
可选地,所述操作类型为导入操作;Optionally, the operation type is an import operation;
所述根据所述操作类型,以及所述目标数据标识列表中是否存储有所述待更新数据标识,生成针对所述待更新数据标识对应的数据的同步信息的步骤,包括:The step of generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list includes:
判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
如果否,从预设的数据库中,获取所述待更新数据标识对应的待更新数据,所述数据库中存储数据标识与数据的对应关系;If not, obtaining to-be-updated data corresponding to the to-be-updated data identifier from a preset database, and the database stores a correspondence between the data identifier and the data;
生成包含所述待更新数据的第一同步信息,所述第一同步信息用于将所述待更新数据导入所述待同步页面。Generate first synchronization information including the data to be updated, where the first synchronization information is used to import the data to be updated into the page to be synchronized.
可选地,所述操作类型为删除操作;Optionally, the operation type is a delete operation;
所述根据所述操作类型,以及所述目标数据标识列表中是否存储有所述待更新数据标识,生成针对所述待更新数据标识对应的数据的同步信息的步骤,包括:The step of generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list includes:
判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
如果是,生成针对待删除数据的第二同步信息,所述待删除数据为所述待更新数据标识对应的数据,所述第二同步信息用于将所述待删除数据从所述待同步页面中删除。If yes, generate second synchronization information for the data to be deleted, where the data to be deleted is data corresponding to the data identifier to be updated, and the second synchronization information is used to remove the data to be deleted from the page to be synchronized Delete.
可选地,所述操作类型为选择操作;Optionally, the operation type is a selection operation;
所述根据所述操作类型,以及所述目标数据标识列表中是否存储有所述待更新数据标识,生成针对所述待更新数据标识对应的数据的同步信息的步 骤,包括:The step of generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list includes:
判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
如果是,生成针对待选择数据的第三同步信息,所述待选择数据为所述待更新数据标识对应的数据,所述第三同步信息用于在所述待同步页面中选择所述待选择数据;If yes, generate third synchronization information for the data to be selected, where the data to be selected is data corresponding to the data identifier to be updated, and the third synchronization information is used to select the to be selected in the page to be synchronized data;
如果否,获取所述待选择数据,并生成包含所述待同步数据的第三同步信息。If not, acquire the data to be selected and generate third synchronization information including the data to be synchronized.
可选地,所述用户已登录的页面包括:功能页面和检索页面;所述方法还包括:Optionally, the pages where the user has logged in include: a function page and a retrieval page; the method further includes:
接收所述功能页面发送的心跳包;Receiving a heartbeat packet sent by the function page;
根据所接收到的心跳包,确定所述功能页面的页面状态;Determining a page state of the function page according to the received heartbeat packet;
将用于指示所述页面状态的信息发送至所述检索页面,以使得所述检索页面对所述功能页面的页面状态进行更新。Sending information indicating the page status to the search page, so that the search page updates the page status of the function page.
可选地,所述根据所接收到的心跳包,确定所述功能页面的页面状态的步骤,包括:Optionally, the step of determining a page status of the function page according to the received heartbeat packet includes:
若在预设时长内接收到下一个心跳包,则确定所述功能页面的页面状态为开启状态,所述预设时长以接收到所述心跳包的时刻为起点;If the next heartbeat packet is received within a preset time period, determining that the page status of the function page is an open state, and the preset time period starts from the time when the heartbeat packet is received;
若在所述预设时长内未接收到下一个心跳包,则中断与所述功能页面的连接,并确定所述功能页面的页面状态为关闭状态。If the next heartbeat packet is not received within the preset time period, the connection to the function page is terminated, and the page state of the function page is determined to be closed.
可选地,所述心跳包包括所述用户信息;Optionally, the heartbeat packet includes the user information;
所述根据所接收到的心跳包,确定所述功能页面的页面状态的步骤,包括:The step of determining a page status of the function page according to the received heartbeat packet includes:
根据所述心跳包包括的所述用户信息,与所述功能页面建立连接;Establishing a connection with the function page according to the user information included in the heartbeat packet;
确定所述功能页面的页面状态为开启状态。It is determined that a page state of the function page is an open state.
第二方面,本申请实施例提供了一种数据同步装置,应用于服务器,所述装置包括:In a second aspect, an embodiment of the present application provides a data synchronization device, which is applied to a server, and the device includes:
第一接收模块,用于接收目标页面发送的更新信息,其中,所述更新信息包括登录所述目标页面的用户的用户信息和待更新数据标识;A first receiving module, configured to receive update information sent by a target page, where the update information includes user information and a data identifier to be updated of a user who logs in to the target page;
第一确定模块,用于从所述用户登录的多个页面中,确定待同步页面;A first determining module, configured to determine a page to be synchronized from a plurality of pages logged in by the user;
生成模块,用于生成针对所述待更新数据标识对应的数据的同步信息;A generating module, configured to generate synchronization information for data corresponding to the data identifier to be updated;
第一发送模块,用于将所述同步信息发送至所述待同步页面,以使得所 述待同步页面根据所述同步信息更新所述待更新数据标识对应的数据。A first sending module is configured to send the synchronization information to the page to be synchronized, so that the page to be synchronized updates data corresponding to the data identifier to be updated according to the synchronization information.
可选地,所述第一确定模块具体用于:Optionally, the first determining module is specifically configured to:
若目标页面为检索页面,从所述用户登录的功能页面中,确定待同步页面;If the target page is a retrieval page, determining a page to be synchronized from the function page logged in by the user;
若目标页面为功能页面,从所述用户登录的除所述目标页面以外的其他功能页面中,确定待同步页面。If the target page is a function page, a page to be synchronized is determined from other function pages registered by the user except the target page.
可选地,所述更新信息还包括操作类型;Optionally, the update information further includes an operation type;
所述生成模块包括:The generating module includes:
获取子模块,用于根据预设的页面与数据标识列表的对应关系,获取所述待同步页面对应的目标数据标识列表,其中,所述数据标识列表用于记录所对应的页面包括的各数据的标识;An acquisition submodule, configured to acquire a target data identifier list corresponding to the page to be synchronized according to a preset correspondence between a page and a data identifier list, wherein the data identifier list is used to record each data included in the corresponding page Identification
生成子模块,用于根据所述操作类型,以及所述目标数据标识列表中是否存储有所述待更新数据标识,生成针对所述待更新数据标识对应的数据的同步信息。A generating sub-module is configured to generate synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list.
可选地,所述操作类型为导入操作;Optionally, the operation type is an import operation;
所述生成子模块具体用于:The generating sub-module is specifically configured to:
判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
如果否,从预设的数据库中,获取所述待更新数据标识对应的待更新数据,所述数据库中存储数据标识与数据的对应关系;If not, obtaining to-be-updated data corresponding to the to-be-updated data identifier from a preset database, and the database stores a correspondence between the data identifier and the data;
生成包含所述待更新数据的第一同步信息,所述第一同步信息用于将所述待更新数据导入所述待同步页面。Generate first synchronization information including the data to be updated, where the first synchronization information is used to import the data to be updated into the page to be synchronized.
可选地,所述操作类型为删除操作;Optionally, the operation type is a delete operation;
所述生成子模块具体用于:The generating sub-module is specifically configured to:
判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
如果是,生成针对待删除数据的第二同步信息,所述待删除数据为所述待更新数据标识对应的数据,所述第二同步信息用于将所述待删除数据从所述待同步页面中删除。If yes, generate second synchronization information for the data to be deleted, where the data to be deleted is data corresponding to the data identifier to be updated, and the second synchronization information is used to remove the data to be deleted from the page to be synchronized Delete.
可选地,所述操作类型为选择操作;Optionally, the operation type is a selection operation;
所述生成子模块具体用于:The generating sub-module is specifically configured to:
判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
如果是,生成针对待选择数据的第三同步信息,所述待选择数据为所述 待更新数据标识对应的数据,所述第三同步信息用于在所述待同步页面中选择所述待选择数据;If yes, generate third synchronization information for data to be selected, where the data to be selected is data corresponding to the data identifier to be updated, and the third synchronization information is used to select the to be selected in the page to be synchronized data;
如果否,获取所述待选择数据,并生成包含所述待同步数据的第三同步信息。If not, acquire the data to be selected and generate third synchronization information including the data to be synchronized.
可选地,所述用户已登录的页面包括:功能页面和检索页面;所述装置还包括:Optionally, the pages that the user has logged in include: a function page and a retrieval page; the device further includes:
第二接收模块,用于接收所述功能页面发送的心跳包;A second receiving module, configured to receive a heartbeat packet sent by the function page;
第二确定模块,用于根据所接收到的心跳包,确定所述功能页面的页面状态;A second determining module, configured to determine a page state of the function page according to the received heartbeat packet;
第二发送模块,用于将用于指示所述页面状态的信息发送至所述检索页面,以使得所述检索页面对所述功能页面的页面状态进行更新。A second sending module is configured to send information used to indicate the page status to the search page, so that the search page updates the page status of the function page.
可选地,所述第二确定模块具体用于:Optionally, the second determining module is specifically configured to:
若在预设时长内接收到下一个心跳包,则确定所述功能页面的页面状态为开启状态,所述预设时长以接收到所述心跳包的时刻为起点;If the next heartbeat packet is received within a preset time period, determining that the page status of the function page is an open state, and the preset time period starts from the time when the heartbeat packet is received;
若在所述预设时长内未接收到下一个心跳包,则中断与所述功能页面的连接,并确定所述功能页面的页面状态为关闭状态。If the next heartbeat packet is not received within the preset time period, the connection to the function page is terminated, and the page state of the function page is determined to be closed.
可选地,所述心跳包包括所述用户信息;所述第二确定模块具体用于:Optionally, the heartbeat packet includes the user information; the second determining module is specifically configured to:
根据所述心跳包包括的所述用户信息,与所述功能页面建立连接;Establishing a connection with the function page according to the user information included in the heartbeat packet;
确定所述功能页面的页面状态为开启状态。It is determined that a page state of the function page is an open state.
第三方面,本申请实施例提供了一种数据同步系统,包括服务器和至少两个页面;所述至少两个页面中的目标页面,用于获取用户输入的更新信息,并将所述更新信息发送至所述服务器,所述更新信息包括所述用户的用户信息和待更新数据标识;In a third aspect, an embodiment of the present application provides a data synchronization system including a server and at least two pages; a target page of the at least two pages is used to obtain update information input by a user, and the update information is Send to the server, the update information includes user information of the user and an identifier of data to be updated;
所述服务器,用于接收所述目标页面发送的所述更新信息,从所述用户登录的多个页面中,确定待同步页面;生成针对所述待更新数据标识对应的数据的同步信息;将所述同步信息发送至所述待同步页面;The server is configured to receive the update information sent by the target page, determine pages to be synchronized from a plurality of pages logged in by the user, generate synchronization information for data corresponding to the data identifier to be updated, and Sending the synchronization information to the page to be synchronized;
所述待同步页面,用于接收所述服务器发送的所述同步信息,并根据所述同步信息更新所述待更新数据标识对应的数据。The page to be synchronized is configured to receive the synchronization information sent by the server, and update data corresponding to the data identifier to be updated according to the synchronization information.
可选地,所述至少两个页面包括检索页面和功能页面;当目标页面为检索页面时,Optionally, the at least two pages include a retrieval page and a function page; when the target page is a retrieval page,
所述目标页面,还用于获取所述用户输入的指定功能页面的信息;检测 所述指定功能页面的页面状态是否为开启状态;如果否,创建所述指定功能页面,并根据所述用户信息,开启所述指定功能页面。The target page is further configured to obtain information of a designated function page input by the user; detect whether a page status of the designated function page is an open state; if not, create the designated function page, and based on the user information To open the specified function page.
第四方面,本申请实施例提供了一种服务器,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;According to a fourth aspect, an embodiment of the present application provides a server including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;
存储器,用于存放计算机程序;Memory for storing computer programs;
处理器,用于执行存储器上所存放的程序时,实现上述任一所述的数据同步方法步骤。The processor is configured to implement any one of the data synchronization method steps described above when executing a program stored in the memory.
第五方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述任一所述的数据同步方法步骤。In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements any one of the data synchronization methods described above. step.
本申请实施例提供的技术方案中,服务器接收目标页面发送的更新信息,从用户登录的多个页面中,确定待同步页面,生成针对待更新数据标识对应的数据的同步信息,并将同步信息发送至待同步页面,待同步页面根据同步信息更新待更新数据标识对应的数据。这样,服务器可以确定待同步页面,待同步页面根据服务器的同步信息进行更新,实现了多页面之间数据同步,并解决了手动操作进行更新的问题,提高了数据同步的效率。In the technical solution provided by the embodiment of the present application, the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information. Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information. In this way, the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例和现有技术的技术方案,下面对实施例和现有技术中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application and the technical solutions of the prior art, the following briefly introduces the embodiments and the drawings needed in the prior art. Obviously, the drawings in the following description are only the present invention. Some embodiments of the application, for those of ordinary skill in the art, can obtain other drawings according to these drawings without paying creative labor.
图1为本申请实施例提供的数据同步方法的一种流程图;FIG. 1 is a flowchart of a data synchronization method according to an embodiment of the present application;
图2为本申请实施例提供的数据同步装置的一种结构示意图;2 is a schematic structural diagram of a data synchronization apparatus according to an embodiment of the present application;
图3为本申请实施例提供的数据同步系统的一种结构示意图;3 is a schematic structural diagram of a data synchronization system according to an embodiment of the present application;
图4为本申请实施例提供的服务器的一种结构示意图。FIG. 4 is a schematic structural diagram of a server according to an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案、及优点更加清楚明白,以下参照附图并举实施例,对本申请进一步详细说明。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本 申请保护的范围。In order to make the purpose, technical solution, and advantages of the present application clearer, the following further describes the present application in detail with reference to the accompanying drawings and examples. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative labor shall fall within the protection scope of the present application.
为了解决通过手动操作的方式实现多页面之间的数据同步的问题,本申请实施例还提供了一种数据同步方法及装置,应用于服务器,其中,该数据同步方法包括如下步骤:In order to solve the problem of data synchronization between multiple pages through manual operation, the embodiments of the present application further provide a data synchronization method and device, which are applied to a server. The data synchronization method includes the following steps:
接收目标页面发送的更新信息,其中,更新信息包括登录目标页面的用户的用户信息和待更新数据标识;Receiving update information sent by a target page, where the update information includes user information of a user who logs in to the target page and an identifier of data to be updated;
从该用户登录的多个页面中,确定待同步页面;Determine the pages to be synchronized from the multiple pages that the user logs in to;
生成针对待更新数据标识对应的数据的同步信息;Generating synchronization information for data corresponding to the data identifier to be updated;
将同步信息发送至待同步页面,以使得待同步页面根据同步信息更新待更新数据标识对应的数据。Send the synchronization information to the page to be synchronized, so that the page to be synchronized updates the data corresponding to the data identifier to be updated according to the synchronization information.
本申请实施例提供的技术方案中,服务器接收目标页面发送的更新信息,从用户登录的多个页面中,确定待同步页面,生成针对待更新数据标识对应的数据的同步信息,并将同步信息发送至待同步页面,待同步页面根据同步信息更新待更新数据标识对应的数据。这样,服务器可以确定待同步页面,待同步页面根据服务器的同步信息进行更新,实现了多页面之间数据同步,并解决了手动操作进行更新的问题,提高了数据同步的效率。In the technical solution provided by the embodiment of the present application, the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information. Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information. In this way, the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
下面首先对本申请实施例提供的一种数据同步方法进行介绍,该数据同步方法可以应用于服务器,具体地,该服务器可以是提供HTTP协议和WebSocket协议通信的HTTP服务器,该服务器还可以是具有本申请实施例所述相应功能的其他服务器,在此不做限定。如图1所示,该数据同步方法包括如下步骤。The following first introduces a data synchronization method provided by an embodiment of the present application. The data synchronization method may be applied to a server. Specifically, the server may be an HTTP server that provides HTTP protocol and WebSocket protocol communication. The server may also have Other servers with corresponding functions described in the application examples are not limited herein. As shown in FIG. 1, the data synchronization method includes the following steps.
S101,接收目标页面发送的更新信息。S101. Receive update information sent by a target page.
其中,目标页面可以是检索页面,还可以是功能页面。The target page can be a retrieval page or a function page.
检索页面为基于多屏的页面中的数据入口页面,用户登录到检索页面后,可以在检索页面输入所需的检索信息进行检索。功能页面为除检索页面以外的其他页面,并且每一个功能页面各自具有相应的功能,一种实现方式中,每一功能页面的功能可以是独立的功能。The retrieval page is a data entry page based on a multi-screen page. After the user logs in to the retrieval page, he can enter the required retrieval information on the retrieval page for retrieval. Function pages are pages other than search pages, and each function page has a corresponding function. In one implementation, the function of each function page may be an independent function.
例如,功能页面可以包括:关系网络页面、地图分析页面和综合研判页面等。其中,关系网络页面用于展示与所检索的目标对象有关联的其他人物的关系图,例如用户检索嫌疑人A,则关系网络页面会展示出与该嫌疑人A有关联的人物关系:家人关系、朋友关系、同事关系等。地图分析页面用于展 示与所检索的目标对象有关联的地址信息。综合研判页面用于展示根据所检索的目标对象的相关信息进行综合判断后的结论。For example, the function page may include a relationship network page, a map analysis page, and a comprehensive research and judgment page. Among them, the relationship network page is used to display the relationship diagram of other people who are related to the retrieved target object. For example, if the user searches for suspect A, the relationship network page will show the relationship between the person and the suspect A: family relationship , Friends, colleagues, etc. The map analysis page is used to display the address information associated with the retrieved target object. The comprehensive research and judgement page is used to display the conclusion after comprehensive judgment according to the relevant information of the retrieved target object.
检索页面和功能页面均与服务器相连接的。一种实现方式中,该连接可以是WebSocket连接,具体地,检索页面和功能页面通过WebSocket与服务器连接,这样,页面与服务器之间便可以进行双向通信。服务器与检索页面和功能页面两者之间的连接方式还可以是其他方式,在此不做限定。Both the retrieval page and the function page are connected to the server. In an implementation manner, the connection may be a WebSocket connection. Specifically, the retrieval page and the function page are connected to the server through WebSocket, so that the page and the server can perform two-way communication. The connection method between the server and the retrieval page and the function page may also be other methods, which are not limited herein.
其中,更新信息包括登录目标页面的用户的用户信息和待更新数据标识。用户信息可以包括以下中的至少一种:用户登录的用户名、用户标识等。The update information includes user information of a user who logs in to the target page and an identifier of data to be updated. The user information may include at least one of the following: a user name, a user ID, and the like that the user logs in to.
可以预设数据与标识的对应关系,即对于每一数据,均可以对应一标识。待更新数据标识为用户在目标页面进行更新的数据对应的标识,即登录目标页面的用户对该待更新数据标识的数据进行了更新,该待更新数据标识的数据需要在该用户登录的其他功能页面进行同样的更新。例如,用户在关系网络页面删除嫌疑人A的数据,该嫌疑人A对应的标识为A,则该A为待更新数据标识。The correspondence between the data and the identifier can be preset, that is, for each data, there can be a corresponding identifier. The identifier of the data to be updated is the identifier corresponding to the data updated by the user on the target page, that is, the user who logged in to the target page has updated the data of the identifier of the data to be updated. The page is updated the same. For example, if the user deletes the data of the suspect A on the relationship network page, and the identifier corresponding to the suspect A is A, the A is the identifier of the data to be updated.
S102,从用户登录的多个页面中,确定待同步页面。S102. Determine a page to be synchronized from the multiple pages logged in by the user.
其中,该用户为登录目标页面的用户,用户可以登录一个页面,还可以登录多个页面。若用户除了登录目标页面以外,还登录了其他页面,则可以从该其他页面中确定待同步页面。The user is a user who logs in to the target page. The user can log in to one page or multiple pages. If the user has logged in to other pages in addition to the target page, the pages to be synchronized can be determined from the other pages.
服务器可以监测同一用户登录的各页面的页面状态,其中,页面状态可以分为关闭状态和开启状态。其中,关闭状态的页面可以是手动操作关闭,还可以是异常终止关闭。页面的关闭状态是指页面与服务器之间的连接断开,并且页面无法展示、也无法提供相应的功能。页面的开启状态是指页面与服务器相连接,并且页面可以向用户展示出来、并提供相应的功能。服务器从用户登录的多个页面中,将页面状态为开启状态的页面确定为待同步页面。The server can monitor the page status of each page where the same user logs in. The page status can be divided into a closed state and an open state. Among them, the closed page can be manually closed, or it can be closed abnormally. The closed state of a page means that the connection between the page and the server is broken, and the page cannot be displayed and cannot provide corresponding functions. The open state of the page means that the page is connected to the server, and the page can be displayed to the user and provide corresponding functions. The server determines, from multiple pages logged in by the user, the page whose page status is on as the page to be synchronized.
一种实施方式中,根据目标页面的不同,确定待同步页面可以分为以下两种情况。In an implementation manner, according to different target pages, determining the pages to be synchronized can be divided into the following two cases.
第一种情况,若目标页面为检索页面,则从用户登录的功能页面中,确定待同步页面。其中,该用户即为登录该目标页面的用户,该用户登录的功能页面为开启状态的功能页面。In the first case, if the target page is a retrieval page, the page to be synchronized is determined from the function pages logged in by the user. The user is a user who logs in to the target page, and the function page that the user logs in to is a function page in an open state.
例如,目标页面为检索页面,登录该检索页面的用户还登录了功能页面,该用户登录的功能页面包括页面A、页面B和页面C。其中,页面A和页面B均 处于开启状态,页面C处于关闭状态,则服务器将页面A和页面B确定为待同步页面。For example, the target page is a retrieval page, and a user who logs in to the retrieval page also logs in a function page, and the function pages that the user logs in include page A, page B, and page C. Wherein, page A and page B are both on and page C is off, the server determines page A and page B as pages to be synchronized.
其中,可以将用户登录的所有功能页面均确定为待同步页面,还可以将用户登录的功能页面中的部分功能页面确定为待同步页面。在此不做限定。Among them, all function pages logged in by the user may be determined as pages to be synchronized, and some of the function pages logged in by the user may be determined as pages to be synchronized. It is not limited here.
第二种情况,若目标页面为功能页面,可以从用户登录的除目标页面以外的其他功能页面中,确定待同步页面。其中,该用户即为登录该目标页面的用户,该用户登录的除目标页面以外的其他功能页面为开启状态的功能页面。In the second case, if the target page is a function page, the page to be synchronized may be determined from other function pages logged in by the user except the target page. The user is a user who logs in to the target page, and the function pages other than the target page that the user logs in are function pages in an open state.
例如,用户登录的功能页面包括页面A、页面B和页面C,其中,目标页面为页面A,页面B和页面C均处于开启状态,则服务器将页面B和页面C确定为待同步页面。For example, the function page that the user logs in includes page A, page B, and page C, where the target page is page A, and page B and page C are both open, the server determines page B and page C as pages to be synchronized.
其中,可以将用户登录的除目标页面以外的其他所有功能页面均确定为待同步页面,还可以将用户登录的除目标页面以外的其他功能页面中的部分功能页面确定为待同步页面。在此不做限定。Among them, all the function pages except the target page that the user logs in to may be determined as pages to be synchronized, and some of the function pages logged in by the user other than the target page may be determined as pages to be synchronized. It is not limited here.
S103,生成针对待更新数据标识对应的数据的同步信息。S103. Generate synchronization information for data corresponding to the data identifier to be updated.
同步信息用于指示对待更新数据标识对应的数据进行更新。对数据进行更新包括对数据进行导入、删除、选择等操作,根据用户在目标页面进行操作的操作类型的不同,服务器生成的同步信息所指示的更新方式会有不同。The synchronization information is used to indicate that the data corresponding to the data identifier to be updated is updated. Updating data includes operations such as importing, deleting, and selecting data. Depending on the type of operation performed by the user on the target page, the update method indicated by the synchronization information generated by the server will be different.
一种实施方式中,更新信息还可以包括操作类型,其中,操作类型可以包括导入操作、删除操作和选择操作等。例如,更新信息中包括的操作类型为导入操作时,表示用户已将待更新数据标识对应的数据导入到目标页面中。In an implementation manner, the update information may further include an operation type, where the operation type may include an import operation, a delete operation, a selection operation, and the like. For example, when the operation type included in the update information is an import operation, it means that the user has imported the data corresponding to the data identifier to be updated into the target page.
服务器在确定出待同步页面后,可以根据预设的页面与数据标识列表的对应关系,获取待同步页面对应的目标数据标识列表。服务器通过查询所获取的目标数据标识列表,可以确定该目标数据标识列表中是否存储有待更新数据标识。After the server determines the pages to be synchronized, the server may obtain a target data identifier list corresponding to the page to be synchronized according to a preset correspondence between the pages and the data identifier list. The server can determine whether the data identifier to be updated is stored in the target data identifier list by querying the obtained target data identifier list.
其中,每一页面均可以对应一数据标识列表,数据标识列表用于记录所对应页面包括的各数据的标识,即数据标识列表中记录的标识与该数据标识列表对应的页面包括的数据保持一致。Each page may correspond to a data identification list. The data identification list is used to record the identification of each data included in the corresponding page, that is, the identification recorded in the data identification list is consistent with the data included in the page corresponding to the data identification list. .
根据更新信息中包括的操作类型,以及目标数据标识列表中是否存储有待更新数据标识,生成针对待更新数据标识对应的数据的同步信息。Generate synchronization information for the data corresponding to the data identifier to be updated according to the operation type included in the update information and whether the data identifier to be updated is stored in the target data identifier list.
操作类型不同,所生成的同步信息的作用不同。具体地,操作类型为导 入操作时,可以生成用于将待更新数据导入待同步页面的第一同步信息。操作类型为删除操作时,可以生成用于将待删除数据从待同步页面中删除的第二同步信息。操作类型为选择操作时,可以生成用于在待同步页面中选择待选择数据的第三同步信息。Different types of operations have different roles for the generated synchronization information. Specifically, when the operation type is an import operation, first synchronization information for importing data to be updated into a page to be synchronized may be generated. When the operation type is a delete operation, second synchronization information for deleting data to be deleted from a page to be synchronized may be generated. When the operation type is a selection operation, third synchronization information for selecting data to be selected in a page to be synchronized may be generated.
S104,将同步信息发送至待同步页面。S104. Send the synchronization information to a page to be synchronized.
待同步页面在接收到同步信息之后,可以根据同步信息更新待更新数据标识对应的数据。After receiving the synchronization information, the page to be synchronized may update the data corresponding to the data identifier to be updated according to the synchronization information.
待同步页面进行数据更新,以同步信息为根据,同步信息的生成以操作类型为根据。下面根据操作类型的不同分别对同步信息的生成以及发送的过程进行介绍。The data to be synchronized is updated based on the synchronization information, and the generation of the synchronization information is based on the operation type. The following describes the process of generating and sending synchronization information according to different operation types.
一种实施方式中,当操作类型为导入操作时,可以认为,用户在目标页面进行了数据的导入操作。对于服务器来说,在获取待同步页面对应的目标数据标识列表后,可以判断该目标数据标识列表中是否存储有待更新数据标识。In one embodiment, when the operation type is an import operation, it can be considered that the user has performed the data import operation on the target page. For the server, after obtaining the target data identifier list corresponding to the page to be synchronized, it can be determined whether the target data identifier list stores the data identifier to be updated.
如果该目标数据标识列表中已存储有待更新数据标识,则表示待同步页面中已存在该待更新数据标识对应的数据,此时,服务器可以不对该目标数据标识列表对应的待同步页面进行数据同步。如果该目标数据标识列表中未存储有待更新数据标识,则服务器可以从预设的数据库中获取待更新数据标识对应的数据,并作为待更新数据。If the data identifier to be updated is already stored in the target data identifier list, it means that data corresponding to the data identifier to be updated already exists in the page to be synchronized. At this time, the server may not perform data synchronization on the page to be synchronized corresponding to the target data identifier list. . If the data identifier to be updated is not stored in the target data identifier list, the server may obtain data corresponding to the data identifier to be updated from a preset database and use the data as the data to be updated.
其中,预设的数据库用于存储各种数据,以及数据与数据标识的对应关系。从该数据库中可以获取各数据标识对应的数据。The preset database is used to store various data and the corresponding relationship between the data and the data identifier. Data corresponding to each data identifier can be obtained from the database.
在获取待更新数据之后,服务器可以生成包含该待更新数据的第一同步信息,并将包含待更新数据的第一同步信息发送至待同步页面。其中,该第一同步信息用于将待更新数据导入待同步页面。After acquiring the data to be updated, the server may generate first synchronization information including the data to be updated, and send the first synchronization information including the data to be updated to the page to be synchronized. The first synchronization information is used to import the data to be updated into the page to be synchronized.
对于待同步页面来说,在接收到第一同步信息后,可以从第一同步信息中获取待更新数据,并将待更新数据导入自身的页面中,以实现与目标页面的数据同步。For a page to be synchronized, after receiving the first synchronization information, data to be updated may be obtained from the first synchronization information, and the data to be updated may be imported into its own page to achieve data synchronization with the target page.
例如,待同步页面为关系网络页面,当操作类型为导入操作时,待更新数据标识为A,在目标数据标识列表中未存储A,则服务器可以从数据库中获取A对应的数据A,生成包含数据A的第一同步信息,并将包含数据A的第一同步信息发送至关系网络页面。关系网络页面接收到包含数据A的第一同步信息 后,将数据A导入到关系网络页面中。For example, the page to be synchronized is a relational network page. When the operation type is an import operation, the ID of the data to be updated is A, and A is not stored in the target data ID list. Then the server can obtain the data A corresponding to A from the database and generate The first synchronization information of the data A, and the first synchronization information including the data A is sent to the relationship network page. After receiving the first synchronization information containing data A, the relational network page imports the data A into the relational network page.
一种实施方式中,当操作类型为删除操作时,可以认为,用户在目标页面进行了数据的删除操作。对于服务器来说,可以判断目标数据标识列表中是否存储有待更新数据标识。In one embodiment, when the operation type is a delete operation, it can be considered that the user has performed a data delete operation on the target page. For the server, it can be determined whether the data identifier to be updated is stored in the target data identifier list.
如果目标数据标识列表中未存储有待更新数据标识,则表示待同步页面中不存在待更新数据标识对应的数据,此时,服务器可以不对该目标数据标识列表对应的待同步页面进行数据同步。如果已存储,则服务器生成针对待删除数据的第二同步信息,并将该第二同步信息发送至待同步页面。其中,待删除数据为待更新数据标识对应的数据,第二同步信息用于将待删除数据从待同步页面中删除。If the data identifier to be updated is not stored in the target data identifier list, it means that there is no data corresponding to the data identifier to be updated in the page to be synchronized. At this time, the server may not perform data synchronization on the page to be synchronized corresponding to the target data identifier list. If it is stored, the server generates second synchronization information for the data to be deleted, and sends the second synchronization information to the page to be synchronized. The data to be deleted is data corresponding to the data identifier to be updated, and the second synchronization information is used to delete the data to be deleted from the page to be synchronized.
对于待同步页面来说,在接收到第二同步信息后,可以根据第二同步信息,将自身页面中的待删除数据进行删除处理,以实现与目标页面的数据同步。For a page to be synchronized, after receiving the second synchronization information, the to-be-deleted data in the own page can be deleted according to the second synchronization information to achieve data synchronization with the target page.
一种实施方式中,当操作类型为选择操作时,可以认为,用户在目标页面进行了数据的选择操作。对于服务器来说,可以判断目标数据标识列表中是否存储有待更新数据标识。In one embodiment, when the operation type is a selection operation, it can be considered that the user has performed a data selection operation on the target page. For the server, it can be determined whether the data identifier to be updated is stored in the target data identifier list.
如果目标数据标识列表中存储有待更新数据标识,则表示待同步页面中存在待更新数据标识对应的数据,此时,可以生成针对待选择数据的第三同步信息,并可以将该第三同步信息发送至待同步页面。其中,待选择数据为待更新数据标识对应的数据,第三同步信息用于在待同步页面中选择待选择数据。此时,对于待同步页面来说,在接收到第三同步信息后,可以根据第三同步信息,选择自身页面中的待选择数据,以实现与目标页面的数据同步。If the to-be-updated data identifier is stored in the target data identifier list, it indicates that data corresponding to the to-be-updated data identifier exists in the page to be synchronized. At this time, third synchronization information for the data to be selected can be generated, and the third synchronization information Sent to the page to be synchronized. The data to be selected is data corresponding to the data identifier to be updated, and the third synchronization information is used to select the data to be selected in the page to be synchronized. At this time, for the page to be synchronized, after receiving the third synchronization information, the data to be selected in the own page can be selected according to the third synchronization information to achieve data synchronization with the target page.
如果目标数据标识列表中未存储有待更新数据标识,则表示待同步页面中不存在待更新数据标识对应的数据,此时,服务器可以首先获取待更新数据标识对应的数据,该数据即为待选择数据。其中,获取待选择数据可以从服务器预设的数据库中获取,还可以通过其他方式获取,在此不做限定。服务器在获取待选择数据之后,可以生成包含待同步数据的第三同步信息,并可以将包含待同步数据的第三同步信息发送至待同步页面。If no data identifier to be updated is stored in the target data identifier list, it means that there is no data corresponding to the data identifier to be updated in the page to be synchronized. At this time, the server may first obtain the data corresponding to the data identifier to be updated, and the data is to be selected. data. The data to be selected may be obtained from a database preset by the server, or may be obtained by other methods, which is not limited herein. After acquiring the data to be selected, the server may generate third synchronization information including the data to be synchronized, and may send the third synchronization information including the data to be synchronized to the page to be synchronized.
对于待同步页面来说,在接收到包含待同步数据的第三同步信息后,可以从第三同步信息中获取待同步数据,将待选择数据导入自身的页面中,并选择自身页面中的待选择数据,以实现与目标页面的数据同步。For a page to be synchronized, after receiving the third synchronization information containing the data to be synchronized, the data to be synchronized can be obtained from the third synchronization information, the data to be selected is imported into its own page, and the Select data to synchronize data with the target page.
为了可以实时地了解每一功能页面的状态,服务器可以对各功能页面进行监测。一种实施方式中,用户已登录的页面可以包括功能页面和检索页面。其中,功能页面均与服务器相连接,并可以与服务器进行双向通信。对于每一功能页面来说,可以设定按照预设时间间隔向服务器发送心跳包,心跳包中可以包括功能页面自身的状态信息。其中,预设时间间隔可以是自定义设定的,例如,可以设定每隔半秒向服务器发送一个心跳包。发送心跳包的功能页面的页面状态为开启状态。In order to know the status of each function page in real time, the server can monitor each function page. In one embodiment, the pages that the user has logged in may include a function page and a retrieval page. Among them, the function pages are connected to the server and can communicate with the server in both directions. For each function page, a heartbeat packet can be set to be sent to the server at a preset time interval, and the heartbeat packet can include status information of the function page itself. The preset time interval may be customized. For example, it may be set to send a heartbeat packet to the server every half a second. The page status of the function page for sending heartbeat packets is open.
对于服务器来说,可以接收功能页面发送的心跳包,该功能页面为与服务器相连接的任一功能页面。服务器可以每隔预设时间间隔接收功能页面发送的心跳包。根据所接收到的心跳包,可以确定该功能页面的页面状态,其中,可以包括至少以下两种实现方式。For the server, it can receive the heartbeat packet sent by the function page, which is any function page connected to the server. The server can receive the heartbeat packet sent by the function page at a preset interval. According to the received heartbeat packet, the page status of the function page may be determined, which may include at least the following two implementation manners.
第一种实现方式,若在预设时长内接收到下一个心跳包,则可以确定功能页面的页面状态为开启状态。In the first implementation manner, if the next heartbeat packet is received within a preset time period, it can be determined that the page state of the function page is an open state.
其中,预设时长可以是自定义设定的,预设时长以接收到心跳包的时刻为起点,预设时长的实现可以由定时器控制。一种实现方式中,当服务器接收到功能页面发送的心跳包时定时器开始计时,当在预设时长内接收到功能页面发送的下一个心跳包时,则可以确定该功能页面的页面状态为开启状态。The preset duration may be set by user. The preset duration starts from the time when the heartbeat packet is received, and the implementation of the preset duration may be controlled by a timer. In one implementation, when the server receives the heartbeat packet sent by the function page, the timer starts to count. When the next heartbeat packet sent by the function page is received within a preset period of time, the page status of the function page can be determined as On.
若在预设时长内未接收到下一个心跳包,则可以中断与功能页面的连接,并确定功能页面的页面状态为关闭状态。其中,当服务器与功能页面的连接为WebSocket连接时,服务器中断连接的方式可以是服务器删除与功能页面的WebSocket连接。If the next heartbeat packet is not received within a preset time period, the connection to the function page can be interrupted, and the page status of the function page is determined to be closed. When the connection between the server and the function page is a WebSocket connection, the server may interrupt the connection by deleting the WebSocket connection with the function page.
第二种实现方式,心跳包可以包括用户信息,该用户信息对应的用户即为登录功能页面的用户。In the second implementation manner, the heartbeat packet may include user information, and a user corresponding to the user information is a user who logs in to the function page.
当服务器接收到功能页面发送的心跳包后,可以从心跳包获取用户信息。根据该用户信息,服务器与功能页面建立连接。其中,所建立的连接与用户信息是相对应的。After the server receives the heartbeat packet sent from the function page, it can obtain user information from the heartbeat packet. According to the user information, the server establishes a connection with the function page. Among them, the established connection corresponds to user information.
在服务器与功能页面建立连接之后,确定功能页面的页面状态为开启状态,可以包括以下两种情况:若该功能页面第一次发送心跳包,该功能页面当前的页面状态为关闭状态,则将该功能页面的页面状态确定为开启状态;若该功能页面当前的页面状态已经为开启状态,则保持该功能页面的页面状态不变,仍为开启状态。After the server establishes a connection with the function page, the page status of the function page is determined to be open, which can include the following two situations: If the function page sends a heartbeat packet for the first time, and the current page status of the function page is closed, then The page state of the function page is determined to be an open state; if the current page state of the function page is already an open state, the page state of the function page is maintained unchanged and remains open.
本申请实施例提供的技术方案中,服务器接收目标页面发送的更新信息,从用户登录的多个页面中,确定待同步页面,生成针对待更新数据标识对应的数据的同步信息,并将同步信息发送至待同步页面,待同步页面根据同步信息更新待更新数据标识对应的数据。这样,服务器可以确定待同步页面,待同步页面根据服务器的同步信息进行更新,实现了多页面之间数据同步,并解决了手动操作进行更新的问题,提高了数据同步的效率。In the technical solution provided by the embodiment of the present application, the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information. Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information. In this way, the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
相应于上述数据同步方法实施例,本申请实施例还提供一种数据同步装置,如图2所示的数据同步装置,可以应用于服务器,该数据同步装置包括:Corresponding to the foregoing embodiment of the data synchronization method, an embodiment of the present application further provides a data synchronization device. The data synchronization device shown in FIG. 2 may be applied to a server. The data synchronization device includes:
第一接收模块210,用于接收目标页面发送的更新信息,其中,更新信息包括登录目标页面的用户的用户信息和待更新数据标识;The first receiving module 210 is configured to receive update information sent by a target page, where the update information includes user information of a user who logs in to the target page and an identifier of data to be updated;
第一确定模块220,用于从该用户登录的多个页面中,确定待同步页面;A first determining module 220, configured to determine pages to be synchronized from a plurality of pages logged in by the user;
生成模块230,用于生成针对待更新数据标识对应的数据的同步信息;A generating module 230, configured to generate synchronization information for data corresponding to the data identifier to be updated;
第一发送模块240,用于将同步信息发送至待同步页面,以使得待同步页面根据同步信息更新待更新数据标识对应的数据。The first sending module 240 is configured to send synchronization information to a page to be synchronized, so that the page to be synchronized updates data corresponding to the data identifier to be updated according to the synchronization information.
可选地,一种实施方式中,第一确定模块220具体用于:Optionally, in an implementation manner, the first determining module 220 is specifically configured to:
若目标页面为检索页面,从用户登录的功能页面中,确定待同步页面;If the target page is a retrieval page, determine the page to be synchronized from the function page logged in by the user;
若目标页面为功能页面,从用户登录的除目标页面以外的其他功能页面中,确定待同步页面。If the target page is a function page, the page to be synchronized is determined from the function pages other than the target page logged in by the user.
可选地,一种实施方式中,更新信息还包括操作类型;生成模块230包括:Optionally, in an implementation manner, the update information further includes an operation type; the generating module 230 includes:
获取子模块,用于根据预设的页面与数据标识列表的对应关系,获取待同步页面对应的目标数据标识列表,其中,数据标识列表用于记录所对应的页面包括的各数据的标识;An acquisition submodule, configured to acquire a target data identifier list corresponding to a page to be synchronized according to a preset correspondence between a page and a data identifier list, wherein the data identifier list is used to record identifiers of each data included in the corresponding page;
生成子模块,用于根据操作类型,以及目标数据标识列表中是否存储有待更新数据标识,生成针对待更新数据标识对应的数据的同步信息。A generating submodule is configured to generate synchronization information for data corresponding to the data identifier to be updated according to an operation type and whether a data identifier to be updated is stored in a target data identifier list.
可选地,一种实施方式中,操作类型为导入操作;生成子模块具体用于:Optionally, in one embodiment, the operation type is an import operation; the generation submodule is specifically configured to:
判断目标数据标识列表中是否存储有待更新数据标识;Judging whether the data identifier to be updated is stored in the target data identifier list;
如果否,从预设的数据库中,获取待更新数据标识对应的待更新数据,数据库中存储数据标识与数据的对应关系;If not, obtain the data to be updated corresponding to the data identifier to be updated from a preset database, and the correspondence between the data identifier and the data is stored in the database;
生成包含待更新数据的第一同步信息,第一同步信息用于将待更新数据导入待同步页面。Generate first synchronization information including data to be updated, and the first synchronization information is used to import the data to be updated into the page to be synchronized.
可选地,一种实施方式中,操作类型为删除操作;生成子模块具体用于:Optionally, in one embodiment, the operation type is a delete operation; the generating submodule is specifically configured to:
判断目标数据标识列表中是否存储有待更新数据标识;Judging whether the data identifier to be updated is stored in the target data identifier list;
如果是,生成针对待删除数据的第二同步信息,待删除数据为待更新数据标识对应的数据,第二同步信息用于将待删除数据从待同步页面中删除。If yes, second synchronization information is generated for the data to be deleted, the data to be deleted is data corresponding to the data identifier to be updated, and the second synchronization information is used to delete the data to be deleted from the page to be synchronized.
可选地,一种实施方式中,操作类型为选择操作;生成子模块具体用于:Optionally, in one embodiment, the operation type is a selection operation; the generating submodule is specifically configured to:
判断目标数据标识列表中是否存储有待更新数据标识;Judging whether the data identifier to be updated is stored in the target data identifier list;
如果是,生成针对待选择数据的第三同步信息,待选择数据为待更新数据标识对应的数据,第三同步信息用于在待同步页面中选择待选择数据;If yes, generate third synchronization information for the data to be selected, the data to be selected is data corresponding to the data identifier to be updated, and the third synchronization information is used to select the data to be selected in the page to be synchronized;
如果否,获取待选择数据,并生成包含待同步数据的第三同步信息。If not, acquire the data to be selected and generate third synchronization information including the data to be synchronized.
可选地,一种实施方式中,用户已登录的页面包括:功能页面和检索页面;装置还包括:Optionally, in an embodiment, the pages that the user has logged in include: a function page and a retrieval page; the device further includes:
第二接收模块,用于接收功能页面发送的心跳包;A second receiving module, configured to receive a heartbeat packet sent by a function page;
第二确定模块,用于根据所接收到的心跳包,确定功能页面的页面状态;A second determining module, configured to determine a page state of the function page according to the received heartbeat packet;
第二发送模块,用于将用户指示页面状态的信息发送至检索页面,以使得检索页面对功能页面的页面状态进行更新。The second sending module is configured to send information indicating the page status of the user to the search page, so that the search page updates the page status of the function page.
可选地,一种实施方式中,第二确定模块具体用于:Optionally, in an implementation manner, the second determining module is specifically configured to:
若在预设时长内接收到下一个心跳包,则确定功能页面的页面状态为开启状态,该预设时长以接收到心跳包的时刻为起点;If the next heartbeat packet is received within a preset time period, determine that the page status of the function page is open, and the preset time period starts from the time when the heartbeat packet is received;
若在预设时长内未接收到下一个心跳包,则中断与功能页面的连接,并确定功能页面的页面状态为关闭状态。If the next heartbeat packet is not received within a preset time period, the connection to the function page is terminated, and the page state of the function page is determined to be closed.
可选地,一种实施方式中,心跳包包括用户信息;第二确定模块具体用于:Optionally, in an implementation manner, the heartbeat packet includes user information; the second determining module is specifically configured to:
根据心跳包包括的用户信息,与功能页面建立连接;Establish a connection with the function page according to the user information included in the heartbeat package;
确定功能页面的页面状态为开启状态。Make sure the page status of the function page is open.
本申请实施例提供的技术方案中,服务器接收目标页面发送的更新信息,从用户登录的多个页面中,确定待同步页面,生成针对待更新数据标识对应的数据的同步信息,并将同步信息发送至待同步页面,待同步页面根据同步信息更新待更新数据标识对应的数据。这样,服务器可以确定待同步页面,待同步页面根据服务器的同步信息进行更新,实现了多页面之间数据同步,并解决了手动操作进行更新的问题,提高了数据同步的效率。In the technical solution provided by the embodiment of the present application, the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information. Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information. In this way, the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
相应于上述数据同步方法实施例,本申请实施例还提供一种数据同步系统,如图3所示的数据同步系统300,包括服务器310和至少两个页面;Corresponding to the foregoing embodiment of the data synchronization method, an embodiment of the present application further provides a data synchronization system, such as the data synchronization system 300 shown in FIG. 3, including a server 310 and at least two pages;
至少两个页面中的目标页面,用于获取用户输入的更新信息,并将更新信息发送至服务器,更新信息包括用户的用户信息和待更新数据标识。The target page of the at least two pages is used to obtain update information input by the user and send the update information to the server. The update information includes the user information of the user and an identifier of the data to be updated.
其中,目标页面可以是检索页面,还可以是功能页面。The target page can be a retrieval page or a function page.
服务器310,用于接收目标页面发送的更新信息,从用户登录的多个页面中,确定待同步页面,生成针对待更新数据标识对应的数据的同步信息,将同步信息发送至待同步页面。The server 310 is configured to receive update information sent by a target page, determine pages to be synchronized from multiple pages logged in by the user, generate synchronization information for data corresponding to the data identifier to be updated, and send the synchronization information to the pages to be synchronized.
待同步页面,用于接收服务器310发送的同步信息,并根据同步信息更新待更新数据标识对应的数据。The page to be synchronized is used to receive synchronization information sent by the server 310, and update data corresponding to the data identifier to be updated according to the synchronization information.
一种实施方式中,至少两个页面包括检索页面和功能页面,当目标页面为检索页面时,目标页面还用于获取用户输入的指定功能页面的信息,其中,指定功能页面的信息可以是指定功能页面的标识、网址等信息,指定功能页面是由用户自定义指定的待同步的功能页面。In an implementation manner, at least two pages include a retrieval page and a function page. When the target page is a retrieval page, the target page is further used to obtain information of the specified function page input by the user, where the information of the specified function page may be the specified Information such as the identity page and URL of the function page. The designated function page is a user-defined function page to be synchronized.
检索页面中存储有各功能页面的页面状态,其中,登录该检索页面的用户与登录该各功能页面的用户为同一用户。根据所存储的页面状态,检索页面可以检测指定功能页面的页面状态是否为开启状态,如果不是开启状态,检索页面可以根据用户信息,创建并开启指定功能页面。The page status of each function page is stored in the search page. The user who logs in to the search page and the user who logs in to the function page are the same user. According to the stored page status, the retrieval page can detect whether the page status of the specified function page is open. If it is not, the retrieval page can create and open the specified function page according to the user information.
其中,指定功能页面的创建可以通过在浏览器的地址栏中手动输入地址,还可以是检索页面将待更新数据标识导入到指定功能页面的方式创建。指定功能页面在被创建后,服务器310可以从该指定功能页面中获取用户信息,基于所获取的用户信息指定功能页面与服务器310建立连接,即对于服务器310来说,该用户信息对应的用户为登录该指定功能页面的用户。服务器310连接成功后,将该用户的同步数据通过该连接发送给指定功能页面,指定功能页面在接收到同步数据之后进行相应的导入和同步处理。此时,指定功能页面处于开启状态。Wherein, the creation of the designated function page can be created by manually entering the address in the address bar of the browser, or by retrieving the page and importing the data identifier to be updated to the designated function page. After the designated function page is created, the server 310 can obtain user information from the designated function page, and based on the obtained user information, the designated function page establishes a connection with the server 310. That is, for the server 310, the user corresponding to the user information is The user logged in to the specified function page. After the server 310 is successfully connected, the synchronization data of the user is sent to the designated function page through the connection. After receiving the synchronized data, the designated function page performs corresponding import and synchronization processing. At this time, the designated function page is open.
指定功能页面在成功开启之后,该指定功能页面按照预设时间间隔向服务器310发送心跳包,以使得服务器310实时了解该指定功能页面的页面状态。如果指定功能页面被手动关闭或者异常终止时,服务器310会通知检索页面该指定功能页面的页面状态已处于关闭状态,检索页面及时地对所存储的指定功能页面的页面状态进行更新。After the designated function page is successfully opened, the designated function page sends a heartbeat packet to the server 310 at a preset time interval, so that the server 310 knows the page status of the designated function page in real time. If the designated function page is manually closed or terminated abnormally, the server 310 notifies the retrieval page that the page status of the designated function page is in a closed state, and the retrieval page timely updates the stored page status of the designated function page.
本申请实施例提供的技术方案中,服务器接收目标页面发送的更新信息,从用户登录的多个页面中,确定待同步页面,生成针对待更新数据标识对应 的数据的同步信息,并将同步信息发送至待同步页面,待同步页面根据同步信息更新待更新数据标识对应的数据。这样,服务器可以确定待同步页面,待同步页面根据服务器的同步信息进行更新,实现了多页面之间数据同步,并解决了手动操作进行更新的问题,提高了数据同步的效率。In the technical solution provided by the embodiment of the present application, the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information. Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information. In this way, the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
本申请实施例还提供了一种服务器,如图4所示,包括处理器410、通信接口420、存储器430和通信总线440,其中,处理器410,通信接口420,存储器430通过通信总线440完成相互间的通信;An embodiment of the present application further provides a server. As shown in FIG. 4, the server includes a processor 410, a communication interface 420, a memory 430, and a communication bus 440. The processor 410, the communication interface 420, and the memory 430 are implemented through the communication bus 440. Mutual communication;
存储器430,用于存放计算机程序;A memory 430, configured to store a computer program;
处理器410,用于执行存储器430上所存放的程序时,实现如下步骤:The processor 410 is configured to execute the following steps when executing a program stored in the memory 430:
接收目标页面发送的更新信息,其中,更新信息包括登录目标页面的用户的用户信息和待更新数据标识;Receiving update information sent by a target page, where the update information includes user information of a user who logs in to the target page and an identifier of data to be updated;
从该用户登录的多个页面中,确定待同步页面;Determine the pages to be synchronized from the multiple pages that the user logs in to;
生成针对待更新数据标识对应的数据的同步信息;Generating synchronization information for data corresponding to the data identifier to be updated;
将同步信息发送至待同步页面,以使得待同步页面根据同步信息更新待更新数据标识对应的数据。Send the synchronization information to the page to be synchronized, so that the page to be synchronized updates the data corresponding to the data identifier to be updated according to the synchronization information.
本申请实施例提供的技术方案中,服务器接收目标页面发送的更新信息,从用户登录的多个页面中,确定待同步页面,生成针对待更新数据标识对应的数据的同步信息,并将同步信息发送至待同步页面,待同步页面根据同步信息更新待更新数据标识对应的数据。这样,服务器可以确定待同步页面,待同步页面根据服务器的同步信息进行更新,实现了多页面之间数据同步,并解决了手动操作进行更新的问题,提高了数据同步的效率。In the technical solution provided by the embodiment of the present application, the server receives the update information sent by the target page, determines the pages to be synchronized from multiple pages logged in by the user, generates synchronization information for the data corresponding to the data identifier to be updated, and synchronizes the synchronization information. Send to the page to be synchronized, and the page to be updated updates the data corresponding to the data identifier to be updated according to the synchronization information. In this way, the server can determine the pages to be synchronized, and the pages to be synchronized are updated according to the synchronization information of the server, thereby achieving data synchronization between multiple pages, and solving the problem of manual operation for updating, and improving the efficiency of data synchronization.
本申请实施例提供的一种服务器还可以执行上述实施例中任一所述的一种数据同步方法。具体见图1以及图1所对应的实施例,这里不再赘述。A server provided in the embodiment of the present application may also execute a data synchronization method described in any of the foregoing embodiments. For details, see FIG. 1 and the embodiment corresponding to FIG. 1, and details are not described herein again.
在本申请提供的又一实施例中,还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述图1以及图1所对应的实施例中任一所述的一种数据同步方法。In still another embodiment provided by the present application, a computer-readable storage medium is also provided. The computer-readable storage medium stores instructions, and when the computer-readable storage medium runs on the computer, the computer executes the foregoing FIG. 1 and FIG. 1. A data synchronization method according to any one of the corresponding embodiments.
上述服务器提到的通信总线可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned in the above server may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, the figure only uses a thick line, but it does not mean that there is only one bus or one type of bus.
通信接口用于上述服务器与其他设备之间的通信。The communication interface is used for communication between the server and other devices.
存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the foregoing processor.
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processing,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc .; it may also be a digital signal processor (Digital Signal Processing, DSP), special integration Circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that these entities or operations There is any such actual relationship or order among them. Moreover, the terms "including", "comprising", or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or device that includes a series of elements includes not only those elements but also those that are not explicitly listed Or other elements inherent to such a process, method, article, or device. Without more restrictions, the elements defined by the sentence "including a ..." do not exclude the existence of other identical elements in the process, method, article, or equipment that includes the elements.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于数据同步装置、数据同步系统、服务器以及机器可读存储介质的实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, the embodiments of the data synchronization device, the data synchronization system, the server, and the machine-readable storage medium are basically similar to the method embodiment, so the description is relatively simple. For the related parts, see the description of the method embodiment. can.
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。The above are only preferred embodiments of this application, and are not intended to limit this application. Any modification, equivalent replacement, or improvement made within the spirit and principle of this application shall be included in this application Within the scope of protection.

Claims (22)

  1. 一种数据同步方法,其特征在于,应用于服务器,所述方法包括:A data synchronization method, which is applied to a server, and the method includes:
    接收目标页面发送的更新信息,其中,所述更新信息包括登录所述目标页面的用户的用户信息和待更新数据标识;Receiving update information sent by a target page, where the update information includes user information and a data identifier to be updated of a user who logs in to the target page;
    从所述用户登录的多个页面中,确定待同步页面;Determining a page to be synchronized from a plurality of pages logged in by the user;
    生成针对所述待更新数据标识对应的数据的同步信息;Generating synchronization information for data corresponding to the data identifier to be updated;
    将所述同步信息发送至所述待同步页面,以使得所述待同步页面根据所述同步信息更新所述待更新数据标识对应的数据。Sending the synchronization information to the page to be synchronized, so that the page to be synchronized updates data corresponding to the to-be-updated data identifier according to the synchronization information.
  2. 根据权利要求1所述的方法,其特征在于,所述从所述用户登录的多个页面中,确定待同步页面的步骤,包括:The method according to claim 1, wherein the step of determining pages to be synchronized from a plurality of pages logged in by the user comprises:
    若目标页面为检索页面,从所述用户登录的功能页面中,确定待同步页面;If the target page is a retrieval page, determining a page to be synchronized from the function page logged in by the user;
    若目标页面为功能页面,从所述用户登录的除所述目标页面以外的其他功能页面中,确定待同步页面。If the target page is a function page, a page to be synchronized is determined from other function pages registered by the user except the target page.
  3. 根据权利要求1所述的方法,其特征在于,所述更新信息还包括操作类型;The method according to claim 1, wherein the update information further comprises an operation type;
    所述生成针对所述待更新数据标识对应的数据的同步信息的步骤,包括:The step of generating synchronization information for data corresponding to the data identifier to be updated includes:
    根据预设的页面与数据标识列表的对应关系,获取所述待同步页面对应的目标数据标识列表,其中,所述数据标识列表用于记录所对应的页面包括的各数据的标识;Obtaining a target data identifier list corresponding to the page to be synchronized according to a preset correspondence between a page and a data identifier list, where the data identifier list is used to record identifiers of each data included in the corresponding page;
    根据所述操作类型,以及所述目标数据标识列表中是否存储有所述待更新数据标识,生成针对所述待更新数据标识对应的数据的同步信息。Generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list.
  4. 根据权利要求3所述的方法,其特征在于,所述操作类型为导入操作;The method according to claim 3, wherein the operation type is an import operation;
    所述根据所述操作类型,以及所述目标数据标识列表中是否存储有所述待更新数据标识,生成针对所述待更新数据标识对应的数据的同步信息的步骤,包括:The step of generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list includes:
    判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
    如果否,从预设的数据库中,获取所述待更新数据标识对应的待更新数据,所述数据库中存储数据标识与数据的对应关系;If not, obtaining to-be-updated data corresponding to the to-be-updated data identifier from a preset database, and the database stores a correspondence between the data identifier and the data;
    生成包含所述待更新数据的第一同步信息,所述第一同步信息用于将所述待更新数据导入所述待同步页面。Generate first synchronization information including the data to be updated, where the first synchronization information is used to import the data to be updated into the page to be synchronized.
  5. 根据权利要求3所述的方法,其特征在于,所述操作类型为删除操作;The method according to claim 3, wherein the operation type is a delete operation;
    所述根据所述操作类型,以及所述目标数据标识列表中是否存储有所述待更新数据标识,生成针对所述待更新数据标识对应的数据的同步信息的步骤,包括:The step of generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list includes:
    判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
    如果是,生成针对待删除数据的第二同步信息,所述待删除数据为所述待更新数据标识对应的数据,所述第二同步信息用于将所述待删除数据从所述待同步页面中删除。If yes, generate second synchronization information for the data to be deleted, where the data to be deleted is data corresponding to the data identifier to be updated, and the second synchronization information is used to remove the data to be deleted from the page to be synchronized Delete.
  6. 根据权利要求3所述的方法,其特征在于,所述操作类型为选择操作;The method according to claim 3, wherein the operation type is a selection operation;
    所述根据所述操作类型,以及所述目标数据标识列表中是否存储有所述待更新数据标识,生成针对所述待更新数据标识对应的数据的同步信息的步骤,包括:The step of generating synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list includes:
    判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
    如果是,生成针对待选择数据的第三同步信息,所述待选择数据为所述待更新数据标识对应的数据,所述第三同步信息用于在所述待同步页面中选择所述待选择数据;If yes, generate third synchronization information for the data to be selected, where the data to be selected is data corresponding to the data identifier to be updated, and the third synchronization information is used to select the to be selected in the page to be synchronized data;
    如果否,获取所述待选择数据,并生成包含所述待同步数据的第三同步信息。If not, acquire the data to be selected and generate third synchronization information including the data to be synchronized.
  7. 根据权利要求1所述的方法,其特征在于,所述用户已登录的页面包括:功能页面和检索页面;所述方法还包括:The method according to claim 1, wherein the pages the user has logged in to include: a function page and a retrieval page; the method further comprises:
    接收所述功能页面发送的心跳包;Receiving a heartbeat packet sent by the function page;
    根据所接收到的心跳包,确定所述功能页面的页面状态;Determining a page state of the function page according to the received heartbeat packet;
    将用于指示所述页面状态的信息发送至所述检索页面,以使得所述检索页面对所述功能页面的页面状态进行更新。Sending information indicating the page status to the search page, so that the search page updates the page status of the function page.
  8. 根据权利要求7所述的方法,其特征在于,所述根据所接收到的心跳包,确定所述功能页面的页面状态的步骤,包括:The method according to claim 7, wherein the step of determining a page state of the function page according to the received heartbeat packet comprises:
    若在预设时长内接收到下一个心跳包,则确定所述功能页面的页面状态为开启状态,所述预设时长以接收到所述心跳包的时刻为起点;If the next heartbeat packet is received within a preset time period, determining that the page status of the function page is an open state, and the preset time period starts from the time when the heartbeat packet is received;
    若在所述预设时长内未接收到下一个心跳包,则中断与所述功能页面的连接,并确定所述功能页面的页面状态为关闭状态。If the next heartbeat packet is not received within the preset time period, the connection to the function page is terminated, and the page state of the function page is determined to be closed.
  9. 根据权利要求7所述的方法,其特征在于,所述心跳包包括所述用户 信息;The method according to claim 7, wherein the heartbeat packet includes the user information;
    所述根据所接收到的心跳包,确定所述功能页面的页面状态的步骤,包括:The step of determining a page status of the function page according to the received heartbeat packet includes:
    根据所述心跳包包括的所述用户信息,与所述功能页面建立连接;Establishing a connection with the function page according to the user information included in the heartbeat packet;
    确定所述功能页面的页面状态为开启状态。It is determined that a page state of the function page is an open state.
  10. 一种数据同步装置,其特征在于,应用于服务器,所述装置包括:A data synchronization device, which is applied to a server, and the device includes:
    第一接收模块,用于接收目标页面发送的更新信息,其中,所述更新信息包括登录所述目标页面的用户的用户信息和待更新数据标识;A first receiving module, configured to receive update information sent by a target page, where the update information includes user information and a data identifier to be updated of a user who logs in to the target page;
    第一确定模块,用于从所述用户登录的多个页面中,确定待同步页面;A first determining module, configured to determine a page to be synchronized from a plurality of pages logged in by the user;
    生成模块,用于生成针对所述待更新数据标识对应的数据的同步信息;A generating module, configured to generate synchronization information for data corresponding to the data identifier to be updated;
    第一发送模块,用于将所述同步信息发送至所述待同步页面,以使得所述待同步页面根据所述同步信息更新所述待更新数据标识对应的数据。A first sending module is configured to send the synchronization information to the page to be synchronized, so that the page to be synchronized updates data corresponding to the data identifier to be updated according to the synchronization information.
  11. 根据权利要求10所述的装置,其特征在于,所述第一确定模块具体用于:The apparatus according to claim 10, wherein the first determining module is specifically configured to:
    若目标页面为检索页面,从所述用户登录的功能页面中,确定待同步页面;If the target page is a retrieval page, determining a page to be synchronized from the function page logged in by the user;
    若目标页面为功能页面,从所述用户登录的除所述目标页面以外的其他功能页面中,确定待同步页面。If the target page is a function page, a page to be synchronized is determined from other function pages registered by the user except the target page.
  12. 根据权利要求10所述的装置,其特征在于,所述更新信息还包括操作类型;The apparatus according to claim 10, wherein the update information further includes an operation type;
    所述生成模块包括:The generating module includes:
    获取子模块,用于根据预设的页面与数据标识列表的对应关系,获取所述待同步页面对应的目标数据标识列表,其中,所述数据标识列表用于记录所对应的页面包括的各数据的标识;An acquisition submodule, configured to acquire a target data identifier list corresponding to the page to be synchronized according to a preset correspondence between a page and a data identifier list, wherein the data identifier list is used to record each data included in the corresponding page Identification
    生成子模块,用于根据所述操作类型,以及所述目标数据标识列表中是否存储有所述待更新数据标识,生成针对所述待更新数据标识对应的数据的同步信息。A generating sub-module is configured to generate synchronization information for data corresponding to the data identifier to be updated according to the operation type and whether the data identifier to be updated is stored in the target data identifier list.
  13. 根据权利要求12所述的装置,其特征在于,所述操作类型为导入操作;The apparatus according to claim 12, wherein the operation type is an import operation;
    所述生成子模块具体用于:The generating sub-module is specifically configured to:
    判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
    如果否,从预设的数据库中,获取所述待更新数据标识对应的待更新数据,所述数据库中存储数据标识与数据的对应关系;If not, obtaining to-be-updated data corresponding to the to-be-updated data identifier from a preset database, and the database stores a correspondence between the data identifier and the data;
    生成包含所述待更新数据的第一同步信息,所述第一同步信息用于将所述待更新数据导入所述待同步页面。Generate first synchronization information including the data to be updated, where the first synchronization information is used to import the data to be updated into the page to be synchronized.
  14. 根据权利要求12所述的装置,其特征在于,所述操作类型为删除操作;The apparatus according to claim 12, wherein the operation type is a delete operation;
    所述生成子模块具体用于:The generating sub-module is specifically configured to:
    判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
    如果是,生成针对待删除数据的第二同步信息,所述待删除数据为所述待更新数据标识对应的数据,所述第二同步信息用于将所述待删除数据从所述待同步页面中删除。If yes, generate second synchronization information for the data to be deleted, where the data to be deleted is data corresponding to the data identifier to be updated, and the second synchronization information is used to remove the data to be deleted from the page to be synchronized Delete.
  15. 根据权利要求12所述的装置,其特征在于,所述操作类型为选择操作;The apparatus according to claim 12, wherein the operation type is a selection operation;
    所述生成子模块具体用于:The generating sub-module is specifically configured to:
    判断所述目标数据标识列表中是否存储有所述待更新数据标识;Determining whether the target data identifier list stores the data identifier to be updated;
    如果是,生成针对待选择数据的第三同步信息,所述待选择数据为所述待更新数据标识对应的数据,所述第三同步信息用于在所述待同步页面中选择所述待选择数据;If yes, generate third synchronization information for the data to be selected, where the data to be selected is data corresponding to the data identifier to be updated, and the third synchronization information is used to select the to be selected in the page to be synchronized data;
    如果否,获取所述待选择数据,并生成包含所述待同步数据的第三同步信息。If not, acquire the data to be selected and generate third synchronization information including the data to be synchronized.
  16. 根据权利要求10所述的装置,其特征在于,所述用户已登录的页面包括:功能页面和检索页面;所述装置还包括:The device according to claim 10, wherein the pages that the user has logged in include: a function page and a retrieval page; the device further comprises:
    第二接收模块,用于接收所述功能页面发送的心跳包;A second receiving module, configured to receive a heartbeat packet sent by the function page;
    第二确定模块,用于根据所接收到的心跳包,确定所述功能页面的页面状态;A second determining module, configured to determine a page state of the function page according to the received heartbeat packet;
    第二发送模块,用于将用于指示所述页面状态的信息发送至所述检索页面,以使得所述检索页面对所述功能页面的页面状态进行更新。A second sending module is configured to send information used to indicate the page status to the search page, so that the search page updates the page status of the function page.
  17. 根据权利要求16所述的装置,其特征在于,所述第二确定模块具体用于:The apparatus according to claim 16, wherein the second determining module is specifically configured to:
    若在预设时长内接收到下一个心跳包,则确定所述功能页面的页面状态 为开启状态,所述预设时长以接收到所述心跳包的时刻为起点;If a next heartbeat packet is received within a preset time period, determining a page state of the function page as an open state, and the preset time period starts from the time when the heartbeat packet is received;
    若在所述预设时长内未接收到下一个心跳包,则中断与所述功能页面的连接,并确定所述功能页面的页面状态为关闭状态。If the next heartbeat packet is not received within the preset time period, the connection to the function page is terminated, and the page state of the function page is determined to be closed.
  18. 根据权利要求16所述的装置,其特征在于,所述心跳包包括所述用户信息;所述第二确定模块具体用于:The apparatus according to claim 16, wherein the heartbeat packet includes the user information; and the second determining module is specifically configured to:
    根据所述心跳包包括的所述用户信息,与所述功能页面建立连接;Establishing a connection with the function page according to the user information included in the heartbeat packet;
    确定所述功能页面的页面状态为开启状态。It is determined that a page state of the function page is an open state.
  19. 一种数据同步系统,其特征在于,包括服务器和至少两个页面;A data synchronization system, comprising a server and at least two pages;
    所述至少两个页面中的目标页面,用于获取用户输入的更新信息,并将所述更新信息发送至所述服务器,所述更新信息包括所述用户的用户信息和待更新数据标识;A target page of the at least two pages is used to obtain update information input by a user and send the update information to the server, where the update information includes user information of the user and an identifier of data to be updated;
    所述服务器,用于接收所述目标页面发送的所述更新信息,从所述用户登录的多个页面中,确定待同步页面;生成针对所述待更新数据标识对应的数据的同步信息;将所述同步信息发送至所述待同步页面;The server is configured to receive the update information sent by the target page, determine pages to be synchronized from a plurality of pages logged in by the user, generate synchronization information for data corresponding to the data identifier to be updated, and Sending the synchronization information to the page to be synchronized;
    所述待同步页面,用于接收所述服务器发送的所述同步信息,并根据所述同步信息更新所述待更新数据标识对应的数据。The page to be synchronized is configured to receive the synchronization information sent by the server, and update data corresponding to the data identifier to be updated according to the synchronization information.
  20. 根据权利要求19所述的系统,其特征在于,所述至少两个页面包括检索页面和功能页面;当目标页面为检索页面时,The system according to claim 19, wherein the at least two pages include a retrieval page and a function page; when the target page is a retrieval page,
    所述目标页面,还用于获取所述用户输入的指定功能页面的信息;检测所述指定功能页面的页面状态是否为开启状态;如果否,创建所述指定功能页面,并根据所述用户信息,开启所述指定功能页面。The target page is further configured to obtain information of a designated function page input by the user; detect whether a page status of the designated function page is an open state; if not, create the designated function page, and based on the user information To open the specified function page.
  21. 一种服务器,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;A server is characterized by comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;
    存储器,用于存放计算机程序;Memory for storing computer programs;
    处理器,用于执行存储器上所存放的程序时,实现权利要求1-9任一所述的方法步骤。The processor is configured to implement the method steps according to any one of claims 1 to 9 when executing a program stored in the memory.
  22. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-9任一所述的方法步骤。A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps according to any one of claims 1-9 are implemented.
PCT/CN2019/079739 2018-05-30 2019-03-26 Method and apparatus for data synchronization WO2019228034A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810541503.8A CN110557412A (en) 2018-05-30 2018-05-30 data synchronization method and device
CN201810541503.8 2018-05-30

Publications (1)

Publication Number Publication Date
WO2019228034A1 true WO2019228034A1 (en) 2019-12-05

Family

ID=68697803

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/079739 WO2019228034A1 (en) 2018-05-30 2019-03-26 Method and apparatus for data synchronization

Country Status (2)

Country Link
CN (1) CN110557412A (en)
WO (1) WO2019228034A1 (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111459612A (en) * 2020-03-27 2020-07-28 新浪网技术(中国)有限公司 Updating method and device for Pod in Kubernetes system
CN111488151A (en) * 2020-04-17 2020-08-04 上海数禾信息科技有限公司 Method and device for page interaction among Android modules
CN111782728A (en) * 2020-06-30 2020-10-16 北京金山云网络技术有限公司 Data synchronization method, device, electronic equipment and medium
CN112565455A (en) * 2020-12-23 2021-03-26 深圳市和讯华谷信息技术有限公司 Multi-event synchronous processing method, computer equipment and storage medium
CN113127239A (en) * 2019-12-31 2021-07-16 深圳云天励飞技术有限公司 Page state monitoring method, device, terminal and storage medium
CN113704212A (en) * 2020-05-22 2021-11-26 深信服科技股份有限公司 Data synchronization method, device and equipment of server and computer storage medium
CN113949894A (en) * 2021-10-18 2022-01-18 上海哔哩哔哩科技有限公司 Live broadcast related duration recording method and device
CN114281434A (en) * 2021-12-15 2022-04-05 创优数字科技(广东)有限公司 Applet user information management method, device, computer equipment and storage medium
CN115729592A (en) * 2022-11-21 2023-03-03 上海秉匠信息科技有限公司 Page updating method and device, electronic equipment and medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20020089659A (en) * 2001-05-24 2002-11-30 주식회사 비즈모델라인 System and Method for syncronizing web browser of multi-users by using the direct data communication(P2P) between clients
EP1501024A1 (en) * 2003-07-23 2005-01-26 France Telecom Method of synchronized pointing of an object of a web page simultaneously displayed on a plurality of user remote terminals connected through an internet-like network
US20050108299A1 (en) * 2003-11-19 2005-05-19 Nec Corporation Real-time Web sharing system
CN102882762A (en) * 2011-07-11 2013-01-16 腾讯科技(深圳)有限公司 Method and system for synchronizing chat status information in multiple pages
CN103218461A (en) * 2013-05-14 2013-07-24 百度在线网络技术(北京)有限公司 Classified management method, system, terminal and cloud server for browse pages
CN104104575A (en) * 2013-04-03 2014-10-15 腾讯科技(深圳)有限公司 Communication method and system for IM (instant messaging) group
US20160085661A1 (en) * 2014-09-18 2016-03-24 Antoine Clement Multi-Browser Testing For Web Applications

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7000008B2 (en) * 2001-04-16 2006-02-14 Sun Microsystems, Inc. Method, system, and program for providing data updates to a page including multiple regions of dynamic content
CN102185875A (en) * 2011-01-30 2011-09-14 北京开心人信息技术有限公司 Synchronous information updating method and system
CN102270133A (en) * 2011-07-18 2011-12-07 百度在线网络技术(北京)有限公司 Method and equipment for showing status of page window
CN102334366A (en) * 2011-08-12 2012-01-25 华为终端有限公司 Data synchronism method, server, mobile terminal and data synchronism system
US9015062B2 (en) * 2013-06-20 2015-04-21 Aol Advertising Inc. Systems and methods for cross-browser advertising ID synchronization
CN105027120B (en) * 2014-02-24 2019-01-18 华为技术有限公司 multi-page management method and device
CN105099686B (en) * 2014-05-13 2019-08-23 腾讯科技(深圳)有限公司 Data synchronous method, server, terminal and system
CN105808702B (en) * 2016-03-04 2019-07-02 华自科技股份有限公司 The management system of content of pages method for refreshing, system and content of pages synchronous refresh
CN106161629B (en) * 2016-07-13 2020-08-04 广州新博庭网络信息科技股份有限公司 Business object synchronization method, client and server

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20020089659A (en) * 2001-05-24 2002-11-30 주식회사 비즈모델라인 System and Method for syncronizing web browser of multi-users by using the direct data communication(P2P) between clients
EP1501024A1 (en) * 2003-07-23 2005-01-26 France Telecom Method of synchronized pointing of an object of a web page simultaneously displayed on a plurality of user remote terminals connected through an internet-like network
US20050108299A1 (en) * 2003-11-19 2005-05-19 Nec Corporation Real-time Web sharing system
CN102882762A (en) * 2011-07-11 2013-01-16 腾讯科技(深圳)有限公司 Method and system for synchronizing chat status information in multiple pages
CN104104575A (en) * 2013-04-03 2014-10-15 腾讯科技(深圳)有限公司 Communication method and system for IM (instant messaging) group
CN103218461A (en) * 2013-05-14 2013-07-24 百度在线网络技术(北京)有限公司 Classified management method, system, terminal and cloud server for browse pages
US20160085661A1 (en) * 2014-09-18 2016-03-24 Antoine Clement Multi-Browser Testing For Web Applications

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127239A (en) * 2019-12-31 2021-07-16 深圳云天励飞技术有限公司 Page state monitoring method, device, terminal and storage medium
CN111459612A (en) * 2020-03-27 2020-07-28 新浪网技术(中国)有限公司 Updating method and device for Pod in Kubernetes system
CN111488151A (en) * 2020-04-17 2020-08-04 上海数禾信息科技有限公司 Method and device for page interaction among Android modules
CN111488151B (en) * 2020-04-17 2023-09-26 上海数禾信息科技有限公司 Page interaction method and device among Android modules
CN113704212A (en) * 2020-05-22 2021-11-26 深信服科技股份有限公司 Data synchronization method, device and equipment of server and computer storage medium
CN111782728A (en) * 2020-06-30 2020-10-16 北京金山云网络技术有限公司 Data synchronization method, device, electronic equipment and medium
CN111782728B (en) * 2020-06-30 2024-02-02 北京金山云网络技术有限公司 Data synchronization method, device, electronic equipment and medium
CN112565455B (en) * 2020-12-23 2023-01-20 深圳市安数科技有限责任公司 Multi-event synchronous processing method, computer equipment and storage medium
CN112565455A (en) * 2020-12-23 2021-03-26 深圳市和讯华谷信息技术有限公司 Multi-event synchronous processing method, computer equipment and storage medium
CN113949894B (en) * 2021-10-18 2023-06-20 上海哔哩哔哩科技有限公司 Live broadcast related duration recording method and device
CN113949894A (en) * 2021-10-18 2022-01-18 上海哔哩哔哩科技有限公司 Live broadcast related duration recording method and device
CN114281434B (en) * 2021-12-15 2022-11-29 创优数字科技(广东)有限公司 Applet user information management method, apparatus, computer device and storage medium
CN114281434A (en) * 2021-12-15 2022-04-05 创优数字科技(广东)有限公司 Applet user information management method, device, computer equipment and storage medium
CN115729592A (en) * 2022-11-21 2023-03-03 上海秉匠信息科技有限公司 Page updating method and device, electronic equipment and medium

Also Published As

Publication number Publication date
CN110557412A (en) 2019-12-10

Similar Documents

Publication Publication Date Title
WO2019228034A1 (en) Method and apparatus for data synchronization
US9369520B2 (en) Enhancement of upload and/or download performance based on client and/or server feedback information
US11206451B2 (en) Information interception processing method, terminal, and computer storage medium
US9729675B2 (en) Enhancement of upload and/or download performance based on client and/or server feedback information
US9910895B2 (en) Push subscriptions
AU2015280414B2 (en) Cross-device notifications
US20140310241A1 (en) Virtual file system for automated data replication and review
US20160330208A1 (en) Method and apparatus for implementing document sharing between user groups
CN109032663A (en) Generation method, device, computer equipment and the storage medium of interface document
CN103227786B (en) A kind of website login information filling method and device
KR20140022464A (en) Sharing control system and method for network resources download information
WO2019109518A1 (en) Data list uploading method and terminal thereof
US9800488B2 (en) Method for setting heartbeat timer, terminal and server
CN108469972B (en) Method and device for supporting display of multiple windows in WEB page
US9876776B2 (en) Methods for generating and publishing a web site based on selected items and devices thereof
TW201814609A (en) Information pushing
US20240020305A1 (en) Systems and methods for automatic archiving, sorting, and/or indexing of secondary message content
US11178160B2 (en) Detecting and mitigating leaked cloud authorization keys
WO2016169438A1 (en) Method and apparatus for acquiring user account
EP2990947A1 (en) Method and apparatus for backing up data and electronic device
WO2016082616A1 (en) Method and device for providing website authentication data for search engine
US20150026274A1 (en) Method and apparatus for routing a message
CN105052165B (en) Method for processing business, device and system
WO2017080198A1 (en) Memo update method and device
CN109213955B (en) Data processing method and related equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19810250

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19810250

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19810250

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 10/06/2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19810250

Country of ref document: EP

Kind code of ref document: A1