Routing configuration method and device, equipment, storage medium and product

Through the routing configuration method based on array structure, the problem of low positioning efficiency of routing nodes in the existing technology is solved, efficient and accurate routing configuration is achieved, and the flexibility and scalability of routing configuration is improved.

CN119109781AActive Publication Date: 2024-12-10CHINA MOBILE M2M +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411306097.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-10
Estimated Expiration
2044-09-19

AI Technical Summary

Technical Problem

In the existing routing management technology, the routing configuration method of tree structure leads to low node positioning efficiency and error-prone, and a method to improve the location efficiency and accuracy of routing nodes is needed.

Method used

Using a routing configuration method based on array structure, define routing hierarchy relationships by obtaining node attributes, constructing routing objects and storing them in array form, implementing routing table arrays to support tree, order, inheritance and parallel structure routing configurations, and at the hierarchy Dynamically update the routing structure when the relationship changes.

Benefits of technology

It improves the efficiency and accuracy of routing node positioning, enhances the flexibility and scalability of routing configuration, and reduces algorithm complexity and response time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119109781A_ABST
    Figure CN119109781A_ABST
Patent Text Reader

Abstract

The invention discloses a route configuration method. The method comprises the following steps: acquiring a node attribute of a to-be-configured route; the node attribute is used for defining a hierarchical relationship between the route to be configured and other routes; constructing the to-be-configured route in an object form according to the node attribute to obtain a route object; and storing all the routing objects in an array form to obtain a routing table array so as to complete routing configuration. According to the invention, the node positioning efficiency and accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field, and in particular to a routing configuration method, device, equipment, storage medium and product. Background Art

[0002] With the development of front-end application technology, the functions of websites built nowadays are becoming more and more complex and three-dimensional. These functions rely on the equally complex page structure and permission control. A routing structure management mechanism that is easy to expand, modify, and be permission-controlled and suitable for different scenarios is one of the most basic and important technologies for every large website.

[0003] Most of the current routing management technologies use a tree-shaped routing structure. When adding new nodes and finding parent pages, repeated recursive operations are required to traverse the entire tree. This method has a high algorithm complexity and is prone to mislocating routing nodes, resulting in low efficiency in routing node positioning. Therefore, it is necessary to provide a routing configuration method that is conducive to improving node positioning efficiency and accuracy. Summary of the invention

[0004] The present application provides a routing configuration method, which stores routes based on an array structure to implement routing configuration, thereby improving the efficiency and accuracy of routing node positioning.

[0005] In a first aspect, an embodiment of the present application provides a routing configuration method, including:

[0006] Obtaining node attributes of the route to be configured; the node attributes are used to define the hierarchical relationship between the route to be configured and other routes;

[0007] Constructing the route to be configured in the form of an object according to the node attributes to obtain a route object;

[0008] All the routing objects are stored in the form of an array to obtain a routing table array to complete the routing configuration.

[0009] Furthermore, the node attributes include constant attributes, and the constant attributes include at least one of hierarchical relationship information, authority identification, routing path, default jump path, custom parameters, whether to hide, and routing associated components.

[0010] Furthermore, the method further comprises:

[0011] Determine deletion indication information of the route to be deleted based on the input route deletion operation; wherein the deletion indication information is position information in the routing table array or a specified routing feature;

[0012] Find the route to be deleted in the routing table array according to the deletion indication information, so as to delete the route to be deleted;

[0013] Determine the characteristics of the route to be modified based on the input route modification operation;

[0014] The route to be modified is found in the routing table array according to the characteristics of the route to be modified, so as to modify the route to be modified.

[0015] Furthermore, after storing all the routing objects in the form of an array to obtain a routing table array to complete the routing configuration, the method further includes:

[0016] Based on the routing table array, a routing structure is constructed according to the hierarchical relationship between the routing to be configured and other routings; wherein the routing structure includes at least one of a tree structure, a sequential structure, an inheritance structure and a parallel structure.

[0017] Furthermore, after constructing the routing structure according to the hierarchical relationship between the routing to be configured and other routings, the method further includes:

[0018] When the hierarchical relationship changes, clearing the routing structure;

[0019] Build a new routing structure based on the changed hierarchical relationship.

[0020] Further, the node attributes include hierarchical relationship information, and the hierarchical relationship information includes parent node identification information, current node identification information, and previous node identification information at the same level. When the routing structure is a tree structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the route to be configured and other routes, including:

[0021] Constructing a corresponding sub-node array for each of the routing objects; wherein the sub-node array is used to store routing objects corresponding to all sub-nodes of the routing object;

[0022] Find all corresponding child nodes for each routing object based on the parent node identification information and the current node identification information in the routing table array;

[0023] For each of the routing objects, all the child nodes are traversed, and based on the current node identification information of the child node and the previous node identification information of the same level, the child node is added to a specified position in the child node array to obtain a routing structure with a tree structure.

[0024] Furthermore, the node attributes include a source pointer and a target pointer. When the routing structure is a sequential structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the routing to be configured and other routings, including:

