Cross-environment data synchronization method and apparatus, storage medium, and electronic device

CN117407460BActive Publication Date: 2026-05-12SHENZHEN TCL NEW-TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN TCL NEW-TECH CO LTD
Filing Date
2023-04-10
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

[0003]目前,跨环境数据同步的方案,通常是通过通过人工或程序生成sql语句进行跨环境数据同步,这一操作较为繁杂导致数据同步效率较慢,且通过过程中不可靠因素较多,诸如数据的遗漏、表字段不对齐等,这些在数据同步过程中出现的问题往往会导致数据同步失败,并需要进行大量回滚操作

Benefits of technology

[0025] In this way, by deploying a first synchronization service and a second synchronization service that can make cross-environment interface calls in the first environment and the second environment respectively, the first synchronization service and the second synchronization service can read synchronization data and synchronize it to the database of another environment by remotely calling the relevant environment interface. During the synchronization process, the status can be synchronized through authorization value and synchronization value, and the process can be verified through synchronization code. The whole process is safe and reliable, avoiding the problem of generating SQL statements for cross-environment data synchronization, and realizing a safe improvement in synchronization efficiency and reliability when synchronizing data across environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117407460B_ABST
    Figure CN117407460B_ABST
Patent Text Reader

Abstract

The application discloses a cross-environment data synchronization method and device, a storage medium and an electronic device, relates to the technical field of computers, and the cross-environment data synchronization method is applied to a first synchronization service deployed in a first environment. The first synchronization service can execute the cross-environment data synchronization method: receiving an authorization request sent by a first foreground service call authorization interface; calling a reading interface to send a reading request to a second synchronization service deployed in a second environment according to a callback environment address, the reading request carrying a synchronization code and an authorization value corresponding to a data application record, the synchronization code and the authorization value being generated and recorded when indicated by indication information; receiving a synchronization request sent by a second synchronization service calling a writing interface, the synchronization request including the synchronization code and synchronization data; if the synchronization code is verified, storing the synchronization data and updating the authorization value to a synchronization value. The application can safely improve synchronization efficiency and reliability when data is synchronized across environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and specifically to a cross-environment data synchronization method, apparatus, storage medium, and electronic device. Background Technology

[0002] With the development of randomization technology, many scenarios require cross-environment data synchronization between databases in multiple environments. For example, in the software development process, there is usually a need for cross-environment data synchronization between development environment, testing environment, pre-release environment and production environment.

[0003] Currently, cross-environment data synchronization solutions typically involve generating SQL statements manually or programmatically to synchronize data across environments. This process is quite complex, resulting in slow data synchronization efficiency. Furthermore, there are many unreliable factors during the process, such as data omissions and misaligned table fields. These problems often lead to data synchronization failures and require numerous rollback operations.

[0004] Under the current method, cross-environment data synchronization suffers from slow synchronization efficiency and poor synchronization reliability, and it is difficult to ensure security during the synchronization process. Summary of the Invention

[0005] This application provides a solution that can securely improve synchronization efficiency and reliability when synchronizing data across environments.

[0006] The embodiments of this application provide the following technical solutions:

[0007] According to one embodiment of this application, a cross-environment data synchronization method is applied to a first synchronization service deployed in a first environment. The method includes: receiving an authorization request sent by a first foreground service calling an authorization interface, the authorization request carrying indication information of a data request record originating from a second environment, the data request record including a data identifier, a callback address of the second environment, and a target address of the first environment; according to the callback environment address, calling a read interface to send a read request to a second synchronization service deployed in the second environment, the read request carrying a synchronization code and authorization value corresponding to the data request record, the synchronization code and authorization value being generated and recorded when the indication information indicates authorization; receiving a synchronization request sent by the second synchronization service calling a write interface, the synchronization request including the synchronization code and synchronization data corresponding to the data identifier, the write interface being called by the second synchronization service according to the target address when determining that the authorization value represents authorization; if the received synchronization code passes verification, storing the synchronization data and updating the authorization value to a synchronization value, the synchronization value indicating successful synchronization.

