A multi-link routing management method and device

Through the multi-link routing management method, the routing link structure is traversed and the routing search engine business logic is executed, which solves the problem of not supporting multi-routing and multi-link routing in the existing technology, improves application loading speed and supports routing policy upgrades and downgrades.

CN114780800BActive Publication Date: 2025-06-13JINGDONG CITY BEIJING DIGITS TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210437828.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-25
Publication Date
2025-06-13
Estimated Expiration
2042-04-25

AI Technical Summary

Technical Problem

In the prior art, multiple routes are not supported to be configured to execute in sequence, and multiple link routing is not supported. The route registration and resolution design are insufficient, which affects the application loading speed and does not consider the upgrade and downgrade routing strategy.

Method used

A multi-link routing management method is provided. By receiving instructions to jump to the target page, determining the routing table corresponding to the target page, obtaining link structure and routing information, traversing the link structure, determining whether the current route has the next route, and executing the route search engine business logic in the presence, otherwise executing the page jump logic.

Benefits of technology

It solves the problem of not being able to configure multiple routes and multi-link routing, improves application loading speed, and supports upgrade and downgrading routing policies, meeting more complex routing resolution scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114780800B_ABST
    Figure CN114780800B_ABST
Patent Text Reader

Abstract

The present invention discloses a multi-link routing management method and apparatus, relating to the field of computer technology. A specific embodiment of the method includes: receiving an instruction to jump to a target page, determining a routing table corresponding to the target page before executing the page jump logic, obtaining the link structure in the routing table and the routing information of each route located in the link structure; traversing the link structure, and sequentially determining whether there is a next route for the currently traversed route according to the routing information in the traversal order; in the case where the determination result is yes, executing the business logic of the routing search engine; in the case where the determination result is no, executing the page jump logic to jump to the target page. After receiving the routing structure of multiple links, this embodiment parses it to generate a routing binary tree, and then traverses and executes routing parsing and jumping through the pre-order depth traversal algorithm of the binary tree, solving the problem of multi-link routing and meeting more complex routing parsing scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a multi-link routing management method and apparatus. Background Art

[0002] During the development of a large APP, in order to effectively maintain the code and ensure the readability and robustness of the code, according to the design principle of single responsibility, the reusable general modules or modules with the same business attributes need to be abstracted and encapsulated into an SDK, and layered according to the data flow direction, so as to form a componentized design architecture.

[0003] In the componentized design architecture, routing design is an important part. As an intermediary of the SDK, routing is responsible for method calls and data transfer between SDKs, avoiding direct calls between SDKs, so as to achieve the effect of code coupling. In the process of implementing the present invention, the inventors found that most of the existing routing design solutions have at least the following problems: they do not support dynamic configuration of a single route, nor do they support configuring multiple routes to execute sequentially, and even less support configuring multi-link routes; there are deficiencies in the design of the registration and parsing parts of the route, which affect the application loading speed and do not consider the upgrade and downgrade routing strategies. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a multi-link routing management method and apparatus, which can at least solve the problems in the prior art that do not support route configuration, the hard-coded registration method affects the application loading speed, and the upgrade and downgrade routing strategies are not considered.

[0005] To achieve the above object, according to one aspect of the embodiments of the present invention, a multi-link routing management method is provided, including:

[0006] Receiving an instruction to jump to a target page, and before executing the page jump logic, determining a routing table corresponding to the target page, and obtaining a link structure in the routing table and routing information of each route located in the link structure;

[0007] Traversing the link structure, and sequentially judging whether there is a next route for the currently traversed route according to the routing information in the traversal order; wherein, the next route is a sub-route and / or a sibling route;

[0008] In the case where the judgment result is yes, executing the business logic of the route search engine; in the case where the judgment result is no, executing the page jump logic to jump to the target page.

[0009] Optionally, the traversing the link structure includes:

[0010] According to the link structure, store the routing information of each route in sequence on the data structure of the binary tree to generate a routing binary tree, and traverse the routing binary tree.

[0011] Optionally, the routing information includes a routing jump link field;

[0012] The execution of the routing lookup engine business logic includes:

[0013] Obtain the information of the currently traversed route, parse the jump link field in the routing information, and obtain the class protocol field, the target class identifier field, and the method identifier field;

[0014] Use the runtime mechanism to find the target class object corresponding to the target class identifier field, and find the execution method corresponding to the method identifier field in the target class object;

[0015] When the results of finding the target class object and the execution method exist, use the runtime mechanism to execute the business logic of page jump or method call based on the target class identifier field and the method identifier field.

[0016] Optionally, before finding the target class object corresponding to the target class identifier field, it further includes:

[0017] Judge whether the target class identifier field is empty. When the judgment result is empty, generate a new target class identifier field based on the class protocol field using a preset rule.

[0018] Optionally, the routing information includes a routing identifier field;

[0019] The judgment of whether the target class identifier field is empty includes:

[0020] According to the routing identifier field, check whether a new class protocol field and a new target class identifier field are registered;

[0021] When the verification result exists, obtain the new class protocol field and the new target class identifier field, otherwise judge whether the target class identifier field is empty.

