Data synchronization method and apparatus, computer device, and storage medium
By automatically updating the article information table and the index information of the article publication files in the target environment, the problem of low data synchronization efficiency between different environments in the portal system project is solved, and efficient and accurate data switching is achieved.
Patent Information
- Application Number
- CN202311131661.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2043-09-04
AI Technical Summary
During the development and testing of portal system projects, existing technologies have shown that data synchronization between different environments is inefficient and prone to incomplete or incorrect data switching.
This paper provides a data synchronization method that automatically updates the article information table and the index information of the article publication files in the target environment by determining the article identifiers and column identifiers between the source and target environments, and associates the article columns to achieve automatic data synchronization.
It improves the efficiency of data synchronization between different environments, reduces the time and errors of manual operation, and ensures the integrity and accuracy of data switching.
Smart Images

Figure CN117033518B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent operation and maintenance, and in particular to a data synchronization method and device, computer equipment, a storage medium and a computer program product. BACKGROUND
[0002] In the development and testing process of a portal system project, data switching or data synchronization between different environments (such as a development environment, a testing environment, a pre-production environment, a production environment, etc.) is usually involved. For example, if an article page error or other abnormality occurs in a portal system in a production environment, article-related data in the production environment needs to be imported into a testing environment so as to test and locate the source of the problem, and if the source of the problem is located, the modified data needs to be imported into the production environment.
[0003] In the related art, the process of synchronizing article data from a source environment to a target environment is usually manually operated by a tester, and there is a problem of low efficiency. SUMMARY
[0004] Therefore, it is necessary to provide a data synchronization method, device, computer equipment, computer readable storage medium and computer program product capable of improving efficiency in view of the above technical problems.
[0005] In a first aspect, the present application provides a data synchronization method. The method comprises:
[0006] In response to an instruction of synchronizing a target article in a source environment to a target environment, determining a source article identifier of the target article and an identifier of a target column;
[0007] updating article information corresponding to the source article identifier in a database of the source environment to an article information table of the target environment;
[0008] obtaining an article publishing file corresponding to the source article identifier from the database of the source environment, updating index information of the article publishing file based on a target article identifier, and storing the article publishing file with updated index information to a database of the target environment; the target article identifier is an identifier of the target article in the article information table of the target environment;
[0009] updating an article column association table of the target environment based on the identifier of the target column and the target article identifier.
[0010] In one of the embodiments, the article information includes article attribute information and article content information, and the article information table includes an article attribute table and an article content table; and the updating of the article information corresponding to the source article identifier in the database of the source environment to the article information table of the target environment comprises:
[0011] corresponding article attribute information of the source article identified in the database of the source environment is updated into the article attribute table of the target environment, and the article attribute information is associated with the target article identified;
[0012] corresponding article content information of the source article identified in the database of the source environment is updated into the article content table of the target environment, and the article content information is associated with the target article identified.
[0013] In one embodiment, the source article identified of the target article and the identification of the target column are determined in response to the instruction of synchronizing the target article in the source environment to the target environment, comprising:
[0014] In response to the instruction of synchronizing the target article in the source environment to the target environment, the source article identified of the target article, the identification of the target column and the target article identified are obtained from the configuration file;
[0015] The article information corresponding to the source article identified in the database of the source environment is updated into the article information table of the target environment, comprising:
[0016] The article information corresponding to the source article identified is obtained from the database of the source environment;
[0017] The article information corresponding to the target article identified is replaced by the article information corresponding to the source article identified in the article information table of the target environment.
[0018] In one embodiment, the article information corresponding to the source article identified in the database of the source environment is updated into the article information table of the target environment, comprising:
[0019] The article information corresponding to the source article identified is obtained from the database of the source environment;
[0020] The target article identified is generated in the article information table of the target environment, and the article information is filled into the article information table of the target environment, so that the article information is associated with the target article identified.
[0021] In one embodiment, the source article identified of the target article and the identification of the target column are determined in response to the instruction of synchronizing the target article in the source environment to the target environment, comprising:
[0022] In response to the instruction of synchronizing the target article in the source environment to the target environment, the source article identified of the target article, the identification of the target column and the article modification information are obtained from the configuration file;
[0023] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0024] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0025] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0026] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0027] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0028] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0029] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0030] In one of the embodiments, the method further comprises:
[0031] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0032] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0033] In one of the embodiments, the method further comprises:
[0034] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0035] The article information corresponding to the source article identifier is obtained from the database of the source environment, and the article information is modified based on the article modification information.
[0036] The program information is compared with the information of the target program, the first program hierarchical relationship is compared with the second program hierarchical relationship, a comparison result is obtained, and a data verification result is determined according to the comparison result, and the data verification result is used to reflect the correctness of data synchronization.
[0037] In one of the embodiments, the method further comprises:
[0038] In response to a data verification instruction, the target article in the target environment is downloaded to obtain a download file corresponding to the target article;
[0039] Based on the article modification information, the information contained in the download file is verified to obtain a data verification result.
[0040] In a second aspect, the application further provides a data synchronization device. The device comprises:
[0041] A determination module is configured to determine a source article identifier of a target article and an identifier of a target program in response to an instruction of synchronizing the target article in a source environment to a target environment;
[0042] A first update module is configured to update article information corresponding to the source article identifier in a database of the source environment to an article information table of the target environment;
[0043] A second update module is configured to obtain an article publishing file corresponding to the source article identifier from the database of the source environment, update index information of the article publishing file based on a target article identifier, and store the article publishing file with updated index information to the database of the target environment; the target article identifier is an identifier of the target article in the article information table of the target environment;
[0044] A third update module is configured to update an article program association table of the target environment based on the identifier of the target program and the target article identifier.
[0045] In one of the embodiments, the article information comprises article attribute information and article content information, and the article information table comprises an article attribute table and an article content table; the first update module is specifically configured to:
[0046] Update the article attribute information corresponding to the source article identifier in the database of the source environment to the article attribute table of the target environment, and associate the article attribute information with the target article identifier; and update the article content information corresponding to the source article identifier in the database of the source environment to the article content table of the target environment, and associate the article content information with the target article identifier.
[0047] In one of the embodiments, the determining module is specifically configured to: in response to an instruction of synchronizing a target article in a source environment to a target environment, acquire, from a configuration file, a source article identifier of the target article, an identifier of a target column, and an identifier of the target article;
[0048] The first updating module is specifically configured to:
[0049] acquire article information corresponding to the source article identifier from a database of the source environment; and replace, in an article information table of the target environment, article information corresponding to the target article identifier with the article information corresponding to the source article identifier.
[0050] In one of the embodiments, the first updating module is specifically configured to:
[0051] acquire article information corresponding to the source article identifier from a database of the source environment; and generate a target article identifier in an article information table of the target environment, and fill the article information into the article information table of the target environment, so as to associate the article information with the target article identifier.
[0052] In one of the embodiments, the determining module is specifically configured to:
[0053] in response to an instruction of synchronizing a target article in a source environment to a target environment, acquire, from a configuration file, a source article identifier of the target article, an identifier of a target column, and article modification information;
[0054] The first updating module is specifically configured to:
[0055] acquire article information corresponding to the source article identifier from a database of the source environment; modify the article information based on the article modification information, and update the modified article information to an article information table of the target environment;
[0056] The second updating module is specifically configured to:
[0057] acquire an article publishing file corresponding to the source article identifier from a database of the source environment; update index information of the article publishing file based on the target article identifier, and modify content of the article publishing file based on the article modification information; and store the article publishing file after the index information is updated and the content is modified to a database of the target environment.
[0058] In one of the embodiments, the apparatus further includes:
[0059] a first acquiring module configured to acquire column hierarchical relationship information corresponding to the target column from a column table of the target environment;
[0060] The generating module is configured to generate a static file required by an article detail page based on the column hierarchical relationship information and the article information table.
[0061] In one of the embodiments, the apparatus further comprises:
[0062] The second obtaining module is configured to, in response to a data verification instruction, access a page of the target article in the target environment, and obtain a static file of an article detail page of the target article.
[0063] The third obtaining module is configured to obtain, from a column table of the target environment, first column hierarchical relationship information corresponding to the target column, and determine, from the static file, a column information to which the target article belongs and second column hierarchical relationship corresponding to the column information.
[0064] The first verification module is configured to compare the column information with information of the target column, compare the first column hierarchical relationship with the second column hierarchical relationship, obtain a comparison result, and determine a data verification result according to the comparison result, the data verification result being used to reflect correctness of data synchronization.
[0065] In one of the embodiments, the apparatus further comprises:
[0066] The downloading module is configured to, in response to a data verification instruction, download the target article in the target environment, and obtain a download file corresponding to the target article.
[0067] The second verification module is configured to verify information contained in the download file based on the article modification information, and obtain a data verification result.
[0068] In a third aspect, the present application further provides a computer device. The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method of the first aspect when executing the computer program.
[0069] In a fourth aspect, the present application further provides a computer readable storage medium. The computer readable storage medium stores a computer program, and the computer program implements the steps of the method of the first aspect when executed by a processor.
[0070] In a fifth aspect, the present application further provides a computer program product. The computer program product comprises a computer program, and the computer program implements the steps of the method of the first aspect when executed by a processor.
[0071] The aforementioned data synchronization methods, devices, computer equipment, storage media, and computer program products can be configured with relevant information and trigger data synchronization instructions when a user needs to synchronize target articles from a portal system in the source environment to a target category in the portal system in the target environment. This allows the control node to update the article information corresponding to the source article identifier in the source environment's database to the article information table in the target environment. It also updates the index information of the article publication files in the source environment's database based on the target article identifier and stores it in the target environment's database. Furthermore, it updates the article category association table in the target environment to associate the target articles with the target categories, thereby automatically synchronizing article data from the source environment to the target category in the target environment and improving the efficiency of data synchronization between different environments. Attached Figure Description
[0072] Figure 1 This is a diagram illustrating the application environment of a data synchronization method in one embodiment;
[0073] Figure 2 This is a flowchart illustrating a data synchronization method in one embodiment;
[0074] Figure 3 This is a flowchart illustrating the data synchronization method in another embodiment;
[0075] Figure 4 This is a flowchart illustrating the data synchronization method in another embodiment;
[0076] Figure 5 This is a structural block diagram of a data synchronization device in one embodiment;
[0077] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0078] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0079] First, before specifically introducing the technical solutions of the embodiments of the present application, the technical background or technical evolution context based on which the embodiments of the present application are introduced. The portal system usually includes two systems, one is the content management system, which is used for system configuration, data management, column management, article management and other background operations; the other is the front-end portal system, which is mainly used for public access to browse the column content. The two systems have their own front and back ends. For the portal system, the main business data is the related data of the published articles. In the development and testing process of the portal system project, data switching or data synchronization between different environments (such as development environment, test environment, pre-production environment, production environment, etc.) is usually involved. For example, if the portal system in the production environment has article page errors and other abnormalities, the article related data in the production environment needs to be imported into the test environment to facilitate the positioning of the problem source, and if the problem source is located, the data needs to be modified and imported into the production environment.
[0080] In the related art, the process of synchronizing the article data of the source environment to the target environment is usually manually operated by the test personnel, which not only consumes time and effort and is inefficient, but also may have the problems of incomplete data switching and switching errors. Based on this background, the applicant proposes the data synchronization method of the present application through long-term research and development and experimental verification, which updates the article information in the database of the source environment to the article information table of the target environment according to the configuration information, stores the article publishing file in the database of the source environment after updating the index information to the database of the target environment, and updates the article column association table of the target environment, thereby realizing automatic synchronization (or switching, sharing) of the article data of the source environment to the target column of the target environment, and improving the efficiency of data synchronization between different environments. In addition, it should be noted that the applicant has made a lot of creative labor in the discovery of the technical problem and the technical solutions introduced in the following embodiments.
[0081] The data synchronization method provided by the embodiments of the present application can be applied in the application environment as shown in Figure 1 . The control node communicates with the servers of the portal systems in multiple environments through the network. The server of the portal system can include a background server (such as the server of the content management system) and a front-end server (such as the server of the front-end portal system). The control node can be realized by a terminal or a server and other computer devices. It can be understood that the control node can be realized by an independent computer device, or it can be a computer device in the portal system of the source environment or the target environment.
[0082] In one embodiment, as shown in Figure 2 , a data synchronization method is provided, which can be applied to the control node in Figure 1 . In this embodiment, the method includes the following steps:
[0083] Step 201, in response to the instruction of synchronizing the target article in the source environment to the target environment, determining the source article identifier of the target article and the identifier of the target column.
[0084] In implementation, when the user needs to synchronize the target article in the source environment to the target column in the target environment, the configuration information or configuration file can be uploaded to the control node to trigger the data synchronization instruction. The configuration information can include the source environment information (such as the source environment identifier, the server address of the source environment, the database address and the like), the target environment information (such as the identifier of the target environment, the server address of the target environment, the database address and the like), the source article identifier of the target article in the source environment, and the identifier of the target column of the portal system to which the target article needs to be synchronized. The control node can obtain the source environment information, the target environment information, the source article identifier and the identifier of the target column from the configuration information in response to the instruction.
[0085] Step 202, updating the article information corresponding to the source article identifier in the database of the source environment to the article information table in the target environment.
[0086] In implementation, the control node can query the corresponding article information from the database of the source environment by using the source article identifier through the relevant interface service. For example, the control node can query the article information corresponding to the source article identifier in the article information table in the database of the source environment, or can extract the article information corresponding to the target article from other files corresponding to the source article identifier (such as the download file of the target article downloaded from the portal system in the environment). Then, the control node can update the obtained article information to the article information table in the database of the target environment. The article information table is used to store the article information corresponding to each article involved in the portal system in the environment. The article information can include the article title, the abstract, the type and the like attribute information and the article content information.
[0087] Step 203, obtaining the article publishing file corresponding to the source article identifier from the database of the source environment, and updating the index information of the article publishing file based on the target article identifier, and storing the article publishing file with updated index information to the database of the target environment.
[0088] The target article identifier is an identifier of the target article in an article information table of the target environment, and can uniquely identify the target article in a database of the target environment. The article publishing file refers to a file involved in publishing an article through a portal system, and generally includes two types of files, namely, an html file and a doc file. The html file is used for article preview by an article operator / auditor, and the doc file is mainly a source file for editing an article. The article publishing file generally takes the article identifier as index information (for example, as a file name) to associate with the article, so as to facilitate query. Thus, after the control node obtains the article publishing file from the database of the source environment, the control node can update the index information (file name) of the article publishing file to the target article identifier, and store the updated article publishing file in the database of the target environment.
[0089] The control node can directly obtain the article publishing file corresponding to the source article identifier from the database of the source environment, or indirectly obtain the article publishing file through other manners. For example, for the doc file, the target article can be accessed from a portal website of the source environment to obtain a download file (doc file), and the article publishing file is obtained. For the html file, the field with the html style of the article can be found from the article information table according to the source article identifier, the field value is stored as a “target article identifier.html” file, and the file is saved in a correct path of a server of the target environment.
[0090] In step 204, the article column association table of the target environment is updated based on the target column identifier and the target article identifier.
[0091] In implementation, the article column association table is used to store the corresponding relationship between each column and each article involved in the portal system of the environment. The control node can associate the target column identifier and the target article identifier in the article column association table of the target environment.
[0092] In the above data synchronization method, when a user needs to synchronize the target article in the portal system of the source environment to the target column of the portal system of the target environment, the related information can be configured, and a data synchronization instruction is triggered, so that the control node can update the article information corresponding to the source article identifier in the database of the source environment to the article information table of the target environment, store the article publishing file in the database of the source environment in the database of the target environment based on the index information of the target article identifier, and update the article column association table of the target environment to associate the target article and the target column, so as to automatically synchronize the article data of the source environment to the target column of the target environment, and improve the efficiency of data synchronization between different environments.
[0093] In one embodiment, the process of updating the article information in the article information table in step 202 specifically comprises the following steps: updating the article attribute information corresponding to the source article identifier in the database of the source environment into the article attribute table of the target environment, and associating the article attribute information with the target article identifier; and updating the article content information corresponding to the source article identifier in the database of the source environment into the article content table of the target environment, and associating the article content information with the target article identifier.
[0094] In implementation, the article information can comprise article attribute information (such as article title, abstract, type, etc.) and article content information, and the article information table comprises an article attribute table and an article content table, which are respectively used to store the article attribute information and the article content information of each article involved by the portal system in the environment. During data synchronization, the control node can acquire the article attribute information and the article content information corresponding to the source article identifier in the database of the source environment, then update the article attribute information into the article attribute table of the target environment to associate the article attribute information with the target article identifier, and update the article content information into the article content table of the target environment to associate the article content information with the target article identifier. That is, the article identifier and the article attribute information can be correspondingly stored in the article attribute table, and the article identifier and the article content information can be correspondingly stored in the article content table, so that the corresponding article attribute and article content can be queried in the table through the article identifier.
[0095] In one embodiment, the process of determining the source article identifier and the identifier of the target column in step 201 specifically comprises the following steps: in response to the instruction of synchronizing the target article in the source environment to the target environment, acquiring the source article identifier of the target article, the identifier of the target column, and the target article identifier from the configuration file. The process of updating the article information into the article information table of the target environment in step 202 specifically comprises the following steps: acquiring the article information corresponding to the source article identifier from the database of the source environment; and replacing the article information corresponding to the target article identifier in the article information table of the target environment with the article information corresponding to the source article identifier.
[0096] In implementation, the user can specify that the article A (A is the source article identifier) in the source environment is used to replace the article B in the target column of the target environment, and the user can configure the target article identifier (i.e., B) in the configuration information or the configuration file. If the control node reads the target article identifier from the configuration file, it indicates that the target article identifier already exists in the article information table of the target environment, so the control node can query the target article identifier in the article information table of the target environment, and replace the article information originally corresponding to the target article identifier in the article information table with the article information corresponding to the source article identifier in the database of the source environment, i.e., complete the updating of the article information table.
[0097] In the embodiment, if the control node reads the target article identifier in the configuration file, the article information corresponding to the target article identifier in the article information table of the target environment is replaced by the article information corresponding to the source article identifier in the database of the source environment, thereby automatically updating the article information table with high efficiency.
[0098] In one embodiment, the updating of the article information into the article information table of the target environment in step 202 specifically includes the following steps: obtaining the article information corresponding to the source article identifier from the database of the source environment; generating the target article identifier in the article information table of the target environment, and filling the article information into the article information table of the target environment to associate the article information with the target article identifier.
[0099] In implementation, if the user only specifies to insert the article A of the source environment into the target column of the target environment, the target article identifier does not need to be set in the configuration information. In this case, when the control node reads the target article identifier as empty in the configuration information, it indicates that the target article is a newly inserted article, and then a new article identifier can be generated as the target article identifier corresponding to the target article in the article information table of the target environment. The specific generation rule can be automatically generated according to the rule of adding a new article identifier under the target environment, so that the generated article identifier can uniquely identify the article. Then, the control node can fill the article information obtained from the source environment into the article information table, so that the article information is associated with the target article identifier.
[0100] In the embodiment, if the user inserts the article of the source environment into the target column of the target environment, a new target article identifier needs to be added under the target environment, which can be automatically generated in the article information table, and the article information under the source environment is filled into the article information table of the target environment to associate the article information with the target article identifier and establish the corresponding relationship therebetween. Thus, the updating of the article information table is automatically implemented with high efficiency.
[0101] In one embodiment, step 201 specifically includes the following steps: in response to the instruction of synchronizing the target article in the source environment to the target environment, obtaining the source article identifier of the target article, the identifier of the target column, and the article modification information from the configuration file. Step 202 specifically includes the following steps: obtaining the article information corresponding to the source article identifier from the database of the source environment; modifying the article information based on the article modification information, and updating the modified article information into the article information table of the target environment. Step 203 specifically includes the following steps: obtaining the article publishing file corresponding to the source article identifier from the database of the source environment; updating the index information of the article publishing file based on the target article identifier, and modifying the content of the article publishing file based on the article modification information; storing the article publishing file after the index information is updated and the content is modified into the database of the target environment.
[0102] In implementation, the user can specify to synchronize the article A of the source environment to the target column of the target environment, and modify the information (attribute information or content information) of the article. The specific article modification information can be set in the configuration file, and the modification content is not limited to text, letters, hyperlinks, numbers, special symbols, etc., so that the control node can read the article modification information from the configuration file. Then, the control node can modify the article information corresponding to the source article identifier of the source environment based on the article modification information (such as using content matching replacement), and update the modified article information to the article information table of the target environment. Correspondingly, the control node can modify the article publishing file corresponding to the source article identifier of the source environment based on the article modification information, and modify the index information (file naming) of the content modified article publishing file, and store it to the correct path of the server of the portal system of the target environment. It can be understood that the article information and the article publishing file of the source environment can be stored in the database of the target environment after content modification, or the article information and the article publishing file of the source environment can be stored in the database of the target environment first, and then content modification is performed based on the text modification information.
[0103] In this embodiment, if the data of the source environment is synchronized to the target environment while the data content is modified, the modification content can be specified through the setting of the configuration information, so that the content of the article information and the article publishing file of the source environment can be modified and then stored to the correct path of the target environment. Compared with manual modification, the efficiency is higher. The article publishing file of the target environment is obtained by updating the content and index information of the article publishing file of the source environment, rather than being generated by the information in the article information table, so that the accuracy of the file style can be guaranteed, that is, the article publishing file obtained by matching and replacing the content to be changed according to the article modification information in the configuration information (such as regular matching, complete matching) has high accuracy.
[0104] In one embodiment, after updating the article information table, the static file required for generating the detail page of the article in the portal system of the target environment can be further generated, such as shown in Figure 3 The method further includes the following steps:
[0105] Step 301, obtaining the column hierarchical relationship information corresponding to the target column from the column table of the target environment.
[0106] In implementation, the control node can read the column hierarchical relationship information corresponding to the target column from the column table of the database of the target environment, and the column hierarchical relationship information is used to display the hierarchical relationship of the column where the article is located in the front end of the portal system.
[0107] At step 302, based on the column hierarchical relationship information and the article information table, a static file required by the article detail page is generated.
[0108] In implementation, the control node can obtain attribute information of the target article, article information with html tags and the like from the article information table, and combine the column hierarchical relationship information obtained at step 301 to generate a static file (such as a json file) required by the article detail page of the target article in the portal system under the target environment.
[0109] Optionally, the control node can further determine whether a download file corresponding to the target article identifier exists in the database of the target environment. If the data synchronization instruction is to replace the original article under the target environment, that is, the configuration information contains the target article identifier, the control node can query the download file corresponding to the target article identifier in the database of the target environment. If the download file exists, the original download file can be deleted to avoid that the download file obtained by the user from the portal system is the version before the update. Further, for some special columns, a download file is generated and stored in the backend server when an article is published, and then the header and footer are spliced according to the need and then synchronized to the front-end server (generally a doc file). Therefore, the control node can further determine whether the target column is a preset column (special column). If the target column is a special column, the control node can perform a preset header and footer splicing operation on the article publishing file (doc file) of the target article under the target environment to obtain a new download file, store the new download file in the backend server, and then synchronize the new download file to the front-end server.
[0110] In this embodiment, after the article information table is updated, the static file required by the front-end page to display the article can be further generated based on the information of the target article in the article information table and the column hierarchical relationship information of the column to which the target article belongs, so that the static file can be stored in the correct path of the server of the target environment, so that when the front-end accesses the portal system of the target environment, the article detail page of the target article can be correctly displayed.
[0111] In one embodiment, as shown in FIG. 4, the method further includes the following steps: Figure 4
[0112] At step 401, in response to the data verification instruction, a page of a target article under a target environment is accessed to obtain a static file of an article detail page of the target article.
[0113] In implementation, after data synchronization, a data verification instruction can be triggered automatically or triggered by a user to verify the correctness of data synchronization. The control node can request access to the page of the target article in the portal system in the target environment in response to the instruction, and the server (front-end server) of the portal system in the target environment can return the static file of the article detail page of the article and display the article detail page based on the file.
[0114] In step 402, the first column hierarchical relationship information corresponding to the target column in the column table of the target environment is obtained, and the column information to which the target article belongs and the second column hierarchical relationship corresponding to the column information are obtained from the static file.
[0115] In implementation, the control node can obtain the first column hierarchical relationship information corresponding to the target column from the column table of the target environment. In addition, the control node can extract the column information to which the target article belongs and the column hierarchical relationship from the obtained static file. The specific extraction manner is not limited in the present application.
[0116] In step 403, the column information is compared with the information of the target column, the first column hierarchical relationship is compared with the second column hierarchical relationship, the comparison result is obtained, and the data verification result is determined according to the comparison result, and the data verification result is used to reflect the correctness of data synchronization.
[0117] In implementation, the control node can compare the column information extracted from the static file with the information of the target column configured by the configuration information, and compare the column hierarchical relationship of the target column extracted from the column table with the column hierarchical relationship of the column to which the article belongs extracted from the static file. If the comparison result is that the column information and the column hierarchical relationship are the same, a data verification result of verification passed can be obtained, indicating that the data synchronization is correct. If any item is different, a data verification result of verification failed can be obtained, indicating that the data synchronization is incorrect.
[0118] In the present embodiment, after data synchronization, data verification can be automatically performed. Specifically, by accessing the page of the target article, obtaining the static file, and comparing the column to which the article belongs extracted from the static file with the target column set in the configuration information (set when the data synchronization instruction is triggered) and the column hierarchical relationship of the target column obtained from the column table of the target environment, if the data synchronization is accurate, the comparison result is the same, and if there is a problem in data synchronization, the column information or the column hierarchical relationship can be different. Thus, automatic data verification can be realized, and compared with the verification by the test personnel, the present method can take into account the verification efficiency and accuracy.
[0119] In one embodiment, when the article modification information is also contained in the configuration file, the method further comprises the following steps: in response to the data verification instruction, obtaining the download file corresponding to the target article from the portal system in the target environment; and based on the article modification information, verifying the information contained in the download file to obtain the data verification result.
[0120] In implementation, when the article information synchronized to the target environment is modified, the data verification instruction is triggered after data synchronization, and data verification can be performed based on the article information. Specifically, the control node can call the download article interface of the portal system in the target environment to obtain the download file (a file in pdf or doc type) corresponding to the target article identifier, read the file content, and then match the modified keywords and the replacement keywords (replace the replacement keywords with the modified keywords, or insert the modified keywords into the article information) contained in the article modification information with the file content. If the file content contains the content to be replaced (replacement keywords), the verification fails. If the file content does not contain any modified keyword, the verification fails. If the file content does not contain the replacement keywords and contains all the modified keywords, the verification passes.
[0121] It can be understood that, in addition to data verification based on article modification information, data verification based on the column information and column hierarchical relationship in the above embodiments can also be combined.
[0122] In this embodiment, the download file is verified based on the article modification information. If the data synchronization is correct, the downloaded file will not contain the content to be replaced in the article modification information, and will contain the target content to be inserted or changed. Therefore, automatic data verification can be achieved, manual verification can be avoided, and efficiency and verification accuracy can be improved.
[0123] It should be understood that, although each step in the flowchart involved in each of the above embodiments is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise stated herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, as described above, at least part of the steps in the flowchart involved in each of the above embodiments can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or stages in other steps.
[0124] Based on the same inventive concept, the embodiments of the present application further provide a data synchronization apparatus for implementing the above-mentioned data synchronization method. The apparatus provides a solution similar to the implementation solution described in the above-mentioned method, and thus the specific definitions in one or more data synchronization apparatus embodiments provided below can refer to the definitions of the data synchronization method in the above text, which will not be repeated here.
[0125] In one embodiment, as shown in Figure 5 a data synchronization apparatus 500 is provided, comprising a determining module 501, a first updating module 502, a second updating module 503 and a third updating module 504, wherein:
[0126] The determining module 501 is configured to determine the source article identifier of the target article and the identifier of the target column in response to an instruction of synchronizing the target article in the source environment to the target environment.
[0127] The first updating module 502 is configured to update the article information corresponding to the source article identifier in the database of the source environment to the article information table of the target environment.
[0128] The second updating module 503 is configured to obtain the article publishing file corresponding to the source article identifier from the database of the source environment, update the index information of the article publishing file based on the target article identifier, and store the article publishing file with updated index information to the database of the target environment; the target article identifier is the identifier of the target article in the article information table of the target environment.
[0129] The third updating module 504 is configured to update the article column association table of the target environment based on the identifier of the target column and the target article identifier.
[0130] In one embodiment, the article information comprises article attribute information and article content information, and the article information table comprises an article attribute table and an article content table. The first updating module 502 is specifically configured to update the article attribute information corresponding to the source article identifier in the database of the source environment to the article attribute table of the target environment, and associate the article attribute information with the target article identifier; and update the article content information corresponding to the source article identifier in the database of the source environment to the article content table of the target environment, and associate the article content information with the target article identifier.
[0131] In one of the embodiments, the determining module 501 is specifically configured to: in response to an instruction of synchronizing the target article in the source environment to the target environment, acquire the source article identifier of the target article, the identifier of the target column, and the target article identifier from the configuration file. Correspondingly, the first updating module 502 is specifically configured to: acquire the article information corresponding to the source article identifier from the database of the source environment; and replace the article information corresponding to the target article identifier in the article information table of the target environment with the article information corresponding to the source article identifier.
[0132] In one of the embodiments, the first updating module 502 is specifically configured to: acquire the article information corresponding to the source article identifier from the database of the source environment; and generate the target article identifier in the article information table of the target environment, and fill the article information into the article information table of the target environment, so as to associate the article information with the target article identifier.
[0133] In one of the embodiments, the determining module 501 is specifically configured to: in response to an instruction of synchronizing the target article in the source environment to the target environment, acquire the source article identifier of the target article, the identifier of the target column, and the article modification information from the configuration file. Correspondingly, the first updating module 502 is specifically configured to: acquire the article information corresponding to the source article identifier from the database of the source environment; modify the article information based on the article modification information, and update the modified article information to the article information table of the target environment. The second updating module 503 is specifically configured to: acquire the article publishing file corresponding to the source article identifier from the database of the source environment; update the index information of the article publishing file based on the target article identifier, and modify the content of the article publishing file based on the article modification information; and store the article publishing file after the index information is updated and the content is modified to the database of the target environment.
[0134] In one of the embodiments, the apparatus further comprises a first acquiring module and a generating module, wherein:
[0135] The first acquiring module is configured to acquire the column hierarchical relationship information corresponding to the target column from the column table of the target environment.
[0136] The generating module is configured to generate the static file required by the article detail page based on the column hierarchical relationship information and the article information table.
[0137] In one of the embodiments, the apparatus further comprises a second acquiring module, a third acquiring module, and a first verifying module, wherein:
[0138] The second acquiring module is configured to access the page of the target article under the target environment in response to a data verifying instruction, and acquire the static file of the article detail page of the target article.
[0139] The third obtaining module is configured to obtain first column hierarchical relationship information corresponding to the target column from a column table of the target environment, and obtain column information to which the target article belongs and second column hierarchical relationship corresponding to the column information from the static file.
[0140] The first verifying module is configured to compare the column information with information of the target column, compare the first column hierarchical relationship with the second column hierarchical relationship, obtain a comparison result, and determine a data verification result according to the comparison result, the data verification result being used to reflect correctness of data synchronization.
[0141] In one of the embodiments, the apparatus further includes a downloading module and a second verifying module, wherein:
[0142] The downloading module is configured to download the target article in the target environment to obtain a downloading file corresponding to the target article in response to a data verification instruction.
[0143] The second verifying module is configured to verify information contained in the downloading file based on the article modification information to obtain the data verification result.
[0144] The modules in the data synchronization apparatus can be realized by software, hardware or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in the computer device in software form, so as to be called and executed by a processor to perform operations corresponding to the modules.
[0145] In one of the embodiments, a computer device is provided, which can be a terminal and an internal structure diagram of which can be as shown in FIG. 1. Figure 6 The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is configured to perform wired or wireless communication with an external terminal. The wireless communication can be achieved through WIFI, mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by the processor to implement a data synchronization method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.
[0146] Those skilled in the art can understand that, Figure 6The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0147] In an embodiment, a computer device is provided, including a memory and a processor, the memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0148] In an embodiment, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the steps in the above method embodiments.
[0149] In an embodiment, a computer program product is provided, including a computer program, and the computer program is executed by a processor to implement the steps in the above method embodiments.
[0150] The data synchronization method and device, computer device, storage medium and computer program product provided by the present application relate to the technical field of intelligent operation and maintenance, can be used in the field of financial technology or other fields, and the application is not limited to the application field.
[0151] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties.
[0152] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0153] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.
[0154] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A data synchronization method, characterized in that, The method includes: In response to the instruction to synchronize the target article in the source environment to the target environment, the source article identifier and the target category identifier of the target article are determined. The source environment and the target environment are different environments in the portal system development and testing process, including the development environment, the testing environment, the pre-production environment, and the production environment. Update the article information corresponding to the source article identifier in the database of the source environment to the article information table of the target environment; The article publication file corresponding to the source article identifier is obtained from the database of the source environment, and the index information of the article publication file is updated based on the target article identifier. The article publication file with updated index information is then stored in the database of the target environment. The target article identifier is the identifier of the target article in the article information table of the target environment. Based on the identifier of the target section and the identifier of the target article, update the article section association table of the target environment; The article information includes article attribute information and article content information, and the article information table includes an article attribute table and an article content table; updating the article information corresponding to the source article identifier in the source environment's database to the target environment's article information table includes: Update the article attribute information corresponding to the source article identifier in the database of the source environment to the article attribute table of the target environment, and associate the article attribute information with the target article identifier; The article content information corresponding to the source article identifier in the database of the source environment is updated to the article content table of the target environment, and the article content information is associated with the target article identifier.
2. The method according to claim 1, characterized in that, The response to the instruction to synchronize the target article from the source environment to the target environment, determining the source article identifier and the target category identifier of the target article, includes: In response to the instruction to synchronize the target article in the source environment to the target environment, the source article identifier, the target category identifier, and the target article identifier of the target article are obtained from the configuration file; The step of updating the article information corresponding to the source article identifier in the database of the source environment to the article information table of the target environment includes: Retrieve the article information corresponding to the source article identifier from the database of the source environment; In the article information table of the target environment, the article information corresponding to the target article identifier is replaced with the article information corresponding to the source article identifier.
3. The method according to claim 1, characterized in that, The step of updating the article information corresponding to the source article identifier in the database of the source environment to the article information table of the target environment includes: Retrieve the article information corresponding to the source article identifier from the database of the source environment; A target article identifier is generated in the article information table of the target environment, and the article information is filled into the article information table of the target environment, so that the article information is associated with the target article identifier.
4. The method according to claim 1, characterized in that, The response to the instruction to synchronize the target article from the source environment to the target environment, determining the source article identifier and the target category identifier of the target article, includes: In response to the instruction to synchronize the target article from the source environment to the target environment, the source article identifier, target category identifier, and article modification information of the target article are obtained from the configuration file; The step of updating the article information corresponding to the source article identifier in the database of the source environment to the article information table of the target environment includes: Retrieve the article information corresponding to the source article identifier from the database of the source environment; The article information is modified based on the article modification information, and the modified article information is updated in the article information table of the target environment; The step of retrieving the article publication file corresponding to the source article identifier from the database of the source environment, updating the index information of the article publication file based on the target article identifier, and storing the index-updated article publication file in the database of the target environment includes: Retrieve the article publication file corresponding to the source article identifier from the database of the source environment; The index information of the article publication file is updated based on the target article identifier, and the content of the article publication file is modified based on the article modification information; The article publication files with updated index information and modified content are stored in the database of the target environment.
5. The method according to claim 1, characterized in that, The method further includes: Obtain the column hierarchy information corresponding to the target column from the column table of the target environment; Based on the column hierarchy information and the article information table, the static files required for the article details page are generated.
6. The method according to claim 1, characterized in that, The method further includes: In response to a data verification command, access the page of the target article in the target environment and obtain the static file of the article details page of the target article; Obtain the first column hierarchy information corresponding to the target column from the column table of the target environment, and determine the column information to which the target article belongs and the second column hierarchy information corresponding to the column information from the static file; The column information is compared with the target column information, and the first column hierarchy is compared with the second column hierarchy to obtain the comparison result. The data verification result is determined based on the comparison result, which is used to reflect the correctness of data synchronization.
7. The method according to claim 4, characterized in that, The method further includes: In response to a data verification command, the target article in the target environment is downloaded to obtain the download file corresponding to the target article; Based on the article modification information, the information contained in the downloaded file is verified to obtain data verification results.
8. A data synchronization device, characterized in that, The device includes: The determination module is used to respond to the instruction to synchronize the target article in the source environment to the target environment, and to determine the source article identifier and the target column identifier of the target article. The source environment and the target environment are different environments in the portal system development and testing process, including the development environment, the testing environment, the pre-production environment and the production environment. The first update module is used to update the article information corresponding to the source article identifier in the database of the source environment to the article information table of the target environment; The second update module is used to obtain the article publication file corresponding to the source article identifier from the database of the source environment, update the index information of the article publication file based on the target article identifier, and store the article publication file with updated index information in the database of the target environment; the target article identifier is the identifier of the target article in the article information table of the target environment; The third update module is used to update the article category association table of the target environment based on the identifier of the target category and the identifier of the target article. The article information includes article attribute information and article content information, and the article information table includes an article attribute table and an article content table; updating the article information corresponding to the source article identifier in the source environment's database to the target environment's article information table includes: Update the article attribute information corresponding to the source article identifier in the database of the source environment to the article attribute table of the target environment, and associate the article attribute information with the target article identifier; The article content information corresponding to the source article identifier in the database of the source environment is updated to the article content table of the target environment, and the article content information is associated with the target article identifier.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data updating method and device, equipment and storage medium
CN112286545A
Static webpage manuscript publishing method and system, computer and storage medium
CN116127218A