[0025] Create a sequential routing stack;

[0026] Acquire a routing sequence of routing objects required by the sequence structure, and determine a source pointer and a target pointer of each routing object according to the routing sequence;

[0027] Based on the routing table array, each routing object and the corresponding source pointer and target pointer are added to the sequential routing stack in sequence according to the routing sequence to obtain a routing structure of a sequential structure.

[0028] Further, the node attributes include hierarchical relationship information, the hierarchical relationship information includes the node identification information and the inherited attributes, the inherited attributes are used to specify the attributes to be inherited, and the attributes to be inherited refer to the node attributes that can be inherited and shared by other routing objects; when the routing structure is an inheritance structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the routing to be configured and other routings, including:

[0029] Create shared stacks and inherited routing stacks;

[0030] Based on the set mapping relationship between the inherited routing object and the inheriting routing object, the inherited attribute and the local node identification information of the inherited routing object, and the local node identification information of the inheriting routing object corresponding to the inherited routing object are added to the shared stack; wherein the inherited routing object has the inherited attribute, and the inheriting routing object is a routing object used to inherit the corresponding attribute to be inherited of the inherited routing object;

[0031] The inherited attribute of the inherited routing object and the local node identification information are added to the inheritance routing stack to obtain a routing structure of the inheritance structure.

[0032] Furthermore, when the routing structure is a parallel structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the routing to be configured and other routings, including:

[0033] Obtain the routing object required by the parallel structure from the routing table array;

[0034] When the routing object required by the parallel structure is in the stack of the target routing structure, the routing object required by the parallel structure is deleted from the stack of the target routing structure; wherein the target routing structure is a sequential structure or an inheritance structure.

[0035] Furthermore, the obtaining of node attributes of the route to be configured includes:

[0036] Get the existing routing structure;

[0037] The existing routing structure is traversed to determine the routing to be configured, and the hierarchical relationship information of the routing to be configured is obtained as the node attribute of the routing to be configured.

[0038] Furthermore, the node attribute includes a constant attribute, the constant attribute includes an authority identifier, and the method further includes:

[0039] Traverse all routing objects in the routing table array;

[0040] When the permission identifier of the routing object is not in the preset control permission set, the routing object is deleted from the routing table array; wherein the control permission set is a set of permission identifiers of all routing objects that the user is authorized to access.

[0041] Further, the node attribute includes a constant attribute, the constant attribute includes hierarchical relationship information, the hierarchical relationship information includes parent node identification information and a default jump path, and the method further includes:

[0042] When the default jump path cannot be jumped, determining the target parent node identification information according to the routing table array, wherein the target parent node identification information is the parent node identification information of the routing object corresponding to the default jump path;

[0043] Determine a target routing object according to the target parent node identification information and jump to the target routing object; wherein the parent node identification information of the target routing object is the target parent node identification information.

[0044] In a second aspect, an embodiment of the present application provides a routing configuration device, including:

[0045] A data acquisition module, used to acquire node attributes of the route to be configured; the node attributes are used to define the hierarchical relationship between the route to be configured and other routes;

[0046] A route object construction module, used to construct the route to be configured in the form of an object according to the node attributes to obtain a route object;

[0047] The routing configuration module is used to store all the routing objects in the form of an array to obtain a routing table array to complete the routing configuration.

[0048] In a third aspect, an embodiment of the present application provides a routing configuration device, including:

[0049] Memory for storing computer programs;

[0050] A processor, configured to execute the computer program;

[0051] Wherein, when the processor executes the computer program, the routing configuration method described in any one of the first aspects above is implemented.

[0052] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed, the routing configuration method described in any one of the first aspects above is implemented.

[0053] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the routing configuration method described in any one of the first aspects above.

[0054] Compared with the prior art, the embodiments of the present application provide a routing configuration method, apparatus, device, computer-readable storage medium, and computer program product, which have the following beneficial effects: by obtaining the node attributes of the route to be configured; the node attributes are used to define the hierarchical relationship between the route to be configured and other routes; the route to be configured is constructed in the form of an object according to the node attributes to obtain a routing object; all the routing objects are stored in the form of an array to obtain a routing table array to complete the routing configuration, which can improve the efficiency and accuracy of node positioning, thereby improving the flexibility and scalability of the routing configuration. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical features of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0056] Figure 1 It is a flowchart of an embodiment of a routing configuration method provided by the present application;

[0057] Figure 2 It is a structural diagram of an embodiment of a routing configuration device provided by the present application;

[0058] Figure 3 It is a structural diagram of an embodiment of a routing configuration device provided by the present application. DETAILED DESCRIPTION

[0059] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0060] See also Figure 1 , Figure 1 : is a flow chart of a routing configuration method provided in an embodiment of the present application, wherein the routing configuration method comprises steps S1 to S3:

[0061] S1. Obtain node attributes of a route to be configured; the node attributes are used to define a hierarchical relationship between the route to be configured and other routes;

[0062] S2. Construct the route to be configured in the form of an object according to the node attributes to obtain a route object;

