Data processing method and device, electronic equipment and storage medium
By requesting and migrating business data from the original production environment based on the previous environment identifier during the production environment switching, the problem of failure of business data query after the production environment switching is solved, and seamless user operations are achieved and the smooth completion of production environment switching is achieved.
Patent Information
- Application Number
- CN202311821578.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-26
- Publication Date
- 2025-06-27
AI Technical Summary
When switching the production environment, since the servers in different production environments store data is isolated from each other, the target server may not store historical business operation data related to the user's current business, resulting in the service data query failure and the user needs to re-execute the operation process.
By receiving the service operation request from the service client, obtain the prior environment identifier and determine whether the current production environment is consistent with the prior production environment. If inconsistent, a service data request is sent to a prior server in the prior production environment based on the prior environment identification, and the off-site query data is received and migrated to the target server.
When switching the production environment, the data required by the synchronous service is migrated from the production environment before the switching to the production environment after the switching, reducing the problem of failure in business data query, allowing users to continue the operation process seamlessly, and reducing the impact of production environment switching on users.
Smart Images

Figure CN120216529A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and in particular, to a method, device, electronic device, and storage medium for data processing. Background Art
[0002] When conducting business processing, a business client usually sends business operation data of a user for a business interface to a server in a corresponding production environment, and conducts business processing through this server. For example, in an ordering scenario, an ordering client usually sends an ordering request to a server in a corresponding production environment (such as a computer room) according to the ordering operation of a user on an ordering interface, and receives an ordering response message from the server.
[0003] In the prior art, to cope with problems such as a large business volume, the production environment corresponding to the business client is usually switched according to the load status of servers in each production environment, etc., to ensure subsequent business processing.
[0004] However, in some business scenarios, the stored data of servers in different production environments is isolated from each other. Therefore, the target server in the switched production environment may not store historical business operation data related to the user's current business, which may lead to a failure in querying business data, and the user needs to re-execute operation processes such as placing an order. Summary of the Invention
[0005] The purpose of the embodiments of this application is to provide a method, device, electronic device, and storage medium for data processing, so as to reduce the problem of failure in querying business data when the production environment is switched.
[0006] On the one hand, the embodiments of this application provide a method for data processing, which is applied to a target server in a current production environment and includes:
[0007] Receiving a business operation request sent by a business client, and obtaining a prior environment identifier included in the business operation request; wherein, the prior environment identifier is sent by a prior server in a prior production environment to the business client when responding to the request of the business client;
[0008] Judging whether the current production environment is the same as the prior production environment;
[0009] If it is determined that they are not the same, then based on the prior environment identifier, sending a business data request to the prior server in the prior production environment;
[0010] Receiving off-site query data returned by the prior server based on the business data request.
[0011] In an implementation manner, judging whether the current production environment is the same as the prior production environment includes:
[0012] Obtain the service fields included in the service operation request;
[0013] Query in the local stored data based on the service fields to obtain local query data;
[0014] If the local query data is not empty, determine that the current production environment is consistent with the previous production environment;
[0015] If the local query data is empty, verify the previous environment identifier;
[0016] If it is determined that the verification passes, determine that the current production environment is consistent with the previous production environment; otherwise, determine that the current production environment is inconsistent with the previous production environment.
[0017] In one implementation, verifying the previous environment identifier includes:
[0018] Obtain the target environment identifier corresponding to the target server;
[0019] If it is determined that the previous environment identifier matches the target environment identifier, determine that the verification passes; otherwise, determine that the verification fails.
[0020] In one implementation, the service operation request is directed by the gateway to the target server when the environment switching condition is met.
[0021] In one implementation, based on the previous environment identifier, sending a service data request to the previous server in the previous production environment includes:
[0022] Obtain the network address information of the previous server set corresponding to the previous environment identifier;
[0023] Generate a service data request based on the network address information and the service fields further included in the service operation request;
[0024] Send the service data request to the previous server, so that the previous server queries based on the service fields to obtain off-site query data and migrates the off-site query data from the previous server to the target server.
[0025] In one implementation, the method further includes:
[0026] Execute the service operation request based on the off-site query data to obtain a service execution result;
[0027] Return an operation response message including the service execution result and the target environment identifier to the service client, so that the service client presents the service execution result to the user and uses the target environment identifier as the new previous environment identifier.
[0028] In one implementation, the method further includes:
[0029] If the locally queried data is not empty, then based on the locally queried data, execute the service operation request and return the current service execution result to the service client;
[0030] If the locally queried data is empty and the verification of the prior environment identifier passes, then query again in the local stored data based on the service fields to obtain new locally queried data. If the new locally queried data is not empty, then based on the new locally queried data, execute the service operation request and return the current service execution result to the service client.
[0031] On the one hand, an embodiment of the present application provides a data processing device, which is applied to a target server in the current production environment and includes:
[0032] An acquisition unit, configured to receive a service operation request sent by a service client and acquire a prior environment identifier included in the service operation request; wherein, the prior environment identifier is sent by a prior server in a prior production environment to the service client when responding to the request of the service client;
[0033] A judgment unit, configured to judge whether the current production environment is consistent with the prior production environment;
[0034] A sending unit, configured to, if it is determined that they are inconsistent, send a service data request to the prior server in the prior production environment based on the prior environment identifier;
[0035] A receiving unit, configured to receive remote query data returned by the prior server based on the service data request.
[0036] In one implementation manner, the judgment unit is configured to:
[0037] Acquire service fields included in the service operation request;
[0038] Query in the local stored data based on the service fields to obtain locally queried data;
[0039] If the locally queried data is not empty, then determine that the current production environment is consistent with the prior production environment;
[0040] If the locally queried data is empty, then verify the prior environment identifier;
[0041] If it is determined that the verification passes, then determine that the current production environment is consistent with the prior production environment; otherwise, determine that the current production environment is inconsistent with the prior production environment.
[0042] In one implementation manner, the judgment unit is configured to:
[0043] Acquire a target environment identifier corresponding to the target server;
[0044] If it is determined that the prior environment identifier matches the target environment identifier, it is determined that the verification passes; otherwise, it is determined that the verification fails.
[0045] In one implementation, the service operation request is directed by the gateway to the target server when the environment switching condition is met.
[0046] In one implementation, the sending unit is used for:
[0047] Obtain the network address information of the prior server set corresponding to the prior environment identifier;
[0048] Generate a service data request based on the network address information and the service fields further included in the service operation request;
[0049] Send the service data request to the prior server, so that the prior server performs a query based on the service fields to obtain off-site query data and migrates the off-site query data from the prior server to the target server.
[0050] In one implementation, the receiving unit is further used for:
[0051] Execute the service operation request based on the off-site query data to obtain a service execution result;
[0052] Return an operation response message including the service execution result and the target environment identifier to the service client, so that the service client presents the service execution result to the user and uses the target environment identifier as the new prior environment identifier.
[0053] In one implementation, the judging unit is further used for:
[0054] If the local query data is not empty, execute the service operation request based on the local query data, and return the current service execution result to the service client;
[0055] If the local query data is empty and the prior environment identifier verification passes, query again in the local stored data based on the service fields to obtain new local query data. If the new local query data is not empty, execute the service operation request based on the new local query data, and return the current service execution result to the service client.
[0056] On the one hand, an electronic device is provided in an embodiment of the present application, including:
[0057] A processor; and
[0058] A memory storing computer instructions for causing the processor to execute the steps of the method provided in any of the various alternative implementations of the above data processing.
[0059] On the one hand, an embodiment of the present application provides a storage medium storing computer instructions for causing a computer to execute the steps of the method provided in any of the various alternative implementations of data processing as described above.
[0060] The data processing method in the embodiment of the present application includes receiving a service operation request sent by a service client and obtaining a prior environment identifier included in the service operation request, where the prior environment identifier is sent by a prior server in a prior production environment to the service client when responding to the request of the service client; determining whether the current production environment is consistent with the prior production environment; if it is determined that they are inconsistent, then based on the prior environment identifier, sending a service data request to the prior server in the prior production environment; and receiving off-site query data returned by the prior server based on the service data request. In this way, when the production environment is switched, the data required by the service can be synchronized from the prior production environment before the switch to the new production environment after the switch, so as to reduce the problem of service data query failure, enabling the user to seamlessly continue their previous operation process to successfully complete operation processes such as placing an order, without the need to repeat the operation process, and reducing the impact of production environment switching on the user. Description of the Drawings
[0061] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0062] Figure 1 It is an application scenario diagram of data processing in an embodiment of the present application.
[0063] Figure 2 It is a flowchart of a data processing method in an embodiment of the present application.
[0064] Figure 3 It is an example diagram of data migration in an embodiment of the present application.
[0065] Figure 4 It is an interaction diagram of a service processing method in an embodiment of the present application.
[0066] Figure 5 It is a structural block diagram of a data processing device in an embodiment of the present application.
[0067] Figure 6 It is a structural schematic diagram of an electronic device in an embodiment of the present application. Detailed Embodiments
[0068] The technical solution of the present application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts belong to the scope of protection of the present application. In addition, the technical features involved in different embodiments of the present application described below can be combined with each other as long as they do not conflict with each other.
[0069] First, some terms involved in the embodiments of the present application will be explained to facilitate the understanding of those skilled in the art.
[0070] Terminal device: It can be a mobile terminal, a fixed terminal or a portable terminal, such as a mobile phone, a site, a unit, a device, a multimedia computer, a multimedia tablet, an Internet node, a communicator, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a personal communication system device, a personal navigation device, a personal digital assistant, an audio / video player, a digital camera / video camera, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a game device or any combination thereof, including accessories and peripherals of these devices or any combination thereof. It is also foreseeable that the terminal device can support any type of user interface (such as a wearable device), etc.
[0071] Server: It can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
[0072] The technical idea of the present application will be explained below.
[0073] In some business scenarios, for the sake of high availability of the business, multiple independent and peer production environments are usually set up for the business, and each production environment provides services for its corresponding business client. Specifically, the business client can send the business operation data of the user for the business interface (such as the order placement operation data for the catering interface) to the server of the corresponding production environment for business processing by the server.
[0074] Under traditional technology, if it is determined that the production environment needs to be upgraded (for example, a new version of the server in the production environment is released) or the production environment is abnormal (for example, the production environment has an excessive load or is under a network attack), the production environment corresponding to the business client can be switched to another production environment (that is, switch the server corresponding to the business client) to switch the business traffic to another production environment, thereby ensuring the availability of the business.
[0075] However, in some business scenarios, the storage data of the servers in different production environments is isolated from each other, and the business client does not store the corresponding business operation data or the business operation data stored by the business client is untrustworthy. Therefore, after switching the production environment, the server in the switched production environment may not store the historical business operation data related to the user's current business, which may cause the user to need to re-execute operation processes such as placing an order, thereby reducing the business volume per unit time of the platform and damaging the platform's interests (for example, the order rate of merchants decreases, resulting in a reduction in merchant revenue).
[0076] Furthermore, under traditional technology, to solve the above problems, usually the following two methods are adopted:
[0077] Method 1: Use tools such as the Sonic-Starter component to keep the data in each production environment consistent, that is, synchronize the data in each production environment with each other so that each production environment contains the business operation data of all production environments. However, this will occupy a large amount of storage resources.
[0078] Method 2: Use tools such as Redis-Shake / Redis-Migrate-Tool to migrate the required business operation data between different production environments through manual operations. However, this will consume a large amount of labor costs and time costs.
[0079] Therefore, in the embodiments of the present application, a data processing method, device, electronic device, and storage medium are provided, aiming to reduce the problem of failed business data queries while taking cost into account when switching the production environment.
[0080] In the embodiments of the present application, a data processing method is provided. This method can be applied to an electronic device, and the present application does not limit the type of the electronic device. It can be any device type suitable for implementation, and the present application will not elaborate on this.
[0081] The following combines Figure 1 , to illustrate the application scenario of the embodiments of the present application. Refer to Figure 1 As shown, it is an application scenario diagram of data processing. Figure 1 It includes user equipment and multiple production environments.
[0082] Among them, there is at least one user device. Figure 1 Taking three user devices as an example for illustration in Figure 1 . A business client is set in the user device. Optionally, one or more business clients can be set in one user device. Each business client is correspondingly set with a production environment, that is, each business client has a corresponding server in the production environment to implement specific business processing operations for it.
[0083] Among them, there are multiple production environments. Figure 1 Taking the first production environment and the second production environment as an example for illustration in Figure 1 . Servers are set in each production environment. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. Each production environment can correspond to one or more business clients. The databases corresponding to different production environments are isolated from each other.
[0084] As an example, the service scope can be divided into multiple sub - regions according to the geographical environment, and a corresponding production environment is allocated to each sub - region respectively, and services are provided to all business clients within its corresponding region through the servers in each production environment. To avoid over - load problems, the production environment assigned to the business client can be switched according to the load status of the servers in each production environment.
[0085] Furthermore, a gateway can also be included in this application scenario to switch the production environment assigned to the business client through the gateway.
[0086] In one implementation, the business client is used to send a business operation request to the target server in the currently set production environment according to the user's business operation instruction, and receive the business execution result returned by the target server based on the business operation request.
[0087] In one implementation, the target server is used to: receive the business operation request sent by the business client, obtain the prior environment identifier included in the business operation request; determine whether the current production environment is consistent with the prior production environment; if it is determined that they are inconsistent, send a business data request to the prior server in the prior production environment based on the prior environment identifier; receive the off - site query data returned by the prior server based on the business data request, execute the business operation request based on the off - site query data, and return the business execution result to the business client; if the current production environment is consistent with the prior production environment, perform a data query on the locally stored data to obtain the data associated with the current business operation request, that is, the local query data, execute the business operation request based on the local query data, and return the business execution result to the business client.
[0088] Among them, the prior environment identifier is sent by a prior server in a prior production environment to the service client when responding to a request from the service client; the current production environment is the production environment currently assigned to the service client. The target server is a server in the current production environment. The prior production environment is the production environment that previously responded to the service client (i.e., the production environment that responded to the service client before the above service operation request). The prior server is a server in the prior production environment. If the production environment has not been switched, the current production environment is the same as the prior production environment; otherwise, they are different.
[0089] In one implementation, the prior server is used to: query data from the data corresponding to the prior server according to the service data request of the target server, obtain off-site query data, and migrate the off-site query data to the target server.
[0090] Among them, the local storage data of each server is stored in its corresponding database. The server and its corresponding database can be located on the same device or on different devices. The databases in different production environments are isolated from each other. However, if there are multiple physical servers in the same production environment, each physical server in the same production environment is correspondingly provided with the same database, or the databases corresponding to each physical server are data-shared.
[0091] Refer to Figure 2 As shown, it is a flowchart of a data processing method in an embodiment of the present application, which can be applied to Figure 1 the target server in the application scenario of Figure 1 and Figure 2 to illustrate this method. The specific implementation process of this method is as follows:
[0092] Step 200: Receive a service operation request sent by the service client, and obtain the prior environment identifier included in the service operation request.
[0093] In one implementation, the service client is used to send a service operation request to the target server in the currently assigned production environment according to the user's service operation instruction. The target server receives the service operation request and obtains the prior environment identifier included in the service operation request.
[0094] Among them, the prior environment identifier is sent by a prior server in a prior production environment to the service client when responding to the request of the service client. The prior production environment and the current production environment may be the same or different.
[0095] It should be noted that each time the target server corresponding to the service client receives a service operation request from the service client, it will return an operation response message containing the target environment identifier to the service client. Then, the service client will use the latest received target environment identifier as the current prior environment identifier, and when performing the next service processing, it will send a service operation request containing this prior environment identifier to the correspondingly set server (which may be the above-mentioned target server or a new target server after switching). Among them, the environment identifier (including the prior environment identifier and the target environment identifier) is used to uniquely identify the production environment. Since servers are set in each production environment, there is also a corresponding relationship between the environment identifier and the servers in the production environment.
[0096] Optionally, the service client can be an application (APP), such as a browser and a food ordering APP, or it can also be a small program. As an example, the service client is a food ordering APP used by consumer users. The service operation instruction can be generated by the service client according to the user's trigger operation on the service interface, or it can also be generated by the service client according to the user's voice. The service client is set in the user device, and the user device can be a terminal device or a server. The user device and the target server can be the same device or different devices.
[0097] Step 201: Determine whether the current production environment is the same as the prior production environment.
[0098] S2011: Obtain the service fields included in the service operation request.
[0099] For example, if the service operation request is a product order placement request, the service fields include user identification (ID) and / or order placement ID.
[0100] S2012: Based on the service fields, query in the local stored data to obtain the local query data.
[0101] In one implementation, the target server stores data through a correspondingly set database, that is, the local stored data. And when querying data, it queries the data associated with the service fields from the local stored data, that is, the local query data.
[0102] As an example, if the service operation request is to view the current processing progress of the ordered dishes, the service field can be the order placement ID, so that the processing node corresponding to this order placement identifier can be queried in the local stored data.
[0103] As another example, if the business operation request is to place an order for a product, the business field can be the user ID. Then, in the local stored data, the products selected by the user in the shopping cart can be queried so that the products in the shopping cart can be ordered.
[0104] S2013: If the local query data is not empty, it is determined that the current production environment is consistent with the previous production environment.
[0105] Furthermore, if the local query data is not empty, based on the local query data, the business operation request is executed, and the current business execution result is returned to the business client.
[0106] This is because if the local query data is not empty, it indicates that the corresponding query data is stored locally. Therefore, if it is determined that the server corresponding to the business client has not been switched, data migration is not required to implement business processing.
[0107] S2014: If the local query data is empty, the previous environment identifier is verified.
[0108] In one implementation, when executing step S2014:
[0109] S20141: Obtain the previous environment identifier included in the business operation request.
[0110] It should be noted that the previous environment identifier in the business client is obtained from the server corresponding to the business client.
[0111] S20142: Verify the previous environment identifier.
[0112] In one implementation, obtain the target environment identifier corresponding to the target server; if it is determined that the previous environment identifier matches the target environment identifier, it is determined that the verification is passed; otherwise, it is determined that the verification fails.
[0113] As an example, if the similarity between the previous environment identifier and the target environment identifier is higher than the set similarity, it is determined that the two match.
[0114] In practical applications, the set similarity (e.g., 0.6) can be set according to the actual application scenario and is not limited here.
[0115] As another example, if there is an inclusion relationship between the previous environment identifier and the target environment identifier, it is determined that the two match.
[0116] In practical applications, other methods can also be used to verify the previous environment identifier according to the actual application scenario and are not limited here.
[0117] Further, if the local query data is empty and the prior environment identifier is verified successfully, it is also possible to query again in the local stored data based on the service fields to obtain new local query data. If the new local query data is not empty, then based on the new local query data, execute the service operation request and return the current service execution result to the service client.
[0118] S2015: If it is determined that the verification is successful, then determine that the current production environment is the same as the prior production environment; otherwise, determine that the current production environment is different from the prior production environment.
[0119] Further, it is also possible to determine whether there is a production environment switch only based on whether the local query data is empty, and it is also possible to determine whether there is a production environment switch only based on whether the historical environment identifier is verified successfully. Details are not described here.
[0120] Among them, the production environment corresponding to the service client is switched when the gateway determines that the environment switch condition is met. The service operation request is directed by the gateway to the target server when the environment switch condition is satisfied.
[0121] In one implementation, the process of switching the production environment corresponding to the service client may include:
[0122] Respectively set corresponding environment switch conditions for each production environment, and define corresponding routing rules in the gateway (such as, Janus gateway) according to the environment switch conditions of each production environment. The gateway monitors each production environment respectively, and when it determines that there is a production environment that meets the environment switch condition based on the monitoring data, switch the service client corresponding to this production environment to another production environment (to route the service traffic to another production environment). Specifically, when it is determined that the environment switch condition is met, direct the service operation request sent to this production environment to another production environment.
[0123] Among them, the environment switch conditions of different production environments may be the same or different. Each routing rule can specify the same or different environment switch conditions.
[0124] Taking the production environment corresponding to the service client as an example, when the gateway determines that the prior production environment corresponding to this service client meets the environment switch condition, switch the prior production environment corresponding to this service client to the current production environment (that is, redirect the service operation request sent to the prior production environment to the current production environment).
[0125] Among them, the environment switch condition may be determined according to whether the production environment is upgraded and whether it is abnormal. Optionally, when any of the following conditions is met, it is determined that the environment switch condition is met:
[0126] It is detected that the server in the production environment is upgraded (i.e., a new version is released), it is detected that the load in the production environment is higher than the load threshold, and it is detected that the production environment is under a network attack.
[0127] In this way, the running status of each production environment can be monitored so that when there are problems such as unavailability or excessive load in a certain production environment resulting in a decrease in the order volume, the operation of switching the production environment can be triggered.
[0128] Step 202: If it is determined that they are inconsistent, based on the prior environment identifier, send a service data request to the prior server in the prior production environment.
[0129] In one implementation, when executing Step 202, the following steps can be adopted:
[0130] S2021: Obtain the network address information of the prior server set corresponding to the prior environment identifier.
[0131] In one implementation, corresponding environment identifiers are set for each production environment respectively, and the network address information of the servers in each production environment is obtained, and the corresponding relationship between the environment identifier and the network address information of the server is established, and the corresponding environment is stored in the servers of each production environment respectively. Then, according to this corresponding relationship, the network address information corresponding to the prior environment identifier, that is, the network address of the prior server, can be obtained.
[0132] Among them, the network address information can be an Internet Protocol (IP) address. The prior production environment is the production environment that responds to the service client first.
[0133] S2022: Generate a service data request based on the network address information and the service fields further included in the service operation request.
[0134] In one implementation, generate a service data request including the network address information and the service fields.
[0135] S2023: Send the service data request to the prior server, so that the prior server queries based on the service fields to obtain the off-site query data and migrates the off-site query data from the prior server to the target server.
[0136] In one implementation, the prior server receives the service data request, and in the data stored in the corresponding database, queries based on the service fields in the service data request to obtain the queried data, that is, the off-site query data, and migrates the off-site query data from the prior server to the target server.
[0137] Among them, data migration refers to sending the off-site query data to the target server and deleting the off-site query data from the database to reduce the occupation of storage resources.
[0138] In this way, when the production environment corresponding to the business client is switched, the associated data of the business operation request, that is, the off-site query data, can be migrated from the historical data stored in the prior server in the production environment before the switch to the target server in the production environment after the switch.
[0139] Step 203: Receive the off-site query data returned by the prior server based on the business data request.
[0140] In one implementation, the prior server returns the off-site query data to the target server. The target server receives the off-site query data sent by the prior server.
[0141] Furthermore, after obtaining the off-site query data, the business operation request can also be executed based on the off-site query data to obtain the business execution result. As an example, the business operation request is an order placement request for a takeaway order, and the business execution result is an order placement success message.
[0142] In one implementation, the business operation request is executed based on the off-site query data through the application programming interface (API) corresponding to the business operation request to obtain the business execution result.
[0143] Among them, the off-site query data may be empty, that is, the business operation request has not generated corresponding historical data. If the off-site query data is not empty, the local stored data of the target server is updated based on the off-site query data, that is, the off-site query data is stored in the database of the target server, so as to synchronize the associated data of the current business operation request from the prior server before the switch to the target server after the switch.
[0144] In this way, only the historical data required for the current business needs to be migrated, avoiding the problem of excessive consumption of storage resources caused by the full synchronization of data in each production environment, and also solving the problem that the business cannot be executed due to the lack of storage of the historical data in the target server and the user needs to repeat the operation process.
[0145] Furthermore, after obtaining the business execution result, an operation response message can also be returned to the business client based on the business execution result.
[0146] Among them, the operation response message also includes the target environment identifier corresponding to the target server.
[0147] In one implementation, the target server returns an operation response message containing the service execution result and the target environment identifier (i.e., the environment identifier corresponding to the target server) to the service client. After receiving the operation response message, the service client obtains the service execution result and the target environment identifier in the operation response message, and presents the service execution result to the user in the form of a service interface and / or voice, and uses the target environment identifier as the new previous environment identifier and stores the new previous environment identifier. Further, when receiving a new service operation instruction, a new service operation request containing the new previous environment identifier is generated and sent to loop through steps 200 to 203.
[0148] The following combines Figure 3 to illustrate the above embodiments by way of example. Refer to Figure 3 As shown, it is an example diagram of a data migration. Figure 3 It includes the first production environment, the second production environment, and the third production environment.
[0149] Among them, each production environment contains a portal module, a migration module, and a Redis database. The Redis in each production environment is independently accessed, that is, the Redis in each production environment is isolated from each other. Optionally, the server may only include the portal module and migration, and may also include Redis.
[0150] As an example, the current production environment corresponding to a certain food ordering APP is the second production environment, and the first environment identifier of the environment identifier currently stored in the food ordering APP. Therefore, based on the user's service operation request, the food ordering APP generates a service operation request containing the first environment identifier and sends it to the server in the second production environment. After receiving the service operation request sent by the food ordering APP, the portal module in the second production environment obtains the second environment identifier of the second production environment, and after determining that the first environment identifier does not match the second environment identifier, through the migration module in the second production environment, based on the service operation request, it sends a service data request to the migration module in the first production environment. The migration module in the first production environment queries data from the Redis in the first production environment based on the service data request, obtains off-site query data, and returns the off-site query data to the migration module in the second production environment. The migration module in the second production environment stores the off-site query data in the Redis in the second production environment.
[0151] As another example, if the current production environment corresponding to a certain meal ordering APP is the second production environment, and the second environment identifier of the environment identifier currently stored in the meal ordering APP, then after the portal module in the second production environment receives the service operation request sent by the meal ordering APP, it obtains the second environment identifier of the second production environment and determines that the environment identifiers match. Then, based on the service operation request, it reads the corresponding local query data from Redis in the second production environment.
[0152] In the embodiments of the present application, only the data migration between the first production environment and the second production environment is illustrated by way of example. Similarly, similar principles can be used for data migration between any two of the other production environments, which will not be elaborated here.
[0153] The following combines Figure 4 to specifically describe the above embodiments. Refer to Figure 4 As shown, it is an interaction diagram of a method for business processing. The specific implementation process of this method includes:
[0154] Step 400: The business client receives the service operation instruction of the user.
[0155] Step 401: The business client obtains the prior environment identifier of the prior production environment.
[0156] Step 402: The target server receives the service operation request sent by the business client based on the prior environment identifier.
[0157] Step 403: The target server makes a query based on the service operation request and determines whether the obtained local query data is empty. If so, it executes Step 404; otherwise, it executes Step 405.
[0158] Step 404: The target server determines whether the prior environment identifier passes the verification. If so, it executes Step 405; otherwise, it executes Step 408.
[0159] Step 405: The target server makes another query based on the service operation request to obtain new local query data.
[0160] Step 406: If the new local query data is not empty, the target server executes the service operation request based on the new local query data.
[0161] Step 407: The target server returns the service execution result to the business client.
[0162] Step 408: The target server sends a service data request to the prior server in the prior production environment based on the prior environment identifier.
[0163] Step 409: The prior server performs a data query based on the service data request to obtain off-site query data.
[0164] Step 410: The prior server migrates the off-site query data to the target server.
[0165] Step 411: The target server executes the service operation request based on the off-site query data.
[0166] Step 412: The target server returns the service execution result to the service client.
[0167] In practical applications, when executing Steps 400 - 412, the specific steps can refer to the above Steps 200 - 203 and will not be elaborated here.
[0168] In the embodiment of the present application, if the production environment currently set corresponding to the service client is the current production environment, when the target server in the current production environment receives the service operation request from the service client, it determines whether there is a switch in the production environment set corresponding to the service client by means of the prior environment identifier. If so, it queries the associated data required for the service operation request from the data stored in the prior production environment before the switch, and migrates the query result (i.e., off-site query data) to the target server, so that the target server executes the service operation request based on the query result, obtains the service execution result, and presents the service execution result to the user through the service client.
[0169] In this way, a production environment switch recognition mechanism is introduced, enabling accurate determination of whether there is a production environment switch and accurately identifying users with a production environment switch. When a production environment switch is detected, based on the prior environment identifier, the data required for the service can be migrated from the prior production environment before the switch to the new production environment after the switch (i.e., the current production environment), reducing the problem of failed service data queries, allowing users to seamlessly continue their previous operation processes, such as successfully completing order placement and other operation processes without having to repeat the operation process, reducing the impact of production environment switches on users, and reducing the problem of decreased business volume per unit time (e.g., decreased order rate), improving the revenue of the platform (e.g., merchants). Further, in scenarios where the databases of each production environment are isolated from each other, the cost of data synchronization is reduced.
[0170] 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 fully authorized by all parties. The collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0171] Based on the same inventive concept, an embodiment of the present application further provides a data processing device. Since the principles of the above device and equipment for solving problems are similar to those of a data processing method, the implementation of the above device can refer to the implementation of the method, and the repeated parts will not be described again. The device can be applied to an electronic device, and the type of the electronic device is not limited in the present application. It can be any device type suitable for implementation, such as a terminal device and a server, etc., which will not be described again in the present application.
[0172] Refer to Figure 5 As shown, it is a structural block diagram of the data processing device in an embodiment of the present application. In some embodiments, the data processing device exemplified in the present application includes:
[0173] An acquisition unit 501, configured to receive a service operation request sent by a service client and acquire a prior environment identifier included in the service operation request; wherein, the prior environment identifier is sent by a prior server in a prior production environment to the service client when responding to the request of the service client;
[0174] A judgment unit 502, configured to judge whether the current production environment is consistent with the prior production environment;
[0175] A sending unit 503, configured to, if it is determined that they are inconsistent, send a service data request to the prior server in the prior production environment based on the prior environment identifier;
[0176] A receiving unit 504, configured to receive off-site query data returned by the prior server based on the service data request.
[0177] In one embodiment, the judgment unit 502 is configured to:
[0178] Acquire a service field included in the service operation request;
[0179] Query in the local stored data based on the service field to obtain local query data;
[0180] If the local query data is not empty, determine that the current production environment is consistent with the prior production environment;
[0181] If the local query data is empty, verify the prior environment identifier;
[0182] If it is determined that the verification is passed, determine that the current production environment is consistent with the prior production environment; otherwise, determine that the current production environment is inconsistent with the prior production environment.
[0183] In one embodiment, the judgment unit 502 is configured to:
[0184] Acquire a target environment identifier corresponding to the target server;
[0185] If it is determined that the prior environment identifier matches the target environment identifier, it is determined that the verification is passed; otherwise, it is determined that the verification fails.
[0186] In one implementation, the service operation request is directed by the gateway to the target server when the environment switching condition is met.
[0187] In one implementation, the sending unit 503 is used for:
[0188] Obtain the network address information of the prior server set corresponding to the prior environment identifier;
[0189] Generate a service data request based on the network address information and the service fields further included in the service operation request;
[0190] Send the service data request to the prior server, so that the prior server performs a query based on the service fields to obtain off-site query data and migrates the off-site query data from the prior server to the target server.
[0191] In one implementation, the receiving unit 504 is further used for:
[0192] Execute the service operation request based on the off-site query data to obtain a service execution result;
[0193] Return an operation response message including the service execution result and the target environment identifier to the service client, so that the service client presents the service execution result to the user and uses the target environment identifier as the new prior environment identifier.
[0194] In one implementation, the judging unit 502 is further used for:
[0195] If the local query data is not empty, execute the service operation request based on the local query data, and return the current service execution result to the service client;
[0196] If the local query data is empty and the prior environment identifier verification is passed, query again in the local stored data based on the service fields to obtain new local query data. If the new local query data is not empty, execute the service operation request based on the new local query data, and return the current service execution result to the service client.
[0197] The method for data processing in the embodiments of the present application includes receiving a service operation request sent by a service client and obtaining the prior environment identifier included in the service operation request; wherein, the prior environment identifier is sent by a prior server in a prior production environment to the service client when responding to the request of the service client; determining whether the current production environment is consistent with the prior production environment; if it is determined that they are inconsistent, then based on the prior environment identifier, sending a service data request to the prior server in the prior production environment; and receiving the off-site query data returned by the prior server based on the service data request. In this way, when the production environment is switched, the data required by the service can be synchronized from the prior production environment before the switch to the new production environment after the switch, so as to reduce the problem of service data query failure, enabling the user to seamlessly continue their previous operation process to successfully complete operation processes such as placing an order, without the need to repeat the operation process, and reducing the impact of the production environment switch on the user.
[0198] In the embodiments of the present application, an electronic device is provided, including:
[0199] a processor; and
[0200] a memory storing computer instructions for causing the processor to execute the method according to any of the above embodiments.
[0201] In the embodiments of the present application, a storage medium is provided, storing computer instructions for causing a computer to execute the method according to any of the above embodiments. Figure 6 The structural schematic diagram of an electronic device 6000 is shown. Refer to Figure 6 As shown, the electronic device 6000 includes a processor 6010 and a memory 6020. Optionally, it may further include a power supply 6030, a display unit 6040, and an input unit 6050.
[0202] The processor 6010 is the control center of the electronic device 6000, connecting various components through various interfaces and lines, and executing various functions of the electronic device 6000 by running or executing software programs and / or data stored in the memory 6020, thereby performing overall monitoring of the electronic device 6000.
[0203] In the embodiments of the present application, when the processor 6010 calls the computer program stored in the memory 6020, it executes each step in the above embodiments.
[0204] Optionally, the processor 6010 may include one or more processing units; preferably, the processor 6010 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, applications, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 6010. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be separately implemented on independent chips.
[0205] The memory 6020 may mainly include a program storage area and a data storage area. Among them, the program storage area may store the operating system, various applications, etc.; the data storage area may store data created according to the use of the electronic device 6000, etc. In addition, the memory 6020 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices, etc.
[0206] The electronic device 6000 further includes a power source 6030 (such as a battery) for supplying power to each component. The power source can be logically connected to the processor 6010 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption through the power management system.
[0207] The display unit 6040 can be used to display information input by the user or information provided to the user, as well as various menus of the electronic device 6000. In the embodiments of the present application, it is mainly used to display the display interfaces of various applications in the electronic device 6000 and objects such as text and pictures displayed in the display interfaces. The display unit 6040 may include a display panel 6041. The display panel 6041 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.
[0208] The input unit 6050 can be used to receive information such as numbers or characters input by the user. The input unit 6050 may include a touch panel 6051 and other input devices 6052. Among them, the touch panel 6051, also known as a touch screen, can collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any suitable object or accessory on or near the touch panel 6051).
[0209] Specifically, the touch panel 6051 can detect a user's touch operation, detect the signals brought by the touch operation, convert these signals into contact coordinates, send them to the processor 6010, and receive and execute the commands sent by the processor 6010. In addition, the touch panel 6051 can be implemented in multiple types such as resistive, capacitive, infrared, and surface acoustic wave. The other input devices 6052 can include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), trackball, mouse, joystick, etc.
[0210] Of course, the touch panel 6051 can cover the display panel 6041. After the touch panel 6051 detects a touch operation on or near it, it is transmitted to the processor 6010 to determine the type of touch event. Subsequently, the processor 6010 provides a corresponding visual output on the display panel 6041 according to the type of touch event. Although in Figure 6 the touch panel 6051 and the display panel 6041 are implemented as two independent components to realize the input and output functions of the electronic device 6000, in some embodiments, the touch panel 6051 and the display panel 6041 can be integrated to realize the input and output functions of the electronic device 6000.
[0211] The electronic device 6000 may further include one or more sensors, such as a pressure sensor, a gravitational acceleration sensor, a proximity light sensor, etc. Of course, according to the needs in specific applications, the above-mentioned electronic device 6000 may further include other components such as a camera. Since these components are not the key components used in the embodiments of the present application, they are not shown in Figure 6 and will not be described in detail.
[0212] Those skilled in the art can understand that Figure 6 is merely an example of an electronic device and does not constitute a limitation on the electronic device. It may include more or fewer components than shown in the figure, or combine some components, or different components.
[0213] For the convenience of description, the above parts are divided into various modules (or units) according to their functions and described separately. Of course, when implementing the present application, the functions of the various modules (or units) can be implemented in the same or multiple software or hardware.
[0214] Obviously, the above embodiments are merely examples given for clear illustration and are not limitations on the embodiments. For those of ordinary skill in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to enumerate all the embodiments here. And the obvious changes or modifications derived therefrom are still within the protection scope of the present invention.
Claims
1. A data processing method, characterized in that, Applied to a target server in the current production environment, the method includes: Receiving a service operation request sent by a service client, and obtaining a prior environment identifier included in the service operation request; wherein, the prior environment identifier is sent by a prior server in a prior production environment to the service client when responding to the request of the service client; Judging whether the current production environment is consistent with the prior production environment; If it is determined that they are inconsistent, then based on the prior environment identifier, sending a service data request to the prior server in the prior production environment; Receiving the off-site query data returned by the prior server based on the service data request.
2. The method according to claim 1, characterized in that The judging whether the current production environment is consistent with the prior production environment includes: Obtaining service fields included in the service operation request; Querying in the local stored data based on the service fields to obtain local query data; If the local query data is not empty, then determining that the current production environment is consistent with the prior production environment; If the local query data is empty, then verifying the prior environment identifier; If it is determined that the verification passes, then determining that the current production environment is consistent with the prior production environment, otherwise, determining that the current production environment is inconsistent with the prior production environment.
3. The method according to claim 2, wherein The verifying the prior environment identifier includes: Obtaining a target environment identifier corresponding to the target server; If it is determined that the prior environment identifier matches the target environment identifier, then determining that the verification passes, otherwise, determining that the verification fails.
4. The method according to any one of claims 1 to 3, characterized in that The service operation request is directed by a gateway to the target server when an environment switching condition is met.
5. The method according to any one of claims 1 to 3, characterized in that, The sending a service data request to the prior server in the prior production environment based on the prior environment identifier includes: Obtaining network address information of the prior server set corresponding to the prior environment identifier; Generating the service data request based on the network address information and the service fields further included in the service operation request; Sending the service data request to the prior server, so that the prior server queries based on the service fields to obtain the off-site query data and migrates the off-site query data from the prior server to the target server.
6. The method according to claim 3, characterized in that, The method further includes: Executing the service operation request based on the off-site query data to obtain a service execution result; Returning an operation response message including the service execution result and the target environment identifier to the service client, so that the service client presents the service execution result to the user and uses the target environment identifier as a new prior environment identifier.
7. The method according to claim 2 or 3, characterized in that, The method further includes: If the local query data is not empty, then executing the service operation request based on the local query data, and returning the current service execution result to the service client. If the local query data is empty and the verification of the prior environment identifier passes, then based on the service fields, query again in the local stored data to obtain new local query data. If the new local query data is not empty, then based on the new local query data, execute the service operation request and return the current service execution result to the service client.
8. A data processing device, characterized in that, Applied to a target server in the current production environment, the device includes: An acquisition unit, configured to receive a service operation request sent by a service client and acquire the prior environment identifier included in the service operation request; wherein, the prior environment identifier is sent by a prior server in a prior production environment to the service client when responding to the request of the service client. A judgment unit, configured to judge whether the current production environment is consistent with the prior production environment. A sending unit, configured to, if it is determined that they are inconsistent, send a service data request to the prior server in the prior production environment based on the prior environment identifier. A receiving unit, configured to receive remote query data returned by the prior server based on the service data request.
9. An electronic device, characterized in that, Includes: A processor; And A memory storing computer instructions for causing the processor to execute the method according to any one of claims 1 to 7.
10. A storage medium, characterized in that, Storing computer instructions for causing a computer to execute the method according to any one of claims 1 to 7.