[0008] In some embodiments of this application, before receiving the authorization request sent by the first front-end service call authorization interface, the method further includes: receiving a query request sent by the first front-end service call application record query interface; in response to the query request, sending a data synchronization application record in the first environment to the first front-end service, wherein the data synchronization application record includes the data application record.

[0009] In some embodiments of this application, before receiving the authorization request sent by the front-end service calling the authorization interface, the method further includes: receiving a synchronization request sent by the second synchronization service calling the synchronization request interface, wherein the synchronization request carries the data request record; writing the data request record into the database, and returning a write success message to the second synchronization service to trigger the second synchronization service to generate and record a write value based on the write success message, wherein the write value is used to indicate that the write was successful.

[0010] In some embodiments of this application, when the authorization value represents authorization, the second synchronization service generates and records a record value corresponding to the data request record, the record value being used to record that authorization has been granted. After updating the authorization value to the synchronization value, the method further includes: sending a synchronization success indication message to the second synchronization service to trigger the second synchronization service to update the record value to the synchronization value; receiving a synchronization message returned by the second synchronization service, the synchronization message being used to indicate that the synchronization value has been successfully synchronized; and in response to the synchronization message, sending a result message to the first front-end service, the result message indicating that the data synchronization corresponding to the data request record has been completed.

[0011] In some embodiments of this application, the instruction information includes authorization operation information, authorizing account, and authorization time for the target application record in the first front-end service; the synchronization code and authorization value are generated and recorded when the authorization operation information is agreed to; the read request also includes the authorizing account and authorization time, and the authorizing account and authorization time are associated with the data application record in the second synchronization service.

[0012] In some embodiments of this application, before receiving the authorization request sent by the foreground service calling the authorization interface, the method further includes: obtaining the first synchronization service, wherein the first synchronization service is the same data synchronization service as the second synchronization service; and deploying the first synchronization service in the first environment.

[0013] In some embodiments of this application, before storing the synchronization data if the received synchronization code passes the verification, the method further includes: comparing whether the received synchronization code is the same as the recorded synchronization code; if they are the same, then the received synchronization code passes the verification.

[0014] According to one embodiment of this application, a cross-environment data synchronization device is applied to a first synchronization service deployed in a first environment. The device includes: an indication information receiving module, configured to receive an authorization request sent by a first foreground service calling an authorization interface, the authorization request carrying indication information of a data request record originating from a second environment, the data request record including a data identifier, a callback address of the second environment, and a target address of the first environment; a read request sending module, configured to call a read interface to send a read request to a second synchronization service deployed in the second environment according to the callback environment address, the read request carrying a synchronization code and authorization value corresponding to the data request record, the synchronization code and authorization value being generated and recorded when the indication information indicates authorization; a synchronization request receiving module, configured to receive a synchronization request sent by the second synchronization service calling a write interface, the synchronization request including the synchronization code and synchronization data corresponding to the data identifier, the write interface being called by the second synchronization service according to the target address when determining that the authorization value represents authorization; and a synchronization update module, configured to store the synchronization data and update the authorization value to a synchronization value if the received synchronization code passes verification, the synchronization value indicating successful synchronization.

[0015] In some embodiments of this application, the apparatus further includes a query processing module, configured to: receive a query request sent by the first front-end service calling the request record query interface; and in response to the query request, send a data synchronization request record in the first environment to the first front-end service, wherein the data synchronization request record includes the data request record.

[0016] In some embodiments of this application, the apparatus further includes an application processing module, configured to: receive a synchronization application request sent by the second synchronization service via a synchronization application interface, wherein the synchronization application request carries the data application record; write the data application record into a database, and return a write success message to the second synchronization service to trigger the second synchronization service to generate and record a write value based on the write success message, wherein the write value is used to indicate that the write was successful.