[0063] S3. All the routing objects are stored in the form of an array to obtain a routing table array to complete the routing configuration.

[0064] In the specific implementation, firstly, the node attributes of each route to be configured are clarified, and the node attributes include the hierarchical relationship between the route to be configured and other routes and other routing information. According to the obtained node attributes, all routes to be configured are constructed in the form of objects to obtain routing objects, and all routing objects are stored in the form of arrays to obtain routing table arrays, and the routing configuration is completed according to the routing table arrays.

[0065] In an optional implementation, the node attributes include constant attributes, and the constant attributes include at least one of hierarchical relationship information, authority identification, routing path, default jump path, custom parameters, whether to hide, and routing associated components.

[0066] Specifically, node attributes include constant attributes, variable attributes, and function attributes, wherein the constant attributes define the basic structure and relationship of the route, including the route name, hierarchical relationship information, permission identifier pageCode, route path path, default jump path redirect, custom parameter meta, whether to hide hidden, and at least one of the route-related components component, wherein the hierarchical relationship information includes parent node identification information parentId, current node identification information Id, and previous node identification information preId at the same level, the parent node identification information represents the unique identification ID of the previous level route, which is empty when there is no parent node, the current node identification information represents the unique identification ID of the current route, and the previous node identification information at the same level represents the unique identification ID of the previous route of the current route in the same level route, which is empty when there is no previous route.

[0067] It should be noted that the name of the variable attribute can be the same as or different from the constant attribute. When the name of the variable attribute is the same as the constant attribute, the variable attribute overrides the constant attribute. When the route object is in a temporary life cycle, it will be detected whether it has a function attribute when entering the route. The function attribute supports parameter passing and callback, and also supports modifying constant attributes or variable attributes in the current effective life cycle.

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

[0069] Determine deletion indication information of the route to be deleted based on the input route deletion operation; wherein the deletion indication information is position information in the routing table array or a specified routing feature;

[0070] Find the route to be deleted in the routing table array according to the deletion indication information, so as to delete the route to be deleted;

[0071] Determine the characteristics of the route to be modified based on the input route modification operation;

[0072] The route to be modified is found in the routing table array according to the characteristics of the route to be modified, so as to modify the route to be modified.

[0073] Specifically, routes are expanded and deleted based on the routing table array. When a route needs to be deleted, it can be deleted according to the position of the route to be deleted in the routing table array or the specified routing characteristics. For example, when the position of the route to be deleted in the routing table array is n, and the number of routes to be deleted starting from the current position of the route to be deleted is m, then the routing object n and the m routing objects before the routing object n are deleted.

[0074] When deleting a route according to its specified routing features, you only need to use a loop operation to traverse the routing table array and determine whether the route meets the specified routing features to be deleted. All routing objects in the routing table array are traversed. When a routing object meets the specified routing features to be deleted, it is deleted. All routing objects are judged in a loop until all routing objects that meet the specified routing features to be deleted are deleted.

[0075] It can be understood that when making modifications based on the specified routing characteristics of the route to be modified, it is only necessary to use a loop operation to traverse the routing table array and determine whether the route meets the specified routing characteristics. All routing objects in the routing table array are traversed, and when a routing object meets the specified routing characteristics to be modified, it is modified, and all routing objects are judged in a loop until all routing objects that meet the specified routing characteristics to be modified are modified.

[0076] In an optional implementation manner, after storing all the routing objects in the form of an array to obtain a routing table array to complete the routing configuration, the method further includes:

[0077] Based on the routing table array, a routing structure is constructed according to the hierarchical relationship between the routing to be configured and other routings; wherein the routing structure includes at least one of a tree structure, a sequential structure, an inheritance structure and a parallel structure.

[0078] Specifically, the present application can construct different routing structures based on the node attributes of the routing, and different routing structures can be superimposed. The routing structure includes a tree structure, a sequential structure, an inheritance structure, and a parallel structure.

[0079] In an optional implementation manner, after constructing the routing structure according to the hierarchical relationship between the routing to be configured and other routings, the method further includes:

[0080] When the hierarchical relationship changes, clearing the routing structure;

[0081] Build a new routing structure based on the changed hierarchical relationship.

[0082] Specifically, the routing structure constructed in the present application adopts a strategy of being generated as needed and destroyed when used up in the project, which can avoid idleness and waste of resources and reduce the load pressure of the project. When the hierarchical relationship between the route to be configured and other routes changes, that is, the constructed routing structure is out of the current business scenario, it can be set to be invalid. The way to set the invalidation is to set the invalidation in the beforeDestroy hook of the page component when the page corresponding to the routing structure is destroyed, clear the cache or stack corresponding to the routing structure, and generate a new routing structure according to the changed hierarchical relationship. Timely recovery of memory and cache can reduce the consumption of computing power of the website's storage space.

[0083] In an optional implementation, the node attributes include hierarchical relationship information, the hierarchical relationship information includes parent node identification information, current node identification information, and previous node identification information at the same level. When the routing structure is a tree structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the route to be configured and other routes, including:

[0084] Constructing a corresponding sub-node array for each of the routing objects; wherein the sub-node array is used to store routing objects corresponding to all sub-nodes of the routing object;

[0085] Find all corresponding child nodes for each routing object based on the parent node identification information and the current node identification information in the routing table array;

[0086] For each of the routing objects, all the child nodes are traversed, and based on the current node identification information of the child node and the previous node identification information of the same level, the child node is added to a specified position in the child node array to obtain a routing structure with a tree structure.

[0087] Specifically, the tree structure is the basic structure of website routing and is the most common routing that conforms to the menu style structure. In this application, it is configured through constant properties. First, an idMap is created so that nodes can be quickly found according to the id. A corresponding child node array is built for each routing object. The child node array stores all child nodes of the routing object. Each routing object is traversed and added to the child node array of the parent node corresponding to parentId according to its parent node identification information parentId and the node identification information Id. After finding all the corresponding child nodes for each routing object, all child nodes need to be sorted in sequence. The node identification information Id of the child node and the identification information preId of the previous node at the same level are used to determine the position of the child node in the child node array of its parent node and insert it. When the identification information preId of the previous node at the same level of the child node is empty, it is inserted at the end of the child node array of its parent node, and finally a routing structure of a tree structure is obtained. If the identification information preId of the previous node at the same level is inaccurate, then the final generated tree structure will also be wrong. Therefore, in the process of building a tree structure, it is necessary to ensure the accuracy and consistency of the data. The route of the constructed tree structure is generally stored in the cache and can be effective throughout the entire operation cycle of the project.

[0088] This application constructs a tree-structured routing structure and performs a traversal operation on the routing table array. The algorithm complexity is low and the consumption of computing resources is low. In addition, the tree-structured routing structure can be directly received by the vue-router and menu components in the Vue project to generate routes and menus that can be directly used in the project.

[0089] In an optional implementation, the node attributes include a source pointer and a target pointer. When the routing structure is a sequential structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the routing to be configured and other routings, including:

[0090] Create a sequential routing stack;

[0091] Acquire a routing sequence of routing objects required by the sequence structure, and determine a source pointer and a target pointer of each routing object according to the routing sequence;

[0092] Based on the routing table array, each routing object and the corresponding source pointer and target pointer are added to the sequential routing stack in sequence according to the routing sequence to obtain a routing structure of a sequential structure.

[0093] Specifically, when there is a requirement for the order in which multiple pages are loaded, a routing structure with a sequential structure needs to be constructed. The routing structure of the sequential structure requires that the pages must be loaded in a specified order, otherwise the new page cannot be opened. The sequential structure needs to be used in some scenarios. For example, when the business of the next page needs to accept the parameters passed by the previous page, entering the next page requires authentication of the specified page, or in the jump, the source page or the target page must be a specified type of page.

[0094] When constructing a routing structure of a sequential structure, first create a sequential routing stack for storing routing objects with sequential requirements, obtain the routing order of the routing objects required for the sequential structure to be constructed, and determine the source pointer and target pointer of each routing object according to the routing order. Exemplarily, according to business requirements, the routing order to be constructed is to reach routing object B through routing object A, and then to routing object C. According to the routing order, it can be determined that the source pointer of routing object A is empty and the target pointer is B, the source pointer of routing object B is A and the target pointer is C, the source pointer of routing object C is B and the target pointer is empty. Based on the routing table array, all routing objects are added to the sequential routing stack in sequence according to the routing order, and the source pointer and target pointer of each routing object are added to the variable attributes of the routing object in the sequential routing stack. The variable attributes of the routing objects in the routing table array are not modified to obtain a routing structure of a sequential structure.

[0095] Furthermore, when jumping according to the constructed sequential structure, the source pointer and the target pointer can be security checked to avoid routing jump errors. The source route and target route of the current page routing object can be obtained by using the beforeEach hook of vue-router. The source route and target route obtained by the beforeEach hook are compared with the source pointer and target pointer of the routing object in the sequential routing stack. When the comparison is consistent, the jump operation is performed and the routing structure of the sequential structure takes effect. Otherwise, the jump is terminated and an error is prompted to ensure the accuracy and legality of the jump sequence.

[0096] It should be noted that the source pointer and the target pointer can be either an attribute or a function. When the pointer is an attribute, the corresponding source route and target route can be obtained directly according to the attribute. When the pointer is a function, the source route and target route of the routing object are determined according to the function logic. It will not be limited to the constraints of a single source and target, and can expand the scope of application of sequential routing.

[0097] In an optional implementation, the node attributes include hierarchical relationship information, the hierarchical relationship information includes the node identification information and the inherited attributes, the inherited attributes are used to specify the attributes to be inherited, and the attributes to be inherited refer to node attributes that can be inherited and shared by other routing objects; when the routing structure is an inheritance structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the route to be configured and other routes, including:

[0098] Create shared stacks and inherited routing stacks;

