CN117270985A - Application integration and access control method and device - Google Patents

Application integration and access control method and device Download PDF

Info

Publication number
CN117270985A
CN117270985A CN202210664799.9A CN202210664799A CN117270985A CN 117270985 A CN117270985 A CN 117270985A CN 202210664799 A CN202210664799 A CN 202210664799A CN 117270985 A CN117270985 A CN 117270985A
Authority
CN
China
Prior art keywords
application
sub
page
resource
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210664799.9A
Other languages
Chinese (zh)
Inventor
崔镇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Wodong Tianjun Information Technology Co Ltd
Priority to CN202210664799.9A priority Critical patent/CN117270985A/en
Publication of CN117270985A publication Critical patent/CN117270985A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses an application integration and access control method and device, and relates to the technical field of computers. One embodiment of the method comprises the following steps: receiving an access request to a sub-application component in a main application page, and determining a parameter field in the access request; searching sub-application configuration information corresponding to the parameter field to acquire a resource dependent packet address and routing information, and loading a sub-application resource dependent packet based on the resource dependent packet address; and acquiring the URL address in the routing information, and determining a page code corresponding to the URL address in the sub-application resource dependent package so as to jump to a sub-application page for display by accessing the page code. The implementation mode is based on a protocol route injection mode, the sub-application resource dependent package and the route information are loaded according to the actual access request of the user as required, the integration of the sub-application in the main application is realized, and the first page of the sub-application provides access to the outside in the main application framework.

Description