[0022] Optionally, the routing information further includes a routing degradation link field;

[0023] The method further includes:

[0024] When the result of finding the target class object or the execution method does not exist, open the degradation page corresponding to the routing degradation link field.

[0025] Optionally, before determining the routing table corresponding to the target page, it further includes:

[0026] Receive a configuration operation on the routing table and store the configured routing table.

[0027] Optionally, the receiving of the configuration operation on the routing table includes:

[0028] Receive a configuration operation on the routing table in the routing configuration center, and store the configured routing table in the routing configuration center; and

[0029] Send a request to obtain the routing table to the routing configuration center and receive the configured routing table returned by the routing configuration center according to the routing table request.

[0030] Optionally, the receiving of the configured routing table returned by the routing configuration center according to the routing table request includes:

[0031] Receive an object returned by the routing configuration center, and parse the object to obtain the routing table; wherein, the object includes a prompt information field, an identification code field, and a data field, the data field includes a multi-level array, the array includes one or more elements, each element is used to store the routing information of the parent route, and the routing information includes a sub-routing table field, and the sub-routing table field is used to store the routing information of the sub-route.

[0032] To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a multi-link routing management device, including:

[0033] An acquisition module, configured to receive an instruction to jump to a target page, determine a routing table corresponding to the target page before executing the page jump logic, and acquire the link structure in the routing table and the routing information of each route located in the link structure;

[0034] A traversal module, configured to traverse the link structure, and sequentially determine whether there is a next route for the currently traversed route according to the routing information in the traversal order; wherein, the next route is a sub-route and / or a sibling route;

[0035] An execution module, configured to execute the business logic of the routing search engine when the judgment result is existent; and execute the page jump logic to jump to the target page when the judgment result is non-existent.

[0036] Optionally, the traversal module is configured to:

[0037] According to the link structure, store the routing information of each route into the data structure of a binary tree in sequence to generate a routing binary tree, and traverse the routing binary tree.

[0038] Optionally, the routing information includes a routing jump link field;

[0039] The execution module is used for:

[0040] Obtain the information of the currently traversed route, parse the jump link field in the route information, and obtain the class protocol field, the target class identifier field, and the method identifier field;

[0041] Use the runtime mechanism to find the target class object corresponding to the target class identifier field, and find the execution method corresponding to the method identifier field in the target class object;

[0042] When the results of finding the target class object and the execution method exist, use the runtime mechanism to execute the business logic of page jump or method call based on the target class identifier field and the method identifier field.

[0043] Optionally, the execution module is further used for:

[0044] Judge whether the target class identifier field is empty. When the judgment result is empty, generate a new target class identifier field based on the class protocol field using a preset rule.

[0045] Optionally, the route information includes a route identifier field;

[0046] The execution module is used for:

[0047] Verify whether a new class protocol field and a new target class identifier field are registered according to the route identifier field;

[0048] When the verification result exists, obtain the new class protocol field and the new target class identifier field, otherwise judge whether the target class identifier field is empty.

[0049] Optionally, the route information further includes a route downgrade link field;

[0050] The execution module is further used for:

[0051] When the result of finding the target class object or the execution method does not exist, open the downgraded page corresponding to the route downgrade link field.

[0052] Optionally, it further includes a configuration module, which is used for:

[0053] Receive the configuration operation on the route table and store the configured route table.

[0054] Optionally, the configuration module is used for:

[0055] When the route configuration center receives the configuration operation on the route table, the configured route table is stored in the route configuration center; and

[0056] Send a request to obtain the routing table to the routing configuration center, and receive the configured routing table returned by the routing configuration center according to the routing table request.

[0057] Optionally, the configuration module is used for:

[0058] Receive an object returned by the routing configuration center, and parse the object to obtain the routing table; wherein, the object includes a prompt information field, an identification code field, and a data field, the data field includes a multi-level array, the array includes one or more elements, and each element is used to store the routing information of the parent route, and the routing information includes a sub-routing table field, and the sub-routing table field is used to store the routing information of the sub-route.

[0059] To achieve the above object, according to another aspect of the embodiments of the present invention, a multi-link routing management electronic device is provided.

[0060] The electronic device according to the embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the above multi-link routing management methods.

[0061] To achieve the above object, according to another aspect of the embodiments of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, it implements any one of the above multi-link routing management methods.

[0062] According to the solution provided by the present invention, an embodiment of the above invention has the following advantages or beneficial effects: For the complex business scenario of multi-link routing parsing, configure the sub-routes and post-routes of each route in the routing management system to form a multi-link routing structure. After the APP side receives the multi-link routing structure, it parses it to generate a routing binary tree, and then traverses and executes routing parsing and jumping through the pre-order depth traversal algorithm of the binary tree, solving the problems of unable to configure multiple routes and multi-link routing, and meeting more complex routing parsing scenarios.

[0063] The further effects of the above non-conventional optional methods will be described in combination with specific embodiments below. Description of the Drawings

[0064] The drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention. Among them:

[0065] Figure 1 is a main flowchart of a multi-link routing management method according to an embodiment of the present invention;

[0066] Figure 2(a) is a schematic diagram of the configured routing table.