[0099] Based on the set mapping relationship between the inherited routing object and the inheriting routing object, the inherited attribute and the local node identification information of the inherited routing object, and the local node identification information of the inheriting routing object corresponding to the inherited routing object are added to the shared stack; wherein the inherited routing object has the inherited attribute, and the inheriting routing object is a routing object used to inherit the corresponding attribute to be inherited of the inherited routing object;

[0100] The inherited attribute of the inherited routing object and the local node identification information are added to the inheritance routing stack to obtain a routing structure of the inheritance structure.

[0101] Specifically, when a page is loaded, sometimes some sub-pages need to inherit some attributes from the specified page, such as page attributes or public ID, or the permission verification of a public page is granted to multiple sub-pages at the same time. At this time, it is necessary to build a routing structure with an inheritance structure. First, create a shared stack and an inheritance routing stack, obtain the mapping relationship between the inherited routing object and the inheriting routing object, add the inherited attributes and the node identification information of the inherited routing object, and the node identification information of the inheriting routing object corresponding to the inherited routing object to the shared stack, add the inherited attributes and the node identification information of the inherited routing object to the inheriting routing stack, and obtain the routing structure of the inheritance structure according to the shared stack and the inheriting routing stack.

[0102] It should be noted that when jumping according to the constructed inheritance structure, the legitimacy of the inheritance relationship can be verified. Using the beforeEach hook of vue-router, the target route of the current page routing object can be obtained, and the target route can be retrieved in the inheritance routing stack to see whether the necessary inheritance attributes are required. The built-in function attributes are used to verify whether the inheritance attributes are legal. If they are legal, the page can be jumped and the routing structure of the inheritance structure will take effect. Otherwise, the jump is terminated and an error is prompted.

[0103] In an optional implementation, when the routing structure is a parallel structure, constructing the routing structure based on the routing table array according to the hierarchical relationship between the routing to be configured and other routings includes:

[0104] Obtain the routing object required by the parallel structure from the routing table array;

[0105] When the routing object required by the parallel structure is in the stack of the target routing structure, the routing object required by the parallel structure is deleted from the stack of the target routing structure; wherein the target routing structure is a sequential structure or an inheritance structure.

[0106] Specifically, when displaying multiple independent contents or functions at the same time, such as multiple tabs, it is necessary to build a parallel routing structure. The parallel structure means that each page is independent of each other, does not share data, and does not have the problem of value transfer, inheritance, or the order of page opening. The parallel structure cannot be superimposed on the routing relationship with the sequential structure and inheritance structure. Therefore, when building the parallel structure, it is necessary to clear the original sequential structure and inheritance structure. First, obtain the routing object required for the parallel structure from the routing table array. When the routing object required for the parallel structure is in the stack of the target routing structure, delete the routing object required for the parallel structure from the stack of the target routing structure. The target routing structure is a sequential structure or an inheritance structure. The stack of the target routing structure includes a sequential routing stack, a shared stack, and an inherited routing stack.

[0107] In an optional implementation manner, obtaining the node attributes of the route to be configured includes:

[0108] Get the existing routing structure;

[0109] The existing routing structure is traversed to determine the routing to be configured, and the hierarchical relationship information of the routing to be configured is obtained as the node attribute of the routing to be configured.

[0110] Specifically, the complex structured routes currently used in many projects can be converted into unstructured routes using the routing configuration method of the present application. The routes to be configured are constructed in the form of objects and stored in the form of arrays. The routing configuration is completed using the routing table array to obtain at least one routing structure among a tree structure, a sequential structure, an inheritance structure or a parallel structure.

[0111] First, obtain the existing routing structure, traverse all routing nodes, and obtain the hierarchical relationship of the routes to be configured, that is, the node identification information, parent node identification information and previous node identification information of each route to be configured as the node attributes of the routes to be configured. Then, according to the node attributes, all routes to be configured are constructed as routing objects in the form of objects, and then all routing objects are stored in the form of arrays to obtain the routing table array, and the routing configuration is completed according to the routing table array.

[0112] In an optional implementation, the node attribute includes a constant attribute, the constant attribute includes an authority identifier, and the method further includes:

[0113] Traverse all routing objects in the routing table array;

[0114] When the permission identifier of the routing object is not in the preset control permission set, the routing object is deleted from the routing table array; wherein the control permission set is a set of permission identifiers of all routing objects that the user is authorized to access.

[0115] Specifically, the control permission set is a set of permission identifiers of all routing objects that the user is authorized to access, indicating which routes the current user has permission to access. All routing objects in the routing table array are traversed to check whether the permission identifier of each routing object is in the preset control permission set. If the permission identifier of the routing object is not in the control permission set, it means that the current user does not have permission to access the routing object, and the routing object is deleted from the routing table array.

[0116] In an optional implementation, the node attribute includes a constant attribute, the constant attribute includes hierarchical relationship information, the hierarchical relationship information includes parent node identification information and a default jump path, and the method further includes:

[0117] When the default jump path cannot be jumped, determining the target parent node identification information according to the routing table array, wherein the target parent node identification information is the parent node identification information of the routing object corresponding to the default jump path;