[0017] In some embodiments of this application, when the authorization value represents authorization, the second synchronization service generates and records a record value corresponding to the data request record, the record value being used to record authorization. The device further includes a synchronization status module, configured to: send a synchronization success indication message to the second synchronization service to trigger the second synchronization service to update the record value to the synchronization value; receive a synchronization message returned by the second synchronization service, the synchronization message being used to indicate that the synchronization value has been successfully synchronized; and, in response to the synchronization message, send a result message to the first front-end service, the result message indicating that the data synchronization corresponding to the data request record is complete.

[0018] In some embodiments of this application, the instruction information includes authorization operation information, authorizing account, and authorization time for the target application record in the first front-end service; the synchronization code and authorization value are generated and recorded when the authorization operation information is agreed to; the read request also includes the authorizing account and authorization time, and the authorizing account and authorization time are associated with the data application record in the second synchronization service.

[0019] In some embodiments of this application, the apparatus further includes a deployment module for: acquiring the first synchronization service, wherein the first synchronization service is the same data synchronization service as the second synchronization service; and deploying the first synchronization service in the first environment.

[0020] In some embodiments of this application, the device further includes a verification module for: comparing whether the received synchronization code is the same as the recorded synchronization code; if they are the same, the verification of the received synchronization code passes.

[0021] According to another embodiment of this application, a storage medium stores a computer program thereon, which, when executed by a computer's processor, causes the computer to perform the methods described in the embodiments of this application.

[0022] According to another embodiment of this application, an electronic device may include: a memory storing a computer program; and a processor reading the computer program stored in the memory to execute the methods described in the embodiments of this application.

[0023] According to another embodiment of this application, a computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described in the embodiments of this application.

[0024] In this embodiment, the cross-environment data synchronization method is applied to a first synchronization service deployed in a first environment. The first synchronization service can: receive an authorization request sent by a first foreground service calling an authorization interface, the authorization request carrying indication information of a data request record, the data request record originating from a second environment, the data request record including a data identifier, a callback address of the second environment, and a target address of the first environment; according to the callback environment address, call a read interface to send a read request to a second synchronization service deployed in the second environment, the read request carrying a synchronization code and authorization value corresponding to the data request record, the synchronization code and authorization value being generated and recorded when the indication information indicates authorization; receive a synchronization request sent by the second synchronization service calling a write interface, the synchronization request including the synchronization code and synchronization data corresponding to the data identifier, the write interface being called by the second synchronization service according to the target address when determining that the authorization value represents authorization; if the received synchronization code passes verification, then the synchronization data is stored, and the authorization value is updated to a synchronization value, the synchronization value being used to indicate successful synchronization.

[0025] In this way, by deploying a first synchronization service and a second synchronization service that can make cross-environment interface calls in the first environment and the second environment respectively, the first synchronization service and the second synchronization service can read synchronization data and synchronize it to the database of another environment by remotely calling the relevant environment interface. During the synchronization process, the status can be synchronized through authorization value and synchronization value, and the process can be verified through synchronization code. The whole process is safe and reliable, avoiding the problem of generating SQL statements for cross-environment data synchronization, and realizing a safe improvement in synchronization efficiency and reliability when synchronizing data across environments. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 A flowchart of a cross-environment data synchronization method according to an embodiment of this application is shown.

[0028] Figure 2 An architecture diagram of a cross-environment data system according to an embodiment of this application is shown.

[0029] Figure 3 A block diagram of a cross-environment data synchronization apparatus according to an embodiment of this application is shown.

[0030] Figure 4A block diagram of an electronic device according to an embodiment of this application is shown. Detailed Implementation

[0031] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0032] Figure 1 A flowchart illustrating a cross-environment data synchronization method according to an embodiment of this application is shown. The executing entity of this cross-environment data synchronization method can be any device capable of deploying services, such as a television, computer, mobile phone, server, or cloud. In one embodiment of this application, the executing entity is specifically a server in a first environment, where a first synchronization service can be deployed.

[0033] like Figure 1 and Figure 2 As shown, the first synchronization service can execute a cross-environment data synchronization method, which may include steps S110 to S140.

[0034] Step S110: Receive an authorization request sent by the first front-end service calling the authorization interface. The authorization request carries indication information of a data request record, which originates from the second environment. The data request record includes a data identifier, a callback address of the second environment, and a target address of the first environment. Step S120: Based on the callback environment address, call the read interface to send a read request to the second synchronization service deployed in the second environment. The read request carries the synchronization code and authorization value corresponding to the data request record. The synchronization code and authorization value are generated and recorded when the indication information indicates authorization. Step S130: Receive a synchronization request sent by the second synchronization service calling the write interface. The synchronization request includes the synchronization code and the synchronization data corresponding to the data identifier. The write interface is called by the second synchronization service based on the target address when determining that the authorization value represents authorization. Step S140: If the received synchronization code passes verification, store the synchronization data and update the authorization value to a synchronization value. The synchronization value indicates successful synchronization.

[0035] Both the first front-end service and the first synchronization service belong to the first environment. The first front-end service can call the authorization interface of the first synchronization service to send an authorization request to the first synchronization service. This authorization request carries indication information of the data request record. This indication information may be generated by the user approving the data request record in the first front-end service.

[0036] The data request record originates from the second environment. This record can be sent from a second synchronization service deployed in the second environment to the first synchronization service, or it can be sent from a second foreground service in the second environment to the second synchronization service. The data request record includes a data identifier, a callback address from the second environment, and a target address from the first environment. The data identifier is the unique identifier of the data to be synchronized. The first and second environments are different environments; for example, the first environment might be a test environment, and the second environment a development environment.

[0037] After receiving the instruction information, the first synchronization service, if confirming that the data request record is authorized based on the instruction information, generates a synchronization code and an authorization value and records them in the first environment. For example, if the authorization operation information carried in the instruction information is true, an authorization value such as record-flag = 0 can be generated; furthermore, if the authorization operation information carried in the instruction information is false, an authorization value such as record-flag = -1 can be generated. Recording the authorization value can indicate "authorized" for the data request record in the current process node in the first environment.

[0038] Furthermore, the first synchronization service can call the read interface of the second synchronization service based on the callback environment address, sending a read request to the second synchronization service deployed in the second environment. This read request carries the synchronization code and authorization value corresponding to the data request record. The second synchronization service confirms that the data request record is "authorized" based on the authorization value, and can then obtain the synchronization data corresponding to the data identifier from the second environment. It can also call the write interface of the first synchronization service based on the target address, sending a synchronization request to the first synchronization service. This synchronization request can carry the synchronization code and the corresponding synchronization data.

[0039] If the first synchronization service verifies the received synchronization code, it can persistently store the synchronization data in the first environment and update the authorization value to the synchronization value. The synchronization value can be used to indicate in the first environment that the data request record in the current process node has been "successfully synchronized".

[0040] In this way, based on steps S110 to S140, a first synchronization service and a second synchronization service that can make cross-environment interface calls are deployed in the first environment and the second environment, respectively. The first synchronization service and the second synchronization service can read synchronization data and synchronize it to the database of another environment by remotely calling the relevant environment interface. During the synchronization process, the status can be synchronized through the authorization value and the synchronization value, and the process can be verified through the synchronization code. The whole process is safe and reliable, avoiding the problem of generating SQL statements for cross-environment data synchronization, and realizing a safe improvement in synchronization efficiency and reliability when synchronizing data across environments.

[0041] The following description Figure 1 Further optional specific embodiments for each step performed during cross-environment data synchronization in the example implementation.

