Data interaction method, server, terminal and computer-readable storage medium
By performing aggregation interface matching and data response configuration on the server side, the problem of frequent definition and development of front-end and back-end interactions is solved, and efficient data interaction and highly scalable solutions are achieved, reducing resource waste.
Patent Information
- Application Number
- CN202210231557.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-10
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2042-03-10
AI Technical Summary
When interacting with front and back ends, the existing technology requires frequent definition and development of interfaces, resulting in waste of resources and poor scalability, and the inability to efficiently handle multiple interaction requests.
By implementing the aggregation interface matching and cached data matching on the server side, a unified interface request is generated to call multiple interfaces on the backend, and through data response configuration processing and filtering, the number of interactions between front and backend is reduced and data acquisition efficiency is improved.
It realizes reducing the number of front-end interactions, improving data acquisition efficiency and scalability, and being able to reuse the aggregation interface server, reducing resource waste.
Smart Images

Figure CN114615242B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a data interaction method, a server, a terminal and a computer-readable storage medium. Background Art
[0002] The front-end and back-end interactions are usually implemented through remote calls of HTTP interfaces. The interaction between the front-end and back-end varies with the demand for performance, etc. The staff needs to redefine the front-end and back-end interaction interfaces, the front-end needs to redevelop the corresponding parsing, and the back-end needs to redevelop new interfaces, which will consume a lot of manpower and time to define interfaces and development work, resulting in waste of resources and poor scalability. Summary of the invention
[0003] To solve the above technical problems, the embodiments of the present invention provide a data interaction method, a server, a terminal and a computer-readable storage medium, which can solve the problems of resource waste and poor scalability caused by multiple interactions between the front end and the back end.
[0004] The technical solution of the present invention is achieved in this way:
[0005] The embodiment of the present invention provides a data interaction method, which is characterized by being applied to a server and comprising:
[0006] Receive the interface request sent by the front end;
[0007] Matching the first aggregation interface information carried in the interface request with the cached aggregation data in the local cache to obtain a matching result;
[0008] When the matching result indicates a successful match, a unified interface request is generated based on the first aggregate interface information to call multiple interfaces of the backend, and access data corresponding to each of the multiple interfaces fed back by the backend is obtained;
[0009] Based on the access data, valid access data is obtained through data response configuration and sent to the front end.
[0010] In the above solution, the first aggregate interface information is a first aggregate interface identifier, and the aggregate interface identifier is formed by integrating identifiers of multiple interface information into one aggregate interface information;
[0011] The matching of the first aggregation interface information carried in the interface request with the locally cached cached aggregation data to obtain a matching result includes:
[0012] If the first aggregation interface identifier exists in the cached aggregation data in the local cache, a successful matching result is obtained;
[0013] If the first aggregation interface identifier does not exist in the cached aggregation data in the local cache, a matching result of matching failure is obtained.
[0014] In the above solution, the first aggregated interface information is a plurality of interface information;
[0015] The matching of the first aggregation interface information carried in the interface request with the locally cached cached aggregation data to obtain a matching result includes:
[0016] If at least two of the plurality of interface information exist in the cached aggregate data cached locally, a successful matching result is obtained;
[0017] If the plurality of interface information does not exist in the cached aggregate data in the local cache, a matching result of matching failure is obtained.
[0018] In the above solution, before matching the first aggregation interface information carried in the interface request with the locally cached cached aggregation data to obtain a matching result, the method further includes:
[0019] Get information of multiple interfaces to be aggregated;
[0020] Based on the information of the multiple interfaces to be aggregated, perform aggregation interface configuration, and obtain second aggregation interface information and a corresponding second aggregation interface identifier;
[0021] The second aggregation interface information is parsed to obtain the cache data; wherein the cache data includes the second aggregation interface identifier corresponding to the second aggregation interface information and the plurality of interface information to be aggregated.
[0022] In the above solution, the step of configuring the aggregate interface based on the information of the multiple interfaces to be aggregated, and acquiring the second aggregate interface information and the corresponding second aggregate interface identifier includes:
[0023] Based on the information of the multiple interfaces to be aggregated, performing aggregation interface settings in the aggregation interface configuration to obtain setting information;
[0024] Based on the information of the multiple interfaces to be aggregated, perform data response configuration in the aggregate interface configuration to obtain configuration information;
[0025] Based on the setting information and the configuration information, data integration is performed to obtain the second aggregation interface information and the corresponding second aggregation interface identifier.
[0026] In the above solution, the plurality of interface information to be aggregated includes:
[0027] The interface paths, interface request types, interface request data and interface identifiers corresponding to the multiple interfaces to be aggregated;
[0028] The step of performing the aggregate interface setting in the aggregate interface configuration based on the information of the multiple interfaces to be aggregated to obtain the setting information includes:
[0029] Based on the interface paths, interface request types, interface request data and interface identifiers corresponding to the multiple interfaces to be aggregated, respectively, aggregate interface settings are performed to obtain setting interface path information, setting interface request type information, setting interface request data information and setting interface identifier information;
[0030] Based on the setting interface path information, the setting interface request type information, the setting interface request data information and the setting interface identification information, data information integration is performed to obtain the setting information.
[0031] In the above scheme, the data response configuration in the aggregate interface configuration is performed based on the information of the multiple interfaces to be aggregated to obtain the configuration information, including:
[0032] Performing data response parsing on the plurality of interface information to be aggregated to obtain return data path information corresponding to the plurality of interfaces;
[0033] Based on the returned data path information, data integration is performed to obtain the configuration information.
[0034] In the above solution, after matching the first aggregation interface information carried in the interface request with the cached aggregation data in the local cache to obtain a matching result, the method further includes:
[0035] When the matching result indicates a matching failure, the aggregation server stops accessing and generates termination information;
[0036] The termination information is sent to the front end.
[0037] In the above solution, based on the access data, obtaining valid access data through data response configuration and sending it to the front end includes:
[0038] Filtering the access data through the configuration information of the data response configuration to obtain useful access data;
[0039] Reorganizing the useful access data to obtain the effective access data;
[0040] The valid access data is sent to the front end.
[0041] An embodiment of the present invention provides a data interaction method, characterized in that it is applied to a terminal, the terminal includes a front end and a back end, including:
[0042] Sending an interface request carrying the first aggregate interface information to the server;
[0043] Receiving a unified interface request sent by the server after successful matching based on the first aggregation interface information;
[0044] Based on the unified interface request, access data is obtained and sent to the server;
[0045] The valid access data processed by the server based on the access data is received.
[0046] In the above solution, before sending the first interface request carrying the aggregate interface information to the server, the method further includes:
[0047] Get multiple interface information;
[0048] The multiple interface information are integrated into one interface information to obtain the first aggregate interface information; wherein the first aggregate interface information is a first aggregate interface identifier.
[0049] In the above solution, before sending the interface request carrying the first aggregate interface information to the server, the method further includes:
[0050] Get multiple interface information;
[0051] The multiple interface information is used as the first aggregate interface information; wherein the first aggregate interface information is multiple interface information.
[0052] The embodiment of the present disclosure provides a server, the server comprising a first receiving unit, a first acquiring unit and a first sending unit; wherein,
[0053] The first receiving unit is used to receive an interface request sent by the front end;
[0054] The first acquisition unit is used to match the first aggregate interface information carried in the interface request with the cached aggregate data in the local cache to obtain a matching result; when the matching result indicates a successful match, a unified interface request is generated based on the first aggregate interface information to call multiple interfaces of the backend, and access data corresponding to each of the multiple interfaces fed back by the backend is obtained;
[0055] The first sending unit is used to obtain valid access data based on the access data and send the valid access data to the front end through data response configuration.
[0056] The present disclosure provides a terminal, which includes a second sending unit and a second receiving unit; wherein:
[0057] The second sending unit is used to send an interface request carrying the first aggregated interface information to the server;
[0058] The second receiving unit is used to receive a unified interface request sent by the server after a successful match based on the first aggregation interface information;
[0059] The second sending unit is used to obtain access data based on the unified interface request and send the access data to the server;
[0060] The second receiving unit receives the valid access data processed by the server based on the access data.
[0061] An embodiment of the present disclosure provides a server, the server comprising:
[0062] A first memory, used to store executable data instructions;
[0063] The first processor is used to execute the executable instructions stored in the first memory. When the executable instructions are executed, the first processor executes the data interaction method.
[0064] An embodiment of the present disclosure provides a terminal, the terminal comprising:
[0065] A second memory, used for storing executable data instructions;
[0066] The second processor is used to execute the executable instructions stored in the second memory. When the executable instructions are executed, the second processor executes the data interaction method.
[0067] An embodiment of the present invention provides a computer-readable storage medium, wherein the storage medium stores executable instructions, and when the executable instructions are executed, is used to cause a first processor to execute the data interaction method as described in the embodiment of the present invention.
[0068] An embodiment of the present invention provides a computer-readable storage medium, wherein the storage medium stores executable instructions, and when the executable instructions are executed, the second processor is used to execute the data interaction method as described in the embodiment of the present invention.
[0069] The embodiment of the present invention provides a data interaction method, a server, a terminal and a computer-readable storage medium, wherein the method includes: receiving an interface request sent by a front end; matching the first aggregate interface information carried in the interface request with the cached aggregate data in the local cache to obtain a matching result; when the matching result indicates a successful match, generating a unified interface request based on the first aggregate interface information to call multiple interfaces of the back end to obtain access data corresponding to each of the multiple interfaces fed back by the back end; based on the access data, through data response configuration, obtaining valid access data and sending it to the front end. In the above scheme, the first aggregate interface information carried by the interface request is matched with the cached aggregate data in the local cache. If the match is successful, the access data corresponding to each of the multiple interfaces will be obtained at one time, and then the access data will be integrated to obtain valid access data. Finally, the valid access data will be sent to the front end at one time, which reduces the number of interactions between the front end and the back end, is reusable, and has strong scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 is an optional device framework diagram of a data interaction method provided by an embodiment of the present invention;
[0071] Figure 2 An optional process diagram of a data interaction method applied to a server provided in an embodiment of the present invention Figure 1 ;
[0072] Figure 3 An optional process diagram of a data interaction method applied to a server provided in an embodiment of the present invention Figure 2 ;
[0073] Figure 4 An optional process diagram of a data interaction method applied to a server provided in an embodiment of the present invention Figure 3 ;
[0074] Figure 5 An optional process diagram of a data interaction method applied to a terminal provided in an embodiment of the present invention Figure 4 ;
[0075] Figure 6 An optional flow chart of a data interaction method provided by an embodiment of the present invention;
[0076] Figure 7 Another optional flow chart of a data interaction method provided by an embodiment of the present invention;
[0077] Figure 8 A schematic diagram of a server structure provided in an embodiment of the present invention Figure 1 ;
[0078] Fig. 9 A schematic diagram of a terminal structure provided by an embodiment of the present invention Figure 1 ;
[0079] Fig.10 A schematic diagram of a server structure provided in an embodiment of the present invention Figure 2 ;
[0080] Fig.11 A schematic diagram of a terminal structure provided by an embodiment of the present invention Figure 2 . DETAILED DESCRIPTION
[0081] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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 creative work are within the protection scope of the present invention.
[0082] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Figure 1 It is an optional device framework diagram of a data interaction method provided by an embodiment of the present invention. Figure 1 The terminal and the server in the embodiment of the present invention are suitable for the scenario of data interaction.
[0083] Figure 2 This is an optional flow diagram of a data interaction method applied to a server provided by an embodiment of the present invention. Figure 1 , will combine Figure 2 The steps shown are explained.
[0084] S101: Receive an interface request sent by a front end.
[0085] In some embodiments of the present invention, the interface request sent by the front end carries first aggregate interface information, which may be an aggregate information composed of multiple interface information and has a corresponding first aggregate interface identifier; the first aggregate interface information may also be multiple interface information.
[0086] In some embodiments of the present invention, the server is an aggregate interface server, and the server may receive an interface request carrying the first aggregate interface information sent by the front end.
[0087] S102: Match the first aggregation interface information carried in the interface request with the cached aggregation data in the local cache to obtain a matching result.
[0088] In some embodiments of the present invention, the cached aggregate data includes an aggregation identifier of a plurality of interfaces aggregated into one interface and a plurality of interface information.
[0089] In some embodiments of the present invention, the server may match the first aggregation interface information carried in the interface request with cached aggregation data locally cached by the server to obtain two matching results: a successful match and a failed match.
[0090] In some embodiments of the present invention, step S102 may be implemented by S1021 and S1022 as follows:
[0091] S1021: If the first aggregation interface identifier exists in the cached aggregation data in the local cache, a successful matching result is obtained.
[0092] In some embodiments of the present invention, the first aggregate interface information is a first aggregate interface identifier, and the first aggregate interface identifier is formed by integrating identifiers of multiple interface information into one first aggregate interface information.
[0093] In some embodiments of the present invention, the server may search for the first aggregate interface identifier carried in the interface request in the locally cached cached aggregate data. If found, it indicates a successful match, and a successful match result is obtained.
[0094] S1022: If the first aggregation interface identifier exists in the cached aggregation data in the local cache, a successful matching result is obtained.
[0095] In some embodiments of the present invention, the server may search for the first aggregate interface identifier carried in the interface request in the locally cached cached aggregate data. If the first aggregate interface identifier is not found, it indicates that the match fails, and a failed match result is obtained.
[0096] It can be understood that in some embodiments of the present invention, the server can search for the first aggregation interface identifier carried by the interface request in the locally cached cached aggregation data. If found, it means that the match is successful; if not found, it means that the match fails, thereby obtaining a matching result, and further determining whether the data can be called for access, thereby improving the efficiency of accessing data.
[0097] In some embodiments of the present invention, step S102 may also be implemented by S1023 and S1024 as follows:
[0098] S1023: If at least two pieces of interface information to be aggregated among the multiple pieces of interface information to be aggregated exist in the cached aggregation data cached locally, a successful matching result is obtained.
[0099] In some embodiments of the present invention, the first aggregated interface information is a plurality of interface information, and the interface information includes: an interface path, an interface request type, an interface request data, and an interface identifier.
[0100] In some embodiments of the present invention, the server may search for multiple interface information carried by the interface request in the locally cached cache aggregate data. If at least two interface information are found, it indicates a successful match, and a successful match result is obtained.
[0101] Exemplarily, the interface request includes 6 pieces of interface information, and the server finds 3 pieces of interface information in the locally cached cached aggregate data, which indicates a successful match, and the server proceeds to the next step.
[0102] S1024: If the plurality of interface information to be aggregated does not exist in the cached aggregation data in the local cache, a matching result of matching failure is obtained.
[0103] In some embodiments of the present invention, the server may search for multiple interface information carried by the interface request in the locally cached cache aggregate data. If no interface information is found or the number is less than two, it indicates a match failure, resulting in a failed match result.
[0104] Exemplarily, the interface request includes 6 interface information, and the server finds 1 interface information in the locally cached cached aggregate data or does not find the interface information, then the match fails, and the next step is performed.
[0105] It can be understood that in some embodiments of the present invention, the server can search for multiple interface information carried by the interface request in the cache aggregate data cached locally. If at least two interface information are found, it means that the match is successful; if not found or only one interface information is found, it means that the match fails, thereby obtaining a matching result, and further determining whether the data can be called for access, thereby improving the efficiency of accessing data.
[0106] S103: When the matching result indicates a successful match, a unified interface request is generated based on the first aggregate interface information to call multiple interfaces of the backend, and access data corresponding to each of the multiple interfaces fed back by the backend is obtained.
[0107] In some embodiments of the present invention, the unified interface is a convention for connecting different components of a software system, and is used to provide a set of routines that applications and developers can access based on certain software or hardware without having to access the source code or understand the details of the internal working mechanism.
[0108] In some embodiments of the present invention, the server can perform the next operation based on the matching result. If the matching result indicates a successful match, the server will generate a unified interface request based on the first aggregation interface information, and call multiple interfaces of the backend at the same time through the unified interface request, thereby obtaining the access data corresponding to each of the multiple interfaces fed back by the backend.
[0109] S104. Based on the access data, valid access data is obtained through data response configuration and sent to the front end.
[0110] In some embodiments of the present invention, data response configuration is mainly the arrangement of response data. By arranging the data response data structure, the data returned by the interface can be customized, and the required fields can be dynamically adjusted, and the unnecessary fields can be filtered and not displayed. Response arrangement is the process of the server parsing the data returned by the original interface and copying it according to the configured jsonPath value.
[0111] In some embodiments of the present invention, the server may extract effective access data from the access data through data response configuration, obtain the effective access data and send it to the front end.
[0112] It can be understood that in some embodiments of the present invention, the server can receive an interface request sent by the front end; match the first aggregate interface information carried in the interface request with the cached aggregate data of the local cache to obtain a matching result; when the matching result indicates a successful match, a unified interface request is generated based on the first aggregate interface information to call multiple interfaces of the back end, and obtain access data corresponding to each of the multiple interfaces fed back by the back end; based on the access data, through the data response configuration, effective access data is obtained and sent to the front end, thereby reducing the number of interactions between the front end and the back end, improving data acquisition efficiency, and method scalability.
[0113] In some embodiments of the present invention, step S104 may also be implemented by S1041, S1042 and S1043 as follows:
[0114] S1041. Filter access data through configuration information of the data response configuration to obtain useful access data.
[0115] In some embodiments of the present invention, the server may filter the access data through the configuration information of the data response configuration, remove useless information, and obtain useful access data.
[0116] S1042. Reorganize the useful access data to obtain effective access data.
[0117] In some embodiments of the present invention, the server may obtain effective access data by reorganizing the acquired useful access data.
[0118] S1043. Send valid data to the front end.
[0119] In some embodiments of the present invention, the server sends the acquired valid access data to the front end.
[0120] It can be understood that in some embodiments of the present invention, the server can filter the access data through the configuration information of the data response configuration to obtain useful access data; reorganize the useful access data to obtain valid access data; and send the valid data to the front end, thereby improving the effectiveness of the access data.
[0121] In some embodiments of the present invention, Figure 3 This is an optional flow diagram of a data interaction method applied to a server provided by an embodiment of the present invention. Figure 2 , before step S102, it also includes S105-S107. As follows:
[0122] S105: Acquire information of multiple interfaces to be aggregated.
[0123] In some embodiments of the present invention, the server may obtain a plurality of interface information to be aggregated, where the interface information includes an interface path, an interface request type, interface request data, and an interface identifier.
[0124] In some embodiments of the present invention, the interface request types include GET and POST.
[0125] S106: Perform aggregation interface configuration based on information of multiple interfaces to be aggregated, and obtain second aggregation interface information and a corresponding second aggregation interface identifier.
[0126] In some embodiments of the present invention, the aggregate interface configuration includes two parts: aggregate interface setting and data response configuration. The aggregate interface setting includes the interface path to be aggregated, the interface request type, the interface request data, and the interface identifier; the data response configuration includes the arrangement of the response data.
[0127] In some embodiments of the present invention, the server may perform aggregation interface configuration through information of multiple interfaces to be aggregated, and obtain second aggregation interface information and a corresponding second aggregation interface identifier.
[0128] Exemplarily, the interfaces to be aggregated are getUserInfo (interface for obtaining user information) and getUserAddress (for obtaining); both interfaces have their own data structure and interface information; the server can configure a new aggregation interface called getUserAll, and getUserAll is the second aggregation interface identifier corresponding to the second aggregation interface information.
[0129] For example, the following is the configuration implementation code of the aggregation interface.
[0130] The simplified data structure after definition is as follows:
[0131]
[0132]
[0133] In some embodiments of the present invention, Figure 4 An optional process diagram of a data interaction method applied to a server provided by an embodiment of the present invention Figure 3 , step S106 can also be implemented by S1061-S1063 as follows:
[0134] S1061. Based on information of multiple interfaces to be aggregated, perform aggregation interface settings in aggregation interface configuration to obtain setting information.
[0135] In some embodiments of the present invention, the server may perform aggregation interface settings on multiple pieces of interface information to be aggregated to obtain setting information.
[0136] In some embodiments of the present invention, step S1061 may also be implemented by S10611 and S10612 as follows:
[0137] S10611. Based on the interface paths, interface request types, interface request data and interface identifiers corresponding to the multiple interfaces to be aggregated, respectively, aggregate interface settings are performed to obtain interface path setting information, interface request type setting information, interface request data setting information and interface identifier setting information.
[0138] In some embodiments of the present invention, the information of the multiple interfaces to be aggregated includes interface paths, interface request types, interface request data and interface identifiers corresponding to the multiple interfaces to be aggregated.
[0139] In some embodiments of the present invention, the server can perform aggregate interface settings respectively through the interface paths, interface request types, interface request data and interface identifiers corresponding to multiple interfaces to be aggregated, and obtain interface path setting information, interface request type setting information, interface request data setting information and interface identifier setting information.
[0140] S10612: Based on the setting interface path information, the setting interface request type information, the setting interface request data information, and the setting interface identification information, data information is integrated to obtain setting information.
[0141] In some embodiments of the present invention, the server may integrate data information by setting interface path information, setting interface request type information, setting interface request data information, and setting interface identification information to obtain setting information.
[0142] Exemplarily, the following is the implementation code for setting the aggregation interface.
[0143]
[0144] It can be understood that in some embodiments of the present invention, the server can perform aggregate interface settings respectively through the interface paths, interface request types, interface request data and interface identifiers corresponding to multiple interfaces to be aggregated, and obtain interface path setting information, interface request type setting information, interface request data setting information and interface identifier setting information; integrate data information to obtain setting information, provide conditions for obtaining data, and improve the scalability of interface requests.
[0145] S1062: Based on the information of multiple interfaces to be aggregated, perform data response configuration in the aggregate interface configuration to obtain configuration information.
[0146] In some embodiments of the present invention, the server may perform data response configuration through multiple interface information to be aggregated, obtain return data path information corresponding to multiple interfaces, integrate the data path information, and obtain configuration information.
[0147] In some embodiments of the present invention, step S1062 may also be implemented by S10621-S10622 as follows:
[0148] S10621. Perform data response analysis on multiple interface information to be aggregated to obtain return data path information corresponding to the multiple interfaces.
[0149] In some embodiments of the present invention, the server may obtain return data path information corresponding to the multiple interfaces by performing data response parsing on the multiple interface information to be aggregated.
[0150] S10622. Based on the returned data path information, perform data integration to obtain configuration information.
[0151] In some embodiments of the present invention, the server may perform data integration and obtain configuration information by returning data path information.
[0152] Exemplarily, the following is the data response configuration implementation code.
[0153]
[0154] S1063: Perform data integration based on the setting information and the configuration information to obtain second aggregation interface information and a corresponding second aggregation interface identifier.
[0155] In some embodiments of the present invention, the server may perform data integration according to the setting information and the configuration information to obtain the second aggregate interface information and the second aggregate interface identifier corresponding to the second aggregate interface information.
[0156] It can be understood that in some embodiments of the present invention, the server can perform the aggregation interface setting in the aggregation interface configuration through the information of multiple interfaces to be aggregated to obtain the setting information; perform the data response configuration in the aggregation interface configuration through the information of multiple interfaces to be aggregated to obtain the configuration information; perform data integration through the setting information and the configuration information to obtain the second aggregation interface information and the corresponding second aggregation interface identifier, complete the aggregation interface configuration, obtain the second aggregation interface information of multiple interfaces to be aggregated, and provide conditions for subsequent acquisition of access data.
[0157] S107: parse the second aggregation interface information to obtain cache data.
[0158] In some embodiments of the present invention, the cached data includes a second aggregation interface identifier corresponding to the second aggregation interface information and a plurality of interface information to be aggregated.
[0159] In some embodiments of the present invention, the server may perform data information parsing processing on the second aggregation interface information to obtain parsed data and use the parsed data as cache data.
[0160] It can be understood that in some embodiments of the present invention, the server performs aggregation interface configuration for multiple interface information to be aggregated, obtains second aggregation interface information and corresponding aggregation interface identifier; parses the second aggregation interface information to obtain cached data, so that the server does not need to repeatedly parse data, thereby improving the efficiency of data access.
[0161] In some embodiments of the present invention, after step S102, S108 and S109 are further performed as follows:
[0162] S108: When the matching result indicates a matching failure, the aggregation server stops accessing and generates termination information.
[0163] In some embodiments of the present invention, the server may perform the next operation according to the matching result. If the matching result indicates a matching failure, the server will stop accessing and generate a termination message.
[0164] S109, sending the termination information to the front end.
[0165] In some embodiments of the present invention, the server sends a termination message to the front end, and the request ends.
[0166] It is understandable that in some embodiments of the present invention, when the matching result indicates a matching failure, the aggregation server stops accessing and generates a termination message; the termination message is sent to the front end, and the request ends, thereby reducing unnecessary access and improving effective access efficiency.
[0167] In some embodiments of the present invention, Figure 5 An optional process diagram of a data interaction method applied to a terminal provided in an embodiment of the present invention Figure 4 , will combine Figure 5 The steps shown are explained.
[0168] S201. Send an interface request carrying first aggregate interface information to a server.
[0169] In some embodiments of the present invention, the first aggregated interface information is the interface information obtained by processing a plurality of interface information or is directly a plurality of interface information, and the terminal includes a front end and a back end.
[0170] In some embodiments of the present invention, the terminal may send an interface request carrying the first aggregate interface information to the server.
[0171] S202: Receive a unified interface request sent by the server after successful matching based on the first aggregation interface information.
[0172] In some embodiments of the present invention, the terminal receives a unified interface request sent by the server after successful matching based on the first aggregate interface information.
[0173] S203: Based on the unified interface request, obtain access data and send it to the server.
[0174] In some embodiments of the present invention, the terminal unified interface requests to call multiple interfaces, obtain access data, and send the access data to the server.
[0175] S204: Receive valid access data processed by the server based on the access data.
[0176] In some embodiments of the present invention, the terminal receives valid access data sent by the server, and the valid access data is data processed by the server.
[0177] It is understandable that in some embodiments of the present invention, the terminal can send multiple interface information to the server at one time, thereby obtaining valid access data of multiple interfaces at one time, reducing multiple interactions and improving data access efficiency.
[0178] In some embodiments of the present invention, before step S201, S205 and S206 are further performed as follows:
[0179] S205: Acquire multiple interface information.
[0180] In some embodiments of the present invention, the terminal may obtain multiple pieces of interface information, wherein the interface information includes an interface path, an interface request type, an interface request data, and an interface identifier.
[0181] S206. Obtain first aggregate interface information based on the multiple interface information; wherein the first aggregate interface information is a first aggregate interface identifier.
[0182] In some embodiments of the present invention, the terminal may merge multiple interface information into one interface information, and the interface information also has a corresponding first aggregate interface identifier.
[0183] It is understandable that, in some embodiments of the present invention, the terminal may process multiple interface information to obtain first aggregate interface information, which may reduce the number of interactions.
[0184] In some embodiments of the present invention, before step S201, S207 and S208 are further performed as follows:
[0185] S207: Acquire multiple interface information.
[0186] In some embodiments of the present invention, the terminal may obtain multiple pieces of interface information, wherein the interface information includes an interface path, an interface request type, an interface request data, and an interface identifier.
[0187] S208. Use the multiple interface information as first aggregate interface information; wherein the first aggregate interface information is multiple interface information.
[0188] In some embodiments of the present invention, the terminal may directly use multiple interface information as the first aggregate interface information.
[0189] It is understandable that, in some embodiments of the present invention, the terminal may use multiple interface information as the first aggregated interface information, and may directly match the cache data in the server.
[0190] The following describes an exemplary application of an embodiment of the present invention in a practical application scenario.
[0191] An embodiment of the present invention provides an optional flow chart of a data interaction method as shown in FIG. Figure 6 shown.
[0192] S1. The terminal obtains information of multiple interfaces.
[0193] S2. The terminal obtains first aggregate interface information based on multiple interface information.
[0194] S3. The terminal sends an interface request carrying the first aggregation interface information to the server.
[0195] S4. In response to the interface request carrying the first aggregation interface information sent by the terminal, the server matches the first aggregation interface information carried in the interface request sent by the terminal with the cached aggregation data cached locally to obtain a matching result.
[0196] S5. When the matching result indicates that the match is successful, the server generates a unified interface request based on the first aggregation interface information; when the matching result indicates that the match is unsuccessful, the server generates termination information.
[0197] S6. The server sends a unified interface request or termination information to the terminal.
[0198] S7. The terminal responds to the unified interface request sent to the server, calls multiple interfaces, and obtains access data corresponding to the multiple interfaces; the terminal receives termination information and ends the request.
[0199] S8. The terminal sends access data corresponding to the multiple interfaces to the server.
[0200] S9. The server processes the access data sent by the terminal based on the data response configuration to obtain valid access data.
[0201] S10. The server sends the valid access data to the terminal.
[0202] S11. The terminal receives valid access data returned by the server.
[0203] In the above steps, the specific implementation process is consistent with the implementation process of the steps explained above, and will not be repeated here.
[0204] It is understandable that in some embodiments of the present invention, in the prior art, the front-end and the back-end interact multiple times. To reduce the number of interactions, the interaction interface needs to be redefined, the front-end needs to redevelop the corresponding analysis, and the back-end needs to redevelop a new interface. Each time the interface request is different, a new interface needs to be re-set, which has poor scalability. The embodiments of the present invention establish an aggregate interface server as an intermediate layer for the front-end and back-end interactions. Both the front-end and the back-end can send a request to obtain data at one time, which reduces the number of interactions. At the same time, the aggregate interface server can also process the data, which improves the effectiveness of accessing data, and can be reused, with strong scalability.
[0205] The embodiment of the present invention provides another optional flow chart of a data interaction method, such as Figure 7 shown.
[0206] In some embodiments of the present invention, Figure 7 It includes the front end, the aggregation interface server and the back end, and both the front end and the back end are terminals. The front end sends an interface request to the aggregation interface server (equivalent to the server mentioned above), and the interface request carries multiple interface information; the aggregation interface server will configure the aggregation interface before receiving the interface request; when receiving the interface request sent by the front end, it will load the aggregation interface configuration, parse the configuration information, and pass the parsing results to other aggregation interface servers to ensure that each aggregation interface server has the same cached aggregation data; the aggregation interface server will match the multiple interface information carried by the interface request with the cache information, and when the match is successful, it will send a unified interface request to the back end; after receiving the unified interface request, the back end calls multiple interfaces to obtain access data; the back end sends the access data to the aggregation interface server; after receiving the access data, the aggregation interface server processes the access data to obtain valid access data; the aggregation server sends the valid access data to the front end; the front end receives the valid access data.
[0207] It is understandable that in some embodiments of the present invention, in the prior art, the front-end and the back-end interact multiple times. To reduce the number of interactions, the interaction interface needs to be redefined, the front-end needs to redevelop the corresponding analysis, and the back-end needs to redevelop a new interface; it takes a lot of manpower and time to define the interface and development work, and each time the interface request is different, a new interface needs to be re-set, and the scalability is poor. The embodiment of the present invention establishes an aggregate interface server as an intermediate layer for the front-end and back-end interaction. The front-end and the back-end can both send requests to obtain data at one time, reducing the number of interactions. At the same time, the aggregate interface server can also process the data, improving the effectiveness of accessing the data, and can be reused, with strong scalability.
[0208] An embodiment of the present invention provides a server, such as Figure 8 As shown, Figure 8 A schematic diagram of a server structure provided in an embodiment of the present invention Figure 1 The server includes: a first receiving unit 801, a first acquiring unit 802 and a first sending unit 803; wherein,
[0209] The first receiving unit 801 is used to receive an interface request sent by the front end;
[0210] The first acquisition unit 802 is used to match the first aggregate interface information carried in the interface request with the cached aggregate data in the local cache to obtain a matching result; when the matching result indicates a successful match, a unified interface request is generated based on the first aggregate interface information to call multiple interfaces of the backend, and access data corresponding to each of the multiple interfaces fed back by the backend is obtained;
[0211] The first sending unit 803 is used to obtain valid access data based on the access data through data response configuration and send the valid access data to the front end.
[0212] In some embodiments of the present invention, the first aggregate interface information is a first aggregate interface identifier, and the first aggregate interface identifier is formed by integrating identifiers of multiple interface information into one first aggregate interface information;
[0213] The first acquisition unit 802 is used to obtain a matching result of successful matching if the first aggregation interface identifier exists in the cached aggregation data in the local cache; if the first aggregation interface identifier does not exist in the cached aggregation data in the local cache, obtain a matching result of failed matching.
[0214] In some embodiments of the present invention, the first aggregated interface information is a plurality of interface information;
[0215] The first acquisition unit 802 is used to obtain a matching result of successful matching if at least two of the multiple interface information exist in the cache aggregate data cached locally; if the multiple interface information does not exist in the cache aggregate data cached locally, obtain a matching result of failed matching.
[0216] In some embodiments of the present invention, the first acquisition unit 802 is used to obtain multiple interface information to be aggregated; based on the multiple interface information to be aggregated, perform aggregation interface configuration, obtain second aggregation interface information and corresponding second aggregation interface identifier; parse and process the second aggregation interface information to obtain the cache data; wherein the cache data includes the second aggregation interface identifier corresponding to the second aggregation interface information and the multiple interface information to be aggregated.
[0217] In some embodiments of the present invention, the first acquisition unit 802 is used to perform the aggregation interface setting in the aggregation interface configuration based on the multiple interface information to be aggregated to obtain the setting information; perform the data response configuration in the aggregation interface configuration based on the multiple interface information to be aggregated to obtain the configuration information; perform data integration based on the setting information and the configuration information to obtain the second aggregation interface information and the corresponding second aggregation interface identifier.
[0218] In some embodiments of the present invention, the information of the multiple interfaces to be aggregated includes: interface paths, interface request types, interface request data and interface identifiers corresponding to each of the multiple interfaces to be aggregated;
[0219] The first acquisition unit 802 is used to perform aggregation interface settings respectively based on the interface paths, interface request types, interface request data and interface identifiers corresponding to the multiple interfaces to be aggregated, and obtain interface path setting information, interface request type setting information, interface request data setting information and interface identifier setting information; based on the interface path setting information, the interface request type setting information, the interface request data setting information and the interface identifier setting information, perform data information integration to obtain the setting information.
[0220] In some embodiments of the present invention, the first acquisition unit 802 is used to perform data response analysis on the multiple interface information to be aggregated to obtain return data path information corresponding to the multiple interfaces; and perform data integration based on the return data path information to obtain the configuration information.
[0221] In some embodiments of the present invention, the terminal further includes a first generating unit 804, wherein:
[0222] The first generating unit 804 is configured to stop the access of the aggregation server and generate termination information when the matching result indicates a matching failure;
[0223] The first sending unit 803 is used to send the termination information to the front end.
[0224] In some embodiments of the present invention, the first acquisition unit 802 is used to filter the access data through the configuration information of the data response configuration to obtain useful access data; reorganize the useful access data to obtain the valid access data;
[0225] The first sending unit 803 is used to send the valid access data to the front end.
[0226] It can be understood that in some embodiments of the present invention, the server can receive an interface request sent by the front end; match the first aggregate interface information carried in the interface request with the cached aggregate data of the local cache to obtain a matching result; when the matching result indicates a successful match, a unified interface request is generated based on the first aggregate interface information to call multiple interfaces of the back end, and obtain access data corresponding to each of the multiple interfaces fed back by the back end; based on the access data, through the data response configuration, effective access data is obtained and sent to the front end, thereby reducing the number of interactions between the front end and the back end, improving data acquisition efficiency, and method scalability.
[0227] An embodiment of the present invention provides a terminal, such as Fig. 9 As shown, Fig. 9 A schematic diagram of another terminal structure provided by an embodiment of the present invention Figure 1The terminal includes: a second sending unit 901 and a second receiving unit 902; wherein,
[0228] The second sending unit 901 is used to send an interface request carrying the first aggregation interface information to the server;
[0229] The second receiving unit 902 is used to receive a unified interface request sent by the server after the first aggregation interface information is successfully matched;
[0230] The second sending unit 901 is used to obtain access data based on the unified interface request and send the access data to the server;
[0231] The second receiving unit 902 receives the valid access data processed by the server based on the access data.
[0232] In some embodiments of the present invention, the terminal further includes a second acquiring unit 903, wherein:
[0233] The second acquisition unit 903 is used to acquire multiple interface information; integrate the multiple interface information into one interface information to obtain the first aggregate interface information; wherein the first aggregate interface information is a first aggregate interface identifier.
[0234] In some embodiments of the present invention, the terminal further includes a second acquiring unit 903, wherein:
[0235] The second acquisition unit 903 is used to acquire multiple interface information; and use the multiple interface information as the first aggregate interface information; wherein the first aggregate interface information is multiple interface information.
[0236] It is understandable that in some embodiments of the present invention, the terminal can send multiple interface information to the server at one time, thereby obtaining valid access data of multiple interfaces at one time, reducing multiple interactions and improving data access efficiency.
[0237] An embodiment of the present invention provides a server, such as Fig.10 As shown, Fig.10 A schematic diagram of a server structure provided in an embodiment of the present invention Figure 2 The server 10 includes: a first processor 1001 and a first memory 1002; the first memory 1002 stores one or more programs executable by the first processor 1001. When one or more programs are executed, a data interaction method corresponding to the server of the embodiment described above is executed by the first processor 1001.
[0238] An embodiment of the present invention provides a terminal, such as Fig.11 As shown, Fig.11A schematic diagram of a terminal structure provided by an embodiment of the present invention Figure 2 The terminal 11 includes: a second processor 1101 and a second memory 1102; the second memory 1102 stores one or more programs executable by the second processor 1101. When one or more programs are executed, a data interaction method corresponding to the terminal in the above-mentioned embodiment is executed by the second processor 1101.
[0239] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0240] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A server and terminal with functions specified in one or more boxes.
[0241] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction server and a terminal, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0242] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0243] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention.
Claims
1. A data interaction method, characterized in that: Applicable to servers, including: Receive the interface request sent by the front end; Matching the first aggregate interface information carried in the interface request with the locally cached cached aggregate data to obtain a matching result; wherein the first aggregate interface information is a first aggregate interface identifier, and the first aggregate interface identifier is formed by integrating identifiers of multiple interface information into one aggregate interface information; or, the first aggregate interface information is multiple interface information; When the matching result indicates a successful match, a unified interface request is generated based on the first aggregate interface information to call multiple interfaces of the backend, and access data corresponding to each of the multiple interfaces fed back by the backend is obtained; Based on the access data, valid access data is obtained through data response configuration and sent to the front end.
2. The method according to claim 1, characterized in that The matching of the first aggregation interface information carried in the interface request with the locally cached cached aggregation data to obtain a matching result includes: If the first aggregation interface identifier exists in the cached aggregation data in the local cache, a successful matching result is obtained; If the first aggregation interface identifier does not exist in the cached aggregation data in the local cache, a matching result of matching failure is obtained.
3. The method according to claim 1, characterized in that The matching of the first aggregation interface information carried in the interface request with the locally cached cached aggregation data to obtain a matching result includes: If at least two of the plurality of interface information exist in the cached aggregate data cached locally, a successful matching result is obtained; If the plurality of interface information does not exist in the cached aggregate data in the local cache, a matching result of matching failure is obtained.
4. The method according to claim 1, characterized in that Before matching the first aggregation interface information carried in the interface request with the locally cached cached aggregation data to obtain a matching result, the method further includes: Get information of multiple interfaces to be aggregated; Based on the information of the multiple interfaces to be aggregated, perform aggregation interface configuration, and obtain second aggregation interface information and a corresponding second aggregation interface identifier; The second aggregation interface information is parsed to obtain the cache data; wherein the cache data includes the second aggregation interface identifier corresponding to the second aggregation interface information and the plurality of interface information to be aggregated.
5. The method according to claim 4, characterized in that The performing aggregation interface configuration based on the plurality of interface information to be aggregated, and acquiring second aggregation interface information and a corresponding second aggregation interface identifier, includes: Based on the information of the multiple interfaces to be aggregated, performing aggregation interface settings in the aggregation interface configuration to obtain setting information; Based on the information of the multiple interfaces to be aggregated, perform data response configuration in the aggregate interface configuration to obtain configuration information; Based on the setting information and the configuration information, data integration is performed to obtain the second aggregation interface information and the corresponding second aggregation interface identifier.
6. The method according to claim 5, characterized in that The plurality of interface information to be aggregated includes: The interface paths, interface request types, interface request data and interface identifiers corresponding to the multiple interfaces to be aggregated; The step of performing the aggregate interface setting in the aggregate interface configuration based on the information of the multiple interfaces to be aggregated to obtain the setting information includes: Based on the interface paths, interface request types, interface request data and interface identifiers corresponding to the multiple interfaces to be aggregated, respectively, aggregate interface settings are performed to obtain setting interface path information, setting interface request type information, setting interface request data information and setting interface identifier information; Based on the setting interface path information, the setting interface request type information, the setting interface request data information and the setting interface identification information, data information integration is performed to obtain the setting information.
7. The method according to claim 5, characterized in that The step of performing data response configuration in the aggregate interface configuration based on the plurality of interface information to be aggregated to obtain configuration information includes: Performing data response parsing on the plurality of interface information to be aggregated to obtain return data path information corresponding to the plurality of interfaces; Based on the returned data path information, data integration is performed to obtain the configuration information.
8. The method according to any one of claims 1 to 3, characterized in that After matching the first aggregation interface information carried in the interface request with the locally cached cached aggregation data to obtain a matching result, the method further includes: When the matching result indicates a matching failure, the aggregation server stops accessing and generates termination information; The termination information is sent to the front end.
9. The method according to any one of claims 1 to 3, characterized in that The obtaining effective access data based on the access data and sending the data to the front end through data response configuration includes: Filtering the access data through the configuration information of the data response configuration to obtain useful access data; Reorganizing the useful access data to obtain the effective access data; The valid access data is sent to the front end.
10. A data interaction method, characterized in that: Applied to a terminal, the terminal includes a front end and a back end, including: Sending an interface request carrying first aggregate interface information to a server; wherein the first aggregate interface information is a first aggregate interface identifier, and the first aggregate interface identifier is formed by integrating identifiers of multiple interface information into one aggregate interface information; or, the first aggregate interface information is multiple interface information; Receiving a unified interface request sent by the server after successful matching based on the first aggregation interface information; Based on the unified interface request, access data is obtained and sent to the server; The valid access data processed by the server based on the access data is received.
11. The method according to claim 10, characterized in that Before sending the interface request carrying the first aggregate interface information to the server, the method further includes: Get multiple interface information; The multiple interface information are integrated into one interface information to obtain the first aggregate interface information; wherein the first aggregate interface information is a first aggregate interface identifier.
12. The method according to claim 10, characterized in that Before sending the interface request carrying the first aggregate interface information to the server, the method further includes: Get multiple interface information; The multiple interface information is used as the first aggregate interface information; wherein the first aggregate interface information is multiple interface information.
13. A server, characterized in that: The server includes a first receiving unit, a first acquiring unit and a first sending unit; wherein, The first receiving unit receives an interface request sent by the front end; The first acquisition unit matches the first aggregate interface information carried in the interface request with the cached aggregate data of the local cache to obtain a matching result; when the matching result indicates a successful match, a unified interface request is generated based on the aggregate interface information to call multiple interfaces of the backend, and access data corresponding to each of the multiple interfaces fed back by the backend is obtained; wherein the first aggregate interface information is a first aggregate interface identifier, and the first aggregate interface identifier is formed by integrating identifiers of multiple interface information into one aggregate interface information; or, the first aggregate interface information is multiple interface information; The first sending unit is used to obtain valid access data based on the access data and send the valid access data to the front end through data response configuration.
14. A terminal, characterized in that: The terminal includes a second sending unit and a second receiving unit; wherein, The second sending unit is used to send an interface request carrying the first aggregate interface information to the server; wherein the first aggregate interface information is a first aggregate interface identifier, and the first aggregate interface identifier is formed by integrating identifiers of multiple interface information into one aggregate interface information; or, the first aggregate interface information is multiple interface information; The second receiving unit is used to receive a unified interface request sent by the server after successful matching based on the aggregation interface information; The second sending unit is used to obtain access data based on the unified interface request and send the access data to the server; The second receiving unit receives the valid access data processed by the server based on the access data.
15. A server, characterized in that: The server comprises: A first memory, used to store executable instructions; The first processor is configured to implement the method according to any one of claims 1 to 9 when executing the executable instructions stored in the memory.
16. A terminal, characterized in that: The terminal comprises: A second memory, used for storing executable instructions; The second processor is configured to implement the method according to any one of claims 10 to 12 when executing the executable instructions stored in the memory.
17. A computer-readable storage medium, characterized in that: Executable instructions are stored, which are used to cause a first processor to execute and implement the method described in any one of claims 1 to 9; or are used to cause a second processor to execute and implement the method described in any one of claims 10 to 12.
Citation Information
Patent Citations
Method for parallelly integrating multistate instant messaging in mobile phone
CN102143452A
Closed-loop ecological feedback chain system based on server and webpage
CN107704582A
Business request method and device, electronic equipment and storage medium
CN111314459A
Data service method and device, server and storage medium
CN111935210A
Data processing method and device, server and storage medium
CN112039896A
