Data processing method, device, system and storage medium

Through custom compilation functions, the rapid synchronization between the main server and the micro-server is solved, and the cumbersome synchronization of the main service and the micro-service interface is improved, and the project development efficiency is improved.

CN115145689BActive Publication Date: 2025-08-22BEIJING GANGTIEXIA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210764621.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-30
Publication Date
2025-08-22
Estimated Expiration
2042-06-30

AI Technical Summary

Technical Problem

During the back-end development process, the synchronization process of main service and microservice interfaces is cumbersome, resulting in low project development efficiency.

Method used

Through custom compilation functions, we judge whether the main server and the micro server belong to the same server, and compile and process based on the judgment results to generate the target interface file to realize the synchronization of the transmission interface between the main server and the micro server.

Benefits of technology

The synchronization process of the main service and microservice interface is simplified and the efficiency of project development is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115145689B_ABST
    Figure CN115145689B_ABST
Patent Text Reader

Abstract

The present invention discloses a data processing method, device, system, and storage medium. The method comprises: obtaining request data and sending the request data to a main server; determining a microserver corresponding to the main server based on the request data; determining whether the main server and the microserver belong to the same server and obtaining a determination result; determining a corresponding compilation function based on the determination result, and compiling a preset interface file based on the compilation function to obtain a target interface file; transmitting the target interface file to the main server and the microserver; and controlling the main server to transmit the request data to the microserver based on the synchronized transmission interface. The present invention solves the technical problem of cumbersome synchronization of the main service and microservice interfaces during back-end development, which in turn leads to low project development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Internet software development, and in particular to a data processing method, device, system and storage medium. Background Art

[0002] In the back-end development process, for example, in terms of data transmission between the main service and the remaining microservers, the microserver solution will most likely use the remote procedure call framework (gRPC, Google Remote Procedure Call) for data transmission. As for the data interface definition, there are also definition methods such as Jason Json and the data serialization protocol ProtoBuf. For gRPC, the official recommendation is to use ProtoBuf to define the data interface. After defining the interface file (proto file), it is necessary to execute relevant commands for the language to compile, and then put the compiled file into the relevant server. If different languages ​​are used for development between microservers, each interface file must be compiled using different language commands and moved to the relevant service. The operation process is more cumbersome and the project development efficiency is low.

[0003] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0004] The embodiments of the present invention provide a data processing method, device, system and storage medium to at least solve the technical problem that the synchronization process between the main service and microservice interface is cumbersome during the back-end development process, thereby leading to low project development efficiency.

[0005] According to one aspect of an embodiment of the present invention, a data processing method is provided, including: obtaining request data, and synchronizing the above-mentioned request data to a main server; determining a microserver corresponding to the main server based on the above-mentioned request data; judging whether the above-mentioned main server and the above-mentioned microserver belong to the same server, and obtaining a judgment result; determining a corresponding compilation function based on the above-mentioned judgment result, and compiling a preset interface file based on the above-mentioned compilation function to obtain a target interface file; transmitting the above-mentioned target interface file to the above-mentioned main server and the above-mentioned microserver, wherein the above-mentioned target interface file is used to realize synchronization of the transmission interface between the above-mentioned main server and the above-mentioned microserver; controlling the above-mentioned main server to transmit the above-mentioned request data to the above-mentioned microserver based on the synchronized transmission interface.

[0006] According to another aspect of an embodiment of the present invention, a data processing method is also provided, characterized in that it includes: receiving a target interface file from a master control device, wherein the target interface file is used to realize synchronization of a transmission interface between a main server and a corresponding micro server, and the target interface file is obtained by the master control device through obtaining request data and synchronizing the request data to the main server; determining the micro server corresponding to the main server according to the request data; judging whether the main server and the micro server belong to the same server to obtain a judgment result; determining a corresponding compilation function according to the judgment result, and compiling and processing a preset interface file based on the compilation function; after the master control device sends the request data to the main server, receiving the request data from the main server based on the synchronized transmission interface.

[0007] According to another aspect of an embodiment of the present invention, a data processing method is also provided, including: a main server receives request data; a main control device determines a microserver corresponding to the main server based on the request data; the main control device determines whether the main server and the microserver belong to the same server and obtains a judgment result; the main control device determines a corresponding compilation function based on the judgment result, and compiles and processes a preset interface file based on the compilation function to obtain a target interface file; the main control device transmits the target interface file to the main server and the microserver, wherein the target interface file is used to realize synchronization of a transmission interface between the main server and the microserver; the main control device controls the main server to transmit the request data to the microserver based on the synchronized transmission interface; the microserver receives the request data from the main server.

[0008] According to another aspect of an embodiment of the present invention, a data processing system is also provided, including: a main server for receiving request data; a main control device, connected to the above-mentioned main server, for determining the micro server corresponding to the main server according to the above-mentioned request data; judging whether the above-mentioned main server and the above-mentioned micro server belong to the same server, and obtaining a judgment result; determining the corresponding compilation function according to the above-mentioned judgment result, and compiling and processing the preset interface file based on the above-mentioned compilation function to obtain a target interface file; transmitting the above-mentioned target interface file to the above-mentioned main server and the above-mentioned micro server, wherein the above-mentioned target interface file is used to realize the synchronization of the transmission interface between the above-mentioned main server and the above-mentioned micro server; controlling the above-mentioned main server to transmit the above-mentioned request data to the above-mentioned micro server based on the synchronized transmission interface; the above-mentioned micro server, connected to the above-mentioned main server and the above-mentioned main control device, for receiving the above-mentioned request data from the above-mentioned main server.