[0042] In one embodiment, before receiving the authorization request sent by the first front-end service call authorization interface, the method further includes: receiving a query request sent by the first front-end service call application record query interface; and in response to the query request, sending a data synchronization application record in the first environment to the first front-end service, wherein the data synchronization application record includes the data application record.

[0043] The first synchronization service provides an application record query interface. The first front-end service can send a query request to the first synchronization service by calling the application record query interface. In response to the query request, the first synchronization service can send the data synchronization application records of the first environment to the first front-end service.

[0044] The data synchronization request record can include at least the aforementioned data request record. Users can select and approve the data request record through the first front-end service. For example, users can authorize the approval by clicking "agree" or "reject." Clicking "agree" generates the authorization operation information as "true," while clicking "reject" generates the authorization operation information as "false."

[0045] In one embodiment, before receiving the authorization request sent by the foreground service calling the authorization interface, the method further includes: receiving a synchronization request sent by the second synchronization service calling the synchronization request interface, wherein the synchronization request carries the data request record; writing the data request record into the database, and returning a write success message to the second synchronization service to trigger the second synchronization service to generate and record a write value based on the write success message, wherein the write value is used to indicate that the write was successful.

[0046] Data request records can be sent from the second front-end service to the second synchronization service in the second environment. Users can fill in information in the second front-end service to generate data request records and submit them to the second synchronization service.

[0047] The second synchronization service can send a synchronization request to the first synchronization service by calling the synchronization request interface based on the target address of the first environment in the data request record. The synchronization request carries the data request record. The first synchronization service can first determine whether a duplicate data request record exists in the database; if not, it writes the data request record into the database.

[0048] The first synchronization service can write data request records to the database and, upon successful writing, return a write success message to the second synchronization service. This triggers the second synchronization service to generate and record a write value corresponding to the data request record based on the write success message. This write value can indicate in the second environment that the data request record has been successfully written in the current process node. The second synchronization service can also further provide write success feedback to the second front-end service.

[0049] In one embodiment, when the authorization value represents authorization, the second synchronization service generates and records a record value corresponding to the data request record, the record value being used to record that authorization has been granted. After updating the authorization value to the synchronization value, the method further includes: sending a synchronization success indication message to the second synchronization service to trigger the second synchronization service to update the record value to the synchronization value; receiving a synchronization message returned by the second synchronization service, the synchronization message being used to indicate that the synchronization value has been successfully synchronized; and in response to the synchronization message, sending a result message to the first front-end service, the result message indicating that the data synchronization corresponding to the data request record has been completed.

[0050] After successfully synchronizing the data, the first synchronization service generates and records a synchronization value, and then sends a synchronization success indication message to the second synchronization service, triggering the second synchronization service to update the previously stored record value to the synchronization value. Thus, the first environment and the second environment simultaneously indicate that the data request record has been synchronized.

[0051] After successfully recording the synchronization value in the second synchronization service, it further returns a synchronization message to the first synchronization service. This synchronization message can then instruct the first and second synchronization services to successfully synchronize the value. The first synchronization service can then further report the completion of the process to the first front-end service.

[0052] In one embodiment, the instruction information includes authorization operation information, authorizing account, and authorization time for the target application record in the first front-end service; the synchronization code and authorization value are generated and recorded when the authorization operation information is agreed to; the read request also includes the authorizing account and authorization time, and the authorizing account and authorization time are associated with the data application record in the second synchronization service.

[0053] The instruction information includes the authorization operation information, authorizer account, and authorization time for the target application record in the first front-end service. The instruction information may be a data transfer object (DTO) obtained by assembling the authorization operation information, authorizer account, and authorization time in the first synchronization service.

[0054] The synchronization code and authorization value are generated and recorded by the first synchronization service when the authorization operation information is "agree to authorization" (e.g., true). The read request also includes the authorizer's account and authorization time. The second synchronization service can further associate the authorizer's account and authorization time with the data request record, further realizing the synchronization of process information in different environments in the cross-environment interface call-based data synchronization process.