[0067] Figure 2(b) is a schematic diagram of binary tree routing representation;

[0068] Figure 2(c) is a schematic diagram of binary tree traversal routing representation;

[0069] Figure 3 is a schematic flowchart of an optional multi-link routing management method according to an embodiment of the present invention;

[0070] Figure 4 is a schematic flowchart of another optional multi-link routing management method according to an embodiment of the present invention;

[0071] Figure 5 is a multi-link routing flowchart;

[0072] Figure 6(a) is a schematic diagram of the structure of a routing configuration center;

[0073] Figure 6(b) is a schematic diagram of the structure of a mobile application;

[0074] Figure 7 is a schematic diagram of the main modules of a multi-link routing management device according to an embodiment of the present invention;

[0075] Figure 8 is an exemplary system architecture diagram to which the embodiments of the present invention can be applied;

[0076] Figure 9 is a schematic diagram of the structure of a computer system of a mobile device or a server suitable for implementing the embodiments of the present invention. Detailed implementation manners

[0077] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description below omits the description of well-known functions and structures.

[0078] During the development of large-scale APPs, with the increase in business complexity and the number of developers, the code volume will increase sharply, and the coupling degree of business modules will also increase accordingly. The traditional MVC (Model-View-Controller) or MVVM (Model-View-ViewModel) architecture can no longer manage the code efficiently. To effectively maintain the code and ensure its readability and robustness, it is necessary to extract and encapsulate reusable general modules or modules with the same business attributes into an SDK (Software Development Kit) according to the single responsibility design principle, and divide them into layers according to the data flow direction, thus forming a component-based design architecture.

[0079] For the development of current iOS apps, there are three relatively popular routing design frameworks, namely the URL Router solution, the Protocol-Class solution, and the Target-Action solution:

[0080] 1. The URL Router solution draws on the routing design concepts of the iOS system and H5 pages, regarding the routing as a URL, and defining the routing information with reference to the syntax of the URL, including the routing name and the routing parameter pair. A routing key-value pair list is maintained in the APP cache, with the routing name as the key, and the routing information and the routing execution method are stored in the value. After the APP receives a routing request, it traverses the routing key-value pair list to obtain the routing execution method and the routing parameters, and then calls the method and passes in the parameters for execution.

[0081] 2. The Protocol-Class solution is a routing solution designed to address the shortcoming that the routing key-value pair list in the URL Router solution is difficult to maintain. It has a routing center that can register and distribute the routing. When the APP starts, it registers in the routing center in the form of Protocol-Class key-value pairs. After the APP receives a routing request, it queries the Class corresponding to the Protocol through the routing center, and then executes the method under the Class.

[0082] 3. The Target-Action solution is a routing solution designed to solve the problem that the previous two solutions require registering the routing when the APP starts, thus affecting the APP startup speed. This solution does not require registering the routing and introduces an SDK intermediate layer to uniformly handle the routing distribution. After receiving a routing request, the SDK intermediate layer is responsible for finding the routing and executing it.

[0083] The explanations for the terms involved in this solution are as follows:

[0084] Objective-C: An object-oriented programming language used for iOS app development, which has powerful dynamic features.

[0085] runtime: The runtime, a dynamic feature of the Objective-C language, which can complete the registration, search, and execution of methods in an app.

[0086] target: The identifier of a class object in runtime.

[0087] action: The identifier of a function or method in runtime.

[0088] protocol: A keyword in the Objective-C language. In a protocol, some methods are declared, and the implementation of the methods depends on the class that implements this protocol. Combining with the runtime mechanism, method interception and method replacement can be completed. What is similar in the Java language is the interface.

[0089] class: A keyword in an object-oriented language used to identify an object. A class can inherit from a class or implement a protocol.

[0090] API (Application Programming Interface): Some predefined interfaces (such as functions, HTTP interfaces), or the conventions for the connection between different components of a software system.

[0091] SDK (Software Development Kit): A set of software tools and programs used by developers to create applications for a specific platform.

[0092] webView: An engine based on webkit that can parse DOM elements and display html pages. The principle of it displaying pages is the same as that of a browser, so it can be regarded as a browser.

[0093] H5: The functions and pages implemented according to the HTML5 standard.

[0094] scheme: The protocol for uniform resource location. In the iOS system, it is used for app-to-app jumps. In this scheme, it is used to identify a page or method. The scheme identifies the app, the name identifies the module, and k1, k2 are parameters, and v1, v2 are parameter values.

[0095] URL: A protocol for uniform resource location, which is a representation method used by web service programs on the Internet to specify the location of information. In this solution, it is used to identify the HTML address of a page.

[0096] JSON: A lightweight data exchange format. The commonly used types are JSON objects and JSON arrays, which can be nested with each other. A JSON object is the content wrapped by {}, and its data structure is a key-value pair structure of {k1:v1,k2:v2,...}. A JSON array is the content wrapped by [], and its data structure is an index structure of ["v1","v2","v3",...].

[0097] Key-value pair: A data storage format, with the key as the index and the value as the value. The key and value are paired, and a corresponding value can be obtained according to a key.