[0118] Determine a target routing object according to the target parent node identification information and jump to the target routing object; wherein the parent node identification information of the target routing object is the target parent node identification information.

[0119] Specifically, the commonly used methods currently used generally jump to a 404 page or log out for routes that do not exist. However, in many default jump scenarios, it is hoped that when the target route does not exist, it can jump to a specified route at the same level as the target route. In this application, when the default jump path of a routing object cannot be jumped, the parent node identification information in the node attribute of the routing object is determined according to the routing table array. According to the parent node identification information, other child nodes under the parent node, that is, routing objects at the same level as the routing object, can be found, thereby determining the target routing object at the same level to which you want to jump.

[0120] Compared with the prior art, the present application obtains the node attributes of the route to be configured; the node attributes are used to define the hierarchical relationship between the route to be configured and other routes; the route to be configured is constructed in the form of an object according to the node attributes to obtain a route object; all the route objects are stored in the form of an array to obtain a route table array to complete the route configuration, and there is no need to perform repeated recursive operations when adding new nodes and searching for parent pages. The algorithm complexity is low, and the efficiency and accuracy of node positioning can be improved, thereby improving the flexibility and scalability of route configuration and reducing the algorithm complexity and response time.

[0121] In a second aspect, the present application embodiment provides a routing configuration device, see Figure 2 , which is a schematic diagram of the structure of a routing configuration device provided in an embodiment of the present application.

[0122] like Figure 2 As shown, the routing configuration device includes:

[0123] The data acquisition module 21 is used to acquire the node attributes of the route to be configured; the node attributes are used to define the hierarchical relationship between the route to be configured and other routes;

[0124] A route object construction module 22, configured to construct the route to be configured in the form of an object according to the node attributes to obtain a route object;

[0125] The routing configuration module 23 is used to store all the routing objects in the form of an array to obtain a routing table array to complete the routing configuration.

[0126] In an optional implementation, the node attributes include constant attributes, and the constant attributes include at least one of hierarchical relationship information, authority identification, routing path, default jump path, custom parameters, whether to hide, and routing associated components.

[0127] In an optional implementation, the device further includes a route modification module, configured to:

[0128] Determine deletion indication information of the route to be deleted based on the input route deletion operation; wherein the deletion indication information is position information in the routing table array or a specified routing feature;

[0129] Find the route to be deleted in the routing table array according to the deletion indication information, so as to delete the route to be deleted;

[0130] Determine the characteristics of the route to be modified based on the input route modification operation;

[0131] The route to be modified is found in the routing table array according to the characteristics of the route to be modified, so as to modify the route to be modified.

[0132] In an optional implementation, the device further includes a routing structure building module, which is used to:

[0133] Based on the routing table array, a routing structure is constructed according to the hierarchical relationship between the routing to be configured and other routings; wherein the routing structure includes at least one of a tree structure, a sequential structure, an inheritance structure and a parallel structure.

[0134] In an optional implementation, the device further includes a routing structure updating module, configured to:

[0135] When the hierarchical relationship changes, clearing the routing structure;

[0136] Build a new routing structure based on the changed hierarchical relationship.

[0137] In an optional implementation, the node attributes include hierarchical relationship information, the hierarchical relationship information includes parent node identification information, current node identification information and previous node identification information at the same level, and when the routing structure is a tree structure, the routing configuration module is further used to:

[0138] Constructing a corresponding sub-node array for each of the routing objects; wherein the sub-node array is used to store routing objects corresponding to all sub-nodes of the routing object;

[0139] Find all corresponding child nodes for each routing object based on the parent node identification information and the current node identification information in the routing table array;

[0140] For each of the routing objects, all the child nodes are traversed, and based on the current node identification information of the child node and the previous node identification information of the same level, the child node is added to a specified position in the child node array to obtain a routing structure with a tree structure.

[0141] In an optional implementation, the node attributes include a source pointer and a target pointer, and when the routing structure is a sequential structure, the routing configuration module is further used to:

[0142] Create a sequential routing stack;

[0143] Acquire a routing sequence of routing objects required by the sequence structure, and determine a source pointer and a target pointer of each routing object according to the routing sequence;

[0144] Based on the routing table array, each routing object and the corresponding source pointer and target pointer are added to the sequential routing stack in sequence according to the routing sequence to obtain a routing structure of a sequential structure.

[0145] In an optional implementation, the node attributes include hierarchical relationship information, the hierarchical relationship information includes the node identification information and the inherited attributes, the inherited attributes are used to specify the attributes to be inherited, and the attributes to be inherited refer to node attributes that can be inherited and shared by other routing objects; when the routing structure is an inheritance structure, the routing configuration module is further used to:

[0146] Create shared stacks and inherited routing stacks;

[0147] Based on the set mapping relationship between the inherited routing object and the inheriting routing object, the inherited attribute and the local node identification information of the inherited routing object, and the local node identification information of the inheriting routing object corresponding to the inherited routing object are added to the shared stack; wherein the inherited routing object has the inherited attribute, and the inheriting routing object is a routing object used to inherit the corresponding attribute to be inherited of the inherited routing object;