[0055] In one embodiment, before receiving the authorization request sent by the foreground service calling the authorization interface, the method further includes: obtaining the first synchronization service, wherein the first synchronization service is the same data synchronization service as the second synchronization service; and deploying the first synchronization service in the first environment.

[0056] The first synchronization service is the same data synchronization service as the second synchronization service. By deploying the same first synchronization service as the second synchronization service in the first environment, cross-environment data synchronization can be reliably performed through the first synchronization service and the second synchronization service.

[0057] In one embodiment, before storing the synchronization data if the received synchronization code passes the verification, the method further includes: comparing whether the received synchronization code is the same as a recorded synchronization code; if they are the same, then the received synchronization code passes the verification.

[0058] By comparing the received synchronization code with the recorded synchronization code, the validity of cross-environment call requests can be verified. If the received synchronization code is the same as the recorded synchronization code, the synchronization request of the second synchronization service in the second environment is valid. Then, the verification of the received synchronization code passes, and the synchronization data is stored, effectively ensuring the security of cross-environment data synchronization.

[0059] To facilitate better implementation of the cross-environment data synchronization method provided in this application, this application also provides a cross-environment data synchronization device based on the above-described cross-environment data synchronization method. The meanings of the terms used are the same as in the cross-environment data synchronization method described above, and specific implementation details can be found in the descriptions within the method embodiments. Figure 3 A block diagram of a cross-environment data synchronization apparatus according to an embodiment of this application is shown.

[0060] like Figure 3As shown, a cross-environment data synchronization device 200 is applied to a first synchronization service deployed in a first environment. The cross-environment data synchronization device 200 may include: an instruction information receiving module 210, which can be used to receive an authorization request sent by the first foreground service calling an authorization interface. The authorization request carries instruction information of a data request record, which originates from a second environment. The data request record includes a data identifier, a callback address of the second environment, and a target address of the first environment; and a read request sending module 220, which can be used to call a read interface to send a read request to the second synchronization service deployed in the second environment according to the callback environment address. The synchronization request receiving module 230 carries the synchronization code and authorization value corresponding to the data request record. The synchronization code and authorization value are generated and recorded when the authorization is indicated by the indication information. The synchronization request receiving module 230 can be used to receive the synchronization request sent by the second synchronization service calling the write interface. The synchronization request includes the synchronization code and the synchronization data corresponding to the data identifier. The write interface is called by the second synchronization service according to the target address when determining that the authorization value represents authorization. The synchronization update module 240 can be used to store the synchronization data and update the authorization value to a synchronization value if the received synchronization code passes the verification. The synchronization value is used to indicate that the synchronization is successful.

[0061] In some embodiments of this application, the apparatus further includes a query processing module, configured to: receive a query request sent by the first front-end service calling the request record query interface; and in response to the query request, send a data synchronization request record in the first environment to the first front-end service, wherein the data synchronization request record includes the data request record.

[0062] In some embodiments of this application, the apparatus further includes an application processing module, configured to: receive a synchronization application request sent by the second synchronization service via a synchronization application interface, wherein the synchronization application request carries the data application record; write the data application record into a database, and return a write success message to the second synchronization service to trigger the second synchronization service to generate and record a write value based on the write success message, wherein the write value is used to indicate that the write was successful.

[0063] In some embodiments of this application, when the authorization value represents authorization, the second synchronization service generates and records a record value corresponding to the data request record, the record value being used to record authorization. The device further includes a synchronization status module, configured to: send a synchronization success indication message to the second synchronization service to trigger the second synchronization service to update the record value to the synchronization value; receive a synchronization message returned by the second synchronization service, the synchronization message being used to indicate that the synchronization value has been successfully synchronized; and, in response to the synchronization message, send a result message to the first front-end service, the result message indicating that the data synchronization corresponding to the data request record is complete.