[0098] Binary tree: A classic data structure, which is an important type of tree structure. Its characteristic is that each node can have at most two subtrees, and there is a distinction between left and right. Traversal is the most basic operation on a tree. The so-called traversing a binary tree means walking through all the nodes of the binary tree according to certain rules and orders, so that each node is visited once and only once. The traversal methods include depth-first traversal and breadth-first traversal. Depth-first traversal includes pre-order traversal, in-order traversal, and post-order traversal. Among them, pre-order traversal means visiting the root node first, then pre-order traversing the left subtree, and then pre-order traversing the right subtree.

[0099] The problems existing in the prior art are elaborated in detail here:

[0100] 1. It does not support dynamic configuration of a single route, nor does it support configuring multiple routes to execute sequentially, let alone configuring multi-link routes. For some complex business scenarios, such as before opening a certain page or executing a certain method, it is necessary to verify preconditions such as login status, authorization status, and real-name status, and there may also be sub-conditions under the preconditions, which may involve 4 routes and sub-routes. Most routing schemes cannot meet this requirement.

[0101] 2. The design of the routing registration and parsing parts is not perfect enough. Most of them register the routing information table or routing distribution queue in the loading method of the App in a hard-coded manner according to business requirements. This kind of scheme will not only affect the loading speed of the App, but also requires additional maintenance of routing-related documents, increasing the development cost of developers.

[0102] 3. It does not consider the upgrade and downgrade strategy, and once a route is defined, it is impossible or very difficult to change. In addition, when a route cannot be found, no friendly processing is done, which may cause the APP to become unresponsive or even crash, affecting the experience.

[0103] SeeFigure 1 , shown is a main flowchart of a multi-link routing management method provided by an embodiment of the present invention, including the following steps:

[0104] S101: Receive an instruction to jump to a target page. Before executing the page jump logic, determine the routing table corresponding to the target page, and obtain the link structure in the routing table and the routing information of each route located in the link structure;

[0105] S102: Traverse the link structure, and sequentially determine whether there is a next route for the currently traversed route according to the routing information in the traversal order; wherein, the next route is a sub-route and / or a sibling route;

[0106] S103: In the case where the judgment result is yes, execute the routing search engine business logic;

[0107] S104: In the case where the judgment result is no, execute the page jump logic to jump to the target page.

[0108] In the above embodiment, for step S101, the target page can be a certain page in the App (Application) side, or the home page or a specific page in a certain third-party application, and this solution does not make any restrictions here.

[0109] Taking the jump to a third-party application as an example, its business logic is described in detail. Before jumping to a third-party application, it is necessary to verify the login status (A), verify the real-name status (B), verify the authorization status (C), verify the integrity of user information (D), etc. Among them, verifying the login status includes the mobile phone number quick login page (A), the add user password page (A1), verifying the real-name status includes the real-name authorization page (B), the name and ID card real-name page (B1), the face verification page (B2), verifying the authorization status includes the authorization agreement confirmation page (C), the authorization page (C1), verifying the integrity of user information includes the complete user information page (D), and the example diagram is shown in Figure 2(a). Finally, the black dot represents the end in the UML (Unified Model Language) diagram or flowchart.

[0110] The selected third-party application can be located in the third-party application list. Clicking on any one of the applications can jump to the third-party application, which depends on the design at the business level, and jumping to the third-party application is the final result of the routing, and other logic processing are all preconditions.

[0111] Before the mobile APP jumps to the target page, it requests the routing configuration center through the API to obtain the routing table corresponding to the target page, and the routing configuration center returns the routing table. The routing table includes the routing information of multiple routes and the link structure composed of multiple routes.

[0112] For steps S102 - S104, the link structure stores the parent - child relationship or sibling relationship between each route and its adjacent routes, so the link structure can be directly traversed. According to the traversal order of parent route - child route - sibling route, it is sequentially determined whether the currently traversed route has a next - step route. If so, the business logic of the routing search engine is executed. If not, it jumps to the target page.

[0113] In actual operation, directly traversing the link structure is mainly applicable to the case where the number of routes is small. For some complex business scenarios, to facilitate inserting and deleting nodes and improve the search efficiency, it is preferably to use a binary tree. According to the routing link structure, the routing information of each route in the routing table is stored in the data structure of the binary tree in order to generate a routing binary tree; where each binary - tree node represents only one routing information, as shown in Figure 2(b).

[0114] It should be noted that each node of the binary tree can store an object, and in programming, everything is an object. The routing ID is a string, and the routing information is a key - value pair object. Although only the routing ID can be stored here, the routing information needs to be stored in other locations later, and an association relationship needs to be established with the binary tree, and then the specific routing information is searched based on the association relationship and the routing ID, which consumes a large amount. Therefore, in this solution, it is preferably to directly store the routing information on the node.

[0115] Since the routing information is stored according to the data structure of the binary tree, according to the traversal order of parent route - child route - sibling route, it is the pre - order traversal algorithm of the binary tree. Using the pre - order depth - first traversal algorithm of the binary tree, the routing binary tree is traversed, and it is sequentially determined whether there is a next - step route according to the traversal order. If so, the business logic of the routing search engine is executed. If not, it jumps to the target page.

[0116] Taking Figure 2(b) as an example, the traversal order is A - A1 - B - B1 - B2 - C - C1 - D - end. The traversal example diagram is shown in Figure 2(c), where the solid arc is the traversal route, and the dotted line is the return to the parent node after traversing the child node.

[0117] For the method provided in the above - mentioned embodiment, after the APP side receives the routing structure of multiple links, it parses and generates a routing binary tree, and then traverses and executes routing parsing and jumping through the pre - order depth - first traversal algorithm of the binary tree, solving the problem of multi - link routing and meeting more complex routing - parsing scenarios.

[0118] See Figure 3, shows a schematic flow chart of an optional multi-link routing management method according to an embodiment of the present invention, comprising the following steps:

[0119] S301: receiving a configuration operation on a routing table at a routing configuration center, and storing the configured routing table at the routing configuration center;

[0120] S302: receiving an instruction to jump to a target page, and before executing the page jump logic, sending a request to obtain a routing table to a routing configuration center;

[0121] S303: receiving an object returned by the routing configuration center, parsing the object to obtain the routing table; wherein the object comprises a prompt information field, an identification code field and a data field, the data field comprises a multi-level array, the array comprises one or more elements, each of the elements is used to store routing information of a parent route, the routing information comprises a sub-routing table field, the sub-routing table field is used to store routing information of a sub-route;

[0122] S304: Acquire a link structure in the routing table and routing information of each route in the link structure;

[0123] S305: traversing the link structure, and judging whether there is a next route for the currently traversed route according to the routing information in the traversal order; wherein the next route is a sub-route and / or a brother route;

[0124] S306: If the result of the judgment is yes, execute the routing search engine business logic;

[0125] S307: When the result of the judgment is that the target page does not exist, execute the page jump logic to jump to the target page.

[0126] In the above implementation, for steps S304 to S307, see Figure 1 The description shown is not repeated here.

[0127] In the above implementation, for steps S301 to S303, the routing configuration center includes a routing management system and a routing service layer. The developer configures a multi-level routing table corresponding to the target page in the routing management system according to product or business requirements, as shown in Figure 2(a). After the developer completes the configuration, the routing table is uploaded to the routing service layer. After receiving the routing table, the routing service layer stores it in the database.

[0128] It should be noted that the difference between sub-routes and post-routes is the different relationships. For a current route with sub-routes and post-routes, the relationship between the sub-routes and the current route is a parent-child relationship, which is a containment relationship in business logic. The post-routes and the current route are siblings, which is a connection relationship in business logic.

[0129] Before the mobile APP jumps to the target page, it obtains the routing table by making an API request to the routing service layer. The routing service layer returns the routing table in the form of a JSON object. After receiving the JSON object, the mobile device parses it to obtain the routing table. Among them, JSON is a lightweight data interchange format, which has the advantages of easy-to-use syntax, wide compatibility, fast parsing speed, etc.

[0130] The returned JSON object contains three fields: message, code, and data. Among them, message is a prompt message. Code is an identification code used to identify whether the interface request is successful. Generally, 200 represents success, and other cases are failures. If it fails, the content in message will be prompted to the user.

[0131] Data is a multi-dimensional JSON array (or multi-level array). The array consists of one or more elements. Each array element is only used to store the information of a parent route. The routing information includes sub-routing table fields, and the sub-routing table fields are used to store the routing information of sub-routes. An example of the structure of the JSON object is as follows:

[0132]

[0133]

[0134] It can be seen from this that each routing information includes a routing id number rId field, a routing jump link scheme, a routing degradation link URL field, and a sub-routing table subRouter field. The value of subRouter is also a JSON array, and this array stores the information of sub-routes, and so on. Referring to the above 0{4} part, the information of the parent route is stored, and the 0{3} part stores the information of the sub-route, which is located in subRouter[1] of the parent route. For subRouter[2] of the 1{4} part, it means there are two sub-routing information, and these two sub-routes are in a sibling route relationship; for subRouter[0] of the 3{4} part, it means there is no sub-route.

[0135] The method provided in the above embodiment configures the sub-routes and post-routes of each route in the routing management center, thereby forming a multi-link routing structure, and solving the problem of being unable to configure multiple routes.

[0136] See Figure 4 , which shows a schematic flow diagram of another optional multi-link routing management method according to an embodiment of the present invention, including the following steps:

[0137] S401: Obtain the information of the currently traversed route, parse the scheme field in the route information to obtain the class protocol protocol field, the target class identifier target field, and the method identifier action field in the target class; wherein, the route information includes a route identifier ID field and a fallback link URL field;

[0138] S402: According to the ID field, verify whether the new protocol field and the new target field are registered;

[0139] S403: If the verification result is existent, obtain the new protocol field and the new target field;

[0140] S404: Otherwise, determine whether the target field is empty;

[0141] S405: If it is empty, generate a new target field based on the protocol field using a preset rule;

[0142] S406: Based on the target field or the new target field in the scheme field, find the corresponding target class object;

[0143] S407: If the query result is existent, find the execution method corresponding to the action field in the target class object;

