A target function parameter transmission method, device, equipment and storage medium
By intercepting, verifying, and parsing network request parameters, the target function to be called and its associated interfaces are determined, the call complexity is calculated, and an appropriate calling method is selected. This solves the problems of low efficiency and poor stability in client-server interaction, and achieves efficient and stable interaction.
Patent Information
- Application Number
- CN202510612498.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2045-05-13
AI Technical Summary
In the interaction process between the client and the server, existing technologies suffer from low interaction efficiency and poor stability, and cannot meet the diverse interaction needs in complex business scenarios.
By intercepting and verifying network requests, parsing request parameters, determining the target function to be called and its associated functional interfaces, calculating the call complexity and determining the call type, and selecting an appropriate call method to pass the functional parameters.
It improves interaction efficiency and stability, meets the interaction needs in complex business scenarios, and enhances the system's response speed and performance.
Smart Images

Figure CN120528639B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for transmitting target functional parameters. Background Technology
[0002] With the development of the mobile internet, hybrid development models are receiving increasing attention. In hybrid development, the need for interaction between clients and servers is growing. Clients can interact with servers directly through native code or through JavaScript code in web views using relevant network request frameworks to transmit data and interact with servers. This is common in mobile applications, desktop applications, and other fields, aiming to improve development efficiency, reduce costs, and enhance user experience.
[0003] In related technologies, during the interaction between the client and the server, the network request parameters sent by the client are usually received directly, the function request data in the network request parameters is parsed, and the function interface corresponding to the function request data is called in a fixed way. This interaction method has problems such as low efficiency and poor stability, and cannot meet the interaction needs in complex business scenarios. For example, when dealing with complex business scenarios, the fixed interaction method cannot meet the diverse interaction needs, such as real-time interaction of multiple types of data and collaborative calling of complex functions. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for transmitting target function parameters, solving problems such as low efficiency and poor stability in multi-terminal interactions, which cannot meet the interaction needs of complex business scenarios. By intercepting and verifying function call requests, irrelevant request parameters are avoided, improving parsing efficiency. By calculating the call complexity of function data and determining the corresponding call type based on the call complexity, interaction efficiency and stability are improved, fully meeting the interaction needs of complex business scenarios.
[0005] In a first aspect, embodiments of this application provide a method for transmitting target functional parameters, including:
[0006] Upon detecting a network request, determine whether the network request meets the preset interception conditions based on the request protocol and function identifier in the network request. For network requests that meet the preset interception conditions, perform request interception verification to obtain network request parameters.
[0007] The network request parameters are parsed to obtain the network request identifier and the target calling function. Multiple functional interfaces associated with the target calling function are identified, and the degree of association between each functional interface is analyzed to obtain the degree of association between each functional interface.
[0008] The call complexity of the functional data is calculated based on the number of functional interfaces, the degree of association, and the preset weight ratio, and the call type corresponding to the call complexity is determined.
[0009] According to the call type, the first target function parameter corresponding to each of the function interfaces is invoked, and the first target function parameter is written into the target call function associated with the network request identifier. The target call function is then executed to pass the first target function parameter.
[0010] Optionally, the step of performing correlation analysis on each of the functional interfaces to obtain the correlation degree between each of the functional interfaces includes:
[0011] Semantic parsing is performed on the method signatures of each functional interface to determine the semantic relationship of the method signatures. The collaboration relationship of the method signatures is determined according to the calling position of each method signature. The degree of association between each functional interface is determined according to the semantic relationship and the collaboration relationship.
[0012] Optionally, determining the degree of association between each of the functional interfaces based on the semantic relationship and the collaboration relationship includes:
[0013] The relationship type between each of the functional interfaces is determined based on the semantic relationship and the collaboration relationship. If the relationship type is an inheritance type or an implementation type, a first association level is determined to exist between each of the functional interfaces.
[0014] When the relationship type is a composite or aggregate type, a second association level is determined to exist between the functional interfaces described above;
[0015] When the relationship type is a dependency type, it is determined that there is a third association level among the functional interfaces, where the degree of association of the first association level is greater than that of the second association level, and the degree of association of the second association level is greater than that of the third association level.
[0016] Optionally, the step of performing request interception verification on network requests that meet the preset interception conditions to obtain network request parameters includes:
[0017] The network request parameters are obtained by intercepting network requests that meet the preset interception conditions through a preset interceptor, validating the interception parameters according to a preset data type, and formatting abnormal parameters in the validation results.
[0018] Optionally, after invoking the first target function parameters corresponding to each of the function interfaces according to the invocation type, the method further includes:
[0019] The first target function parameter is idempotent according to the preset interceptor, and the target function parameter is filtered according to the idempotency verification result to obtain the second target function parameter.
[0020] Accordingly, the step of writing the first target function parameter into the target call function associated with the network request identifier and executing the target call function to pass the first target function parameter includes:
[0021] Write the second target function parameter into the target call function associated with the network request identifier, and execute the target call function to pass the second target function parameter.
[0022] Optionally, after transmitting the second target function parameter, the method further includes:
[0023] Receive page layout update notification information, parse the update data of the page layout update notification information to obtain page update data, and update the page configuration according to the page update data.
[0024] Optionally, determining whether the network request meets the preset interception conditions based on the request protocol and function identifier in the network request includes:
[0025] The request protocol in the network request is matched with a preset protocol, and the function identifier in the network request is matched with a preset function identifier. If the request protocol matches the preset protocol and the function identifier matches the preset function identifier, the network request is determined to meet the preset interception conditions.
[0026] In a second aspect, embodiments of this application provide a device for transmitting target functional parameters, comprising:
[0027] The network request interception and verification module is used to determine whether a network request meets a preset interception condition based on the request protocol and function identifier in the network request when a network request is detected, and to perform request interception and verification on network requests that meet the preset interception condition to obtain network request parameters.
[0028] The parameter parsing module is used to parse the network request parameters to obtain the network request identifier and the target calling function;
[0029] The correlation degree determination module is used to determine multiple functional interfaces associated with the target calling function, perform correlation degree analysis on each functional interface, and obtain the correlation degree between each functional interface.
[0030] The complexity calculation module is used to calculate the calling complexity of the functional data based on the number of functional interfaces, the degree of association, and the preset weight ratio, and to determine the calling type corresponding to the calling complexity.
[0031] The target function parameter passing module is used to call the first target function parameter corresponding to each of the function interfaces according to the call type, write the first target function parameter into the target call function associated with the network request identifier, and execute the target call function to pass the first target function parameter.
[0032] In a third aspect, embodiments of this application provide an electronic device, the device comprising: one or more processors; and a storage device configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for transmitting target function parameters as described in the first aspect.
[0033] In a fourth aspect, embodiments of this application provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the method for transmitting target function parameters as described in the first aspect.
[0034] This application embodiment, upon detecting a network request, determines whether the request meets preset interception conditions based on the request protocol and function identifier within the network request. For network requests meeting the preset interception conditions, request interception and verification are performed to obtain network request parameters. These parameters are then parsed to obtain the network request identifier and the target function call. Multiple functional interfaces associated with the target function call are identified, and the correlation degree between these interfaces is analyzed. The call complexity of the functional data is calculated based on the number of functional interfaces, their correlation degree, and a preset weight ratio, and the call type corresponding to this complexity is determined. The first target function parameter corresponding to each functional interface is called according to the call type, and this first target function parameter is written into the target call function associated with the network request identifier. The target call function is then executed to transmit the first target function parameter. This solution improves parsing efficiency by intercepting and verifying function call requests, avoiding the parsing of irrelevant request parameters. Furthermore, by calculating the call complexity of the functional data and determining the corresponding call type based on this complexity, the interaction efficiency and stability are improved, fully meeting the interaction needs of complex business scenarios. Attached Figure Description
[0035] Figure 1 This is a flowchart of a method for transmitting target function parameters provided in an embodiment of this application;
[0036] Figure 2This is a schematic diagram illustrating a method for transmitting target function parameters provided in an embodiment of this application;
[0037] Figure 3 This is a flowchart illustrating a method for determining the degree of association between functional interfaces, as provided in an embodiment of this application.
[0038] Figure 4 This is a flowchart of another method for passing target function parameters provided in an embodiment of this application;
[0039] Figure 5 This is a schematic diagram of the structure of a target function parameter transmission device provided in an embodiment of this application;
[0040] Figure 6 This is a schematic diagram of the structure of a target function parameter transmission device provided in an embodiment of this application. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0042] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0043] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0044] The following description, in conjunction with the accompanying drawings, details the method, apparatus, device, and medium for transmitting target functional parameters provided in this application through specific embodiments and application scenarios.
[0045] The method for transmitting target function parameters provided in this application embodiment is used in multi-terminal interaction scenarios under a hybrid development mode, such as client-server interaction scenarios. Based on the above usage scenarios, it can be understood that the execution entity of this solution is the server.
[0046] Figure 1 This is a flowchart of a method for transmitting target function parameters provided in an embodiment of this application, such as... Figure 1 As shown, it includes:
[0047] Step S101: When a network request is detected, determine whether the network request meets the preset interception conditions based on the request protocol and function identifier in the network request. For network requests that meet the preset interception conditions, perform request interception verification to obtain the network request parameters.
[0048] In this context, a network request refers to a client sending a request containing request methods, headers, and bodies to a server via a URL, based on a specific protocol, to obtain information or perform an operation. The server then receives, processes, and returns a response. A request protocol refers to a set of rules and conventions followed by the client and server in network communication to achieve data exchange and interaction. These rules include specifications for data formats, transmission methods, and request methods, such as HTTP, TCP, and SMTP protocols. A function identifier is a specific identifier used to clearly define the specific operation or function expected to be performed in the request, allowing the server to accurately identify the client's needs and process them accordingly. Request interception and verification involves intercepting received requests and checking and verifying each element of the request (such as request headers, request parameters, user identity, etc.) according to certain rules to ensure the request's legitimacy, security, and compliance with system requirements. Network request parameters are data sent by the client to the server after interception and verification, confirming their legitimacy and compliance with system requirements. These parameters specify the details and operations of the request, helping the server accurately execute the corresponding function.
[0049] In one embodiment, network requests sent by clients are monitored in real time. Upon detecting a network request, the request protocol and function identifier of the request are determined. First, the request protocol is matched against preset request protocols in preset interception conditions. If the request protocol matches successfully, the function identifier is matched against preset function identifiers. If the function identifier matches successfully, the network request is intercepted, and the access permissions for the network request are verified. If the permission verification passes, the network request parameters are obtained. If the request protocol does not match successfully, the network request is not intercepted or verified.
[0050] Optionally, network requests that meet preset interception conditions are intercepted and validated to obtain network request parameters. This includes: intercepting network requests that meet preset interception conditions using a preset interceptor to obtain interception parameters; validating the interception parameters according to preset data types; and formatting abnormal parameters in the validation results to obtain network request parameters. The preset interceptor can be a component in a software system used to intercept and process specific requests or operations. It can intercept, check, modify, or supplement information before or after the request reaches the target component, and can also perform authentication, authorization verification, and logging. Validation refers to the process of checking input data or operations in a computer program or system to ensure that they conform to preset rules, formats, and constraints. Formatting refers to the conversion, adjustment, and standardization of data, text, files, etc., to conform to specific standards or requirements.
[0051] In one embodiment, a preset interceptor intercepts network requests that meet preset interception conditions to obtain interception parameters. The data format of the interception parameters is checked according to a preset data type to see if it meets preset rules. Abnormal parameters in the verification results are converted, adjusted, and standardized to obtain network request parameters that conform to preset standards.
[0052] This application embodiment intercepts network requests that meet preset interception conditions using a preset interceptor, obtains interception parameters, performs validity checks on the interception parameters according to preset data types, and formats abnormal parameters in the validation results to obtain network request parameters. In the above scheme, the validity checks and formatting through the interceptor ensure data accuracy and consistency, improve data quality, prevent system crashes due to illegal data, reduce system load, and enhance the stability of the interaction process.
[0053] In one embodiment, determining whether a network request meets a preset interception condition based on the request protocol and function identifier in the network request includes: matching the request protocol in the network request with a preset protocol, matching the function identifier in the network request with a preset function identifier, and determining that the network request meets the preset interception condition if the request protocol matches the preset protocol and the function identifier matches the preset function identifier.
[0054] For example, if the network request is: bridge: / / navgative?uuid=xxxxxx&function parameter, where the request protocol is bridge: / / and the function identifier is navgative, the default blocking rule is: request information starting with bridge: / / navgative? will be blocked, that is, the bridge: / / protocol and the navgative function identifier will be blocked.
[0055] This application embodiment determines that a network request meets preset interception conditions by matching the request protocol in the network request with a preset protocol and matching the function identifier in the network request with a preset function identifier. If both the request protocol and the function identifier match, the network request can be identified as meeting preset interception conditions. This approach improves the accuracy of network request judgment by matching the request protocol and function identifier, avoids parsing irrelevant network requests, and enhances system response speed and performance.
[0056] Step S102: Parse the network request parameters to obtain the network request identifier and the target calling function, determine multiple functional interfaces associated with the target calling function, analyze the degree of association between each functional interface, and obtain the degree of association between each functional interface.
[0057] The network request identifier is a unique and randomized universal identifier composed of numbers and letters, used to uniquely identify a request or related object in a network request for tracking, management, and differentiation. The target invocation function can refer to a client explicitly specifying a particular operation or function to be performed on the server side through a network request, and the server invoking the corresponding program logic to complete the specific task. A functional interface can refer to an interaction point in a software system or network application used to connect different functional modules or systems. It defines a specific set of methods or operations, specifying input parameters, output results, and execution logic to achieve specific functions, enabling different components or systems to work collaboratively by calling these interfaces to complete more complex tasks. In one embodiment, by parsing the network request parameters to obtain the network request identifier and the target invocation function, multiple functional interfaces associated with the target invocation function are identified, and the degree of association between the functional interfaces is determined based on the data flow or dependencies of each functional interface. For example, if the output data of one interface is the input data of another interface, the correlation between the two interfaces can be considered high. If data output from interface A is input to interface B, and data output from interface B is input to interface C, then the correlation between interface A and interface B can be considered greater than the correlation between interface A and interface C. Alternatively, it can be determined whether multiple interfaces jointly operate on the same batch of data. If multiple interfaces operate on the same batch of data, the correlation between the multiple interfaces can be considered high. For example, if interfaces A, B, and C all receive data from data set m, and interfaces D and E receive data from data set n, then the correlation between interface A and interfaces B and C can be considered greater than the correlation between interface A and interfaces D or E.
[0058] In one embodiment, semantic parsing is performed on the method signatures of each functional interface to determine the semantic relationships between them. The call positions of each method signature are then used to determine their collaborative relationships. Finally, the degree of association between the functional interfaces is determined based on both the semantic and collaborative relationships. The method signature of a functional interface can refer to the method declaration portion of the interface, which includes the method name, parameter types, and parameter order. The method signature allows the program to accurately identify different methods, such as the method signature `User getUserById(int id)`. The semantic relationships of method signatures refer to the logical and business meanings implied by the method signature, as well as its functional and conceptual connections with other methods, classes, and the system. The collaborative relationships of method signatures refer to the functional cooperation and collaboration among multiple methods through their respective signatures to achieve more complex business logic or system functions. This collaborative relationship can be determined through parameter passing and the order of invocation between methods. The degree of association between functional interfaces refers to the closeness of the mutual connection and dependence between different functional interfaces in terms of functionality, data, and logic.
[0059] For example, the network request parameters are parsed to obtain the network request identifier UUID = xxxxxx and functional parameters. The functional parameters represent the target function called corresponding to the network request identifier. For example, if the functional parameter represents the implementation of a product search function in an e-commerce system, then the target function called is the product search function. Multiple functional interfaces associated with this product search function are identified, such as the product information query interface and the category information interface. Semantic parsing is performed on the method signatures of the product information query interface and the category information interface. The method signature and corresponding semantic parsing results for the product query interface are as follows: getProductById(int productId) indicates that the function of this method is to obtain product information by product ID; getAllProducts() indicates that it is used to obtain all product information in the system; getProductsByPriceRange(double minPrice, double maxPrice) indicates the function of querying product information based on price range. The method signature and corresponding semantic parsing results for the category information interface are as follows: getCategoryById(int categoryId) indicates that it is used to obtain category information by category ID; getAllCategories() indicates that it is used to obtain all category information in the system; getCategoryByProductId(int `productId` indicates that the category information of a product is retrieved by its product ID. Based on the semantic parsing results of the method signatures, both `getProductById(int productId)` and `getAllProducts()` revolve around product information and belong to the same business scope. `getAllProducts()` retrieves information on all products in the system, a comprehensive query operation, while `getProductById(int productId)` is a precise query, retrieving detailed information for a single product by its product ID. Similarly, `getProductById(int productId)` and `getProductsByPriceRange(double minPrice, double maxPrice)` focus on product information retrieval. `getProductById` uses the product ID as the query condition for a specific product, while `getProductsByPriceRange` filters products based on price ranges, resulting in a set of products matching the price range. For example, if a user first uses `getProductsByPriceRange` to filter a list of products within a certain price range, and then uses `getProductById` to view a specific product in the list, the method signature call position indicates a sequential collaborative call relationship.Both `getCategoryById(int categoryId)` and `getAllCategories()` are related to product category information. `getAllCategories()` retrieves all category information in the system, allowing users to understand which categories exist. `getCategoryById(int categoryId)`, on the other hand, precisely queries detailed information for a specific category based on the category ID. For example, when managing or displaying categories, `getAllCategories()` might be used first to display all categories, and then `getCategoryById()` might be used to view the specific category details. The method signatures and call positions also indicate a sequential collaborative call relationship. The `getProductById(int productId)` and `getCategoryByProductId(int productId)` methods establish a connection between product information and category information. `getProductById` focuses on the detailed information of the product itself, while `getCategoryByProductId` uses the product ID to find the category information to which the product belongs. For example, in an e-commerce system, when a user views product details, they might also want to know which category the product belongs to; in this case, these two methods would be called sequentially. In one embodiment, the collaboration relationship between method signatures can also include nested call relationships, callback call relationships, and chained call relationships. A nested call relationship occurs when one method calls another method, and the called method in turn calls other methods. Therefore, the collaboration relationship between method signatures can be determined based on the call positions of each method. A first association level exists between functional interfaces whose method signatures have a semantic relationship and whose collaboration relationship is a nested call relationship. A second association level exists between functional interfaces whose method signatures have a semantic relationship but whose collaboration relationship is a non-nested substitution relationship. A third association level exists between functional interfaces whose method signatures do not have a semantic relationship or no collaboration relationship. The degree of association at the first association level is greater than that at the second association level, which is greater than that at the third association level.
[0060] Step S103: Calculate the calling complexity of the functional data based on the number of functional interfaces, the degree of association, and the preset weight ratio, and determine the calling type corresponding to the calling complexity.
[0061] The complexity of function data invocation refers to the degree of complexity involved in invoking various functions and processing related data in a software system or program. In one embodiment, the correlation between the degree of association and the first invocation complexity, as well as the correlation between the number of function interfaces and the second invocation complexity, can be predetermined. For example, the first invocation complexity corresponding to the first association level is 80%, the first invocation complexity corresponding to the second association level is 60%, the first invocation complexity corresponding to the third association level is 40%, the second invocation complexity is determined to be 30% when the number of function interfaces is less than or equal to 3, 60% when the number of function interfaces is 4-6, and 90% when the number of function interfaces is greater than 7. For example, a call complexity of 0-30% corresponds to a batch call, a call complexity of 31-60% corresponds to a synchronous call, and a call complexity of 61-100% corresponds to an asynchronous call. If there are 3 functional interfaces, the degree of association between the functional interfaces is the second association level, and the preset weight ratio is 4:6, then the call complexity of the functional data can be calculated as 30%*40%+60%*60%=48%.
[0062] In one embodiment, the call type can also be determined based on the judgment result and the degree of association. For example, if the call complexity is greater than the complexity threshold and the degree of association is the third association level, the call type is determined to be an asynchronous call; if the call complexity is less than or equal to the complexity threshold and the degree of association is the third association level, the call type is determined to be a synchronous call; if the call complexity is less than or equal to the complexity threshold and the degree of association is the first or second association level, the call type is determined to be a batch call. A synchronous call can be a method where, during program execution, the caller issues a call request, pauses its own execution, waits for the callee to complete the operation and return the result, and then continues executing subsequent code. An asynchronous call can also be a program call method where, after issuing a call request, the caller does not wait for the callee to complete execution and return the result, but continues executing its own subsequent code. The callee executes the task independently in the background and returns the result to the caller through callback functions, event notifications, or other mechanisms upon completion. A batch call can refer to performing the same or similar call operations on multiple objects or tasks at once in a program or system, rather than calling them one by one. By combining multiple call requests together, they can be sent to the target function, interface, or service in batches.
[0063] In one embodiment, the calculated call complexity is compared with a preset complexity threshold. If the call complexity is greater than the threshold and the correlation level is the third correlation level, the call complexity is considered high, and the correlation between the interfaces is weak. In this case, asynchronous calls can be used for parameter invocation. If the call complexity is less than or equal to the threshold and the correlation level is the third correlation level, the call complexity is considered low, and the correlation between the interfaces is strong. In this case, synchronous calls can be used for parameter invocation. If the call complexity is less than or equal to the threshold and the correlation level is the first or second correlation level, the call complexity is considered low, and the correlation between the interfaces is strong. In this case, batch calls can be used for parameter invocation.
[0064] This application's embodiments determine the call type as asynchronous when the call complexity is greater than a complexity threshold and the correlation level is the third correlation level; determine the call type as synchronous when the call complexity is less than or equal to the complexity threshold and the correlation level is the third correlation level; and determine the call type as batch call when the call complexity is less than or equal to the complexity threshold and the correlation level is the first or second correlation level. In the above scheme, determining the corresponding parameter calling method based on the call complexity and the correlation level between each functional interface can significantly improve system performance, achieve efficient operation, enhance system stability, reduce coupling, improve fault tolerance, and ensure system reliability.
[0065] Step S104: Call the first target function parameter corresponding to each function interface according to the call type, write the first target function parameter into the target call function associated with the network request identifier, and execute the target call function to pass the first target function parameter.
[0066] The first target function parameter is the final function parameter to be invoked, determined based on the network request information. Since different network request information corresponds to different target call functions, and the network request identifier is used to uniquely identify a request within a network request, and different network request parameters also correspond to different network request identifiers, there is an association between the network request identifier and the target call function. The target call function can be a function defined using the `function` keyword, invoked in other code using its function name enclosed in parentheses, passing the actual parameters to it to trigger function execution. This invoked function is the target call function. In one embodiment, after determining the call type, the target function parameters corresponding to each functional interface are invoked according to the call type. The associated target call function is determined based on the network request identifier, the obtained target function parameters are written into the target call function, and the target call function is executed. Execution of the target call function transmits the invoked function parameters to the client, enabling interaction between the client and server.
[0067] Figure 2 This is a schematic diagram illustrating a method for transferring target function parameters provided in an embodiment of this application. Figure 2 As shown, the client predefines a JavaScript function, which is executed through a webview to generate a processing result block and the corresponding UUID of the JavaScript function. The UUID and block are stored as key-value pairs. A network request "bridge: / / navgative?uuid=xxxxxx&function parameters" is sent to the server to call the corresponding function interface. The server intercepts and verifies network requests that meet preset interception conditions, obtains the network request parameters, analyzes and processes the parameters, calls the function parameters of the corresponding function interface based on the analysis and processing results, writes the function parameters into the JavaScript function, executes the JavaScript function, and passes the function parameters to the client. The client determines the corresponding block based on the UUID and executes the block.
[0068] This application embodiment, upon detecting a network request, determines whether the network request meets preset interception conditions based on the request protocol and function identifier in the network request. For network requests that meet the preset interception conditions, request interception verification is performed to obtain network request parameters. The network request parameters are parsed to obtain the network request identifier and the target call function. Multiple functional interfaces associated with the target call function are identified. Semantic parsing is performed on the method signatures of each functional interface to determine the semantic relationships of the method signatures. The collaboration relationships of the method signatures are determined based on the call positions of each method signature. The degree of association between each functional interface is determined based on the semantic and collaboration relationships. The call complexity of the functional data is calculated based on the number of functional interfaces, the degree of association, and a preset weight ratio. It is then determined whether the call complexity exceeds a set complexity threshold. The call type is determined based on the judgment result and the degree of association. The first target function parameter corresponding to each functional interface is called according to the call type, and the first target function parameter is written into the target call function associated with the network request identifier. The target call function is executed to pass the first target function parameter. The above solution can intercept and verify function call requests, avoiding the parsing of irrelevant request parameters and improving parsing efficiency. By calculating the call complexity of function data and determining the corresponding call type based on the call complexity, the interaction efficiency and stability are improved, fully meeting the interaction needs in complex business scenarios.
[0069] Figure 3 This is a flowchart illustrating a method for determining the degree of association between functional interfaces, as provided in an embodiment of this application. Figure 3 As shown, it includes:
[0070] Step S1021: Determine the relationship type between each functional interface based on the semantic relationship and the cooperation relationship. If the relationship type is an inheritance type or an implementation type, determine that there is a first association level between each functional interface.
[0071] Inheritance refers to the process in programming where one interface (sub-interface) inherits the functional definitions of another interface (parent interface). The sub-interface receives all methods declared in the parent interface and can also add new methods. Implementation relationships between functional interfaces refer to one interface providing a concrete implementation of the methods and functionalities defined in another interface. When an interface implements another interface, it needs to provide the specific code logic for all methods in the implemented interface to ensure that these methods execute as expected. Through implementation relationships, interfaces can form a contractual constraint, requiring classes or objects implementing the interface to adhere to specific method signatures and functional specifications, thereby ensuring functional consistency and substitutability between different modules. In one embodiment, the relationship type between functional interfaces is determined based on semantic and collaboration relationships. This relationship type can include inheritance, implementation, composition, aggregation, and dependency. When the relationship type between functional interfaces is determined to be inheritance or implementation, the degree of association between the functional interfaces is considered strong, and a first-level association can be determined between the functional interfaces.
[0072] Step S1022: When the relationship type is a composite type or an aggregate type, determine that there is a second association level between the functional interfaces.
[0073] Composition refers to combining multiple different functional interfaces to form a more complex interface or object. In composition, an interface or object does not inherit methods from other interfaces but treats instances of other interfaces as its own members, implementing richer functionality by calling the methods of these member interfaces. Aggregation embodies a whole-part relationship; partial interfaces can exist independently of the whole interface. In aggregation, one interface (the whole interface) contains references to other interfaces (partial interfaces). The whole interface uses these partial interfaces to complete specific functions, but the partial interfaces are not entirely dependent on the whole interface; they can be reused in other environments. In one embodiment, when determining whether the relationship between functional interfaces is composition or aggregation, the degree of association between the functional interfaces can be considered weaker than inheritance or implementation relationships, thus classifying the degree of association between the functional interfaces as the second association level.
[0074] Step S1023: When the relationship type is a dependency type, determine that there is a third association level between each functional interface. The degree of association of the first association level is greater than that of the second association level, and the degree of association of the second association level is greater than that of the third association level.
[0075] In this context, the dependency relationship between functional interfaces refers to the fact that the implementation or use of one interface requires the functionality of another interface. When one interface depends on another, its normal operation is inseparable from the services provided by the dependent interface. This dependency relationship does not form a strict hierarchical structure like inheritance, but rather a more flexible association. In one embodiment, when determining that the relationship type between functional interfaces is a dependency relationship, the degree of association between the functional interfaces can be considered weak. In this case, the degree of association between the functional interfaces can be determined as the third association level, where the degree of association at the first association level is greater than that at the second association level, and the degree of association at the second association level is greater than that at the third association level.
[0076] This application's embodiments determine the relationship type between functional interfaces based on semantic and collaborative relationships. When the relationship type is inheritance or implementation, a first association level is determined between the functional interfaces; when the relationship type is composition or aggregation, a second association level is determined; and when the relationship type is dependency, a third association level is determined. The degree of association at the first association level is greater than that at the second association level, and the degree of association at the second association level is greater than that at the third association level. This scheme allows for the classification of relationship types into corresponding association levels, grouping relationship types with similar degrees of association into the same association level. This ensures the accuracy of the determined association levels while facilitating subsequent calculations of call complexity based on the association levels.
[0077] Figure 4 This is a flowchart of another method for passing target function parameters provided in an embodiment of this application, such as... Figure 4 As shown, it includes:
[0078] Step S201: When a network request is detected, determine whether the network request meets the preset interception conditions based on the request protocol and function identifier in the network request. For network requests that meet the preset interception conditions, perform request interception verification to obtain the network request parameters.
[0079] Step S202: Parse the network request parameters to obtain the network request identifier and the target calling function, identify multiple functional interfaces associated with the target calling function, perform semantic parsing on the method signatures of each functional interface to determine the semantic relationship of the method signatures, determine the cooperation relationship of the method signatures based on the calling position of each method signature, and determine the degree of association between each functional interface based on the semantic relationship and the cooperation relationship.
[0080] Step S203: Calculate the calling complexity of the functional data based on the number of functional interfaces, the degree of association, and the preset weight value, and determine whether the calling complexity exceeds the set complexity threshold. Determine the calling type based on the judgment result and the degree of association.
[0081] Step S204: Call the first target function parameter corresponding to each function interface according to the call type, perform idempotency verification on the first target function parameter according to the preset interceptor, and filter the target function parameter according to the idempotency verification result to obtain the second target function parameter.
[0082] Step S205: Write the second target function parameter into the target call function associated with the network request identifier, and execute the target call function to pass the second target function parameter.
[0083] Idempotency checking can be a mechanism to ensure that an operation produces the same result when executed multiple times. In the system, it uniquely identifies the request, such as using a request ID or a specific business key, to determine whether the same operation has already been executed. When a request is received, the system checks whether the request identifier already exists in the record. If it does, it means that the operation has already been executed, and the system will directly return the previous result without repeating the actual business logic. In one embodiment, the first target function parameter corresponding to each function interface is called according to the call type. The first target function parameter is idempotent according to a preset interceptor to check whether there is a duplicate call parameter corresponding to the function identifier in the first target function parameter. If so, the duplicate call parameter is filtered out to obtain the second function parameter. The second function parameter is the remaining function parameter after filtering out the duplicate call parameters in the first target function parameter. The second target function parameter is written into the target call function associated with the network request identifier, and the target call function is executed to pass the second target function parameter to the client.
[0084] This embodiment of the application performs idempotency verification on the first target function parameter according to a preset interceptor, filters the target function parameter based on the idempotency verification result to obtain a second target function parameter, writes the second target function parameter into a target call function associated with a network request identifier, and executes the target call function to transmit the second target function parameter. This scheme avoids repeatedly transmitting the same function parameter to the client, improves interaction efficiency, reduces resource consumption, and enhances system stability.
[0085] In one embodiment, after transmitting the second target function parameters, the method further includes: receiving page layout update prompt information, parsing the page layout update prompt information to obtain page update data, and updating the page configuration based on the page update data. The page layout update prompt information may be generated after the client receives the page layout function parameters and updates the original page configuration based on those parameters. The system can monitor and receive this page layout update prompt information in real time, parse it to obtain update data, identify the function parameters in the update data, and update the page configuration based on those parameters.
[0086] Figure 5 This is a schematic diagram of the structure of a target function parameter transmission device provided in an embodiment of this application, as shown below. Figure 5 As shown, it includes:
[0087] The network request interception and verification module 31 is used to determine whether the network request meets the preset interception conditions based on the request protocol and function identifier in the network request when a network request is detected, and to perform request interception and verification on the network request that meets the preset interception conditions to obtain the network request parameters.
[0088] Parameter parsing module 32 is used to parse the network request parameters to obtain the network request identifier and the target calling function;
[0089] The correlation degree determination module 33 is used to determine multiple functional interfaces associated with the target calling function, perform correlation degree analysis on each functional interface, and obtain the correlation degree between each functional interface.
[0090] Complexity calculation module 34 is used to calculate the calling complexity of the functional data based on the number of functional interfaces, the degree of association and the preset weight value, and to determine the calling type corresponding to the calling complexity;
[0091] The target function parameter passing module 35 is used to call the first target function parameter corresponding to each of the function interfaces according to the call type, write the first target function parameter into the target call function associated with the network request identifier, and execute the target call function to pass the first target function parameter.
[0092] This application embodiment, upon detecting a network request, determines whether the network request meets preset interception conditions based on the request protocol and function identifier in the network request. For network requests that meet the preset interception conditions, request interception verification is performed to obtain network request parameters. The network request parameters are parsed to obtain the network request identifier and the target call function. Multiple functional interfaces associated with the target call function are identified. Semantic parsing is performed on the method signatures of each functional interface to determine the semantic relationships of the method signatures. The collaboration relationships of the method signatures are determined based on the call positions of each method signature. The degree of association between each functional interface is determined based on the semantic and collaboration relationships. The call complexity of the functional data is calculated based on the number of functional interfaces, the degree of association, and a preset weight ratio. It is then determined whether the call complexity exceeds a set complexity threshold. The call type is determined based on the judgment result and the degree of association. The first target function parameter corresponding to each functional interface is called according to the call type, and the first target function parameter is written into the target call function associated with the network request identifier. The target call function is executed to pass the first target function parameter. The above solution can intercept and verify function call requests, avoiding the parsing of irrelevant request parameters and improving parsing efficiency. By calculating the call complexity of function data and determining the corresponding call type based on the call complexity, the interaction efficiency and stability are improved, fully meeting the interaction needs in complex business scenarios.
[0093] In one possible embodiment, the association degree determination module 33 is specifically used for:
[0094] The relationship type between each of the functional interfaces is determined based on the semantic relationship and the collaboration relationship. If the relationship type is an inheritance type or an implementation type, a first association level is determined to exist between each of the functional interfaces.
[0095] When the relationship type is a composite or aggregate type, a second association level is determined to exist between the functional interfaces described above;
[0096] When the relationship type is a dependency type, it is determined that there is a third association level among the functional interfaces, where the degree of association of the first association level is greater than that of the second association level, and the degree of association of the second association level is greater than that of the third association level.
[0097] In one possible embodiment, the association degree determination module 33 is specifically used for:
[0098] The relationship type between each of the functional interfaces is determined based on the semantic relationship and the collaboration relationship. If the relationship type is an inheritance type or an implementation type, a first association level is determined to exist between each of the functional interfaces.
[0099] When the relationship type is a composite or aggregate type, a second association level is determined to exist between the functional interfaces described above;
[0100] When the relationship type is a dependency type, it is determined that there is a third association level among the functional interfaces, where the degree of association of the first association level is greater than that of the second association level, and the degree of association of the second association level is greater than that of the third association level.
[0101] In one possible embodiment, the network request interception and verification module 31 is specifically used for:
[0102] The network request parameters are obtained by intercepting network requests that meet the preset interception conditions through a preset interceptor, validating the interception parameters according to a preset data type, and formatting abnormal parameters in the validation results.
[0103] In one possible embodiment, an idempotency verification module is also included, which is used for:
[0104] The first target function parameter is idempotent according to the preset interceptor, and the target function parameter is filtered according to the idempotency verification result to obtain the second target function parameter.
[0105] The target function parameter passing 35 is specifically used for:
[0106] Write the second target function parameter into the target call function associated with the network request identifier, and execute the target call function to pass the second target function parameter.
[0107] In one possible embodiment, a configuration update module is also included, which is used to:
[0108] Receive page layout update notification information, parse the update data of the page layout update notification information to obtain page update data, and update the page configuration according to the page update data.
[0109] In one possible embodiment, the network request interception and verification module 31 is specifically used for:
[0110] The request protocol in the network request is matched with a preset protocol, and the function identifier in the network request is matched with a preset function identifier. If the request protocol matches the preset protocol and the function identifier matches the preset function identifier, the network request is determined to meet the preset interception conditions.
[0111] This application also provides an electronic device, which can integrate a target function parameter transmission device provided in this application. Figure 6 This is a schematic diagram of the structure of a target function parameter transmission device provided in an embodiment of this application, with reference to... Figure 6 The device for transmitting the target function parameter includes: an input device 43, an output device 44, a memory 42, and one or more processors 41; the memory 42 is used to store one or more programs; when one or more programs are executed by one or more processors 41, the one or more processors 41 implement the method for transmitting the target function parameter as provided in the above embodiments. The input device 43, output device 44, memory 42, and processors 41 can be connected via a bus or other means. Figure 6 Taking the example of a connection between China and Israel via a bus.
[0112] The memory 42, as a computing device readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the method for transmitting target functional parameters provided in any embodiment of this application. The memory 42 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the device. Furthermore, the memory 42 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 42 may further include memory remotely located relative to the processor 41, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0113] Input device 43 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device. Output device 44 may include display devices such as a display screen.
[0114] The processor 41 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 42, thereby realizing the above-mentioned method for transmitting target functional parameters.
[0115] The target function parameter transmission device, equipment, and computer provided above can be used to execute the target function parameter transmission method provided in any of the above embodiments, and have corresponding functions and beneficial effects.
[0116] This application embodiment also provides a storage medium for storing computer-executable instructions, which, when executed by a computer processor, are used to perform a method for transmitting target function parameters as provided in the above embodiments. The method for transmitting target function parameters includes:
[0117] Upon detecting a network request, determine whether the network request meets the preset interception conditions based on the request protocol and function identifier in the network request. For network requests that meet the preset interception conditions, perform request interception verification to obtain network request parameters.
[0118] The network request parameters are parsed to obtain the network request identifier and the target calling function. Multiple functional interfaces associated with the target calling function are identified, and the degree of association between each functional interface is analyzed to obtain the degree of association between each functional interface.
[0119] The call complexity of the functional data is calculated based on the number of functional interfaces, the degree of association, and the preset weight value, and the call type corresponding to the call complexity is determined.
[0120] According to the call type, the first target function parameter corresponding to each of the function interfaces is invoked, and the first target function parameter is written into the target call function associated with the network request identifier. The target call function is then executed to pass the first target function parameter.
[0121] Storage medium – any type of memory device or storage device. The term “storage medium” is intended to include: mounting media, such as CD-ROMs, floppy disks, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (e.g., hard disks or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. Furthermore, storage media may reside in a first computer system in which a program is executed, or may reside in a different second computer system connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term “storage medium” can include two or more storage media that may reside in different locations (e.g., in different computer systems connected via a network). Storage media may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.
[0122] Of course, the computer-executable instructions provided in the embodiments of this application are not limited to the method of transmitting target function parameters as described above, but can also perform related operations in the method of transmitting target function parameters provided in any embodiment of this application.
[0123] The target function parameter transmission device, equipment, and storage medium provided in the above embodiments can execute the target function parameter transmission method provided in any embodiment of this application. For technical details not described in detail in the above embodiments, please refer to the target function parameter transmission method provided in any embodiment of this application.
[0124] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the claims.
Claims
1. A method for transmitting target function parameters, characterized in that, include: Upon detecting a network request, determine whether the network request meets the preset interception conditions based on the request protocol and function identifier in the network request. For network requests that meet the preset interception conditions, perform request interception verification to obtain network request parameters. The network request parameters are parsed to obtain the network request identifier and the target calling function. Multiple functional interfaces associated with the target calling function are identified. The semantic relationships of the method signatures of each functional interface are determined through semantic parsing. The collaboration relationships of the method signatures are determined based on their calling positions. The relationship type between the functional interfaces is determined based on the semantic relationships and the collaboration relationships. If the relationship type is inheritance or implementation, a first association level is determined between the functional interfaces. If the relationship type is composition or aggregation, a second association level is determined between the functional interfaces. If the relationship type is dependency, a third association level is determined between the functional interfaces. The degree of association at the first association level is greater than that at the second association level, and the degree of association at the second association level is greater than that at the third association level. The call complexity of the function data is calculated based on the number of function interfaces, the degree of association, and the preset weight ratio, and the call type corresponding to the call complexity is determined. According to the call type, the first target function parameter corresponding to each of the function interfaces is invoked, and the first target function parameter is written into the target call function associated with the network request identifier. The target call function is then executed to pass the first target function parameter.
2. The method for transmitting target functional parameters according to claim 1, characterized in that, The step of performing request interception verification on network requests that meet the preset interception conditions to obtain network request parameters includes: The network request parameters are obtained by intercepting network requests that meet the preset interception conditions through a preset interceptor, validating the interception parameters according to a preset data type, and formatting abnormal parameters in the validation results.
3. The method for transmitting target functional parameters according to claim 1, characterized in that, After invoking the first target function parameters corresponding to each of the function interfaces according to the invocation type, the method further includes: The first target function parameter is idempotent according to the preset interceptor, and the target function parameter is filtered according to the idempotency verification result to obtain the second target function parameter. Accordingly, the step of writing the first target function parameter into the target call function associated with the network request identifier and executing the target call function to pass the first target function parameter includes: Write the second target function parameter into the target call function associated with the network request identifier, and execute the target call function to pass the second target function parameter.
4. The method for transmitting target functional parameters according to claim 3, characterized in that, Following the transmission of the second target function parameter, the method further includes: Receive page layout update notification information, parse the update data of the page layout update notification information to obtain page update data, and update the page configuration according to the page update data.
5. The method for transmitting target functional parameters according to claim 1, characterized in that, The step of determining whether a network request meets preset blocking conditions based on the request protocol and function identifier in the network request includes: The request protocol in the network request is matched with a preset protocol, and the function identifier in the network request is matched with a preset function identifier. If the request protocol matches the preset protocol and the function identifier matches the preset function identifier, the network request is determined to meet the preset interception conditions.
6. A device for transmitting target functional parameters, characterized in that, include: The network request interception and verification module is used to determine whether a network request meets a preset interception condition based on the request protocol and function identifier in the network request when a network request is detected, and to perform request interception and verification on network requests that meet the preset interception condition to obtain network request parameters. The parameter parsing module is used to parse the network request parameters to obtain the network request identifier and the target calling function; The association degree determination module is used to determine multiple functional interfaces associated with the target calling function, perform semantic parsing on the method signatures of each functional interface to determine the semantic relationship of the method signatures, determine the cooperation relationship of the method signatures based on the calling position of each method signature, determine the relationship type between each functional interface based on the semantic relationship and the cooperation relationship, determine a first association level between the functional interfaces when the relationship type is inheritance or implementation, determine a second association level between the functional interfaces when the relationship type is composition or aggregation, and determine a third association level between the functional interfaces when the relationship type is dependency. The association degree of the first association level is greater than that of the second association level, and the association degree of the second association level is greater than that of the third association level. The complexity calculation module is used to calculate the calling complexity of the function data based on the number of function interfaces, the degree of association, and the preset weight ratio, and to determine the calling type corresponding to the calling complexity. The target function parameter passing module is used to call the first target function parameter corresponding to each of the function interfaces according to the call type, write the first target function parameter into the target call function associated with the network request identifier, and execute the target call function to pass the first target function parameter.
7. An electronic device, the device comprising: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the method for passing target function parameters as described in any one of claims 1-5.
8. A storage medium storing computer-executable instructions, which, when executed by a computer processor, are used to perform a method for transmitting target function parameters as described in any one of claims 1-5.
Citation Information
Patent Citations
Device and method for JavaScript native interface calling conducted by crossing mobile operating system platform
CN104461575A