[0064] In some embodiments of this application, the instruction information includes authorization operation information, authorizing account, and authorization time for the target application record in the first front-end service; the synchronization code and authorization value are generated and recorded when the authorization operation information is agreed to; the read request also includes the authorizing account and authorization time, and the authorizing account and authorization time are associated with the data application record in the second synchronization service.

[0065] In some embodiments of this application, the apparatus further includes a deployment module for: acquiring the first synchronization service, wherein the first synchronization service is the same data synchronization service as the second synchronization service; and deploying the first synchronization service in the first environment.

[0066] In some embodiments of this application, the device further includes a verification module for: comparing whether the received synchronization code is the same as the recorded synchronization code; if they are the same, the verification of the received synchronization code passes.

[0067] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0068] Furthermore, embodiments of this application also provide an electronic device, which can be a terminal or a server, such as... Figure 4 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically:

[0069] The electronic device may include components such as a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, a power supply 303, and an input unit 304. Those skilled in the art will understand that... Figure 4The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0070] in:

[0071] The processor 301 is the control center of the electronic device. It connects to various parts of the computer device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 302, and by calling data stored in the memory 302, it performs various functions of the computer device and processes data, thereby providing overall monitoring of the electronic device. Optionally, the processor 301 may include one or more processing cores; preferably, the processor 301 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user page, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 301.

[0072] The memory 302 can be used to store software programs and modules. The processor 301 executes various functional applications and data processing by running the software programs and modules stored in the memory 302. The memory 302 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 302 may also include a memory controller to provide the processor 301 with access to the memory 302.

[0073] The electronic device also includes a power supply 303 that supplies power to various components. Preferably, the power supply 303 can be logically connected to the processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 303 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0074] The electronic device may also include an input unit 304, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0075] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 301 in the electronic device loads the executable files corresponding to the processes of one or more computer programs into the memory 302 according to the following instructions, and the processor 301 runs the computer programs stored in the memory 302, thereby realizing the various functions in the foregoing embodiments of this application.

[0076] For example, processor 301 can perform the following steps: receiving an authorization request sent by a first foreground service calling an authorization interface, the authorization request carrying indication information of a data request record, the data request record originating from a second environment, the data request record including a data identifier, a callback address of the second environment, and a target address of the first environment; according to the callback environment address, calling a read interface to send a read request to a second synchronization service deployed in the second environment, the read request carrying a synchronization code and authorization value corresponding to the data request record, the synchronization code and authorization value being generated and recorded when the indication information indicates authorization; receiving a synchronization request sent by a second synchronization service calling a write interface, the synchronization request including the synchronization code and synchronization data corresponding to the data identifier, the write interface being called by the second synchronization service according to the target address when determining that the authorization value represents authorization; if the received synchronization code passes verification, storing the synchronization data and updating the authorization value to a synchronization value, the synchronization value being used to indicate successful synchronization.

[0077] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by a computer program, or by a computer program controlling related hardware. The computer program can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0078] Therefore, embodiments of this application also provide a storage medium storing a computer program that can be loaded by a processor to execute the steps in any of the methods provided in embodiments of this application.

[0079] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0080] Since the computer program stored in the storage medium can execute the steps of any of the methods provided in the embodiments of this application, the beneficial effects that the methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.

[0081] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.

[0082] It should be understood that this application is not limited to the embodiments described above and shown in the accompanying drawings, but various modifications and changes can be made without departing from its scope.

Claims

1. A cross-environment data synchronization method, characterized in that, The method, applied to a first synchronization service deployed in a first environment, includes: Receive an authorization request sent by the authorization interface of the first front-end service. The authorization request carries indication information of a data request record. The data request record comes from the second environment and includes a data identifier, a callback address of the second environment, and a target address of the first environment. According to the callback address, the read interface is called to send a read request to the second synchronization service deployed in the second environment. The read request carries the synchronization code and authorization value corresponding to the data request record. The synchronization code and authorization value are generated and recorded when the authorization is indicated by the indication information. The system receives a synchronization request sent by the second synchronization service through the write interface. The synchronization request includes the synchronization code and the synchronization data corresponding to the data identifier. The write interface is called by the second synchronization service based on the target address when determining the authorization value to represent authorization. If the received synchronization code passes the verification, the synchronization data is stored, and the authorization value is updated to a synchronization value, which indicates successful synchronization.