Application integration and access control method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an application integration and access control method and apparatus.
Background
With the continuous development of services, more and more service applications are generated, each service application is provided with an independent website domain name, and can independently provide access to the outside, and each website can be put into different channels. Some service applications have similar attributes, such as all the service applications belong to commercialized items, so that the integration of all the scattered service applications of the class can be considered to provide a unified access address to the outside, thereby facilitating unified monitoring and service optimization.
In carrying out the present invention, the inventors have found that at least the following problems exist in the prior art: during the research and integration scheme, the number of the dispersed business applications is found to be large, the reconstruction cost is high, the development frameworks used by the applications are different, and resource conflict exists during integration, so that how to integrate a large number of the dispersed applications and ensure the user experience is a problem considered at present.
Disclosure of Invention
In view of this, the embodiments of the present invention provide an application integration and access control method and apparatus, which at least can solve the problem in the prior art that the number of integrated service applications is high in reconstruction cost, and the development frameworks of the applications are different, so that integration is difficult.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided an application access control method applied to a host application, including:
receiving an access request to a sub-application component in a main application page, and determining a parameter field in the access request;
searching sub-application configuration information corresponding to the parameter field to acquire a resource dependent packet address and routing information, and loading a sub-application resource dependent packet based on the resource dependent packet address;
and acquiring a Uniform Resource Location (URL) address in the routing information, and determining a page code corresponding to the URL address in the sub-application resource dependent package so as to jump to a sub-application page for display by accessing the page code.
Optionally, the searching for the sub-application configuration information corresponding to the parameter field includes:
responding to the existence of a parameter field in the access request, and searching sub-application configuration information corresponding to the parameter field from a local configuration information array; or (b)
And searching the first-ordered sub-application configuration information from the local configuration information array in response to the fact that the parameter field does not exist in the access request.
Optionally, the method further comprises: pulling configuration information of all sub-applications from a configuration platform and caching the configuration information to a local place; the configuration platform also stores the corresponding relation between the parameter field and the sub-application configuration information.
Optionally, the searching for the sub-application configuration information corresponding to the parameter field includes:
searching a resource dependent packet address attribute and a method name attribute corresponding to the parameter field from a local configuration information array to acquire a value of the resource dependent packet address attribute;
acquiring a value of a method name attribute, and searching route information corresponding to the method name under a naming space of a main application; the method name is a combination of a preset field and the parameter field.
Optionally, the searching for the sub-application configuration information corresponding to the parameter field includes:
searching a resource dependent packet address attribute corresponding to the parameter field from a local configuration information array to acquire a value of the resource dependent packet address attribute; and
and generating a method name based on the preset field and the parameter field so as to search the routing information corresponding to the method name under the name space of the main application.
Optionally, the loading the sub-application resource dependent package based on the resource dependent package address includes:
in the code of the main application page, globally searching tags with preset types, determining the URL attribute of each tag, and judging whether the resource dependent packet address attribute exists or not;
If so, determining that the resource-dependent package of the sub-application exists, and not needing to be reloaded, otherwise, loading the resource-dependent package of the sub-application based on the address of the resource-dependent package.
Optionally, before the obtaining the URL address in the routing information, the method includes:
determining a routing array of the main application page; the routing array is used for executing page jump logic to jump from the main application page to a page corresponding to the routing information;
acquiring the name attribute of each piece of routing information in the routing array, and judging whether the name attribute of the routing information exists or not;
if so, determining that the routing information exists in the routing array, and loading the routing information into the routing array without reloading, otherwise, loading the routing information into the routing array.
Optionally, the method further comprises:
responding to the ordering operation of the objects in the sub-application page, judging whether an account number logs in the sub-application, and if not, triggering the account number to log in the sub-application logic;
responding to sharing operation of the sub-application pages, and calling page sharing logic of the main application to share the pages to the designated channels;
the login logic code and the page sharing logic code of the sub-application are written into the entry file of the main application.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided an application integration method, applied to a sub-application, including:
responding to the selection operation of the sub-application integration, and outputting the first page of the sub-application to a main application page in a component form for display;
executing the packing operation of codes of all pages in the sub-application to generate a resource dependent package, and transmitting the resource dependent package to a deployment platform to obtain a resource dependent package address; the main application loads a resource dependent package from the deployment platform through the resource dependent package address;
acquiring a Uniform Resource Location (URL) address of a sub-application home page, receiving a name attribute defined by the sub-application, and generating routing information based on the name attribute and the URL address;
receiving an identification alias created for a sub-application, generating a method name based on a preset field and the identification alias, and storing the routing information as an attribute value of the method name into a naming space of a main application;
and storing the identification alias, the resource dependent package address, the method name or the identification alias and the resource dependent package address as configuration information of the sub-application on a configuration platform.
Optionally, before the first page of the sub application is output to the main application page in a component form for display, the method further includes:
and receiving a selection operation of a specific page in the sub-application, taking the specific page as a first page of the sub-application, and taking the URL address of the first page as an external access entry of the sub-application.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided an application access control apparatus applied to a host application, including:
the determining module is used for receiving an access request of the sub-application component in the main application page and determining a parameter field in the access request;
the loading module is used for searching the sub-application configuration information corresponding to the parameter field so as to acquire a resource dependent packet address and routing information, and loading a sub-application resource dependent packet based on the resource dependent packet address;
and the jump module is used for acquiring the Uniform Resource Location (URL) address in the routing information, determining a page code corresponding to the URL address in the sub-application resource dependence package, and jumping to a sub-application page for display by accessing the page code.
Optionally, the loading module is configured to:
responding to the existence of a parameter field in the access request, and searching sub-application configuration information corresponding to the parameter field from a local configuration information array; or (b)
And searching the first-ordered sub-application configuration information from the local configuration information array in response to the fact that the parameter field does not exist in the access request.
Optionally, the determining module is further configured to: pulling configuration information of all sub-applications from a configuration platform and caching the configuration information to a local place; the configuration platform also stores the corresponding relation between the parameter field and the sub-application configuration information.
Optionally, the loading module is configured to:
searching a resource dependent packet address attribute and a method name attribute corresponding to the parameter field from a local configuration information array to acquire a value of the resource dependent packet address attribute;
acquiring a value of a method name attribute, and searching route information corresponding to the method name under a naming space of a main application; the method name is a combination of a preset field and the parameter field.
Optionally, the loading module is configured to:
searching a resource dependent packet address attribute corresponding to the parameter field from a local configuration information array to acquire a value of the resource dependent packet address attribute; and
and generating a method name based on the preset field and the parameter field so as to search the routing information corresponding to the method name under the name space of the main application.
Optionally, the loading module is configured to:
in the code of the main application page, globally searching tags with preset types, determining the URL attribute of each tag, and judging whether the resource dependent packet address attribute exists or not;
if so, determining that the resource-dependent package of the sub-application exists, and not needing to be reloaded, otherwise, loading the resource-dependent package of the sub-application based on the address of the resource-dependent package.
Optionally, the jump module is configured to:
determining a routing array of the main application page; the routing array is used for executing page jump logic to jump from the main application page to a page corresponding to the routing information;
acquiring the name attribute of each piece of routing information in the routing array, and judging whether the name attribute of the routing information exists or not;
if so, determining that the routing information exists in the routing array, and loading the routing information into the routing array without reloading, otherwise, loading the routing information into the routing array.
Optionally, the apparatus further comprises a common logic module for:
responding to the ordering operation of the objects in the sub-application page, judging whether an account number logs in the sub-application, and if not, triggering the account number to log in the sub-application logic;
Responding to sharing operation of the sub-application pages, and calling page sharing logic of the main application to share the pages to the designated channels;
the login logic code and the page sharing logic code of the sub-application are written into the entry file of the main application.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided an application integration, applied to a sub-application, including:
the response module is used for responding to the selection operation of the sub-application integration and outputting the first page of the sub-application to the main application page in a component form for display;
the packaging module is used for executing the packaging operation of codes of all pages in the sub-application to generate a resource dependent package, and transmitting the resource dependent package to the deployment platform to obtain a resource dependent package address; the main application loads a resource dependent package from the deployment platform through the resource dependent package address;
the routing module is used for acquiring the uniform resource location URL address of the sub-application home page, receiving the name attribute defined by the sub-application, and generating routing information based on the name attribute and the URL address; receiving an identification alias created for a sub-application, generating a method name based on a preset field and the identification alias, and storing the routing information as an attribute value of the method name into a naming space of a main application;
And the storage module is used for storing the identification alias, the resource dependent packet address and the method name or the identification alias and the resource dependent packet address as configuration information of the sub-application on a configuration platform.
Optionally, the device further comprises a selection module for: and receiving a selection operation of a specific page in the sub-application, taking the specific page as a first page of the sub-application, and taking the URL address of the first page as an external access entry of the sub-application.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided an electronic device for system current limiting.
The electronic equipment of the embodiment of the invention comprises: one or more processors; and the storage device is used 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 are enabled to realize the application integration and access control method.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements any of the above-described application integration, access control methods.
According to the solution provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: the sub-applications output the home page to the main application in a component form, so that the main application is embedded quickly and seamlessly, the resources of the sub-applications are packaged and output to the deployment platform, and the resource dependent packages of different sub-applications are mutually independent according to the naming space, so that the stability and the independence of page jumping and display are ensured; the main application only loads the resource dependent package of the accessed sub-application based on the protocol route injection mode, reduces the loaded resource volume and realizes unified management and monitoring of the sub-application.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic flow diagram of an application integration method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a sub-application integration flow;
FIG. 3 is a flow chart of an application access control method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a sub-application access control flow;
FIG. 5 is a schematic diagram of the main modules of an application access control device according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of the main modules of an application integration apparatus according to an embodiment of the invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 8 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It is noted that embodiments of the invention and features of the embodiments may be combined with each other without conflict. The data acquisition, storage, use, processing and the like in the technical scheme meet the relevant regulations of national laws and regulations.
The prior art and the drawbacks present are described in detail herein:
1. iframe embedding: iframe is a tag of HTML that creates an inline frame (i.e., a line inside frame) that contains another document. Briefly, an area is reserved in a URL page (a), an iframe tag is embedded in the area, and the tag can configure other page URLs (B) to be embedded through parameters, so that the page embedded in the iframe is not recorded by a browser, and the current URL of the browser is the same as the current URL of (a).
Each business application packages all files of the project and deploys, and each application has its independent access address. The iframe is embedded into each access service line address, and then provides access to the outside. 1) The size of the display area embedded by the iframe is not easy to control, and certain limitation exists; 2) The record of the embedded URL is completely invalid, page refreshing can not be memorized, and the refreshing can return to the first page; 3) The jump between iframe functions is invalid; 4) Style display, compatibility, etc. of iframes have limitations.
2. Project reconstruction: and all projects are integrated into one project, so that the development cost of the reconstructed code is high.
The words related to the scheme are explained as follows:
the window namespace (referred to as package in some languages) is a common concept in static languages that helps operators to sort codes and avoid naming conflicts. The functions, objects, variables and the like are only required to be placed in a pseudo-namespace, namely, the functions, the objects, the variables and the like are packaged by an anonymous function to be protected, and the functions, the objects and the variables can be mutually accessed as the functions, the objects and the variables are positioned in one function.
UMD (Universal Module Definition, general module definition specification): is a mashup of AMD and common js, AMD (Asynchronous Module Definition ) develops on the browser first principle, asynchronous loading module. The CommonJS module evolves on the first principles of the server, choosing synchronous loading, which module does not need wrapper (unwrapped modules), which forces the operator to come up with another more general model UMD, hopefully solving a cross-platform solution.
Referring to fig. 1, a main flowchart of an application integration method applied to a sub-application according to an embodiment of the present invention is shown, including the following steps:
s101: responding to the selection operation of the sub-application integration, and outputting the first page of the sub-application to a main application page in a component form for display;
s102: executing the packing operation of codes of all pages in the sub-application to generate a resource dependent package, and transmitting the resource dependent package to a deployment platform to obtain a resource dependent package address; the main application loads a resource dependent package from the deployment platform through the resource dependent package address;
s103: acquiring a Uniform Resource Location (URL) address of a sub-application home page, receiving a name attribute defined by the sub-application, and generating routing information based on the name attribute and the URL address;
S104: receiving an identification alias created for a sub-application, generating a method name based on a preset field and the identification alias, and storing the routing information as an attribute value of the method name into a naming space of a main application;
s105: and storing the identification alias, the resource dependent package address, the method name or the identification alias and the resource dependent package address as configuration information of the sub-application on a configuration platform.
In the above embodiment, first, the operation object in the present embodiment will be described with reference to steps S101 to S105:
1) Sub-applications, which are decentralized business applications;
2) A main application, which is a new application formed by integrating each dispersed business application;
3) The deployment platform is used for storing the resource dependent package of the sub-application;
4) And the configuration platform is used for storing the configuration information of the sub-application.
Referring to fig. 2, a schematic diagram of a sub-application integration flow is shown:
1. and receiving a selection operation of a specific page in the sub-application, taking the specific page as a first page of the sub-application, such as a shop first page, and taking the URL address of the first page as an external access entry of the sub-application. In general, there are multiple pages in the sub-application, which page is output as a top page, and depending on the definition of an operator, as for the access of other pages, the top page generally includes links for jumping to other pages, for example, the top page is a display page of multiple items, clicking a certain item will jump to a detail page of the item, and after clicking and purchasing, the user jumps from the detail page of the item to a settlement page.
Under vue framework (a progressive JavaScript framework), the sub-application home page is output to the main application designated page in the form of a component, and a subsequent user can access the sub-application home page by clicking the sub-application component. And displaying the sub-application component at a menu position in the home page navigation of the main application, wherein a user clicks the sub-application component from the menu position and triggers page jump logic to access the home page of the sub-application, the menu represents an entry, and the opened home page of the sub-application provides the home page for the user to access.
2. The method comprises the steps of obtaining codes of all pages in a sub-application, executing a packing command, packing in a lib mode to obtain a compressed package file with UMD format as a suffix, deploying the UMD file under a dist directory of a deployment platform to obtain a storage address, and downloading the UMD file from the deployment platform by a subsequent main application according to the address. For example, the objects in the store and the codes of each page are processed into compressed package files with UMD format as suffixes in the lib mode, placed under the dist partition directory and then deployed on the deployment platform.
3. Defining the routing information of the sub-application home page, wherein the format is { name: 'xxx', URL: 'xxx' }, and URL (Uniform Resource Locator ) is the access address of the sub-application home page, and the name attribute needs to be customized by an operator for later judging whether the routing information is used in the routing array or not, and particularly referring to later figures 3 and 4.
The configuration information of the sub-application may also include a "whether to open cache" attribute for use in browser rollback operations in the main application, typically set to yes. If the user sees other article introduction positions when browsing the store A last time, then the user clicks to visit the store B through navigation, the page cache of the store A is unchanged at the moment, and when the user switches from the store B to the store A, the display page of the store A still remains at the article introduction position browsed before. Or may also contain "application title" attributes such as item title, store title.
The configuration platform is an independent configuration system and is used for recording configuration information of the sub-application, wherein the configuration information comprises attributes such as type, resource dependent packet address, method name, application title, whether to start a cache or not and the like, and example codes are as follows:
{
type:'xxx',
resource dependent packet addresses, 'xxx',
the method name is 'xxx',
application title, 'xxx',
whether or not to start the buffer memory, yes/no
}
Because the method name is composed of preset characters and sub-application identification alias type, the configuration information does not need to contain the method name, and the route information is searched according to the method name after the method name is generated when the route information is searched, and example codes are as follows:
{
type:'xxx',
Resource dependent packet addresses, 'xxx',
application title, 'xxx',
whether or not to start the buffer memory, yes/no
}
4. An identification alias type is created for the sub-applications, each sub-application has a unique alias, the unique alias represents the identity number of each sub-application, and the aliases of different sub-applications are different, such as sub-application 1:shopA and sub-application 2:shopB. And establishing a corresponding relation between the aliases and the sub-application configuration information, and storing the corresponding relation and the sub-application configuration information into a configuration platform. When the subsequent main application processes the access request of the user to the sub-application component, the corresponding sub-application configuration information can be loaded under the local configuration information array according to the type alias.
5. Based on the preset character and the sub-application identification alias, generating a method name of the sub-application, such as loadshopA. Assuming that the name of the name application is just one element of the name application, such as the name application, the name application is the name application, and the name application is the name application; { loadshopoA, loadshopoB, loadshopoC }. And storing the sub-application routing information as an attribute value of the method name to the under-name of the main application. When the subsequent main application processes the access request of the user to the sub-application component, the corresponding routing information can be loaded under the name space according to the method name.
6. Because the sub-applications are unified to provide access to the outside under the main application, the sub-applications do not need to access the portal solely, so that the deployment resource can be free from portal HTML (Hyper Text Markup Language ) pages, the final portal page is only in the main application code, the dependent resource of the sub-application can be placed in the portal page of the main application to provide access, and the resource comprises js, css (Cascading Style Sheets ), fonts (in a microcomputer system, a folder for storing fonts), imgs pictures and the like.
According to the method provided by the embodiment, the sub-application outputs the home page to the main application in the form of the component, so that the main application is embedded quickly and seamlessly, the resources of the sub-application are packaged and output to the deployment platform, the resource dependent packages of different sub-applications are mutually independent according to the naming space, and the stability and the independence of page jumping and display are ensured.
Referring to fig. 3, a main flowchart of an application access control method applied to a main application according to an embodiment of the present invention is shown, including the following steps:
s301: receiving an access request to a sub-application component in a main application page, and determining a parameter field in the access request;
S302: searching sub-application configuration information corresponding to the parameter field to acquire a resource dependent packet address and routing information, and loading a sub-application resource dependent packet based on the resource dependent packet address;
s303: and acquiring a Uniform Resource Location (URL) address in the routing information, and determining a page code corresponding to the URL address in the sub-application resource dependent package so as to jump to a sub-application page for display by accessing the page code.
In the above embodiment, for steps S301 to S303, the present embodiment is described from the perspective of the main application, where the main application may display the home page of the sub-application in the form of a component, define the sub-application registration mechanism, load the sub-application resource dependent package, execute the page switch jump, and so on.
1. The user clicks a page for displaying sub-application components in the main application, selects one of the sub-application components and clicks to initiate an access request for jumping to a front page of the sub-application to the main application; the sub-application outputs the first page of the sub-application to the main application page in a component form for display;
2. after receiving an access request of a user to a sub-application component, a main application firstly judges whether the configuration information of all sub-applications is stored in a local configuration information array, and if not, the configuration information of all the sub-applications is required to be pulled from a configuration platform and cached to the local to obtain the local configuration information array;
3. Analyzing the access request to find corresponding sub-application configuration information according to a type field in the access request:
1) Such as: https:// xxx.jd.com/index.htmltype=shopa, the value of the parameter type represents the sub-application identification alias, and the configuration information of the corresponding sub-application is obtained by searching from the local configuration information array according to the type, as follows:
{
type:shopA,
resource dependent packet addresses, 'xxx',
the method name is 'xxx',
application title, 'xxx',
whether the cache is turned on or not-yes/no,
}
the name space of the main application is set as a shoonamespace, as described above, the method name of each sub-application is stored under the name space of the main application as an attribute of the shoonamespace, and the method names of a plurality of sub-applications are contained under one name space, such as the shoonamespace { loadshopoA, loadshopoB, loadshopoC }, and the routing information of each sub-application is stored under the method name in the form of attribute values. Taking loadshopoA as an example, a shopoA is an alias of a certain sub-application, a method name is formed by preset fields such as load and type parameters, and routing information corresponding to the loadshopoA is searched from the shapmespace.
2) Such as: http:// xxx. Xx.com, without type parameter, find the first sub application configuration information from the local configuration array, such as [ store K configuration information, store B configuration information, all other store configuration information ], here take store K configuration information, finally jump to store K first page, in order to prevent the problem of jump page being empty.
4. After the main application obtains the configuration information of the sub-application, the sub-application resource dependent package is dynamically loaded from the deployment platform according to the resource dependent package address in the configuration information. The resource dependent package is a js file, and the judgment of whether the resource dependent package exists is to judge whether the js file exists. First, in the code of the main application page, a tag with a type of libminjs is globally searched, for example:
< script class= "libminjs" url= "store A url" >
< script class= "libminjs" url= "store B url" >
For example, whether resource-dependent packages of store a and store C exist or not is determined, tags with a type of libminjs need to be searched globally, the search result is 2, and URL attributes of each tag and sub-application configuration information are compared through polling, and if the URL attribute of store a exists, the resource-dependent package does not need to be loaded. If the URL attribute of store C does not exist, then the resource-dependent package needs to be loaded from the deployment platform based on its resource-dependent package address.
5. When the sub-application resource dependent package is loaded, the routing information acquired according to the method name can be loaded into the routing array of the main application page; the main application access sub-application is mainly in the form of route injection, so that the route array is used when executing the page jump logic to jump from the main application page to the page corresponding to the route information.
According to the foregoing description, the routing information format is { name: 'xxx', URL: 'xxx' }, which includes a name attribute and a URL attribute, and the URL address is an access address of the home page of the sub-application, where it is required to poll and compare whether the name attribute of each routing information in the routing array is the same as the name attribute of the current routing information, and if the name attribute is the same, it indicates that the current routing information is already loaded into the routing array, and no reloading is required. Otherwise, the current route information is loaded into the route array.
6. The sub-application resource-dependent package includes code implementation logic for each page in the sub-application. After detecting that the current routing information exists in the sub-application resource dependent package and the routing array, executing URL address jump logic in the routing information, and jumping to a home page of the sub-application for display by accessing a home page code in the sub-application resource dependent package.
The implementation logic is specifically shown in fig. 4, and ensuring that the page is successfully output needs to ensure that the loading of the resource-dependent package is completed before the page can be rendered, otherwise, the page is abnormal. The resource dependent package is loaded, the route information is loaded to the route array, and the page rendering is synchronous loading mode, so that resource repeated loading and white screen abnormality are avoided.
In addition, the main application provides a unified public method for the sub-applications, such as public methods of login information sharing, general single skip, page sharing and the like, and because the shared code logic of each sub-application is the same, the code redundancy can be avoided by extracting the public method from the main application. After a user jumps to a sub-application home page by clicking a sub-application component in a main application page, ordering and sharing operations of the page are realized through corresponding logic in a main application entry file, firstly judging whether an account logs in a sub-application when an item is ordered, and if the account logs in the sub-application logic is not triggered according to a login logic code in the main application entry file; if the page is shared, the page sharing logic code of the main application is called to share the page to the channel appointed by the user.
The method provided by the embodiment can integrate the disperse sub-applications with high efficiency, and each sub-application can be deployed independently; the method has the advantages that the resource is loaded as required, only the resource dependent package of the accessed sub-application is loaded, the whole engineering volume is reduced, the page access speed is ensured, and the consistency of user experience and the single-page application access effect is ensured.
Compared with the prior art, the method provided by the embodiment of the invention has at least the following beneficial effects:
1. the sub-application outputs the home page to the main application in a component form, so that the main application is embedded quickly and seamlessly, the resources of the sub-application are packaged and output to the deployment platform, and the page jumping and display stability is ensured;
2. each sub-application distinguishes the externally provided access address under the framework of the main application according to the type parameter of the access address, and is provided with a naming space, so that the resources of different sub-applications are mutually independent, and the development cost is reduced;
3. the main application only loads the resource dependent package of the accessed sub-application based on the protocol route injection mode, reduces the loaded resource volume, realizes unified management and monitoring of the sub-application, and can be deployed independently;
4. and a complete integration mechanism is provided for the sub-applications in a configuration mode, so that the sub-applications are integrated efficiently, and the user experience is ensured to be consistent with the access effect of the single-page application.
Referring to fig. 5, a schematic diagram of main modules of an application access control device 500 according to an embodiment of the present invention is shown, where the main modules are applied to a main application, and the main modules include:
a determining module 501, configured to receive an access request to a sub-application component in a main application page, and determine a parameter field in the access request;
The loading module 502 is configured to search the sub-application configuration information corresponding to the parameter field, so as to obtain a resource dependent packet address and routing information, and load a sub-application resource dependent packet based on the resource dependent packet address;
and a skip module 503, configured to obtain a uniform resource location URL address in the routing information, determine a page code corresponding to the URL address in the sub-application resource dependency packet, and skip to a sub-application page for display by accessing the page code.
In the embodiment of the present invention, the loading module 502 is configured to:
responding to the existence of a parameter field in the access request, and searching sub-application configuration information corresponding to the parameter field from a local configuration information array; or (b)
And searching the first-ordered sub-application configuration information from the local configuration information array in response to the fact that the parameter field does not exist in the access request.
In the embodiment of the present invention, the determining module 501 is further configured to: pulling configuration information of all sub-applications from a configuration platform and caching the configuration information to a local place; the configuration platform also stores the corresponding relation between the parameter field and the sub-application configuration information.
In the embodiment of the present invention, the loading module 502 is configured to:
Searching a resource dependent packet address attribute and a method name attribute corresponding to the parameter field from a local configuration information array to acquire a value of the resource dependent packet address attribute;
acquiring a value of a method name attribute, and searching route information corresponding to the method name under a naming space of a main application; the method name is a combination of a preset field and the parameter field.
In the embodiment of the present invention, the loading module 502 is configured to:
searching a resource dependent packet address attribute corresponding to the parameter field from a local configuration information array to acquire a value of the resource dependent packet address attribute; and
and generating a method name based on the preset field and the parameter field so as to search the routing information corresponding to the method name under the name space of the main application.
In the embodiment of the present invention, the loading module 502 is configured to:
in the code of the main application page, globally searching tags with preset types, determining the URL attribute of each tag, and judging whether the resource dependent packet address attribute exists or not;
if so, determining that the resource-dependent package of the sub-application exists, and not needing to be reloaded, otherwise, loading the resource-dependent package of the sub-application based on the address of the resource-dependent package.
In the embodiment of the present invention, the skip module 503 is configured to:
determining a routing array of the main application page; the routing array is used for executing page jump logic to jump from the main application page to a page corresponding to the routing information;
acquiring the name attribute of each piece of routing information in the routing array, and judging whether the name attribute of the routing information exists or not;
if so, determining that the routing information exists in the routing array, and loading the routing information into the routing array without reloading, otherwise, loading the routing information into the routing array.
In the implementation device of the invention, the device also comprises a common logic module for:
responding to the ordering operation of the objects in the sub-application page, judging whether an account number logs in the sub-application, and if not, triggering the account number to log in the sub-application logic;
responding to sharing operation of the sub-application pages, and calling page sharing logic of the main application to share the pages to the designated channels;
the login logic code and the page sharing logic code of the sub-application are written into the entry file of the main application.
Referring to fig. 6, a schematic diagram of main modules of an application integration apparatus 600 according to an embodiment of the present invention is shown, and the application module is applied to a sub-application, and includes:
The response module 601 is configured to output, in a component form, a first page of the sub-application to a main application page for display in response to a selection operation of the sub-application integration;
the packaging module 602 is configured to perform a packaging operation on codes of all pages in the sub-application, so as to generate a resource dependent package, and transmit the resource dependent package to the deployment platform to obtain a resource dependent package address; the main application loads a resource dependent package from the deployment platform through the resource dependent package address;
the routing module 603 is configured to obtain a uniform resource location URL address of a home page of the sub-application, receive a name attribute defined by the sub-application, and generate routing information based on the name attribute and the URL address; receiving an identification alias created for a sub-application, generating a method name based on a preset field and the identification alias, and storing the routing information as an attribute value of the method name into a naming space of a main application;
a storage module 604, configured to store the identifier alias, the resource-dependent packet address, the method name, or the identifier alias and the resource-dependent packet address as configuration information of a sub-application on a configuration platform.
The implementation device of the invention further comprises a selection module for:
And receiving a selection operation of a specific page in the sub-application, taking the specific page as a first page of the sub-application, and taking the URL address of the first page as an external access entry of the sub-application.
In addition, the implementation of the apparatus in the embodiments of the present invention has been described in detail in the above method, so that the description is not repeated here.
Fig. 7 shows an exemplary system architecture 700, including terminal devices 701, 702, 703, a network 704, and a server 705 (by way of example only), to which embodiments of the invention may be applied.
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, are installed with various communication client applications, and a user may interact with the server 705 through the network 704 using the terminal devices 701, 702, 703 to receive or transmit messages, etc.
The network 704 is the medium used to provide communication links between the terminal devices 701, 702, 703 and the server 705. The network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The server 705 may be a server providing various services, and it should be noted that the method provided by the embodiment of the present invention is generally performed by the server 705, and accordingly, the apparatus is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, there is illustrated a schematic diagram of a computer system 800 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 8 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU) 801 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, mouse, etc.; an output portion 807 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 808 including a hard disk or the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. The drive 810 is also connected to the I/O interface 805 as needed. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as needed so that a computer program read out therefrom is mounted into the storage section 808 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 809, and/or installed from the removable media 811. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 801.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor includes a determination module, a loading module, and a skip module. The names of these modules do not constitute a limitation on the module itself in some cases, and for example, a skip module may also be described as a "page skip module".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to perform any of the application integration, access control methods described above.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (14)