[0009] According to another aspect of an embodiment of the present invention, a data processing device is also provided, including: a first acquisition module, used to acquire request data and synchronize the above request data to the main server; a first determination module, used to determine the microserver corresponding to the above main server based on the above request data; a first judgment module, used to judge whether the above main server and the above microserver belong to the same server, and obtain a judgment result; a first compilation module, used to determine the corresponding compilation function according to the above judgment result, and compile the preset interface file based on the above compilation function to obtain a target interface file; a first transmission module, used to transmit the above target interface file to the above main server and the above microserver, wherein the above target interface file is used to realize the synchronization of the transmission interface between the above main server and the above microserver; a second transmission module, used to control the above main server to transmit the above request data to the above microserver based on the synchronized transmission interface.

[0010] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is provided. The non-volatile storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing any one of the above-mentioned data processing methods.

[0011] In an embodiment of the present invention, request data is obtained and synchronized to the main server; the microserver corresponding to the main server is determined according to the request data; it is judged whether the main server and the microserver belong to the same server to obtain a judgment result; the corresponding compilation function is determined according to the judgment result, and the preset interface file is compiled based on the compilation function to obtain a target interface file; the target interface file is transmitted to the main server and the microserver, wherein the target interface file is used to realize the synchronization of the transmission interface between the main server and the microserver; the main server is controlled to transmit the request data to the microserver based on the synchronized transmission interface, thereby achieving the purpose of realizing fast synchronization between the main server and the microserver through a custom compilation function, thereby realizing the technical effect of simplifying the synchronization process of the main service and microservice interface and improving the project development efficiency, thereby solving the technical problem that the synchronization process of the main service and microservice interface in the back-end development process is cumbersome, which leads to low project development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0013] Figure 1 is a flow chart of a data processing method according to an embodiment of the present invention;

[0014] Figure 2 is a schematic diagram of an optional persistence operation process according to an embodiment of the present invention;

[0015] Figure 3 A flowchart of an optional data processing method according to an embodiment of the present invention;

[0016] Figure 4 is a structural diagram of a data processing system according to an embodiment of the present invention;

[0017] Figure 5 is a structural diagram of a data processing device according to an embodiment of the present invention;

[0018] Figure 6 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0019] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0020] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0021] In traditional back-end development, the back-end framework is developed using a monolithic architecture and a layered model, divided into a view layer, a logical business layer, and a persistence layer. This structural model is easy to develop and deploy in the early stages of a project, but as project modules increase, a single project contains multiple modules, each of which also contains a large number of logical business functions. In this situation, a logical error in any module in the entire project can cause the entire project to crash. Further, in the development process, changes to the business logic of a single module require the entire project to be redeployed, resulting in excessive coupling and further complex operations and maintenance.

[0022] This highlights the importance of the microservices framework, which divides the entire project into multiple small services based on modules. Each service runs in its own process without interfering with each other, and each service can be independently deployed on different servers. The main service serves as the entry point for the entire project, communicating with each microserver via a remote procedure call framework. This makes the entire project more modular, facilitating staff allocation and improving project development efficiency.

[0023] However, the microservice framework in existing technologies has the following problems in practical applications:

[0024] 1) Java is used more frequently than Python in back-end development, so most complete microserver solutions are based on Java. There are relatively few Python-based solutions, and the documentation is not very complete.

[0025] 2) In terms of data transmission between the main service and the remaining microservices, the microservice solution will most likely use the remote procedure call framework (gRPC, Google Remote Procedure Call) for data transmission. As for the definition of the data interface, there are also definition methods such as Jason Json and the data serialization protocol ProtoBuf. For gRPC, the official recommendation is to use ProtoBuf to define the data interface. After defining the interface file (proto file), it is necessary to compile it according to the language execution related commands, and then put the compiled file into the relevant server. If different languages ​​are used for development between microservices, each interface file must be compiled using different language commands and moved to the relevant service. The operation process is relatively cumbersome and the project development efficiency is low.

[0026] 3) Python development frameworks generally offer two approaches for database operations: Object Relational Mapping (ORM) and native Structured Query Language (SQL). ORM allows for custom model classes and migrations to build database tables and fields, but its performance is inferior to native SQL for database access. Native SQL also offers significant advantages over ORM for complex queries. However, improper handling of query field values ​​in native SQL can easily lead to malicious SQL injection, posing a threat to the entire project data.

[0027] 4) For the online deployment of the entire project, a single-type project has a relative advantage. The entire project only needs to configure and deploy the environment separately for the front-end and back-end. However, a microserver project requires the front-end and each microserver to be configured with the corresponding environment and deployed independently. In the case that each microserver has less content, all microservers can be deployed on the same server in order to save resources in the early stage. Under the premise of developing the project in a unified language, all microservers can share the same environment. Although this can avoid installing the same module multiple times on a server, multiple microservers running on the same server have higher requirements for server hardware and poor environmental isolation, which is obviously contrary to the low coupling characteristics of microservers. As for the need to deploy a microserver with more content on a server separately in the later stage of the project, all the code needs to be transferred to another server and the new environment needs to be reconfigured, which is more cumbersome.

[0028] Based on the above problems, an embodiment of the present invention provides an embodiment of a data processing method. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0029] Figure 1 is a flow chart of a data processing method according to an embodiment of the present invention. Figure 1 As shown, the method includes the following steps:

[0030] Step S102: Obtain request data and synchronize the request data to the main server;

[0031] Step S104, determining the micro server corresponding to the main server according to the request data;

[0032] Step S106, determining whether the main server and the micro server belong to the same server, and obtaining a determination result;

[0033] Step S108, determining a corresponding compile function according to the above judgment result, and compiling the preset interface file based on the above compile function to obtain a target interface file;

[0034] Step S110: transmitting the target interface file to the main server and the micro server, wherein the target interface file is used to synchronize the transmission interface between the main server and the micro server;

[0035] Step S112: Control the main server to transmit the request data to the micro server based on the synchronized transmission interface.

[0036] Optionally, steps S102 to S112 are performed by a master control device, which may be a device built into the master server or another device other than the master control device. The data processing method provided in steps S102 to S112 may be applied, but is not limited to, to back-end development using Python.

[0037] Through the above steps, the goal of quickly synchronizing the main server and microserver through custom compilation functions can be achieved, thereby simplifying the synchronization process of the main service and microservice interfaces and improving project development efficiency. This solves the technical problem of cumbersome synchronization process of the main service and microservice interfaces during back-end development, which leads to low project development efficiency.

[0038] Optionally, the above judgment result is: the main server and the micro server belong to the same server; or the main server and the micro server do not belong to the same server.

[0039] Optionally, after receiving the request data from the front end, the microserver corresponding to the main server is determined according to the request data; depending on whether the above-mentioned main server and microserver belong to the same server, different compilation functions are set to synchronize the interface of the main server, and on this basis, the above-mentioned request data is sent to the above-mentioned main server, and the above-mentioned main server is controlled to transmit the above-mentioned request data to the above-mentioned microserver based on the synchronized transmission interface, so as to simplify the interface synchronization efficiency and effectively improve the project development efficiency.

[0040] Optionally, after receiving the request data from the front-end, the main server needs to first verify the rationality of the request data, and can only continue to perform subsequent operations after the verification is passed. The specific verification process includes: after obtaining the request sent by the front-end, the main server part compares the interface information defined in the control file urls.py in the request data to determine whether its interface name and request method are reasonable, and then transfers the request to the corresponding view function through the interface information, and authenticates the request by comparing the user information carried in the request with the user information required in the decorator on the corresponding function. The specific authentication method is: first, add different decorators to each function according to the needs, so as to add authentication function to the function without changing the original function structure. The main content of the decorator is to obtain the user type carried in the request data and compare it with the user type required by the current decorator; if the user type in the request data is higher than the user type required in the current decorator, or is the same as the user type required in the current decorator, then the request data is authenticated successfully, otherwise the authentication fails. For request data that fails authentication, an error message is directly returned to prompt the user that the authority is insufficient. After successful authentication, the request parameters carried by the request are verified again to see if they meet the function's parameter requirements. Parameter verification includes verifying the name, type, and whether the parameters in the request data are required and whether they have default values. It should be noted that the relevant definitions of request parameters in the function are defined by the developer according to specific application requirements when writing the function. For request data that does not meet the function's requirements, an error message is directly returned to prompt the request error. Only request data that meets the user type requirements and parameter requirements can enter the function for business logic processing. The processed data is then transmitted to the microserver through the remote procedure call framework for specific data persistence operations.

[0041] Optionally, when the user clicks a button or a module on the front-end operation interface, a corresponding click event will be triggered to send a corresponding Ajax request to the main server according to the interface defined in the RESTful style. After receiving the corresponding request, the main server distributes it to the corresponding view function according to the interface set defined in the routing control file urls.py and performs authentication operations at the same time.

[0042] It's important to note that the front-end includes the actual page content and various design styles, as well as controlling specific routing (i.e., clicking a button or module to jump to a new page). The specific data displayed on the page can be obtained by using the jQuery framework during the page development process, using the RESTful interface defined by sending corresponding Ajax requests to the corresponding interface of the main server, and then being processed by the main server.

[0043] Optionally, the microserver corresponding to the main server is determined based on the request data, and the IP address and port number corresponding to the above microserver are obtained from the service registration and discovery center consul based on the microservice name. If an error occurs within the microserver, or the microserver name defined in the main server is inconsistent with the microserver name registered in consul, the acquisition will fail. At this time, a prompt message will be returned to the user and the error will be promptly fed back to the developer. After the IP address and port number corresponding to the above microserver are successfully obtained, a connection is established with the microserver through the remote procedure call framework gRPC, and then the relevant request data is assigned according to the interface and type defined in the interface file, and transmitted to the gRPC server of the microserver.

[0044] Optionally, the specific data transmission process between the microserver and the main server is to execute the specified registration script after the microserver is started, and register the relevant information of the microserver into consul. consul will display the status of all registered services on the specified interface, and users can view the status of all microservers at a glance by accessing the interface in a browser. When the main server needs to pass request data to the microserver, it can first search for the microserver in consul according to the name of the microserver. After finding it, it can return the IP address and port number of the microserver, and then transmit data through gRPC.

[0045] In an optional embodiment, the above-mentioned determining a corresponding compilation function according to the above-mentioned judgment result, and compiling the preset interface file based on the above-mentioned compilation function to obtain the target interface file include:

[0046] If the above judgment result indicates that the above main server and the above micro server belong to the same server, the first compilation function is used to compile the above preset interface file to obtain the above target interface file, wherein the input parameters corresponding to the above first compilation function include: the file address corresponding to the above target interface file, the main server address corresponding to the above main server, and the micro server address corresponding to the above micro server.

[0047] It should be noted that the interface file for data transmission, i.e., the proto file, needs to be compiled after it is written, and then placed in the main server and the corresponding microserver respectively, and then the gRPC service server and user client are defined at both ends, and the entire transmission chain is considered to be configured. Here, if the compilation of the proto file is on the same server, it can be moved to any location by specifying a compilation command (such as the mv command). If the microserver and the main server are not on the same server, in order to reduce the need to perform compilation operations and move the generated files each time the proto file is changed, this embodiment uses a custom compilation function, which not only includes the compilation command for the proto file, but also includes the step of moving the interface file.

[0048] Optionally, if the master server and microserver are on the same server, simply pass the target interface file's file address, the master server address, and the microserver address as parameters to the compilation function when calling the compilation function. This will move the generated file to the specified location upon completion. You can also use, but are not limited to, calling the system method of the Python built-in system module to simulate executing the mv command on the command line to move the corresponding interface file to the specified location.

[0049] In an optional embodiment, the above-mentioned determining a corresponding compilation function according to the above-mentioned judgment result, and compiling the preset interface file based on the above-mentioned compilation function to obtain the target interface file include:

[0050] If the above judgment result indicates that the above main server and the above micro server do not belong to the same server, a second compilation function is used to compile the above preset interface file to obtain the above target interface file, wherein the input parameters corresponding to the above second compilation function include: the above file address, the above main server address, the above micro server address, the address, user name, and key of the server corresponding to the above main server and the above micro server respectively.

[0051] Optionally, if the main server and microserver are not on the same server, you only need to pass the file address, main server address, microserver address, the addresses of the servers corresponding to the main server and microserver, the user name, and the key as parameters to the compilation function when calling the compilation function. The generated file can be moved to the specified location at the same time as the compilation is completed. You can, but are not limited to, generate relevant files by calling the Python built-in communication module (i.e., the ftplib module) and send the relevant files to the specified directory of the specified server through the socket protocol. This operation requires that at the same time as passing the relevant file location, you must pass the file address, main server address, microserver address, the addresses of the servers corresponding to the main server and microserver, the user name, and the key as parameters to the compilation function.

[0052] In an optional embodiment, the above method further includes:

[0053] Determine corresponding image files for the main server and the micro server respectively;

[0054] Based on the above-mentioned image files corresponding to the above-mentioned main server and the above-mentioned microserver respectively, the above-mentioned main server and the above-mentioned microserver are deployed in container form.

[0055] Optionally, in the deployment phase after the project development is completed, the main server and the microservers are deployed in a containerized manner using the Docker image. In the deployment phase after the project development is completed, this solution uses the Docker image for containerized deployment. The advantage is that you only need to define the image file Dockerfile in a single service, you can generate an image based on the file, and then generate a container based on the image. Moreover, each container is independent, and even if all microservers run on the same server, it will not cause confusion in the system environment. In addition, even if the container is lost or the server has an accident, you only need to regenerate a new container based on the original image. Compared with traditional deployment methods, it will not make the system environment complicated and is easy to move, avoiding the troublesome operation of redeploying the environment due to replacing a new server.

[0056] According to an embodiment of the present invention, a data processing method is further provided, the method comprising:

[0057] Step S1102: Receive a target interface file from a master control device, wherein the target interface file is used to synchronize the transmission interface between the main server and the corresponding micro server. The target interface file is generated by the master control device by obtaining request data and synchronizing the request data to the main server; determining the micro server corresponding to the main server based on the request data; determining whether the main server and the micro server belong to the same server, and obtaining a determination result; determining a corresponding compilation function based on the determination result, and compiling a preset interface file based on the compilation function;

[0058] Step S1104: After the master control device sends the request data to the master server, the master control device receives the request data from the master server based on the synchronized transmission interface.

[0059] Through the above steps, the goal of quickly synchronizing the main server and microserver through custom compilation functions can be achieved, thereby simplifying the synchronization process of the main service and microservice interfaces and improving project development efficiency. This solves the technical problem of cumbersome synchronization process of the main service and microservice interfaces during back-end development, which leads to low project development efficiency.

[0060] Optionally, the execution entity of the above steps S1102 to S1104 is the microserver corresponding to the main server. After receiving the target interface file from the main control device, the microserver corresponding to the main server receives the above request data from the above main server through the gRPC server in the microserver based on the synchronized transmission interface.

[0061] In an optional embodiment, the above method further includes:

[0062] Based on the request data, a persistence operation is performed on the database corresponding to the request data to obtain a persistence operation result, wherein the persistence operation includes at least one of the following: a data addition operation, a data deletion operation, a data modification operation, and a data query operation;

[0063] The above persistence operation result is returned to the above master server.

[0064] Optionally, based on the target interface file and the request data, a corresponding persistence function is selected to perform the persistence operation.

[0065] Optionally, the gRPC server in the microserver acts as the entry point. After receiving the request data sent by the main server, it also sends the request to the corresponding persistence function according to the interface defined in the target interface file (i.e., proto file) to perform specific persistence operations. Persistence operations can be completed based on, but are not limited to, the interface functions provided by the custom data exchange module (i.e., DataChange module).

[0066] It should be noted that the DataChange module mainly inherits the connection Connection class of the persistent connections module in the Python third-party package pymysql. By overriding the __init__ initialization function of the Connection class in the DataChange module, some parameters such as database IP address, port, user name, password, database name, etc. that are required to connect to the database are set as mandatory items for instantiating the object, so that the user can establish a connection with the database when instantiating the DataChange object, avoiding connection failure due to the lack of parameters required to connect to the database; after the connection is successful, the cursor function of the Connection class is called to create a cursor object, and then specific persistence operations (that is, database addition, deletion, modification, and query operations) are performed through the cursor object. After the operation is completed, the confirmation and submission commit function of the Connection class can be called to submit the database transaction of the previous step. After the submission is completed, the close function of the Connection class can be called to close the connection.

[0067] In an optional embodiment, performing a persistence operation on a database corresponding to the request data based on the request data to obtain a persistence operation result includes:

[0068] Get the interface function corresponding to the above persistence operation;

[0069] Based on the request data, determine the database parameters corresponding to the persistence operation, wherein the database parameters include: database table name, database table field, and database table field value;

[0070] After the above interface function receives the above database parameters, it performs regular matching on the above database parameters to obtain a matching result;

[0071] The database parameters are filtered according to the matching results to obtain processed database parameters;

[0072] Based on the processed database parameters, a structured query statement corresponding to the above interface function is constructed;

[0073] The above structured query statement is used to perform the above persistence operation to obtain the above persistence operation result.

[0074] Optionally, for specific persistence operations, developers can call the four interface functions of the corresponding data addition operation (insert), data deletion operation (delete), data modification operation (update), and data query operation (select) opened by the DataChange module according to their needs, and pass the database parameters that need to be persisted (such as database table name, database table field, and database table field value) as parameters to the corresponding interface function. The interface function will first match the received database parameters with relevant sensitive words through regular expressions. For the matched database table fields and database table field values, they will be spliced ​​into SQL statements according to the string formatting method, and then the spliced ​​SQL statements will be executed through the execute method of the cursor object to perform database operations. The return value is a dictionary composed of the data operated on. For query operations, a list of multiple data that meet the conditions can be returned in the form of a dictionary.