[0148] The inherited attribute of the inherited routing object and the local node identification information are added to the inheritance routing stack to obtain a routing structure of the inheritance structure.

[0149] In an optional implementation, when the routing structure is a parallel structure, the routing configuration module is further used to:

[0150] Obtain the routing object required by the parallel structure from the routing table array;

[0151] When the routing object required by the parallel structure is in the stack of the target routing structure, the routing object required by the parallel structure is deleted from the stack of the target routing structure; wherein the target routing structure is a sequential structure or an inheritance structure.

[0152] In an optional implementation manner, obtaining the node attributes of the route to be configured includes:

[0153] Get the existing routing structure;

[0154] The existing routing structure is traversed to determine the routing to be configured, and the hierarchical relationship information of the routing to be configured is obtained as the node attribute of the routing to be configured.

[0155] In an optional implementation, the node attribute includes a constant attribute, the constant attribute includes an authority identifier, and the device further includes an authority control module, which is used to:

[0156] Traverse all routing objects in the routing table array;

[0157] When the permission identifier of the routing object is not in the preset control permission set, the routing object is deleted from the routing table array; wherein the control permission set is a set of permission identifiers of all routing objects that the user is authorized to access.

[0158] In an optional implementation, the node attribute includes a constant attribute, the constant attribute includes hierarchical relationship information, the hierarchical relationship information includes parent node identification information and a default jump path, and the device further includes a jump control module, which is used to:

[0159] When the default jump path cannot be jumped, determining the target parent node identification information according to the routing table array, wherein the target parent node identification information is the parent node identification information of the routing object corresponding to the default jump path;

[0160] Determine a target routing object according to the target parent node identification information and jump to the target routing object; wherein the parent node identification information of the target routing object is the target parent node identification information.

[0161] In a third aspect, the present application embodiment provides a routing configuration device, see Figure 3 As shown, it is a structural diagram of a routing configuration device provided by the present application.

[0162] like Figure 3 As shown, the device includes:

[0163] A memory 31, used for storing computer programs;

[0164] A processor 32, configured to execute the computer program;

[0165] Wherein, when the processor 32 executes the computer program, the routing configuration method as described in any of the above embodiments is implemented.

[0166] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 31 and executed by the processor 32 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the routing configuration device.

[0167] The processor 32 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0168] The memory 31 can be used to store the computer program and / or module, and the processor 32 realizes various functions of the routing configuration device by running or executing the computer program and / or module stored in the memory 31, and calling the data stored in the memory 31. The memory 31 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 31 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0169] It should be noted that the above-mentioned routing configuration device includes, but is not limited to, a processor and a memory. Those skilled in the art can understand that Figure 3 The structural diagram is merely an example of the above-mentioned routing configuration device and does not constitute a limitation on the routing configuration device, and may include more components than shown in the figure, or a combination of certain components, or different components.

[0170] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed, the routing configuration method described in any of the above embodiments is implemented.

[0171] It should be understood that the present application implements all or part of the processes in the above-mentioned routing configuration method, and can also be completed by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned routing configuration method when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.

[0172] In a fifth aspect, an embodiment of the present application further provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the routing configuration method described in any of the above embodiments.

[0173] The above is only a preferred implementation of the present application, but the protection scope of the present application is not limited thereto. It should be pointed out that for those skilled in the art, several equivalent obvious variations and / or equivalent replacements can be made without departing from the technical principles of the present application. These obvious variations and / or equivalent replacements should also be regarded as the protection scope of the present application.

Claims

1. A routing configuration method, characterized in that: include: Get the node attributes of the route to be configured; The node attribute is used to define the hierarchical relationship between the route to be configured and other routes; Constructing the route to be configured in the form of an object according to the node attributes to obtain a route object; All the routing objects are stored in the form of an array to obtain a routing table array to complete the routing configuration.

2. The routing configuration method according to claim 1, characterized in that: The node attributes include constant attributes, and the constant attributes include at least one of hierarchical relationship information, authority identification, routing path, default jump path, custom parameters, whether to hide, and routing associated components.

3. The routing configuration method according to claim 1, characterized in that: The method further comprises: Determine deletion indication information of the route to be deleted based on the input route deletion operation; wherein the deletion indication information is position information in the routing table array or a specified routing feature; Find the route to be deleted in the routing table array according to the deletion indication information, so as to delete the route to be deleted; Determine the characteristics of the route to be modified based on the input route modification operation; The route to be modified is found in the routing table array according to the characteristics of the route to be modified, so as to modify the route to be modified.

4. The routing configuration method according to claim 1, characterized in that: After storing all the routing objects in the form of an array to obtain a routing table array to complete the routing configuration, the method further includes: Based on the routing table array, a routing structure is constructed according to the hierarchical relationship between the routing to be configured and other routings; wherein the routing structure includes at least one of a tree structure, a sequential structure, an inheritance structure and a parallel structure.