1. An application access control method applied to a main application, comprising:
receiving an access request to a sub-application component in a main application page, and determining a parameter field in the access request;
searching sub-application configuration information corresponding to the parameter field to acquire a resource dependent packet address and routing information, and loading a sub-application resource dependent packet based on the resource dependent packet address;
And acquiring a Uniform Resource Location (URL) address in the routing information, and determining a page code corresponding to the URL address in the sub-application resource dependent package so as to jump to a sub-application page for display by accessing the page code.
2. The method of claim 1, wherein the looking up the sub-application configuration information corresponding to the parameter field comprises:
responding to the existence of a parameter field in the access request, and searching sub-application configuration information corresponding to the parameter field from a local configuration information array; or (b)
And searching the first-ordered sub-application configuration information from the local configuration information array in response to the fact that the parameter field does not exist in the access request.
3. The method as recited in claim 2, further comprising: pulling configuration information of all sub-applications from a configuration platform and caching the configuration information to a local place; the configuration platform also stores the corresponding relation between the parameter field and the sub-application configuration information.
4. A method according to any of claims 1-3, wherein said looking up sub-application configuration information corresponding to said parameter field comprises:
searching a resource dependent packet address attribute and a method name attribute corresponding to the parameter field from a local configuration information array to acquire a value of the resource dependent packet address attribute;
Acquiring a value of a method name attribute, and searching route information corresponding to the method name under a naming space of a main application; the method name is a combination of a preset field and the parameter field.
5. A method according to any of claims 1-3, wherein said looking up sub-application configuration information corresponding to said parameter field comprises:
searching a resource dependent packet address attribute corresponding to the parameter field from a local configuration information array to acquire a value of the resource dependent packet address attribute; and
and generating a method name based on the preset field and the parameter field so as to search the routing information corresponding to the method name under the name space of the main application.
6. The method of claim 1, wherein loading a sub-application resource-dependent package based on the resource-dependent package address comprises:
in the code of the main application page, globally searching tags with preset types, determining the URL attribute of each tag, and judging whether the resource dependent packet address attribute exists or not;
if so, determining that the resource-dependent package of the sub-application exists, and not needing to be reloaded, otherwise, loading the resource-dependent package of the sub-application based on the address of the resource-dependent package.
7. The method of claim 1, comprising, prior to said obtaining a uniform resource location URL address in said routing information:
determining a routing array of the main application page; the routing array is used for executing page jump logic to jump from the main application page to a page corresponding to the routing information;
acquiring the name attribute of each piece of routing information in the routing array, and judging whether the name attribute of the routing information exists or not;
if so, determining that the routing information exists in the routing array, and loading the routing information into the routing array without reloading, otherwise, loading the routing information into the routing array.
8. The method of claim 1, wherein the method further comprises:
responding to the ordering operation of the objects in the sub-application page, judging whether an account number logs in the sub-application, and if not, triggering the account number to log in the sub-application logic;
responding to sharing operation of the sub-application pages, and calling page sharing logic of the main application to share the pages to the designated channels;
the login logic code and the page sharing logic code of the sub-application are written into the entry file of the main application.
9. An application integration method applied to a sub-application, comprising:
responding to the selection operation of the sub-application integration, and outputting the first page of the sub-application to a main application page in a component form for display;
executing the packing operation of codes of all pages in the sub-application to generate a resource dependent package, and transmitting the resource dependent package to a deployment platform to obtain a resource dependent package address; the main application loads a resource dependent package from the deployment platform through the resource dependent package address;
acquiring a Uniform Resource Location (URL) address of a sub-application home page, receiving a name attribute defined by the sub-application, and generating routing information based on the name attribute and the URL address;
receiving an identification alias created for a sub-application, generating a method name based on a preset field and the identification alias, and storing the routing information as an attribute value of the method name into a naming space of a main application;
and storing the identification alias, the resource dependent package address, the method name or the identification alias and the resource dependent package address as configuration information of the sub-application on a configuration platform.
10. The method of claim 9, further comprising, prior to outputting the first page of the child application in component form to the main application page for display:
And receiving a selection operation of a specific page in the sub-application, taking the specific page as a first page of the sub-application, and taking the URL address of the first page as an external access entry of the sub-application.
11. An application access control apparatus applied to a host application, comprising:
the determining module is used for receiving an access request of the sub-application component in the main application page and determining a parameter field in the access request;
the loading module is used for searching the sub-application configuration information corresponding to the parameter field so as to acquire a resource dependent packet address and routing information, and loading a sub-application resource dependent packet based on the resource dependent packet address;
and the jump module is used for acquiring the Uniform Resource Location (URL) address in the routing information, determining a page code corresponding to the URL address in the sub-application resource dependence package, and jumping to a sub-application page for display by accessing the page code.
12. An application integration apparatus for application to a sub-application, comprising:
the response module is used for responding to the selection operation of the sub-application integration and outputting the first page of the sub-application to the main application page in a component form for display;
The packaging module is used for executing the packaging operation of codes of all pages in the sub-application to generate a resource dependent package, and transmitting the resource dependent package to the deployment platform to obtain a resource dependent package address; the main application loads a resource dependent package from the deployment platform through the resource dependent package address;
the routing module is used for acquiring the uniform resource location URL address of the sub-application home page, receiving the name attribute defined by the sub-application, and generating routing information based on the name attribute and the URL address; receiving an identification alias created for a sub-application, generating a method name based on a preset field and the identification alias, and storing the routing information as an attribute value of the method name into a naming space of a main application;
and the storage module is used for storing the identification alias, the resource dependent packet address and the method name or the identification alias and the resource dependent packet address as configuration information of the sub-application on a configuration platform.
13. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-10.
14. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-10.
CN202210664799.9A 2022-06-14 2022-06-14 Application integration and access control method and device Pending CN117270985A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210664799.9A CN117270985A (en) 2022-06-14 2022-06-14 Application integration and access control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210664799.9A CN117270985A (en) 2022-06-14 2022-06-14 Application integration and access control method and device