[0075] Optional, such as Figure 2 As shown, the above-mentioned DataChange module is used. After the interface function receives the above-mentioned database parameters, regular matching is performed on the above-mentioned database parameters to filter out sensitive information and obtain processed database parameters. Based on the above-mentioned processed database parameters, a structured query statement (i.e., SQL statement) corresponding to the above-mentioned interface function is constructed. The above-mentioned SQL statement may be, but is not limited to, an insert statement corresponding to a data addition operation, an update statement corresponding to a data modification operation, a select statement corresponding to a data query operation, and a delete statement corresponding to a data deletion operation. The above-mentioned structured query statement is used to perform the above-mentioned persistence operation to obtain the above-mentioned persistence operation result.

[0076] It should be noted that only data persistence operations are performed in the microserver, while the establishment of database tables and database table fields is performed in the main server. In addition to distributing front-end routes and authenticating users, the main server also includes the migration of database models. The specific implementation method is: in the model class models.py file of the main server, with the help of the ORM module that comes with the application framework Django, each database table is defined in the form of a model class, the database table fields are defined in the form of model class attributes, and the database table field values ​​(that is, the specific type of the database table field) are defined in the form of model class attribute values. In the configuration settings.py file, the database is configured with the database name, user name, password and database IP address. After the configuration is completed, the constructed model class can be mapped to the database for model relationship by executing the Django database migration command, without manually building each database table and field.

[0077] In an optional embodiment, when the persistence operation is the above-mentioned data deletion operation, the above-mentioned method further includes:

[0078] Before performing the data deletion operation based on the processed database parameters and using the structured query statement corresponding to the interface function, the database corresponding to the database parameters is backed up.

[0079] It should be noted that, optionally, for the delete interface function, the field value passed in will be matched with a regular expression inside the function. Delete operations involving sensitive operations (for example, keywords involving deleting a database or deleting an entire table) will directly return a warning message and restrict the user from operating the database within a certain period of time. When deleting a large amount of data through conditional statements, a prompt message will first be returned for user confirmation and the current database content will be backed up at the same time to avoid various malicious database deletion operations caused by SQL injection.

[0080] Optionally, the above method also includes: obtaining a pre-built connection pool, wherein the above connection pool stores the connection relationship between the target account and the above database; after obtaining the above connection relationship from the above connection pool, based on the above request data, performing the above persistence operation on the above database corresponding to the above request data in the above micro server to obtain the above persistence operation result.

[0081] It's important to note that if persistence operations are frequent, each time a connection is established between the requesting user and the database, the connection is closed after the persistence operation is performed, and this obviously creates redundant operations and poses a security risk to the database. To address this, a custom connection pool is used to establish a certain number of connections. If a persistence operation is required, a connection is extracted from the pool for a separate operation, and the connection is returned to the pool after the operation is complete. If the number of connections is insufficient, a separate connection is established for the persistence operation and closed after the operation is complete. The connection pool specifically instantiates a certain number of DataChange objects at project startup and stores each object in a list of connection sets (i.e., the connection pool). When a connection is extracted, it is temporarily removed from the list of connection sets (i.e., the connection pool) and added to a temporary list of another connection set in use. After the persistence operation on this connection is completed, the connection is returned to the unused connection set (i.e., the connection pool). The completion of the persistence operation is determined by whether the database transaction is committed, that is, whether the commit function is called.

[0082] According to an embodiment of the present invention, a data processing method is further provided, the method comprising:

[0083] Step S1102: the primary server receives the request data;

[0084] Step S1104: The main control device determines the micro server corresponding to the main server according to the request data;

[0085] Step S1106: The master control device determines whether the main server and the micro server belong to the same server, and obtains a determination result;

[0086] Step S1107: the main control device determines a corresponding compile function according to the determination result, and compiles the preset interface file based on the compile function to obtain a target interface file.

[0087] Step S1110: The master control device transmits the target interface file to the main server and the micro server, wherein the target interface file is used to synchronize the transmission interface between the main server and the micro server;

[0088] Step S1112: Control the main server to transmit the request data to the micro server based on the synchronized transmission interface;

[0089] Step S1114: the micro server receives the request data from the main server.

[0090] Through the above steps, the goal of quickly synchronizing the main server and microserver through custom compilation functions can be achieved, thereby simplifying the synchronization process of the main service and microservice interfaces and improving project development efficiency. This solves the technical problem of cumbersome synchronization process of the main service and microservice interfaces during back-end development, which leads to low project development efficiency.

[0091] Based on the above embodiment and optional embodiment, the present invention proposes an optional implementation mode: Figure 3 A flowchart of an optional data processing method according to an embodiment of the present invention is as follows: Figure 3 As shown in the figure, the specific process is as follows: When a user clicks a button or a module on the front-end interface, a corresponding click event is triggered, and the corresponding Ajax request is sent to the main server according to the interface defined in the RESTful style. After receiving the corresponding request, the main server distributes the request data to the corresponding view function according to the interface set defined in the routing control file urls.py, and performs authentication at the same time. After the above request data is authenticated, consul is used to obtain the microserver IP and port. Based on the interface and data type defined in the proto file, the request data is transmitted to the gRPC server of the corresponding microserver via the gRPC protocol. Based on the interface file defined in the proto file, the microserver distributes the request data to the corresponding persistence function for persistence operation, and returns the result of the persistence operation to the main server. The main server returns the final result to the front-end, and finally presents it to the user. After the entire project is developed, it is containerized and deployed through the Docker image.

[0092] It should be noted that the embodiments of the present invention improve and add some functions on the basis of the existing open source back-end development framework, and for developers in this professional field, there is no problem of relearning another development framework to a large extent. In terms of service registration and discovery, the service registration center Consul adopted in this solution can display the operating status of each microserver in real time on the page. It is only necessary to write the host IP and name of the microserver in the specified location of the registration script and then run the registration script to register the microserver into the Consul management center. In terms of data transmission between the main server and the microserver, the gRPC protocol plus ProtoBuf is used to define and transmit the data interface, and the steps for compiling the proto file are simplified. In terms of database operations of the project, the database tables and fields and their types are defined in the main server in the form of Python model classes in the form of object-relational mapping, and their fields are defined in the form of model class attributes, and then the command is executed to migrate to the database, which reduces the complexity of the database structure writing method. For microserver persistence, we customized a persistence module to operate the database. By customizing and encapsulating database operation functions, and using regular expressions to match sensitive statements and delete related operations, we backed up the database to prevent large amounts of data loss due to misoperation. This improved query and operation efficiency while also ensuring database security. For project deployment, we used Docker for containerized deployment. Each microserver was stored and transferred as an image by writing a corresponding Dockerfile. Independent containers were then generated based on the image, improving the isolation of the entire project and maximizing the performance of the server hardware.

[0093] The embodiments of the present invention have at least the following effects:

[0094] 1) Compared with the monolithic development solution, in the embodiment of the present invention, when there are many system modules or a single module has many logical business functions, each module is run and processed separately. When the project is initially run, the back-end part only needs to run the relevant definitions in the main server completely. As for the remaining microservers, they only need to be registered in consul. When relevant persistent processing is required, they can be obtained from consul and connected through gRPC.

[0095] 2) Compared to DRF's built-in ORM, this embodiment of the present invention rewrites some methods based on the Connection class in the connections module of the Python third-party package pymysql, customizes and encapsulates four types of interfaces for developers to call: add, delete, modify, and query. This avoids the ORM's poor performance for complex queries and eliminates the tedious operation of repeatedly writing similar SQL statements by encapsulating the interface.

[0096] 3) Compared with the compilation method of interface files, the embodiment of the present invention concentrates the compilation commands of different languages ​​in the function by constructing a compilation function, and provides two solutions for moving the generated files after compilation. The first solution is that when the main server and the micro server are on the same server, the Python built-in sys module can be used to simulate the command line output mv statement to move the file; the second solution is that when the two are not on the same server, the file is transferred to the specified server via ftp through the Python built-in ftplib module. This solution only requires passing the IP and port of the other server into the compilation function at the same time.

[0097] 4) In the deployment phase after project development is completed, the embodiment of the present invention uses Docker for containerized deployment. The traditional deployment method is to first configure the service environment and then pull the project to the server to deploy the front-end and back-end separately. In the case of changing the server, this process needs to be repeated. The advantage of this solution is that only the environment requirements need to be written into the Dockerfile file to generate the image in sequence, and then the container generated according to the image can be normally accessed externally by opening the specified port, which improves the isolation between each service. At the same time, if the server needs to be changed, it is only necessary to package and move the image without redeploying the server environment.

[0098] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0099] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of various embodiments of the present invention.

[0100] According to an embodiment of the present invention, a system embodiment for implementing the above data processing method is also provided. Figure 4 FIG. 1 is a structural diagram of a data processing system according to an embodiment of the present invention. Figure 4 As shown, the above data processing system includes: a main server 400, a main control device 402, and a micro server 404, wherein:

[0101] The main server 400 is used to receive the requested data;

[0102] The main control device 402 is connected to the main server and is used to determine the micro server corresponding to the main server according to the request data; determine whether the main server and the micro server belong to the same server and obtain a determination result; determine the corresponding compilation function according to the determination result, and compile the preset interface file based on the compilation function to obtain a target interface file; transmit the target interface file to the main server and the micro server, wherein the target interface file is used to realize the synchronous control of the transmission interface between the main server and the micro server; the main server transmits the request data to the micro server based on the synchronized transmission interface;

[0103] The micro server 404 is connected to the main server and the main control device, and is used to receive the request data from the main server.

[0104] In an embodiment of the present invention, the main server 400 is set to receive request data; the main control device 402 is connected to the main server and is used to determine the microserver corresponding to the main server according to the request data; it is determined whether the main server and the microserver belong to the same server to obtain a judgment result; the corresponding compilation function is determined according to the judgment result, and the preset interface file is compiled based on the compilation function to obtain a target interface file; the target interface file is transmitted to the main server and the microserver, wherein the target interface file is used to realize synchronous control of the transmission interface between the main server and the microserver; the main server transmits the request data to the microserver based on the synchronized transmission interface; the microserver 404 is connected to the main server and the main control device and is used to receive the request data from the main server, thereby achieving the purpose of realizing fast synchronization between the main server and the microserver through the custom compilation function, thereby achieving the technical effect of simplifying the synchronization process of the main service and microservice interface and improving project development efficiency, thereby solving the technical problem of cumbersome synchronization process of the main service and microservice interface in the back-end development process, which leads to low project development efficiency.

[0105] It should be noted that in this application Figure 4 The specific structure of the data processing system shown in the figure is only for reference. In specific applications, the data processing system in this application can be compared with the data processing system in the figure. Figure 4The main server 400, the master device 402, and the micro server 404 shown have more or less structures.

[0106] It should be noted that any optional or preferred data processing method in the above embodiments can be executed or implemented in the data processing provided in this embodiment.

[0107] In addition, it should be noted that the optional or preferred implementation of this embodiment can refer to the relevant description in the above method embodiment, which will not be repeated here.

[0108] In this embodiment, a data processing device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments. Details that have already been described will not be repeated here. As used below, the terms "module" and "device" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0109] According to an embodiment of the present invention, there is also provided an embodiment of a device for implementing the above data processing method. Figure 5 FIG. 1 is a structural diagram of a data processing device according to an embodiment of the present invention. Figure 5 As shown, the data processing device includes: a first acquisition module 500, a first determination module 502, a first judgment module 504, a first compilation module 506, a first transmission module 508, and a second transmission module 510, wherein:

[0110] The first acquisition module 500 is configured to acquire request data and synchronize the request data to the master server;

[0111] The first determining module 502 is configured to determine the micro server corresponding to the main server according to the request data;

[0112] The first determination module 504 is configured to determine whether the main server and the micro server belong to the same server and obtain a determination result;

[0113] The first compiling module 506 is configured to determine a corresponding compiling function according to the determination result, and to compile the preset interface file based on the compiling function to obtain a target interface file.

[0114] The first transmission module 508 is configured to transmit the target interface file to the main server and the micro server, wherein the target interface file is used to synchronize the transmission interface between the main server and the micro server;

[0115] The second transmission module 510 is configured to control the main server to transmit the request data to the micro server based on the synchronized transmission interface.

[0116] In an embodiment of the present invention, the first acquisition module 500 is provided for acquiring request data and synchronizing the request data to the main server; the first determination module 502 is provided for determining the microserver corresponding to the main server based on the request data; the first judgment module 504 is provided for determining whether the main server and the microserver belong to the same server and obtaining a judgment result; the first compilation module 506 is provided for determining the corresponding compilation function based on the judgment result, and compiling the preset interface file based on the compilation function to obtain a target interface file; the first transmission module 508 is provided for transmitting the target interface file to the main server and the microserver, wherein the target interface file is used to synchronize the transmission interface between the main server and the microserver; and the second transmission module 510 is provided for controlling the main server to transmit the request data to the microserver based on the synchronized transmission interface. This achieves the purpose of achieving rapid synchronization between the main server and the microserver through a custom compilation function, thereby simplifying the synchronization process between the main service and microservice interfaces and improving project development efficiency. This solves the technical problem of cumbersome synchronization between the main service and microservice interfaces during back-end development, which leads to low project development efficiency.

[0117] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0118] It should be noted that the first acquisition module 500, first determination module 502, first judgment module 504, first compilation module 506, first transmission module 508, and second transmission module 510 described above correspond to steps S102 to S112 in the embodiment. The examples and application scenarios implemented by these modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiment. It should be noted that the above modules, as part of the device, can be run in a computer terminal.

[0119] It should be noted that the optional or preferred implementation of this embodiment can be found in the relevant description in the embodiment, which will not be repeated here.

[0120] The above-mentioned data processing device may also include a processor and a memory. The above-mentioned first acquisition module 500, first determination module 502, first judgment module 504, first compilation module 506, first transmission module 508, second transmission module 510, etc. are all stored in the memory as program modules, and the processor executes the above-mentioned program modules stored in the memory to realize corresponding functions.

[0121] The processor includes a core, which retrieves corresponding program modules from memory. There can be one or more cores. Memory may include non-permanent memory in a computer-readable medium, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory includes at least one memory chip.

[0122] According to an embodiment of the present application, an embodiment of a non-volatile storage medium is further provided. Optionally, in this embodiment, the non-volatile storage medium includes a stored program, wherein when the program is executed, the device where the non-volatile storage medium is located is controlled to execute any of the above-mentioned data processing methods.

[0123] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group, and the non-volatile storage medium includes a stored program.

[0124] Optionally, when the program is running, the device where the non-volatile storage medium is located is controlled to perform the following functions: obtain request data; determine the micro-server corresponding to the main server based on the above request data; judge whether the above main server and the above micro-server belong to the same server, and obtain a judgment result; determine the corresponding compilation function based on the above judgment result, and compile the preset interface file based on the above compilation function to obtain a target interface file; transmit the above target interface file to the above main server and the above micro-server, wherein the above target interface file is used to realize the synchronization of the transmission interface between the above main server and the above micro-server; send the above request data to the above main server, and control the above main server to transmit the above request data to the above micro-server based on the synchronized transmission interface.

[0125] According to an embodiment of the present application, an embodiment of a processor is further provided. Optionally, in this embodiment, the processor is used to run a program, wherein the program executes any one of the above-mentioned data processing methods when it is run.

[0126] According to an embodiment of the present application, an embodiment of a computer program product is also provided, which, when executed on a data processing device, is suitable for executing a program that initializes any one of the steps of the above-mentioned data processing method.

[0127] Optionally, the above-mentioned computer program product, when executed on a data processing device, is suitable for executing a program initialized with the following method steps: obtaining request data; determining the microserver corresponding to the main server based on the above-mentioned request data; judging whether the above-mentioned main server and the above-mentioned microserver belong to the same server, and obtaining a judgment result; determining the corresponding compilation function based on the above-mentioned judgment result, and compiling the preset interface file based on the above-mentioned compilation function to obtain a target interface file; transmitting the above-mentioned target interface file to the above-mentioned main server and the above-mentioned microserver, wherein the above-mentioned target interface file is used to realize the synchronization of the transmission interface between the above-mentioned main server and the above-mentioned microserver; sending the above-mentioned request data to the above-mentioned main server, and controlling the above-mentioned main server to transmit the above-mentioned request data to the above-mentioned microserver based on the synchronized transmission interface.

[0128] According to an embodiment of the present application, an embodiment of a processor is further provided. Optionally, in this embodiment, the processor is used to run a program, wherein when the program is run, any of the above-mentioned data processing fault detection methods is executed.

[0129] like Figure 6 As shown, an embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and capable of running on the processor. When the processor executes the program, the following steps are implemented: obtaining request data; determining the micro-server corresponding to the main server based on the above request data; judging whether the above main server and the above micro-server belong to the same server, and obtaining a judgment result; determining the corresponding compilation function based on the above judgment result, and compiling the preset interface file based on the above compilation function to obtain a target interface file; transmitting the above target interface file to the above main server and the above micro-server, wherein the above target interface file is used to realize synchronization of the transmission interface between the above main server and the above micro-server; sending the above request data to the above main server, and controlling the above main server to transmit the above request data to the above micro-server based on the synchronized transmission interface.

[0130] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.

[0131] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0132] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the above modules can be a logical function division. In actual implementation, there may be other division methods, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, modules or indirect coupling or communication connection of modules, which can be electrical or other forms.

[0133] The modules described above as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0134] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or software functional modules.

[0135] If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable non-volatile storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a non-volatile storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present invention. The aforementioned non-volatile storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, and other media that can store program codes.

[0136] The above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A data processing method, characterized in that: include: Obtaining request data and synchronizing the request data to the main server; Determine the micro server corresponding to the main server according to the request data; Determine whether the main server and the micro server belong to the same server, and obtain a determination result; Determining a corresponding compile function according to the judgment result, and compiling a preset interface file based on the compile function to obtain a target interface file; Transmitting the target interface file to the main server and the micro server, wherein the target interface file is used to synchronize the transmission interface between the main server and the micro server; The main server is controlled to transmit the request data to the micro server based on the synchronized transmission interface.

2. The method according to claim 1, characterized in that The determining of a corresponding compilation function according to the judgment result, and compiling a preset interface file based on the compilation function to obtain a target interface file, includes: If the judgment result indicates that the main server and the micro server belong to the same server, a first compilation function is used to compile the preset interface file to obtain the target interface file, wherein the input parameters corresponding to the first compilation function include: a file address corresponding to the target interface file, a main server address corresponding to the main server, and a micro server address corresponding to the micro server.

3. The method according to claim 2, characterized in that The determining of a corresponding compilation function according to the judgment result, and compiling a preset interface file based on the compilation function to obtain a target interface file, includes: If the judgment result indicates that the main server and the micro server do not belong to the same server, a second compilation function is used to compile the preset interface file to obtain the target interface file, wherein the input parameters corresponding to the second compilation function include: the file address, the main server address, the micro server address, the server address, user name, and key corresponding to the main server and the micro server respectively.

4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Determine corresponding image files for the main server and the micro server respectively; Based on the image files corresponding to the main server and the micro server respectively, the main server and the micro server are deployed in a containerized manner.

5. A data processing method, characterized in that: include: The micro-server corresponding to the main server receives a target interface file from a master control device, wherein the target interface file is used to synchronize the transmission interface between the main server and the corresponding micro-server. The target interface file is obtained by the master control device by obtaining request data and synchronizing the request data to the main server; determining the micro-server corresponding to the main server according to the request data; determining whether the main server and the micro-server belong to the same server to obtain a judgment result; determining a corresponding compilation function according to the judgment result, and compiling a preset interface file based on the compilation function; After the master control device sends the request data to the main server, the micro server receives the request data from the main server based on the synchronized transmission interface.

6. The method according to claim 5, characterized in that The method further comprises: Based on the request data, performing a persistence operation on a database corresponding to the request data to obtain a persistence operation result, wherein the persistence operation includes at least one of the following: a data addition operation, a data deletion operation, a data modification operation, and a data query operation; The persistence operation result is returned to the primary server.

7. The method according to claim 6, characterized in that The performing a persistence operation on a database corresponding to the request data based on the request data to obtain a persistence operation result includes: Obtain the interface function corresponding to the persistence operation; Determine database parameters corresponding to the persistence operation based on the request data, wherein the database parameters include: database table name, database table field, and database table field value; After the interface function receives the database parameters, regular matching is performed on the database parameters to obtain a matching result; Filtering the database parameters according to the matching results to obtain processed database parameters; Based on the processed database parameters, a structured query statement corresponding to the interface function is constructed; the structured query statement is used to perform the persistence operation to obtain the persistence operation result.

8. The method according to claim 7, characterized in that When the persistence operation is the data deletion operation, the method further includes: Before performing the data deletion operation based on the processed database parameters and using the structured query statement corresponding to the interface function, backing up the database corresponding to the database parameters.

9. A data processing method, characterized in that: include: The main server receives the request data; The main control device determines the micro server corresponding to the main server according to the request data; The main control device determines whether the main server and the micro server belong to the same server, and obtains a determination result; The main control device determines a corresponding compile function according to the judgment result, and compiles the preset interface file based on the compile function to obtain a target interface file; The master control device transmits the target interface file to the main server and the micro server, wherein the target interface file is used to synchronize the transmission interface between the main server and the micro server; The master control device controls the main server to transmit the request data to the micro server based on the synchronized transmission interface; The micro server receives the request data from the main server.

10. A data processing system, characterized in that: include: The main server is used to receive request data; A main control device, connected to the main server, and configured to determine the micro server corresponding to the main server according to the request data; Determine whether the main server and the micro server belong to the same server, and obtain a determination result; determine a corresponding compilation function according to the determination result, and compile a preset interface file based on the compilation function to obtain a target interface file; Transmitting the target interface file to the main server and the micro server, wherein the target interface file is used to synchronize the transmission interface between the main server and the micro server; controlling the main server to transmit the request data to the micro server based on the synchronized transmission interface; The micro server is connected to the main server and the main control device, and is used to receive the request data from the main server.

11. A data processing device, characterized in that: include: A first acquisition module is used to acquire request data and synchronize the request data to the main server; A first determining module, configured to determine a micro server corresponding to the main server according to the request data; A first judgment module is used to judge whether the main server and the micro server belong to the same server and obtain a judgment result; a first compiling module, configured to determine a corresponding compiling function according to the judgment result, and compile a preset interface file based on the compiling function to obtain a target interface file; a first transmission module, configured to transmit the target interface file to the main server and the micro server, wherein the target interface file is used to synchronize the transmission interface between the main server and the micro server; The second transmission module is configured to control the main server to transmit the request data to the micro server based on the synchronized transmission interface.

12. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the data processing method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Service interface updating method and system based on gRPC micro-service

    CN113608768A

  • Interface document generation method and system and storage medium

    CN113641355A