[0144] S408: If the query result is existent, use the runtime mechanism to execute the business logic of page jump or method call based on the target field and the action field;

[0145] S409: In the case where the result of finding the target class object or the execution method is non-existent, use the webView to open the fallback page corresponding to the URL field.

[0146] In the above embodiments, for steps S401 to S409, the business logic of the route lookup engine and the business engine of the route promotion and demotion mechanism are described here.

[0147] 1. The route lookup engine parses the scheme field in the route information to obtain the protocol field, the target field, and the action field; wherein, the route information further includes a route id number rId field, a route fallback link URL field, and a sub-route table subRouter field;

[0148] 2. The routing upgrade and downgrade mechanism checks whether a new protocol-target is registered according to the rId field. Generally, a registration mechanism is provided to store the list of registered protocol-targets. Traverse this list according to rId to determine whether a certain protocol-target is registered:

[0149] 1) If there is, execute the upgrade strategy and return the new protocol-target to the routing search engine; this generally occurs in componentized architecture design, such as the target in the main project replacing the target in the SDK;

[0150] 2) If not, determine whether the target field in the original scheme is empty:

[0151] a) If it is not empty, return the original target field to the routing search engine;

[0152] b) If it is empty, generate a new target according to certain rules and return it to the routing search engine; among them, the rules depend on the business design. The relatively simple one is character matching. For example, if the protocol name is myProtocol, then the target must be myTarget.

[0153] 3. The routing search engine, based on the target field or the new target field in the scheme field, searches for the target class object through runtime:

[0154] 1) If the search result is that it exists, then search for the action method corresponding to the action field in the target class object through runtime;

[0155] a) If the action method is found, then through runtime, pass in the parameters target and action to execute the business logic of page jump or method call;

[0156] b) If the action method cannot be found, execute the routing downgrade strategy. Through the routing upgrade and downgrade mechanism, use webView to open the URL. After the business logic in the webView is executed, continue to execute Figure 1 the business logic of the routing resolution engine shown to determine whether there is a next route for the next traversed route.

[0157] 2) If the search result is that it does not exist, execute the routing downgrade strategy. Through the routing upgrade and downgrade mechanism, use webView to open the URL. After the business logic in the webView is executed, continue to execute Figure 1The routing resolution engine business logic shown is used to determine whether there is a next route for the next traversed route.

[0158] 4. After the business logic in the page or the called method is executed, continue to execute Figure 1 The routing resolution engine business logic shown is used to determine whether there is a next route for the next traversed route.

[0159] The method provided by the above embodiment provides a routing lookup method. Combining the three current popular routing schemes, through the runtime mechanism of Objective-C, the routing can be self-registered and self-discovered, solving the problems that the routing information is hard-coded into the code, making the routing information difficult to maintain and the code readability not high. It also provides a routing upgrade and downgrade mechanism. By registering the protocol, it can flexibly handle the problems of routing interception and the APP unresponsive or crashing when the route cannot be found.

[0160] See Figure 5 , which shows the multi-link routing flowchart provided by the embodiment of the present invention, including a routing configuration center, a routing resolution engine, a routing lookup engine, and a routing upgrade and downgrade mechanism;

[0161] 1. Routing configuration center, as shown in Figure 6(a)

[0162] 1) Routing service layer, deployed on the server side, used for adding, deleting, modifying, and querying the routing table.

[0163] 2) Routing management system, deployed on the PC side, used for configuring multi-level routing tables, including link structures and sub-routing links for each route, and uploading the routing table to the routing service layer.

[0164] 2. APP side, as shown in Figure 6(b), the App is generally installed on mobile devices such as mobile phones and computers. The mobile device needs to be simply transformed and integrated with the routing SDK, which is very simple and the workload is very small.

[0165] 1) Routing resolution engine, used to obtain the latest routing table corresponding to the target page to be jumped, parse the routing table, and traverse and execute routing operations.

[0166] 2) Routing lookup engine, according to the agreed syntax, parses the scheme field of the route, finds the page or method in the route, and then jumps to the page or executes the method.

[0167] 3) Routing upgrade and downgrade mechanism, used to perform upgrade or downgrade operations in a certain scenario. Upgrade generally occurs in componentized architecture design. Through routing interception, the target of the main project is replaced with the target in the SDK. Downgrade generally occurs when a page or method cannot be found. In this case, a certain solution is executed according to a certain strategy, such as opening the URL in the routing information.

[0168] The methods provided by the embodiments of the present invention are used in scenarios including but not limited to data and message passing between SDKs in a componentized architecture, mutual invocation or jump of methods or pages between SDKs or within an SDK, jump of multiple precondition pages or multi-level precondition pages before jumping to a certain application or page, etc. Compared with the prior art, its beneficial effects are at least as follows:

[0169] 1. Introduce the design of multi-link routing. Through configuration in the routing configuration center, the APP side parses and uses the data structure of a binary tree for storage and traversal execution, so as to be able to complete the jump requirements of multiple pages and multi-level pages. The operating environment is not limited to the iOS system and can also be satisfied in other systems such as the Android system or H5 pages.