5. The routing configuration method according to claim 4, characterized in that: After the routing structure is constructed according to the hierarchical relationship between the routing to be configured and other routings, the method further includes: When the hierarchical relationship changes, clearing the routing structure; Build a new routing structure based on the changed hierarchical relationship.

6. The routing configuration method according to claim 4, characterized in that: The node attributes include hierarchical relationship information, and the hierarchical relationship information includes parent node identification information, current node identification information, and previous node identification information at the same level. When the routing structure is a tree structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the routing to be configured and other routings, including: Constructing a corresponding sub-node array for each of the routing objects; wherein the sub-node array is used to store routing objects corresponding to all sub-nodes of the routing object; Find all corresponding child nodes for each routing object based on the parent node identification information and the current node identification information in the routing table array; For each of the routing objects, all the child nodes are traversed, and based on the current node identification information of the child node and the previous node identification information of the same level, the child node is added to a specified position in the child node array to obtain a routing structure with a tree structure.

7. The routing configuration method according to claim 4, characterized in that: The node attributes include a source pointer and a target pointer. When the routing structure is a sequential structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the routing to be configured and other routings, including: Create a sequential routing stack; Acquire a routing sequence of routing objects required by the sequence structure, and determine a source pointer and a target pointer of each routing object according to the routing sequence; Based on the routing table array, each routing object and the corresponding source pointer and target pointer are added to the sequential routing stack in sequence according to the routing sequence to obtain a routing structure of a sequential structure.

8. The routing configuration method according to claim 4, characterized in that: The node attributes include hierarchical relationship information, the hierarchical relationship information includes the node identification information and the inherited attribute, the inherited attribute is used to specify the attribute to be inherited, and the attribute to be inherited refers to the node attribute that can be inherited and shared by other routing objects; When the routing structure is an inheritance structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the routing to be configured and other routings, including: Create shared stacks and inherited routing stacks; Based on the set mapping relationship between the inherited routing object and the inheriting routing object, the inherited attribute and the local node identification information of the inherited routing object, and the local node identification information of the inheriting routing object corresponding to the inherited routing object are added to the shared stack; wherein the inherited routing object has the inherited attribute, and the inheriting routing object is a routing object used to inherit the corresponding attribute to be inherited of the inherited routing object; The inherited attribute of the inherited routing object and the local node identification information are added to the inheritance routing stack to obtain a routing structure of the inheritance structure.

9. The routing configuration method according to claim 4, characterized in that: When the routing structure is a parallel structure, the routing structure is constructed based on the routing table array according to the hierarchical relationship between the routing to be configured and other routings, including: Obtain the routing object required by the parallel structure from the routing table array; When the routing object required by the parallel structure is in the stack of the target routing structure, the routing object required by the parallel structure is deleted from the stack of the target routing structure; wherein the target routing structure is a sequential structure or an inheritance structure.

10. The routing configuration method according to claim 1, characterized in that: The step of obtaining the node attributes of the route to be configured includes: Get the existing routing structure; The existing routing structure is traversed to determine the routing to be configured, and the hierarchical relationship information of the routing to be configured is obtained as the node attribute of the routing to be configured.

11. The method for configuring unstructured routing according to claim 1, characterized in that: The node attribute includes a constant attribute, and the constant attribute includes an authority identifier. The method further includes: Traverse all routing objects in the routing table array; When the permission identifier of the routing object is not in the preset control permission set, the routing object is deleted from the routing table array; wherein the control permission set is a set of permission identifiers of all routing objects that the user is authorized to access.

12. The method for configuring unstructured routing according to claim 1, characterized in that: The node attributes include constant attributes, the constant attributes include hierarchical relationship information, the hierarchical relationship information includes parent node identification information and a default jump path, and the method further includes: When the default jump path cannot be jumped, determining the target parent node identification information according to the routing table array, wherein the target parent node identification information is the parent node identification information of the routing object corresponding to the default jump path; Determine a target routing object according to the target parent node identification information and jump to the target routing object; wherein the parent node identification information of the target routing object is the target parent node identification information.

13. A routing configuration device, characterized in that: include: A data acquisition module is used to obtain node attributes of the route to be configured; The node attribute is used to define the hierarchical relationship between the route to be configured and other routes; A route object construction module, used to construct the route to be configured in the form of an object according to the node attributes to obtain a route object; The routing configuration module is used to store all the routing objects in the form of an array to obtain a routing table array to complete the routing configuration.

14. A routing configuration device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program; Wherein, when the processor executes the computer program, the routing configuration method according to any one of claims 1 to 12 is implemented.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the routing configuration method according to any one of claims 1 to 12 is implemented.

16. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the routing configuration method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Node generation method and device based on data processing, and computer equipment

    CN111126931A

  • Method and device for configuring front-end route

    CN114268538A

  • Custom routing information processing method and related device

    CN114785862A

  • Routing network expression method and device, electronic equipment and storage medium

    CN115914084A

  • Data transmission method and apparatus

    WO2017219476A1