2. The method according to claim 1, characterized in that, Before receiving the authorization request sent by the first foreground service call authorization interface, the method further includes: Receive the query request sent by the first front-end service call application record query interface; In response to the query request, a data synchronization request record in the first environment is sent to the first front-end service, and the data synchronization request record includes the data request record.

3. The method according to claim 1, characterized in that, Before receiving the authorization request sent by the foreground service calling the authorization interface, the method further includes: Receive the synchronization request sent by the second synchronization service calling the synchronization request interface, wherein the synchronization request carries the data request record; The data request record is written to the database, and a write success message is returned to the second synchronization service to trigger the second synchronization service to generate and record a write value based on the write success message. The write value is used to indicate that the write was successful.

4. The method according to claim 1, characterized in that, The second synchronization service generates and records a record value corresponding to the data request record when the authorization value represents authorization. The record value is used to record that authorization has been granted. After updating the authorization value to the synchronization value, the method further includes: Send a synchronization success indication message to the second synchronization service to trigger the second synchronization service to update the record value to the synchronization value; Receive a synchronization message returned by the second synchronization service, the synchronization message being used to indicate that the synchronization value was successfully synchronized; In response to the synchronization message, a result message is sent to the first front-end service, the result message indicating that the data synchronization corresponding to the data request record has been completed.

5. The method according to claim 1, characterized in that, The instruction information includes the authorization operation information, authorizer account, and authorization time recorded in the first front-end service for the target application record; the synchronization code and authorization value are generated and recorded when the authorization operation information is agreed to. The read request also includes the authorizing account and authorization time, and the second synchronization service associates the authorizing account and authorization time with the data request record.

6. The method according to claim 1, characterized in that, Before receiving the authorization request sent by the foreground service calling the authorization interface, the method further includes: Obtain the first synchronization service, which is the same data synchronization service as the second synchronization service; Deploy the first synchronization service in the first environment.

7. The method according to claim 1, characterized in that, Before storing the synchronization data if the received synchronization code passes the verification, the method further includes: Compare the received synchronization code with the recorded synchronization code to see if they are the same; If they are the same, then the received synchronization code passes the verification.

8. A cross-environment data synchronization device, characterized in that, The apparatus for a first synchronization service deployed in a first environment includes: The instruction information receiving module is used to receive the authorization request sent by the first front-end service calling the authorization interface. The authorization request carries the instruction information of the data request record. The data request record comes from the second environment and includes a data identifier, the callback address of the second environment, and the target address of the first environment. The read request sending module is used to call the read interface to send a read request to the second synchronization service deployed in the second environment according to the callback address. The read request carries the synchronization code and authorization value corresponding to the data request record. The synchronization code and authorization value are generated and recorded when the authorization is indicated by the indication information. A synchronization request receiving module is used to receive a synchronization request sent by the second synchronization service calling the write interface. The synchronization request includes the synchronization code and the synchronization data corresponding to the data identifier. The write interface is called by the second synchronization service based on the target address when determining the authorization value to represent authorization. The synchronization update module is used to store the synchronization data and update the authorization value to a synchronization value if the received synchronization code passes the verification, and the synchronization value is used to indicate that the synchronization is successful.

9. A storage medium, characterized in that, It stores a computer program that, when executed by the computer's processor, causes the computer to perform the method described in any one of claims 1 to 7.

10. An electronic device, characterized in that, include: Memory, which stores computer programs; A processor reads a computer program stored in memory to perform the method described in any one of claims 1 to 7.