[0170] 2. Implement a routing parsing scheme, which combines the runtime mechanism of Objective-C to achieve self-registration and self-discovery of routes, avoids maintaining a specific route registration file, solves the problem of difficult management of routing information, makes the code easy to maintain and expand, thereby improving the code quality and reducing the App startup time. Compared with the current popular routing scheme, the code volume can be reduced by more than 20%, the code reuse rate can be increased by more than 25%, and the human efficiency can be increased by about 35% or more.

[0171] 3. Provide an upgrade and downgrade mechanism. By registering a protocol and combining the runtime mechanism of Objective-C, it flexibly processes routing interception and the situation where a route cannot be found, avoids the problem of APP unresponsiveness or crashes, and thus improves the user experience.

[0172] See Figure 7 , which shows a schematic diagram of the main modules of a multi-link routing management device 700 provided by the embodiments of the present invention, including:

[0173] An acquisition module 701, configured to receive an instruction to jump to a target page, determine a routing table corresponding to the target page before executing the page jump logic, and acquire the link structure in the routing table and the routing information of each route located in the link structure;

[0174] A traversal module 702 is configured to traverse the link structure and, in the traversal order, sequentially determine whether there is a next route according to the routing information; wherein, the next route is a sub-route and / or a sibling route.

[0175] It further includes: storing the routing information of each route in the data structure of a binary tree in sequence according to the link structure to generate a routing binary tree, and traversing the routing binary tree.

[0176] An execution module is configured to, when the judgment result is that there is a next route, execute the service logic of the routing search engine; when the judgment result is that there is no next route, execute the page jump logic to jump to the target page.

[0177] The routing information includes a routing jump link field; the execution module is configured to:

[0178] Obtain the information of the currently traversed route, parse the jump link field in the routing information to obtain a class protocol field, a target class identifier field, and a method identifier field.

[0179] Use the runtime mechanism to find the target class object corresponding to the target class identifier field and find the execution method corresponding to the method identifier field in the target class object.

[0180] When the results of finding the target class object and the execution method are existent, use the runtime mechanism to execute the service logic of page jump or method call based on the target class identifier field and the method identifier field. And determine whether the target class identifier field is empty. When the judgment result is that it is empty, generate a new target class identifier field based on the class protocol field using a preset rule.

[0181] The routing information includes a routing identifier field; the execution module is configured to: check whether a new class protocol field and a new target class identifier field are registered according to the routing identifier field.

[0182] When the verification result is existent, obtain the new class protocol field and the new target class identifier field; otherwise, determine whether the target class identifier field is empty.

[0183] The routing information further includes a routing downgrade link field; the execution module is further configured to: when the result of finding the target class object or the execution method is non-existent, open the downgraded page corresponding to the routing downgrade link field.

[0184] The implementation device of the present invention includes a configuration module, which is configured to:

[0185] Receive the configuration operation on the routing table and store the configured routing table.

[0186] In the implementation device of the present invention, the configuration module is used for:

[0187] Receiving a configuration operation on the routing table in the routing configuration center, and storing the configured routing table in the routing configuration center; and

[0188] Sending a request to obtain the routing table to the routing configuration center, and receiving the configured routing table returned by the routing configuration center according to the routing table request.

[0189] And receiving an object returned by the routing configuration center, and parsing the object to obtain the routing table; wherein, the object includes a prompt information field, an identification code field, and a data field, the data field includes a multi-level array, the array includes one or more elements, and each element is used to store the routing information of the parent route, and the routing information includes a sub-routing table field, and the sub-routing table field is used to store the routing information of the sub-route.

[0190] In addition, the specific implementation content of the device in the embodiment of the present invention has been described in detail in the above method, so the repeated content will not be described here.

[0191] Figure 8 An exemplary system architecture 800 to which the embodiments of the present invention can be applied is shown, including terminal devices 801, 802, 803, a network 804, and a server 805 (merely examples).

[0192] The terminal devices 801, 802, 803 can be various electronic devices with a display screen and supporting web browsing, installed with various communication client applications, and users can use the terminal devices 801, 802, 803 to interact with the server 805 through the network 804 to receive or send messages, etc.

[0193] The network 804 is a medium for providing a communication link between the terminal devices 801, 802, 803 and the server 805. The network 804 can include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0194] The server 805 can be a server providing various services. It should be noted that the method provided by the embodiments of the present invention is generally executed by the server 805, and correspondingly, the device is generally arranged in the server 805.

[0195] It should be understood that Figure 8 The numbers of terminal devices, networks, and servers in

[0196] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 9, which shows a schematic structural diagram of a computer system 900 of a terminal device suitable for implementing the embodiments of the present invention. Figure 9 The terminal device shown is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.

[0197] As Figure 9 shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to the programs stored in the read-only memory (ROM) 902 or the programs loaded from the storage section 908 into the random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, ROM 902, and RAM 903 are connected to each other via a bus 904. The input / output (I / O) interface 905 is also connected to the bus 904.

[0198] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as required. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as required so that the computer program read from it can be installed into the storage section 908 as required.

[0199] Specifically, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network through the communication section 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above functions defined in the system of the present invention are executed.

[0200] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the above two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0201] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0202] The modules involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules can also be provided in a processor. For example, it can be described as: a processor includes an acquisition module, a traversal module, and an execution module. Among them, the names of these modules do not constitute a limitation to the module itself in some cases. For example, the acquisition module can also be described as a "structure traversal module".

[0203] As another aspect, the present invention also provides a computer-readable medium, which can be included in the device described in the above embodiments; or can exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the device, the device executes the multi-link routing management method.

[0204] The above specific implementation manners do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A multi-link routing management method, characterized in that, it includes: Receiving an instruction to jump to a target page. Before executing the page jump logic, determining the routing table corresponding to the target page, obtaining the link structure in the routing table, and the routing information of each route located in the link structure; the routing information includes a routing jump link field, a degradation link field, and a routing identifier field; Traversing the link structure, and sequentially judging whether there is a next route for the currently traversed route according to the routing information in the traversal order; wherein, the next route is a sub-route and / or a sibling route; In the case where the judgment result is yes, execute the routing search engine business logic; in the case where the judgment result is no, execute the page jump logic to jump to the target page; wherein, the execution of the routing search engine business logic includes: Obtaining the information of the currently traversed route, and parsing the jump link field in the routing information to obtain a class protocol field, a target class identifier field, and a method identifier field; According to the routing identifier field, verifying whether there are newly registered class protocol fields and new target class identifier fields; In the case where the verification result is yes, obtaining the newly registered class protocol fields and new target class identifier fields, otherwise judging whether the target class identifier field is empty. In the case where the judgment result is empty, based on the class protocol field, using a preset rule, generating a new target class identifier field; Using the runtime mechanism to find the target class object corresponding to the target class identifier field, and finding the execution method corresponding to the method identifier field in the target class object; In the case where the results of finding the target class object and the execution method are yes, using the runtime mechanism, based on the target class identifier field and the method identifier field, executing the business logic of page jump or method call; In the case where the results of finding the target class object or the execution method are no, opening the degradation page corresponding to the routing degradation link field.

2. The method according to claim 1, characterized in that, The traversing the link structure includes: According to the link structure, storing the routing information of each route in the data structure of a binary tree in sequence to generate a routing binary tree, and traversing the routing binary tree.

3. The method according to claim 1, characterized in that, Before determining the routing table corresponding to the target page, it further includes: Receiving a configuration operation on the routing table and storing the configured routing table.

4. The method according to claim 3, characterized in that, The receiving the configuration operation on the routing table includes: Receiving a configuration operation on the routing table in the routing configuration center, and storing the configured routing table in the routing configuration center; and Sending a routing table request to the routing configuration center and receiving the configured routing table returned by the routing configuration center according to the routing table request.

5. The method according to claim 4, characterized in that, The receiving the configured routing table returned by the routing configuration center according to the routing table request includes: Receive the object returned by the routing configuration center, and parse the object to obtain the routing table; wherein, the object includes a prompt information field, an identification code field, and a data field, the data field includes a multi-level array, the array includes one or more elements, and each element is used to store the routing information of the parent route, and the routing information includes a sub-routing table field, and the sub-routing table field is used to store the routing information of the sub-route.

6. A multi-link routing management device, characterized in that, it includes: An acquisition module, configured to receive an instruction to jump to a target page, determine a routing table corresponding to the target page before executing the page jump logic, and acquire the link structure in the routing table and the routing information of each route located in the link structure; the routing information includes a routing jump link field, a degradation link field, and a routing identification field; A traversal module, configured to traverse the link structure, and sequentially determine whether there is a next route for the currently traversed route according to the routing information in the traversal order; wherein, the next route is a sub-route and / or a sibling route; An execution module, configured to execute the routing search engine business logic when the judgment result is yes; and execute the page jump logic to jump to the target page when the judgment result is no; wherein, the execution of the routing search engine business logic includes: Acquire the information of the currently traversed route, and parse the jump link field in the routing information to obtain a class protocol field, a target class identification field, and a method identification field; According to the routing identification field, verify whether there are registered new class protocol fields and new target class identification fields; When the verification result is yes, acquire the new class protocol field and the new target class identification field, otherwise judge whether the target class identification field is empty, and when the judgment result is empty, generate a new target class identification field based on the class protocol field using a preset rule; Use the runtime mechanism to find the target class object corresponding to the target class identification field, and find the execution method corresponding to the method identification field in the target class object; When the results of finding the target class object and the execution method are yes, use the runtime mechanism to execute the business logic of page jump or method call based on the target class identification field and the method identification field; When the result of finding the target class object or the execution method is no, open the degradation page corresponding to the routing degradation link field.

7. An electronic device, characterized in that, it includes: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-5.

8. A computer-readable medium, on which a computer program is stored, characterized in that, When the program is executed by a processor, the method according to any one of claims 1-5 is implemented.

Citation Information

Patent Citations

  • Instruction processing method and instruction processing device based on dynamic generalized routing

    CN107835228A

  • Page processing method and device, computer equipment and storage medium

    CN113934425A

  • Method and device for jumping between pages

    WO2017162072A1