Publications (1)

Publication Number Publication Date
CN117270985A true CN117270985A (en) 2023-12-22

Family

ID=89209205

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210664799.9A Pending CN117270985A (en) 2022-06-14 2022-06-14 Application integration and access control method and device

Country Status (1)

Country Link
CN (1) CN117270985A (en)

Similar Documents

Publication Publication Date Title
US10831858B2 (en) Mobile enablement of existing web sites
CN110120917B (en) Routing method and device based on content
US8527862B2 (en) Methods for making ajax web applications bookmarkable and crawlable and devices thereof
US20140281859A1 (en) Enhanced mobilization of existing web sites
CN113010827B (en) Page rendering method and device, electronic equipment and storage medium
CN108416021B (en) Browser webpage content processing method and device, electronic equipment and readable medium
US9426202B2 (en) Transforming application cached template using personalized content
CN111680253A (en) Page application data packet generation method and device, computer equipment and storage medium
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
CN111274512A (en) Page loading method, device and medium
CN113590974B (en) Recommendation page configuration method and device, electronic equipment and computer readable medium
CN113760324A (en) Method and device for constructing micro front-end application
CN110795649A (en) Target page display method, device and system and electronic equipment
CN110598135A (en) Network request processing method and device, computer readable medium and electronic equipment
US20230171329A1 (en) Systems and methods for rendering interactive web pages
CN112612982A (en) Webpage preloading method and device and computer equipment
CN111600920B (en) JS-based data request proxy method, device, equipment and readable storage medium
CN110851211A (en) Method, apparatus, electronic device, and medium for displaying application information
CN113076164A (en) Webpage language management method and device
CN110807162A (en) Method and device for loading occupation bitmap
CN112926002A (en) Service request processing method and device
CN103258055A (en) Device and method for file downloading
CN117270985A (en) Application integration and access control method and device
CN116955861A (en) Page generation method and device and front-end fusion system
CN114186156A (en) Access method, device, medium and equipment for sub-application

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination