Request processing method and device, equipment, readable storage medium and program product
By setting up a public API pool for native applications and using data adapters to handle API call requests, the problem of high complexity in API calls for non-native applications is solved, resulting in code simplification and improved development efficiency.
Patent Information
- Application Number
- CN202410575927.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-08
- Publication Date
- 2025-11-11
AI Technical Summary
In existing technologies, API calls between non-native applications and native applications require separate application interfaces to be set, resulting in high code complexity and redundancy.
By setting up a public API pool for the native application and using a data adapter to adapt API call requests, the target public API is identified, the matching processing operation is executed, and the processing result is returned.
It reduces the code complexity and redundancy of application programming interfaces, improves development efficiency, and ensures the timeliness and accuracy of processing results.
Smart Images

Figure CN120929072A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to request processing methods, request processing apparatus, computer equipment, computer-readable storage media, and computer program products. Background Technology
[0002] Native applications are often accompanied by different non-native applications such as web pages and mini-programs to expand usage scenarios and user base. Non-native applications can use some of the functionality of native applications through API calls. However, because different non-native applications are independent of each other, for the same functionality in a native application, a separate API needs to be set for each non-native application. This results in high code complexity and redundancy for the APIs. Therefore, reducing the code complexity and redundancy of APIs is a pressing issue that needs to be addressed. Summary of the Invention
[0003] This application provides a request processing method, apparatus, device, readable storage medium, and program product that can reduce the code complexity and redundancy of application programming interfaces.
[0004] On one hand, embodiments of this application provide a request processing method, the method comprising:
[0005] Obtain API call requests from non-native applications, which are developed based on native applications;
[0006] In response to an API call request, the target public API corresponding to the API call request is determined from the public API pool. The public API pool includes multiple public APIs, which are application interfaces corresponding to the program functions of the native application. One or more non-native applications associated with the native application use the program functions corresponding to the public APIs by calling the public APIs.
[0007] The data adapter set up for non-native applications is invoked to perform data adaptation processing on the API call request and obtain the API call data.
[0008] Based on the API call data, perform processing operations that match the target public API, obtain the processing results, and return the processing results to the non-native application.
[0009] On the other hand, embodiments of this application provide a request processing apparatus, which includes:
[0010] The acquisition unit is used to acquire API call requests from non-native applications, which are developed based on native applications.
[0011] The processing unit is used to respond to the interface call request and determine the target public interface corresponding to the interface call request from the public interface pool. The public interface pool includes multiple public interfaces, which are application interfaces corresponding to the program functions of the native application. One or more non-native applications associated with the native application use the program functions corresponding to the public interface by calling the public interface.
[0012] The adaptation unit is used to call the data adapter set for non-native applications to perform data adaptation processing on the interface call request and obtain the interface call data.
[0013] The processing unit is also used to perform processing operations that match the target public interface based on the interface call data, obtain the processing results, and return the processing results to the non-native application.
[0014] In one possible implementation, when the adaptation unit calls the data adapter set up for the non-native application to perform data adaptation processing on the interface call request and obtain the interface call data, it is specifically used for:
[0015] The data adapter set up for the non-native application is invoked to extract parameters from the interface call request and obtain request parameters in a first data format; the first data format is the data format supported by the interface of the non-native application.
[0016] The request parameters in the first data format are converted to obtain the request parameters in the second data format; the second data format is the data format supported by the public interfaces in the public interface pool.
[0017] The API call data is determined based on the request parameters in the second data format.
[0018] In one possible implementation, the adapter unit is also used for:
[0019] The data adapter set for the non-native application is invoked to perform API call permission detection on the non-native application and obtain the detection result.
[0020] If the detection result indicates that the non-native application has the permission to call the target public interface, then the steps to perform the processing operation that matches the target public interface are executed based on the interface call data.
[0021] In one possible implementation, when the processing unit determines the target public interface corresponding to the interface call request from the public interface pool in response to the interface call request, it specifically performs the following:
[0022] In response to an API call request, extract the API identifier of the API to be called from the API call request;
[0023] Determine the matching public interfaces from the public interface pool whose public interface identifiers match the interface identifier of the interface to be called;
[0024] The matching public interface is determined as the target public interface corresponding to the interface call request.
[0025] In one possible implementation, the processing unit is also used for:
[0026] If there are new application features added to the native application, then new public interfaces are built based on the new application features;
[0027] Add new public interfaces to the public interface pool, and one or more non-native applications associated with the native application can use the new application functions by calling the new public interfaces.
[0028] In one possible implementation, the processing unit is also used for:
[0029] If a new non-native application is added to a native application, then a data adapter is set for the new non-native application;
[0030] Among them, the data adapter set up for newly added non-native applications is used to perform data adaptation processing for the interface call requests of newly added non-native applications.
[0031] In one possible implementation, the target public interface is a data query interface; when the processing unit performs processing operations matching the target public interface based on the data called from the interface and obtains the processing result, it is specifically used for:
[0032] Extract the object identifier and data query parameters of the request initiator from the API call data;
[0033] Use the data query function corresponding to the data query interface to query the candidate data set associated with the object identifier, and select candidate data from the candidate data set according to the data query parameters;
[0034] The processing result is determined based on the selected candidate data.
[0035] In one possible implementation, when the adaptation unit is used to invoke the data adapter set for the non-native application to perform interface call permission detection processing on the non-native application, it is specifically used for:
[0036] Invoke the data adapter set for the non-native application to obtain the object information of the login object on the non-native application, and obtain the access control information of the non-native application; the access control information includes the object information of the authorized object;
[0037] If the object information of the authorized object contains the object information of the logged-in object, then the detection result is determined as the first detection result; the first detection result indicates that the non-native application has the interface call permission for the target public interface;
[0038] If the object information of the authorized object does not contain the object information of the logged-in object, then the detection result is determined to be the second detection result; the second detection result indicates that the non-native application does not have the permission to call the target public interface.
[0039] Accordingly, embodiments of this application provide a computer device, which includes:
[0040] A processor is a tool for implementing computer programs.
[0041] A computer-readable storage medium storing a computer program adapted to be loaded by a processor and executed by the request processing method described above.
[0042] Accordingly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when read and executed by a processor of a computer device, causes the computer device to perform the aforementioned request processing method.
[0043] Accordingly, this application provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the aforementioned request processing method.
[0044] This application embodiment sets up corresponding public interfaces for each program function of the native application. Therefore, when an interface call request from a non-native application is obtained, the target public interface corresponding to the interface call request can be determined from the public interface pool. The data adapter set up for the non-native application is then invoked to perform data adaptation processing on the interface call request, thereby obtaining the interface call data that the public interface can support. Then, processing operations matching the target public interface are executed based on the interface call data to obtain the processing result, ensuring that the processing operation is correct and effective. Finally, the processing result is returned to the non-native application, ensuring timely feedback. This method allows various non-native applications associated with a native application to use the corresponding program functions of the public interface by calling the same public interface, avoiding the need to set up separate application interfaces for each non-native application for the same program function. This reduces the code complexity and redundancy of application interfaces, improves application development efficiency, and reduces development costs. Attached Figure Description
[0045] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0046] Figure 1 This is a schematic diagram of the architecture of a request processing system provided in an embodiment of this application;
[0047] Figure 2 This is a flowchart illustrating a request processing method provided in an embodiment of this application;
[0048] Figure 3 This is a flowchart illustrating another request processing method provided in an embodiment of this application;
[0049] Figure 4A This is a schematic diagram of a request processing procedure provided in an embodiment of this application;
[0050] Figure 4B This is a schematic diagram of an interface for a data query scenario provided in an embodiment of this application;
[0051] Figure 4C This is a schematic diagram of an interface for testing provided in an embodiment of this application;
[0052] Figure 4D This is a schematic diagram of an interaction between applications provided in an embodiment of this application;
[0053] Figure 4E This is a schematic diagram illustrating a method for processing interface call requests, as provided in an embodiment of this application.
[0054] Figure 4F This is a schematic diagram illustrating a newly added application function provided in an embodiment of this application;
[0055] Figure 4G This is a schematic diagram illustrating a newly added non-native application provided in an embodiment of this application;
[0056] Figure 5 This is a schematic diagram of the structure of a request processing device provided in an embodiment of this application;
[0057] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0058] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0059] In the embodiments of this application, the relevant data of the object (including object information of the logged-in object), access control information, etc., are involved. When the above embodiments of this application are applied to specific products or technologies, the collection, use and processing of relevant data should comply with the requirements of relevant laws and regulations. Before collecting data, the information processing rules should be informed and the individual consent of the object should be obtained. Data should be processed in strict accordance with the requirements of laws and regulations and personal information processing rules, and technical measures should be taken to ensure the security of relevant data.
[0060] The request processing system provided in the embodiments of this application is described below with reference to the accompanying drawings. The request processing system is suitable for implementing the request processing method provided in the embodiments of this application.
[0061] Please see Figure 1 This figure is a schematic diagram of the architecture of a request processing system provided in an embodiment of this application. The request processing system may specifically include a client 101 and a server 102. The client 101 and the server 102 are connected via a network, such as a local area network (LAN), a wide area network (WAN), or a mobile internet.
[0062] Client 101 refers to a program configured on a terminal device to provide local services to an object (such as a user). Client 101 can run on the terminal device in various ways, such as running on the terminal device through a browser, or running on the terminal device as a standalone application (APP). This application embodiment does not limit this.
[0063] The terminal device configured on client 101 is also referred to as a terminal, user equipment (UE), access terminal, user unit, mobile device, user terminal, wireless communication device, user agent, or user device. The terminal device can be a smart home appliance, a handheld device with wireless communication capabilities (such as a smartphone or tablet), a computing device (such as a personal computer (PC)), an in-vehicle terminal, a smart voice interaction device, a wearable device, or other smart devices, but is not limited to these.
[0064] Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0065] In one possible implementation, the non-native application can be configured on the terminal device, and correspondingly, the native application's client 101 can be configured on the terminal device. When the non-native application needs to use a certain function of the native application, the client 101 can respond to the non-native application's interface call request and determine the target public interface corresponding to the interface call request from the public interface pool. Since the client 101 is configured with data adapters set up for different non-native applications, the client 101 can call the data adapter set up for the non-native application to perform data adaptation processing on the interface call request and obtain the interface call data. Then, the client 101 performs processing operations matching the target public interface according to the interface call data, obtains the processing result, and returns the processing result to the non-native application. For example, if the target public interface is a data query interface, then the processing result includes the queried data, and the client finally returns the processing result including the queried data to the non-native application.
[0066] In one possible implementation, client 101 can first perform interface call permission detection on the non-native application. After determining that the non-native application has the permission to call the target public interface through the detection process, it then executes the step of performing a processing operation matching the target public interface based on the interface call data, as well as subsequent steps. During the interface call permission detection process, client 101 can obtain the object information of the logged-in object on the non-native application and obtain the access control information of the non-native application from server 102. The access control information includes the object information of authorized objects (such as the object information of authorized objects that have already been authenticated). Client 101 then determines whether the non-native application has the permission to call the target public interface based on the object information of the logged-in object and the object information of the authorized object.
[0067] It is understood that the system architecture diagrams described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. For example, the request processing method provided in the embodiments of this application can be executed not only by client 101, but also by the terminal device configured on client 101, and can also be executed by other terminal devices, servers, or server clusters that are different from the terminal device and can communicate with the terminal device and / or server 102. Those skilled in the art will understand that... Figure 1 The number of clients and servers shown is merely illustrative. Any number of clients and servers can be configured according to business needs. Furthermore, as system architecture evolves and new business scenarios emerge, the technical solutions provided in this application are also applicable to similar technical problems. In subsequent embodiments, "client" will refer to client 101 and "server" will refer to server 102; further details will not be repeated in subsequent embodiments.
[0068] The request processing method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0069] This application provides a request processing method, which can be executed by a terminal device, specifically by a client within the terminal device. The client may be, for example, a client that can be... Figure 1 The client 101 in the request processing system shown. Figure 2 As shown, the request processing method may include, but is not limited to, the following steps S201-S204:
[0070] S201. Obtain the interface call request of a non-native application. The non-native application is developed based on the native application.
[0071] In this embodiment, a native application refers to an application developed for a specific operating system (such as iOS or Android) (i.e., an application that relies on the operating system). A native application can directly call the hardware and system functions of the terminal device. Native applications are distributed through app stores and need to be installed on the terminal device to be used.
[0072] Non-native applications are applications developed based on native applications to expand the use cases and user base of native applications. Non-native applications do not directly rely on the operating system, enabling cross-platform and cross-container use. However, the functionality of non-native applications is limited by the Application Programming Interface (API) provided by the native application; that is, non-native applications use the functionality of the native application through API calls.
[0073] In one possible implementation, the number of non-native applications developed based on the native application (denoted as non-native applications associated with the native application) can be one or more, and the application types of the non-native applications can be different. For example, the application types of non-native applications can include: web applications, mini-programs, and lightweight applications (Lite apps, where a Lite app can refer to a mini-program implemented using Flutter methods). The runtime environment of non-native applications differs from that of native applications. For instance, the runtime environment of a native application can be the operating system of the terminal device, the runtime environment of a web application can be a browser, the runtime environment of a mini-program can be an application client, and the runtime environment of a lightweight application can be a specific host environment.
[0074] In this embodiment of the application, an interface call request refers to a request initiated by a non-native application to a client in a terminal device to call an application interface for using the program function corresponding to the application interface.
[0075] S202. In response to the interface call request, determine the target public interface corresponding to the interface call request from the public interface pool.
[0076] In this embodiment of the application, the public interface pool is a set of common program function interfaces (that is, a set of public interfaces) provided for all the multiple non-native applications associated with the native application. The public interface pool includes multiple public interfaces, which are application interfaces corresponding to the program functions of the native application. In other words, each public interface corresponds to a program function of the native application.
[0077] One or more non-native applications associated with a native application use the corresponding program functions by calling a public interface. In other words, each public interface can be shared and called by various non-native applications. This allows different non-native applications to use the corresponding program functions by calling the same public interface, which can reduce the number of application interfaces, reduce the cost of repeatedly developing application interfaces, and improve the development efficiency of applications.
[0078] In this embodiment of the application, after obtaining the interface call request, the terminal device (specifically, the client in the terminal device) can determine the target public interface corresponding to the interface call request from the public interface pool, thereby determining the processing operation that needs to be completed as indicated by the interface call request, so as to execute the processing operation that matches the target public interface in the future, such as executing the data query processing corresponding to the target public interface, and returning the queried data to the non-native application.
[0079] S203. Call the data adapter set for the non-native application to perform data adaptation processing on the interface call request and obtain the interface call data.
[0080] In this embodiment, the data adapter is used to perform data adaptation processing on the data in the interface call request to obtain data that the public interface can support (denoted as interface call data). Since the program processing logic of non-native applications of different program types (such as web applications and applets) is different, the data format of the interface call requests of different program types of non-native applications received by the client on the terminal device is also different.
[0081] The data adaptation processing performed by the data adapter can be seen as a data standardization process for interface call requests from non-native applications. It is used to centrally process the program processing logic of non-native applications and obtain interface call data. This interface call data includes processing parameters required to execute processing operations that match the target public interface (processing parameters are used to indicate the specific implementation method of the processing operation, such as the data query object, the data query range, etc.) to ensure that the terminal device can smoothly execute processing operations that match the target public interface based on the interface call data in the future.
[0082] In one possible implementation, a corresponding data adapter can be set for each type of non-native application. For example, each non-native application of type Web application can use the data adapter corresponding to Web application; each non-native application of type Mini Program can use the data adapter corresponding to Mini Program. The process of calling the data adapter set for a non-native application can then be as follows: determine the application type of the non-native application, and determine the data adapter set for the non-native application based on the determined application type.
[0083] S204. Execute the processing operation that matches the target public interface based on the interface call data, obtain the processing result, and return the processing result to the non-native application.
[0084] In this embodiment, the target public interface corresponds to a program function of a native application, and the interface call data includes processing parameters required to implement this program function. For example, if the program function of the native application corresponding to the target public interface is a data query function (that is, the target public interface is a data query interface), then the processing parameters included in the interface call data may include one or more of the following: the object of the data query and the scope of the data query.
[0085] The terminal device executes processing operations matching the target public interface based on the interface call data, obtaining processing results (such as performing corresponding data query processing according to the processing parameters in the interface call data to obtain data query results). This ensures that the processing operations are correct and effective, reduces the probability of errors in the processing operations, and accurately meets the needs of non-native applications using the program functions corresponding to the target public interface. Furthermore, the terminal device returns the processing results to the non-native applications, enabling them to obtain the processing results of the interface call request in a timely manner, ensuring the timeliness of the processing result feedback.
[0086] Based on the above embodiments, the beneficial effects of this application are as follows: This application sets corresponding public interfaces for each program function of the native application. Therefore, when an interface call request from a non-native application is obtained, the target public interface corresponding to the interface call request can be determined from the public interface pool. The data adapter set for the non-native application is then called to perform data adaptation processing on the interface call request, thereby obtaining the interface call data that the public interface can support. Then, processing operations matching the target public interface are executed based on the interface call data to obtain the processing result, thus ensuring that the processing operation is correct and effective. Finally, the processing result is returned to the non-native application, ensuring the timeliness of the processing result feedback. The above method allows various non-native applications associated with a native application to use the program functions corresponding to the public interface by calling the same public interface, avoiding the need to set corresponding application interfaces for each non-native application for the same program function. This reduces the code complexity and redundancy of the application interfaces, improves application development efficiency, and reduces development costs.
[0087] This application provides another request processing method, which can be executed by a terminal device, specifically by a client within the terminal device. The client could be, for example, a client that... Figure 1 The client 101 in the request processing system shown. Figure 3 As shown, the request processing method may include, but is not limited to, the following steps S301-S306:
[0088] S301. Obtain the interface call request of a non-native application. The non-native application is developed based on the native application.
[0089] The specific implementation of step S301 is described in the relevant description of step S201 in the foregoing embodiments, and will not be repeated here.
[0090] S302. In response to an interface call request, determine the target public interface corresponding to the interface call request from the public interface pool.
[0091] In this embodiment of the application, the public interface pool includes multiple public interfaces. The public interface is the application interface corresponding to the program function of the native application. One or more non-native applications associated with the native application use the program function corresponding to the public interface by calling the public interface.
[0092] In one possible implementation, regarding step S302 above, i.e., in response to the interface call request, determining the target public interface corresponding to the interface call request from the public interface pool, one possible implementation is as follows:
[0093] (1) In response to the interface call request, extract the interface identifier of the interface to be called from the interface call request.
[0094] In this embodiment of the application, the interface call request includes an interface identifier of the application interface to be called (denoted as the interface to be called), which is used to uniquely identify an application interface. For example, the data format of the interface identifier can be symbols, strings, etc. For example, the interface identifier can be any of the following: program function name (the program function name is globally unique), program function identifier (the program function identifier is globally unique, such as the ID number of the program function), etc.
[0095] (2) Determine the matching public interface from the public interface pool whose public interface identifier matches the interface identifier of the interface to be called.
[0096] In this embodiment, each public interface in the public interface pool corresponds to a public interface identifier, and each public interface identifier can be associated and stored in the public interface pool. Then, the terminal device can query the public interface pool for a matching public interface identifier that matches the interface identifier of the interface to be called. The found matching public interface is then used as the matching public interface; "matching" can mean identical.
[0097] (3) The matching public interface is determined as the target public interface corresponding to the interface call request.
[0098] In the above steps (1)-(3), the terminal device can ensure that the program function provided by the matching public interface is consistent with the program function requested by the interface call request by querying the matching public interface in the public interface pool, thus ensuring the accuracy of the request processing. At the same time, querying the interface based on the interface identifier can ensure the processing efficiency.
[0099] The method in step S203 will be described in detail below through steps S303-S305. It should be noted that, in the embodiments of this application, the specific implementation of steps S303-S305 can also be replaced by the specific implementation of step S203 in the aforementioned embodiments, which will not be repeated here.
[0100] S303. Call the data adapter set for the non-native application to extract parameters from the interface call request and obtain the request parameters in the first data format.
[0101] In this embodiment of the application, parameter extraction processing refers to: extracting the processing parameters (processing parameters are used to indicate the specific implementation method of the processing operation, such as the object of data query, the range of data query, etc.) required for the terminal device to perform the processing operation matching the target public interface smoothly in the subsequent execution based on the interface call data.
[0102] In this embodiment, since the interface call request is sent to the terminal device by a non-native application, the first data format is the data format supported by the interface of the non-native application. That is, the data format of the request parameters included in the interface call request is defined based on the program processing logic and interface design specifications of the non-native application, enabling the non-native application to correctly generate and process these request parameters. The terminal device extracts parameters from the interface call request by calling the data adapter set for the non-native application, obtaining the request parameters in the first data format.
[0103] S304. Perform data format conversion processing on the request parameters in the first data format to obtain the request parameters in the second data format.
[0104] In this embodiment, the terminal device can invoke a data adapter set up for non-native applications to convert the request parameters in the first data format to obtain the request parameters in the second data format. The second data format is a data format supported by the public interfaces in the public interface pool. In other words, the data adapter converts the request parameters in the first data format into the standard data format defined in the public interface pool, i.e., the second data format. This ensures that different public interfaces use the same standardized data format, which helps improve the universality of application interfaces and effectively solves the data format compatibility problem during data interfacing.
[0105] In one possible implementation, data format conversion processing may include one or more of the following: field name mapping, data type conversion, and data structure adjustment. Here, the mapped field names are those supported by the public interface, the converted data types are those supported by the public interface, and the adjusted data structures are those supported by the public interface.
[0106] For example, when the non-native application is a mini-program, the data format of the received request parameters is the first type of raw data format (such as Bundle data format). When the non-native application is a web application (such as a webpage), the data format of the received request parameters is the second type of raw data format (such as String data format). The data adapter corresponding to the non-native application can convert the request parameters in the raw data format to obtain the request parameters in the second data format. The second data format can be a custom data format or a specified data format, such as JSON data format.
[0107] S305. Determine the interface call data based on the request parameters in the second data format.
[0108] In this embodiment, the data adapter can determine the interface call data based on the request parameters of the second data format. Furthermore, the interface call data is a data format supported by the public interface, which enables the terminal device to directly perform processing operations that match the target public interface based on the interface call data, thus ensuring data format compatibility.
[0109] In one possible implementation, there are multiple request parameters in the second data format. The data adapter can use all the request parameters in the second data format as interface call data. Alternatively, the data adapter can use some of the request parameters in the second data format as interface call data according to the processing parameters required by the program function corresponding to the target public interface. This application embodiment does not limit this.
[0110] In one possible implementation, after step S305, the terminal device can also perform interface call permission detection processing. One possible implementation is as follows:
[0111] (1) Call the data adapter set for non-native applications to perform interface call permission detection processing on non-native applications and obtain the detection results.
[0112] In this embodiment, the interface call permission detection process refers to detecting whether the caller has the permission to call a specific application interface (such as a target public interface). The terminal device performs interface call permission detection on the non-native application by calling the data adapter set for the non-native application, obtains the detection result, and determines whether the non-native application has the permission to call the target public interface based on the detection result.
[0113] (2) If the detection result indicates that the non-native application has the permission to call the target public interface, then perform the steps of performing the processing operation that matches the target public interface based on the interface call data.
[0114] In this embodiment, if the detection result indicates that the non-native application has the permission to call the target public interface, the terminal device can continue to execute step S306 and subsequent steps. If the detection result indicates that the non-native application does not have the permission to call the target public interface, then the terminal device can refuse to process the interface call request further.
[0115] By using steps (1)-(2), it can be ensured that only callers with legitimate interface call permissions can call the target public interface, thus guaranteeing the security and stability of the system and effectively preventing unauthorized access and interface call operations.
[0116] For example, the request processing after adding API call permission detection is as follows: Figure 4A As shown:
[0117] 1. Obtain the API call request.
[0118] Terminal devices obtain API call requests from non-native applications.
[0119] 2. Identify the target public interface and adapt the interface call requests accordingly.
[0120] When a terminal device responds to an interface call request, it determines the target public interface corresponding to the interface call request from the public interface pool, and calls the data adapter set up for non-native applications to perform data adaptation processing on the interface call request to obtain the interface call data.
[0121] 3. Determine if you have permission to call the API.
[0122] The terminal device invokes the data adapter set for the non-native application to perform interface call permission detection processing on the non-native application and obtains the detection result. The detection result is used to indicate whether the non-native application has interface call permission for the target public interface.
[0123] 4. Perform the processing operation that matches the target public interface and return the processing result.
[0124] If the detection result indicates that the non-native application has the permission to call the target public interface (that is, it has the permission to call the interface), then the processing operation matching the target public interface is executed according to the interface call data, the processing result is obtained, and the processing result is returned to the non-native application.
[0125] 5. Return a failure result.
[0126] If the detection result indicates that the non-native application does not have the permission to call the target public interface (i.e., it does not have the permission to call the interface), a failure result is returned to the non-native application, which indicates that the target public interface call failed.
[0127] The specific implementation methods of steps 1-5 above can be found in the relevant descriptions in the foregoing embodiments, and will not be repeated here.
[0128] In one possible implementation, regarding step (1) above, namely calling the data adapter set for the non-native application to perform interface call permission detection processing on the non-native application and obtain the detection result, one implementation method is as follows:
[0129] (1) Call the data adapter set for the non-native application to obtain the object information of the login object on the non-native application and obtain the access control information of the non-native application; the access control information includes the object information of the authorized object.
[0130] In this embodiment, the login object refers to the object (such as a user) that performs identity authentication and obtains access permissions to a non-native application. For example, the object information of the login object may include one or more of the following: user identifier (such as username), authentication information (such as login password), identity credentials (such as identity token), login information of the login object (such as IP address), etc. The authorized object refers to the object (such as a user) that has been granted interface call permissions for a target public interface.
[0131] Access control information for non-native applications refers to data or configurations used to manage and control access permissions. Access control information typically includes rules, permission settings, and authentication methods for accessing application resources, application interfaces, or program functions.
[0132] (2) If the object information of the authorized object contains the object information of the login object, then the detection result is determined as the first detection result; the first detection result indicates that the non-native application has the interface call permission for the target public interface.
[0133] (3) If the object information of the authorized object does not include the object information of the login object, the detection result is determined to be the second detection result; the second detection result indicates that the non-native application does not have the permission to call the target public interface.
[0134] In this embodiment of the application, since the access control information includes the object information of the authorized object, the terminal device can determine whether the object information of the authorized object contains the object information of the login object. If the object information of the login object is included, it is determined that the non-native application has the permission to call the interface for the target public interface. If the object information of the login object is not included, it is determined that the non-native application does not have the permission to call the interface for the target public interface.
[0135] Through the above steps (1)-(3), it is possible to maintain only one access control information that includes the object information of the authorized object, without having to consider other complex methods to determine whether the non-native application has the interface call permission for the target public interface. This simplifies the interface call permission detection process and improves the efficiency of interface call permission detection.
[0136] S306. Execute the processing operation that matches the target public interface based on the interface call data, obtain the processing result, and return the processing result to the non-native application.
[0137] In this embodiment, the terminal device can perform processing operations matching the target public interface based on the interface call data to obtain a processing result. Specifically, the client on the terminal device can perform processing operations matching the target public interface based on the processing parameters in the interface call data to obtain a processing result. Furthermore, the client on the terminal device can return the processing result to a non-native application, enabling the non-native application to obtain the processing result of the interface call request in a timely manner, ensuring the timeliness of the processing result feedback.
[0138] For example, the target public interface could be an image capture interface. In this case, the interface call data could be processing parameters related to image capture, and the processing operation matching the target public interface could be: performing image capture processing through a client (the client of the native application). Correspondingly, the processing result could be the captured image. The target public interface could also be a location information acquisition interface. In this case, the interface call data could be processing parameters related to location information acquisition, and the processing operation matching the target public interface could be: performing location processing through a client (the client of the native application). Correspondingly, the processing result could be the location information obtained from the location.
[0139] The following will take a data query scenario as an example to explain in detail the request processing method in the embodiments of this application.
[0140] In one possible implementation, the target public interface is a data query interface. Therefore, regarding step S306 above, which involves performing a processing operation matching the target public interface based on the interface call data to obtain the processing result, one possible implementation is as follows:
[0141] (1) Extract the object identifier and data query parameters of the request initiating object from the interface call data.
[0142] In this embodiment, the object initiating the extraction request refers to the object that initiates the interface call request (such as the login object on a non-native application). Data query parameters are processing parameters used to indicate the specific method of data querying, and are used to limit the conditions or scope of the data query.
[0143] (2) Use the data query function corresponding to the data query interface to query the candidate data set associated with the object identifier, and select candidate data from the candidate data set according to the data query parameters.
[0144] (3) Determine the processing result based on the selected candidate data.
[0145] In steps (2)-(3) above, the terminal device first queries the candidate data set associated with the object identifier, and then selects (filters) candidate data from the candidate data set according to the data query parameters. This hierarchical query method can quickly retrieve data results that meet the requirements, which helps to improve data query efficiency and response speed, enabling users to obtain the data information they need in a timely manner. Then, the terminal device can determine the processing result based on the selected candidate data, such as using the selected candidate data as the processing result.
[0146] The following examples illustrate data query scenarios:
[0147] For example, the native application is a social application, which is associated with multiple non-native applications, such as web applications, mini-programs, and lightweight applications. Different non-native applications can use a certain function of the native application through the public interface corresponding to that function.
[0148] For example, non-native applications can include approval mini-programs. The following example illustrates the interaction between an approval mini-program and a social application: An approval mini-program has a leave request function, which requires selecting an approver. Selecting the approval recipient within the approval mini-program requires calling the social application's data query interface. The leave request interface of the approval mini-program is as follows: Figure 4BWhen the “Select Approval Object” control is triggered, the terminal device (specifically, the client of the social application on the terminal device) receives the interface call request sent by the approval mini-program. At this time, the terminal device responds to the interface call request, determines the target public interface (which is the data query interface) corresponding to the interface call request from the public interface pool, and calls the data adapter set for non-native applications (which is the data adapter corresponding to the approval mini-program) to perform data adaptation processing on the interface call request, obtain the interface call data, and then perform the processing operation that matches the data query interface (which is the data query operation) according to the interface call data.
[0149] Therefore, the object identifier of the request initiating object extracted from the API call data can refer to the object identifier (such as username) of the login object (such as the logged-in user) of the approval mini-program. The data query parameters extracted from the API call data can include one or more of the following: range filtering parameters (such as indicating to query colleagues in the same group, colleagues in the same department, or colleagues in the same company of the logged-in object), and status filtering parameters (such as indicating to query colleagues who are online, colleagues who are offline, or all colleagues of the logged-in object).
[0150] Based on this, the terminal device can use the data query function corresponding to the data query interface to first query the candidate data set associated with the object identifier of the login object of the approval mini-program (such as all colleagues of the login object). Then, according to the data query parameters (such as the range filtering parameters, where the range filtering parameters indicate querying colleagues in the same department of the login user), candidate data is selected from the candidate data set. The selected candidate data may include the account information of multiple colleagues in the same department of the login user. Finally, the terminal device determines the selected candidate data as the processing result.
[0151] After receiving the processing result, the terminal device returns the result to the approval mini-program. The result includes the account information of multiple colleagues in the same department of the logged-in user, such as the account information corresponding to object s1, object s2, object s3, and object s4, and the approval mini-program then processes the data. Figure 4B The processing results are displayed in the selection and approval interface indicated in (2), which shows the account information corresponding to objects s1, s2, s3, and s4 respectively. The logged-in user can select objects, such as choosing objects s1 and s2 from multiple colleagues. After the logged-in user confirms the selection, they are returned to... Figure 4B The leave application interface indicated in (3) now includes information on the approval objects. This information includes the information corresponding to the objects s1 and s2 selected by the logged-in user. The logged-in user can continue to select approval objects (i.e., add new approval objects) or confirm the selection of approval objects.
[0152] Interface testing interface as follows Figure 4C As shown, Figure 4C The interface indicated in (1) includes a list of interface test cases, which contains multiple interface test cases, such as P0 - Select Member from Company | Multiple Selection | Select Member from Company | Single Selection | Select Member from Company | Single Selection | Select Member from Company | Single Selection | Select Member from Department | Single Selection | Select Member from Department, etc. Figure 4C As shown in (2), when the login object selects multiple colleagues from the same department, it is implemented by interface use case P2. Figure 4C The interface indicated in (3) shows that the login object can select multiple colleagues in the same department, which is implemented by interface use case P2. At the same time, Figure 4C The interface indicated in (3) may also include interface code related to interface use case P2 (that is, the execution status of the interface use case).
[0153] It should be noted that native applications (such as social applications) can correspond to one or more non-native applications of the program type mini-program (such as approval mini-programs; besides approval mini-programs, this can also include mini-programs in various application scenarios, such as e-commerce mini-programs). Native applications can also include other types of non-native applications, such as non-native applications of the program type web application or lightweight application, and the number of non-native applications of different program types can be one or more, which is not limited in this embodiment. For web applications, there is also a need for data querying. Therefore, when performing data queries, web applications can also achieve this by calling the same data query interface used by the aforementioned approval mini-program. The data query interface is a public interface in the public interface pool, thereby achieving interface reuse and reducing the code complexity and redundancy of application interfaces.
[0154] A native application typically has counterparts such as web pages and mini-programs developed to expand its use cases and user base. For example... Figure 4D As shown, a native application corresponds to multiple non-native applications, such as non-native application A (e.g., a web application) and non-native application B (e.g., a mini-program). The native application has interaction requirements with multiple non-native applications. For example, the non-native application needs to use the native application's client-side shooting function, client-side location function, etc. Once these interaction requirements exist, it is necessary to define application interfaces and handle the above-mentioned interaction logic by calling the interfaces.
[0155] However, since different non-native applications are independent of each other, the same program function for a native application requires setting a separate application programming interface (API) for each non-native application. In this case, the code complexity and redundancy of the API are relatively high, specifically manifested in:
[0156] 1. Confusing interface logic: The interface code of the application programming interface is coupled with some logic of non-native applications, resulting in unclear logic and structure, and making the code difficult to maintain.
[0157] 2. Cumbersome process: Adding the same application interface for each native application results in repetitive processes and complicated handling.
[0158] 3. Difficult to extend: When extending a new native application, it is necessary to reconfigure the application programming interfaces (APIs) corresponding to the existing program functions. If the number of existing program functions is large, it will be difficult to extend the application because the workload of reconfiguring the APIs corresponding to the existing program functions is enormous.
[0159] The request processing method provided in this application can effectively solve the above problems. This application sets up corresponding public interfaces for each program function of the native application (such as data query function, shooting function, and location function), and adds these public interfaces to a public interface pool. Simultaneously, it sets up data adapters for non-native applications. For example, a data adapter is set up for non-native applications of the same program type (such as mini-programs, web applications, and lightweight applications) to handle the program processing logic of that type of non-native application. Figure 4E As shown, the public interface pool includes multiple public interfaces, such as public interface 1, public interface 2, public interface 3, public interface 4, etc., totaling 50 public interfaces. Taking the interaction between a non-native application A and a native application as an example, when the client of the native application receives an interface call request from the non-native application A (such as a mini-program), it can first determine the target public interface (such as the corresponding public interface 1) from the public interface pool. Then, the client can call the data adapter (such as data adapter a) set for the non-native application A to perform data adaptation processing on the interface call request, obtain the interface call data, and then perform the processing operation matching the target public interface (such as public interface 1) according to the interface call data to obtain the processing result. The processing result is then returned to the non-native application. For the specific implementation method, please refer to the relevant description in the aforementioned embodiments, which will not be repeated here.
[0160] In one possible implementation, the terminal device may also perform the following steps:
[0161] (1) If there are new application functions in the native application, then build new public interfaces based on the new application functions.
[0162] (2) Add the new public interface to the public interface pool. One or more non-native applications associated with the native application can use the new application functions by calling the new public interface.
[0163] In steps (1)-(2) above, when a native application adds a new application function, the terminal device can build a new public interface based on the new application function. This eliminates the need to build a separate application interface for each non-native application, achieving interface reuse, reducing the workload of building application interfaces, and improving development efficiency. Then, the terminal device can add the new public interface to the public interface pool, allowing each non-native application to use the new application function of the non-native application by calling the new public interface. Since the development cost of the new application function is reduced, this will help promote the expansion and enrichment of application functions and enhance the attractiveness of the application.
[0164] For example, such as Figure 4F As shown, when a native application adds a new application feature, it can first build a new public interface corresponding to the new application feature, such as public interface 51, and add public interface 51 to the public interface pool.
[0165] In one possible implementation, the terminal device may also perform the following steps: if a new non-native application is added to the native application, then a data adapter is set for the new non-native application.
[0166] In this embodiment, when a native application needs to add a non-native application (hereinafter referred to as the new non-native application), the terminal device can set up a data adapter (hereinafter referred to as the new data adapter) for the new non-native application. The data adapter set up for the new non-native application is used to perform data adaptation processing on the interface call requests of the new non-native application. In other words, the new data adapter is used to centrally process the program processing logic of the new non-native application to obtain the interface call data. Based on this, the new non-native application can call existing public interfaces in the public interface pool to use the corresponding program functions of the native application. This eliminates the need to separately configure various application interfaces for the new non-native application, improving development efficiency, reducing development costs, enhancing the universality of application interfaces, ensuring scalability, and making code management more reasonable and easier.
[0167] It should be noted that the terminal device can first determine the program type corresponding to each existing data adapter. If the program type of the new non-native application is not included in the program types corresponding to each existing data adapter, then the step of setting a data adapter for the new non-native application can be executed. Otherwise, the data adapter with the same program type as the new non-native application in the existing data adapters can be used as the data adapter set for the new non-native application.
[0168] For example, such as Figure 4G As shown, when a native application needs to add a non-native application, a data adapter can be set for the new non-native application. For example, if the new non-native application is non-native application C, then a new data adapter can be set for non-native application C, such as data adapter c.
[0169] In one possible implementation, the program processing logic of non-native applications of different program types (such as web applications, applets, and lightweight applications) is different. Therefore, the functionality of the data adapter corresponding to non-native applications of different program types may differ, which will be explained in detail below:
[0170] For the data adapter corresponding to the web application, processing may include data adaptation processing, interface call permission detection processing, etc.
[0171] The data adapter for a mini-program can include inter-process communication (IPC) processing, data adaptation processing, and API call permission detection processing. IPC processing can be performed first, followed by data adaptation processing and API call permission detection processing. IPC processing refers to the process of passing (or transferring) relevant information about a method call from the mini-program process to the main process when the mini-program makes a method call, thereby ensuring that the mini-program can interact smoothly with the main process in a multi-process environment.
[0172] For data adapters corresponding to lightweight applications, data adaptation, API call permission detection, context switching, and API callbacks can be handled. Among these, context switching refers to the transfer of data and state between the lightweight application and the native application.
[0173] The data adapter corresponding to a non-native application is used to centrally process the program processing logic of that non-native application. The data adapters for different non-native applications can be flexibly configured according to the actual business requirements of the non-native application; this will not be elaborated further in this embodiment. Based on this, setting a data adapter for a newly added non-native application can be achieved in the following way: setting the data adapter for the newly added non-native application according to its logical characteristic information (logical characteristic information is used to characterize relevant information about the program processing logic of the newly added non-native application), which will not be elaborated further here.
[0174] In this embodiment, each public interface in the public interface pool isolates the characteristics of different non-native applications and contains only pure interface logic code. This allows all non-native applications of a native application to share the same application interface code, achieving code decoupling and reuse. This ensures the uniformity of the application interface code logic, facilitates unified log output and archiving, and better manages the application interfaces.
[0175] The request processing method provided in this application embodiment can be applied to various fields or scenarios such as cloud computing, cloud IoT, cloud gaming, artificial intelligence, vehicle, smart transportation, and assisted driving, to process interface call requests from non-native applications in the above-mentioned fields or scenarios, which will not be elaborated here.
[0176] The methods of the embodiments of this application have been described in detail above. In order to facilitate better implementation of the above methods of the embodiments of this application, the apparatus of the embodiments of this application is provided below.
[0177] Please see Figure 5 This figure is a schematic diagram of a request processing device provided in an embodiment of this application. The request processing device can be located in a computer device, which can be the terminal device containing the client provided in this embodiment of the application. Specifically, the client can be one of the aforementioned... Figure 1 Client 101 in the request processing system shown. Figure 5 The request processing device shown can be a computer program running on a computer device, which can be used to perform... Figure 2 or Figure 3 Some or all of the steps in the method embodiments shown. Please refer to [link / reference]. Figure 5 The request processing apparatus may include the following units:
[0178] The acquisition unit 501 is used to acquire interface call requests from non-native applications, which are developed based on native applications.
[0179] The processing unit 502 is used to respond to the interface call request and determine the target public interface corresponding to the interface call request from the public interface pool. The public interface pool includes multiple public interfaces, which are application interfaces corresponding to the program functions of the native application. One or more non-native applications associated with the native application use the program functions corresponding to the public interface by calling the public interface.
[0180] The adaptation unit 503 is used to call the data adapter set for non-native applications to perform data adaptation processing on the interface call request and obtain the interface call data.
[0181] The processing unit 502 is also used to perform processing operations that match the target public interface based on the interface call data, obtain the processing result, and return the processing result to the non-native application.
[0182] In one possible implementation, when the adaptation unit 503 is used to call the data adapter set for the non-native application to perform data adaptation processing on the interface call request and obtain the interface call data, it is specifically used for:
[0183] The data adapter set up for the non-native application is invoked to extract parameters from the interface call request and obtain request parameters in a first data format; the first data format is the data format supported by the interface of the non-native application.
[0184] The request parameters in the first data format are converted to obtain the request parameters in the second data format; the second data format is the data format supported by the public interfaces in the public interface pool.
[0185] The API call data is determined based on the request parameters in the second data format.
[0186] In one possible implementation, the adapter unit 503 is also used for:
[0187] The data adapter set for the non-native application is invoked to perform API call permission detection on the non-native application and obtain the detection result.
[0188] If the detection result indicates that the non-native application has the permission to call the target public interface, then the steps to perform the processing operation that matches the target public interface are executed based on the interface call data.
[0189] In one possible implementation, when processing unit 502 determines the target public interface corresponding to the interface call request from the public interface pool in response to the interface call request, it specifically performs the following:
[0190] In response to an API call request, extract the API identifier of the API to be called from the API call request;
[0191] Determine the matching public interfaces from the public interface pool whose public interface identifiers match the interface identifier of the interface to be called;
[0192] The matching public interface is determined as the target public interface corresponding to the interface call request.
[0193] In one possible implementation, the processing unit 502 is further configured to:
[0194] If there are new application features added to the native application, then new public interfaces are built based on the new application features;
[0195] Add new public interfaces to the public interface pool, and one or more non-native applications associated with the native application can use the new application functions by calling the new public interfaces.
[0196] In one possible implementation, the processing unit 502 is further configured to:
[0197] If a new non-native application is added to a native application, then a data adapter is set for the new non-native application;
[0198] Among them, the data adapter set up for newly added non-native applications is used to perform data adaptation processing for the interface call requests of newly added non-native applications.
[0199] In one possible implementation, the target public interface is a data query interface; when the processing unit 502 performs processing operations matching the target public interface based on the interface call data and obtains the processing result, it is specifically used for:
[0200] Extract the object identifier and data query parameters of the request initiator from the API call data;
[0201] Use the data query function corresponding to the data query interface to query the candidate data set associated with the object identifier, and select candidate data from the candidate data set according to the data query parameters;
[0202] The processing result is determined based on the selected candidate data.
[0203] In one possible implementation, when the adaptation unit 503 is used to invoke the data adapter set for the non-native application to perform interface call permission detection processing on the non-native application, it is specifically used for:
[0204] Invoke the data adapter set for the non-native application to obtain the object information of the login object on the non-native application, and obtain the access control information of the non-native application; the access control information includes the object information of the authorized object;
[0205] If the object information of the authorized object contains the object information of the logged-in object, then the detection result is determined as the first detection result; the first detection result indicates that the non-native application has the interface call permission for the target public interface;
[0206] If the object information of the authorized object does not contain the object information of the logged-in object, then the detection result is determined to be the second detection result; the second detection result indicates that the non-native application does not have the permission to call the target public interface.
[0207] It should be noted that the functions of each unit of the request processing device in the embodiments of this application can be specifically implemented according to the methods in the above method embodiments. The specific implementation process can be referred to the relevant descriptions in the various method embodiments of this application, which will not be repeated here.
[0208] According to another embodiment of this application, Figure 5 The various units in the request processing apparatus shown can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the request processing apparatus may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0209] According to another embodiment of this application, the following can be achieved by running on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), a device capable of performing operations such as... Figure 2 or Figure 3 Computer programs for the steps involved in some or all of the methods shown, to construct, for example... Figure 5 The request processing apparatus shown herein, and the request processing method for implementing the embodiments of this application, are described. A computer program may be recorded on, for example, a computer-readable storage medium, loaded onto the aforementioned computing device via the computer-readable storage medium, and executed therein.
[0210] Based on the above methods and apparatus embodiments, this application provides a computer device. Please refer to... Figure 6 This figure is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 6The computer device shown includes at least a processor 601, an input interface 602, an output interface 603, and a computer-readable storage medium 604. The processor 601, input interface 602, output interface 603, and computer-readable storage medium 604 can be connected via a bus or other means.
[0211] Computer-readable storage medium 604 can be stored in the memory of a computer device. Computer-readable storage medium 604 is used to store computer programs, including program instructions. Processor 601 is used to execute the computer program stored in computer-readable storage medium 604. Processor 601 (or CPU (Central Processing Unit)) is the computing and control core of the computer device, suitable for implementing computer programs, specifically suitable for loading and executing computer programs to achieve corresponding methods or functions.
[0212] This application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device used to store programs and data. It is understood that the computer-readable storage medium here can include both built-in storage media in the computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space for storing the operating system of the computer device. Furthermore, the storage space also stores computer programs suitable for loading and execution by a processor. It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device; optionally, it can also be at least one computer-readable storage medium located remotely from the aforementioned processor.
[0213] The computer device can be the terminal device where the client provided in the embodiments of this application is located, and the client can specifically be the one described above. Figure 1 The client 101 in the request processing system shown. In a specific implementation, the processor 601 can load and execute the computer program stored in the computer-readable storage medium 604 to implement the corresponding steps of the request processing methods in the various method embodiments of this application. Specifically, the computer program in the computer-readable storage medium 604 is loaded by the processor 601 and executed with the following steps:
[0214] Obtain API call requests from non-native applications, which are developed based on native applications;
[0215] In response to an API call request, the target public API corresponding to the API call request is determined from the public API pool. The public API pool includes multiple public APIs, which are application interfaces corresponding to the program functions of the native application. One or more non-native applications associated with the native application use the program functions corresponding to the public APIs by calling the public APIs.
[0216] The data adapter set up for non-native applications is invoked to perform data adaptation processing on the API call request and obtain the API call data.
[0217] Based on the API call data, perform processing operations that match the target public API, obtain the processing results, and return the processing results to the non-native application.
[0218] In one possible implementation, when processor 601 invokes the data adapter set up for a non-native application to perform data adaptation processing on the interface call request and obtain the interface call data, it specifically performs the following:
[0219] The data adapter set up for the non-native application is invoked to extract parameters from the interface call request and obtain request parameters in a first data format; the first data format is the data format supported by the interface of the non-native application.
[0220] The request parameters in the first data format are converted to obtain the request parameters in the second data format; the second data format is the data format supported by the public interfaces in the public interface pool.
[0221] The API call data is determined based on the request parameters in the second data format.
[0222] In one possible implementation, processor 601 is also used for:
[0223] The data adapter set for the non-native application is invoked to perform API call permission detection on the non-native application and obtain the detection result.
[0224] If the detection result indicates that the non-native application has the permission to call the target public interface, then the steps to perform the processing operation that matches the target public interface are executed based on the interface call data.
[0225] In one possible implementation, when processor 601 determines the target public interface corresponding to the interface call request from the public interface pool in response to the interface call request, it specifically performs the following:
[0226] In response to an API call request, extract the API identifier of the API to be called from the API call request;
[0227] Determine the matching public interfaces from the public interface pool whose public interface identifiers match the interface identifier of the interface to be called;
[0228] The matching public interface is determined as the target public interface corresponding to the interface call request.
[0229] In one possible implementation, processor 601 is also used for:
[0230] If there are new application features added to the native application, then new public interfaces are built based on the new application features;
[0231] Add new public interfaces to the public interface pool, and one or more non-native applications associated with the native application can use the new application functions by calling the new public interfaces.
[0232] In one possible implementation, processor 601 is also used for:
[0233] If a new non-native application is added to a native application, then a data adapter is set for the new non-native application;
[0234] Among them, the data adapter set up for newly added non-native applications is used to perform data adaptation processing for the interface call requests of newly added non-native applications.
[0235] In one possible implementation, the target public interface is a data query interface; when the processor 601 performs processing operations matching the target public interface based on the interface call data and obtains the processing result, it is specifically used for:
[0236] Extract the object identifier and data query parameters of the request initiator from the API call data;
[0237] Use the data query function corresponding to the data query interface to query the candidate data set associated with the object identifier, and select candidate data from the candidate data set according to the data query parameters;
[0238] The processing result is determined based on the selected candidate data.
[0239] In one possible implementation, when the processor 601 is used to invoke the data adapter set up for the non-native application to perform interface call permission detection processing on the non-native application, it is specifically used for:
[0240] Invoke the data adapter set for the non-native application to obtain the object information of the login object on the non-native application, and obtain the access control information of the non-native application; the access control information includes the object information of the authorized object;
[0241] If the object information of the authorized object contains the object information of the logged-in object, then the detection result is determined as the first detection result; the first detection result indicates that the non-native application has the interface call permission for the target public interface;
[0242] If the object information of the authorized object does not contain the object information of the logged-in object, then the detection result is determined to be the second detection result; the second detection result indicates that the non-native application does not have the permission to call the target public interface.
[0243] In the several embodiments provided in this application, it should be understood that the disclosed methods, apparatus, systems, and computer devices can be implemented in other ways. The embodiments described above are merely illustrative, and the division of units is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0244] This application also provides a computer program product, which includes program instructions stored in a computer-readable storage medium. A processor of a computer device reads the program instructions from the computer-readable storage medium and executes the program instructions, causing the computer device to perform the aforementioned request processing method, which will not be described in detail here.
[0245] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0246] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more program instructions. When the program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The program instructions can be stored in or transmitted through a computer-readable storage medium. The program instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0247] It should be noted that, in the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0248] It should be noted that the terms "first," "second," etc., used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature specified with "first" or "second" may explicitly or implicitly include at least one of those features.
[0249] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A request processing method, characterized in that, The method includes: Obtain API call requests from non-native applications, where the non-native applications are developed based on native applications; In response to the interface call request, the target public interface corresponding to the interface call request is determined from the public interface pool; the public interface pool includes multiple public interfaces, which are application interfaces corresponding to the program functions of the native application, and one or more non-native applications associated with the native application use the program functions corresponding to the public interface by calling the public interface; The data adapter set for the non-native application is invoked to perform data adaptation processing on the interface call request, thereby obtaining the interface call data. Based on the interface call data, perform processing operations that match the target public interface, obtain the processing result, and return the processing result to the non-native application.
2. The method as described in claim 1, characterized in that, The call is made to the data adapter set up by the non-native application, which performs data adaptation processing on the interface call request to obtain interface call data, including: The data adapter set up for the non-native application is invoked to extract parameters from the interface call request, resulting in request parameters in a first data format; the first data format is a data format supported by the interface of the non-native application. The request parameters in the first data format are converted to obtain the request parameters in the second data format; the second data format is a data format supported by the public interfaces in the public interface pool. The interface call data is determined based on the request parameters in the second data format.
3. The method as described in claim 1, characterized in that, The method further includes: The data adapter set for the non-native application is invoked to perform interface call permission detection processing on the non-native application and obtain the detection result; If the detection result indicates that the non-native application has interface call permissions for the target public interface, then the step of performing the processing operation matching the target public interface based on the interface call data is executed.
4. The method as described in claim 1, characterized in that, The step of responding to the interface call request by determining the target public interface corresponding to the interface call request from the public interface pool includes: In response to the interface call request, extract the interface identifier of the interface to be called from the interface call request; Determine the matching public interfaces from the public interface pool whose public interface identifiers match the interface identifier of the interface to be called; The matching public interface is determined as the target public interface corresponding to the interface call request.
5. The method according to any one of claims 1-4, characterized in that, The method further includes: If there are new application features in the native application, then a new public interface is constructed based on the new application features; The newly added public interface is added to the public interface pool, and one or more non-native applications associated with the native application use the newly added application functions by calling the newly added public interface.
6. The method according to any one of claims 1-4, characterized in that, The method further includes: If a new non-native application is added to the native application, then a data adapter is set for the new non-native application; The data adapter set up for the newly added non-native application is used to perform data adaptation processing on the interface call requests of the newly added non-native application.
7. The method according to any one of claims 1-4, characterized in that, The target public interface is a data query interface; the step of calling data according to the interface to perform processing operations matching the target public interface and obtaining processing results includes: Extract the object identifier and data query parameters of the request initiating object from the interface call data; Using the data query function corresponding to the data query interface, query the candidate data set associated with the object identifier, and select candidate data from the candidate data set according to the data query parameters; The processing result is determined based on the selected candidate data.
8. The method as described in claim 3, characterized in that, The call is made to the data adapter set up for the non-native application, and the non-native application undergoes interface call permission detection processing to obtain the detection result, including: The data adapter set for the non-native application is invoked to obtain the object information of the login object on the non-native application, and to obtain the access control information of the non-native application; the access control information includes the object information of the authorized object; If the object information of the authorized object contains the object information of the login object, then the detection result is determined to be the first detection result; the first detection result indicates that the non-native application has the interface call permission for the target public interface; If the object information of the authorized object does not contain the object information of the login object, then the detection result is determined to be the second detection result; the second detection result indicates that the non-native application does not have the interface call permission for the target public interface.
9. A request processing apparatus, characterized in that, The device includes: The acquisition unit is used to acquire interface call requests from non-native applications, wherein the non-native applications are developed based on native applications; A processing unit is configured to, in response to the interface call request, determine the target public interface corresponding to the interface call request from a public interface pool; the public interface pool includes multiple public interfaces, which are application interfaces corresponding to the program functions of the native application, and one or more non-native applications associated with the native application use the program functions corresponding to the public interface by calling the public interface; An adaptation unit is used to call the data adapter set for the non-native application to perform data adaptation processing on the interface call request and obtain the interface call data. The processing unit is further configured to perform a processing operation matching the target public interface based on the interface call data, obtain a processing result, and return the processing result to the non-native application.
10. A computer device, characterized in that, The computer device includes: A processor is a tool for implementing computer programs. A computer-readable storage medium storing a computer program adapted to be loaded by the processor and executed as described in any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and executed by the request processing method as described in any one of claims 1-8.
12. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the request processing method as described in any one of claims 1-8.