CN117369910A - Resource processing method and device based on micro-application architecture and electronic equipment - Google Patents

Resource processing method and device based on micro-application architecture and electronic equipment Download PDF

Info

Publication number
CN117369910A
CN117369910A CN202311332654.XA CN202311332654A CN117369910A CN 117369910 A CN117369910 A CN 117369910A CN 202311332654 A CN202311332654 A CN 202311332654A CN 117369910 A CN117369910 A CN 117369910A
Authority
CN
China
Prior art keywords
application
current sub
resource
mode
resource request
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
CN202311332654.XA
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.)
Rajax Network Technology Co Ltd
Original Assignee
Rajax Network 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 Rajax Network Technology Co Ltd filed Critical Rajax Network Technology Co Ltd
Priority to CN202311332654.XA priority Critical patent/CN117369910A/en
Publication of CN117369910A publication Critical patent/CN117369910A/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/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms
    • 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/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • 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/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a resource processing method and device based on a micro-application architecture, electronic equipment and a storage medium, and relates to the technical field of computer processing. The method constructs a micro-application architecture comprising a main application and at least one sub-application; responsive to a resource request from a user, sending the resource request into a container of the host application; according to the application name of the current sub-application, pulling the corresponding resource content of the current sub-application through an interface of the application list; inquiring whether the resource request is in a first mode or not through the route of the resource request; if yes, registering the current sub-application, and rendering the current sub-application according to the resource content of the current sub-application; if not, rendering the resource page in a second mode. The embodiment is compatible with a scene of adapting to the first mode and the second mode, and obtains the application name of the current sub-application through the route of the resource request, so that each sub-application has the capability of independent deployment and independent gray scale, does not interfere with each other, and improves the capability of resource service.

Description

Resource processing method and device based on micro-application architecture and electronic equipment
Technical Field
The present disclosure relates to the field of computer processing technologies, and in particular, to a resource processing method and apparatus based on a micro-application architecture, an electronic device, and a storage medium.
Background
Currently, a shop merchant platform is a framework based on front and rear end fusion of Java (object-oriented programming language) vm templates (a Java template used for rendering pages), front and rear end pages are not separated, and when a menu is switched, the pages are comprehensively refreshed, so that resource waste is caused, and the technical problem needs to be solved.
Disclosure of Invention
In view of the foregoing, the present application has been developed to provide a method and apparatus for resource processing based on a micro-application architecture, an electronic device, and a storage medium that overcome or at least partially solve the foregoing problems. The technical scheme is as follows:
in a first aspect, a resource processing method based on a micro-application architecture is provided, including:
constructing a micro-application architecture comprising a main application and at least one sub-application; the main application comprises a first mode with separated front and back ends and a second mode with fused front and back ends;
responding to a resource request from a user, sending the resource request to a container of the main application, and obtaining an application name of a current sub-application by the main application through the route of the resource request;
pulling the corresponding resource content of the current sub-application through an interface of an application list according to the application name of the current sub-application;
querying whether the resource request is in the first mode through the route of the resource request;
if the resource request is in the first mode, registering the current sub-application, and rendering the current sub-application according to the resource content of the current sub-application;
and if the resource request is not in the first mode, rendering a resource page in the second mode.
In a possible implementation manner, the route of the resource request includes identification information for representing the application name of the current sub-application; the main application obtains the application name of the current sub-application through the route of the resource request, and the method comprises the following steps:
and the main application obtains the application name of the current sub-application through the identification information used for representing the application name of the current sub-application in the route of the resource request.
In one possible implementation manner, according to the application name of the current sub-application, pulling the corresponding resource content of the current sub-application through an interface of an application list, including:
searching a sub-interface matched with the application name of the current sub-application in the interfaces of the application list according to the application name of the current sub-application;
and pulling the corresponding resource content of the current sub-application through a sub-interface matched with the application name of the current sub-application in the interfaces of the application list.
In one possible implementation, querying whether the resource request is in the first mode through the routing of the resource request includes:
querying whether a field for identifying the first mode is included in the route of the resource request through the route of the resource request;
if the route of the resource request comprises a field for identifying the first mode, determining that the resource request is the first mode;
if a field for identifying the first mode is not included in the route of the resource request, determining that the resource request is not the first mode.
In one possible implementation, registering the current sub-application and rendering the current sub-application according to resource content of the current sub-application includes:
activating the current sub-application, calling a preset rendering method to render, and unloading the sub-application rendered last;
and rendering the current sub-application according to the resource content of the current sub-application by calling a preset loading method.
In one possible implementation manner, the rendering the current sub-application according to the resource content of the current sub-application by calling a preset loading method includes:
and according to the resource content of the current sub-application, rendering the corresponding page element definition style, the page element dynamic processing script and the global variable on the page according to the sequence of the document flow by calling a preset loading method, and executing the corresponding page element dynamic processing script by the preset script method to correspondingly render the page.
In one possible implementation, after registering the current sub-application and rendering the current sub-application according to the resource content of the current sub-application, the method further includes:
and caching the resource content of the current sub-application in a pre-reading folder mode, and acquiring the resource content of the current sub-application from the cache when the current sub-application is rendered next time.
In a second aspect, there is provided a resource processing device based on a micro-application architecture, including:
a building module for building a micro-application architecture comprising a main application and at least one sub-application; the main application comprises a first mode with separated front and back ends and a second mode with fused front and back ends;
the sending module is used for responding to a resource request from a user, sending the resource request to a container of the main application, and the main application obtains the application name of the current sub-application through the route of the resource request;
the pulling module is used for pulling the corresponding resource content of the current sub-application through an interface of the application list according to the application name of the current sub-application;
the searching module is used for searching whether the resource request is in the first mode or not through the route of the resource request;
a first rendering module, configured to register the current sub-application if the resource request is in the first mode, and render the current sub-application according to the resource content of the current sub-application;
and the second rendering module is used for rendering the resource page by adopting the second mode if the resource request is not in the first mode.
In a possible implementation manner, the route of the resource request includes identification information for representing the application name of the current sub-application; the sending module is further configured to:
and the main application obtains the application name of the current sub-application through the identification information used for representing the application name of the current sub-application in the route of the resource request.
In one possible implementation, the pulling module is further configured to:
searching a sub-interface matched with the application name of the current sub-application in the interfaces of the application list according to the application name of the current sub-application;
and pulling the corresponding resource content of the current sub-application through a sub-interface matched with the application name of the current sub-application in the interfaces of the application list.
In one possible implementation, the search module is further configured to:
querying whether a field for identifying the first mode is included in the route of the resource request through the route of the resource request;
if the route of the resource request comprises a field for identifying the first mode, determining that the resource request is the first mode;
if a field for identifying the first mode is not included in the route of the resource request, determining that the resource request is not the first mode.
In one possible implementation, the first rendering module is further configured to:
activating the current sub-application, calling a preset rendering method to render, and unloading the sub-application rendered last;
and rendering the current sub-application according to the resource content of the current sub-application by calling a preset loading method.
In one possible implementation, the first rendering module is further configured to:
and according to the resource content of the current sub-application, rendering the corresponding page element definition style, the page element dynamic processing script and the global variable on the page according to the sequence of the document flow by calling a preset loading method, and executing the corresponding page element dynamic processing script by the preset script method to correspondingly render the page.
In one possible implementation, the apparatus further includes:
the cache module is used for registering the current sub-application in the first rendering module, caching the resource content of the current sub-application in a pre-reading folder mode after the current sub-application is rendered according to the resource content of the current sub-application, and acquiring the resource content of the current sub-application from the cache when the current sub-application is rendered next time.
In a third aspect, an electronic device is provided, comprising a processor and a memory, wherein the memory has stored therein a computer program, the processor being configured to run the computer program to perform the resource processing method based on the micro-application architecture of any of the above.
In a fourth aspect, a storage medium is provided, where the storage medium stores a computer program, where the computer program is configured to perform, when run, the resource processing method based on a micro-application architecture according to any of the above.
By means of the technical scheme, the resource processing method and device based on the micro-application architecture, the electronic equipment and the storage medium are provided, and the method constructs the micro-application architecture comprising a main application and at least one sub-application; the main application comprises a first mode with separated front and back ends and a second mode with fused front and back ends; responding to a resource request from a user, sending the resource request to a container of a main application, and obtaining an application name of a current sub-application by the main application through a route of the resource request; according to the application name of the current sub-application, pulling the corresponding resource content of the current sub-application through an interface of the application list; inquiring whether the resource request is in a first mode or not through the route of the resource request; if the resource request is in the first mode, registering the current sub-application, and rendering the current sub-application according to the resource content of the current sub-application; if the resource request is not in the first mode, rendering the resource page in the second mode. It can be seen that the embodiment of the application provides resource service by constructing a micro-application architecture comprising a main application and at least one sub-application, wherein the main application comprises a first mode with separated front and back ends and a second mode with fused front and back ends, so that scenes adapting to the first mode and the second mode can be compatible; and the application name of the current sub-application is obtained through the route of the resource request, so that each sub-application has the capability of independent deployment and independent gray scale, mutual interference is avoided, and the capability of resource service is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the description of the embodiments of the present application will be briefly described below.
FIG. 1 shows a flowchart of a resource processing method based on a micro-application architecture according to an embodiment of the present application;
FIG. 2 illustrates an architecture diagram of a main application and sub-applications provided by an embodiment of the present application;
FIG. 3 illustrates a block diagram of a resource processing device based on a micro-application architecture according to an embodiment of the present application;
FIG. 4 is a block diagram of a resource processing device based on a micro-application architecture according to another embodiment of the present application;
fig. 5 shows a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that such uses may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or described herein. Furthermore, the terms "include" and variations thereof are to be interpreted as open-ended terms that mean "include, but are not limited to.
In order to solve the above technical problems, an embodiment of the present application provides a resource processing method based on a micro-application architecture, as shown in fig. 1, the resource processing method based on the micro-application architecture may include the following steps S101 to S106:
step S101, constructing a micro-application architecture comprising a main application and at least one sub-application; the main application comprises a first mode with separated front end and back end and a second mode with fused front end and back end.
In this step, the content contained by the host application may include menu switching logic, login logic, providing global variables, and the like. And, the main application communicates with each sub-application, and the part of the main application booklet application is based on the qiankun (universe) bottom layer.
qiankun is a system formed by decomposing a single complex application into a main application and a plurality of sub-applications, loading the sub-applications through the main application, and splitting the sub-applications by different functions according to different dimensions, wherein each sub-application can be independently developed and independently deployed.
Step S102, in response to the resource request from the user, the resource request is sent to a container of the main application, and the main application obtains the application name of the current sub-application through the route of the resource request.
In this step, the resource request may be an HTTP (HyperText Transfer Protocol ) request, and the main application may obtain the application name of the current sub-application through the HTTP request.
Step S103, pulling the corresponding resource content of the current sub-application through the interface of the application list according to the application name of the current sub-application.
Step S104, inquiring whether the resource request is in a first mode or not through the route of the resource request; if the resource request is in the first mode, continuing to execute step S105; if the resource request is not the first mode, the process continues to step S106.
Step S105, registering the current sub-application, and rendering the current sub-application according to the resource content of the current sub-application.
And S106, rendering the resource page in a second mode.
According to the embodiment of the application, the resource service is provided by constructing a micro-application architecture comprising a main application and at least one sub-application, wherein the main application comprises a first mode with separated front and back ends and a second mode with fused front and back ends, so that scenes adapting to the first mode and the second mode can be compatible; and the application name of the current sub-application is obtained through the route of the resource request, so that each sub-application has the capability of independent deployment and independent gray scale, mutual interference is avoided, and the capability of resource service is improved.
In the embodiment of the application, a possible implementation manner is provided, and the route of the resource request includes identification information for representing the application name of the current sub-application; the step S102 of obtaining the application name of the current sub-application by the main application through the route of the resource request may specifically include the following step A1:
and A1, the main application obtains the application name of the current sub-application through the identification information used for representing the application name of the current sub-application in the route of the resource request.
The main application of the embodiment obtains the application name of the current sub-application through the identification information used for representing the application name of the current sub-application in the routing of the resource request, and the method is accurate and efficient.
In the embodiment of the present application, a possible implementation manner is provided, and step S103 above pulls, according to an application name of a current sub-application, a resource content of the corresponding current sub-application through an interface of an application list, and may specifically include the following steps B1 and B2:
step B1, searching a sub-interface matched with the application name of the current sub-application in the interfaces of the application list according to the application name of the current sub-application;
and step B2, pulling the corresponding resource content of the current sub-application through the sub-interface matched with the application name of the current sub-application in the interfaces of the application list.
According to the method and the device, the static resources of the sub-applications are acquired through the interfaces of the application list, HTTP request acquisition can be performed at the server side, and the problem of mutual isolation among different domains is solved.
In the embodiment of the present application, a possible implementation manner is provided, where step S104 includes the following steps C1 to C3 by routing a resource request to query whether the resource request is in the first mode:
step C1, inquiring whether the route of the resource request comprises a field for identifying the first mode or not through the route of the resource request.
Step C2, if the route of the resource request includes a field for identifying the first mode, determining that the resource request is the first mode.
And step C3, if the route of the resource request does not comprise a field for identifying the first mode, determining that the resource request is not the first mode.
In the above embodiment, a field for identifying the first mode, for example, a micro field, if the micro field is included in the route of the resource request, it is determined that the resource request is the first mode; if the micro field is not included in the routing of the resource request, it is determined that the resource request is not in the first mode. The examples are illustrative only and are not intended to limit the present embodiments.
The embodiment can directly determine whether the resource request is in the first mode by inquiring whether the route of the resource request comprises a field for identifying the first mode, and then subsequently adopt different models for page rendering.
In the embodiment of the present application, a possible implementation manner is provided, where step S105 above registers the current sub-application, and renders the current sub-application according to the resource content of the current sub-application, which may specifically include the following steps D1 and D2:
and D1, activating the current sub-application, calling a preset rendering method to render, and unloading the sub-application rendered last.
In this step, the preset rendering method may be a mount (rendering) method, etc., which is not limited in this embodiment.
And D2, rendering the current sub-application according to the resource content of the current sub-application by calling a preset loading method.
In this step, the preset loading method may be a load (loading) method or the like, which is not limited in this embodiment.
The embodiment can activate the current sub-application, call the preset rendering method to render, unload the last rendered sub-application, and render the current sub-application according to the resource content of the current sub-application by calling the preset loading method, thereby being accurate and efficient.
In the embodiment of the present application, a possible implementation manner is provided, and step D2 renders the current sub-application according to the resource content of the current sub-application by calling a preset loading method, which specifically may include the following step D21:
and D21, rendering the corresponding page element definition style, the page element dynamic processing script and the global variable on the page according to the sequence of the document flow by calling a preset loading method and correspondingly rendering the page by executing the corresponding page element dynamic processing script by the preset script method.
In this step, the page element definition style, css, is used to make static modification to the web page, so that the web page can be displayed in a certain layout mode, it is a markup language for separating the style information from the web page content, and css is used to define style for each element, and it is mainly used to beautify the HTML page.
The dynamic processing script of page element, js, processes various dynamic effects of page, and can be used for realizing the functions of web page and human interaction, such as picture replacement, picture scrolling, layer display and hiding, shortcut key processing, etc.
The preset script method such as eval (script) method or the like is not limited thereto.
The embodiment can accurately and efficiently render the current sub-application according to the resource content of the current sub-application by calling the preset loading method.
In the embodiment of the present application, a possible implementation manner is provided, after registering the current sub-application in step S105 and rendering the current sub-application according to the resource content of the current sub-application, the method may further include the following step E1:
and E1, caching the resource content of the current sub-application in a pre-reading folder mode, and acquiring the resource content of the current sub-application from the cache when the current sub-application is rendered next time.
In the step, the resource content of the current sub-application can be cached in a mode of pre-reading the folder, such as a prefetch mode, and when the current sub-application is rendered next time, the resource content of the current sub-application is obtained from the cache, so that the rendering efficiency is improved.
In the step S106, the resource page is rendered by adopting the second mode, namely, css and js can be directly mounted by adopting the second mode, so that the requirements of different scenes are met.
Having described various implementations of the various links of the embodiment shown in fig. 1, a resource processing method based on a micro-application architecture according to an embodiment of the present application will be further described below through a specific embodiment.
In specific embodiments, the following technical terms are first introduced.
Micro-application: a front-end architecture mode realizes that each domain is independently deployed and online, js and css are isolated from each other.
spa: the single page mode, which is a model of a web application, can dynamically rewrite a current page to interact with a user without reloading the entire page. Compared with the traditional Web (webpage) application, the single-page application has the advantages that front and back ends are separated, the back end is responsible for processing data to provide an interface, and page logic and page rendering are given to the front end.
mpa: the multi-page mode is composed of a plurality of complete pages, and the jump between pages is from one page to another.
vm template: a Java (object oriented programming language) template is used to render pages.
The embodiment is a general architecture upgrading scheme for improving middle and background performance experience, can be applied to a background scene in a business, is used by a plurality of applications, particularly when the whole architecture of a business platform is upgraded, the architecture of front and rear end fusion of the mpa mode based on a Java vm template is upgraded into a micro-application architecture with separated front and rear ends, so that migration cost is minimized, the problem of full brushing of pages and the problem of most of experience performance are solved, and all projects are independently deployed and online and are not affected.
The embodiment is based on the bottom layers of qiankun and single-spa, wherein single-spa is a combination of a sub-application loader and a state machine, and particularly how to load the sub-application or the base application; the state of each sub-application is maintained within the framework and is responsible for changing the state of the sub-application and executing the corresponding lifecycle function when appropriate.
Fig. 2 is a schematic architecture diagram of a main application and a sub-application, and in fig. 2, the main application may include general functions such as global monitoring and burial point, base (based on qiankun), gray scale policy, act (for building a predictable and declarative web user interface) resource, route switching, communication, general vm template, login authentication, menu switching, global variable, and the like.
The sub-applications may include sub-application merchandise, sub-application store, sub-application marketing, etc., each of which sends its own information to a WAP (Wireless Application Protocol ) platform, which pushes version number information to the host application.
The main application can acquire the static resource version of the sub-application through an applist (application list) interface.
In addition, umd mode (general module definition mode), consumption global variable, kobe scaffold, js and css, monitoring report, route management and the like can be included. The kobe scaffold here may in particular comprise the following steps 1) to 5):
step 1) integration of plug-in form into solution;
step 2) using a history mode for routing, wherein a container is a compact-content;
step 3) newly adding public-path js file for modifying public path in operation;
step 4) modifying and deriving three generated periodic functions bootstrap, unmount, mount;
step 5) weback packaging, allowing the development environment to cross-domain and umd packaging.
bootstrap is called when an application is just loaded, and can be called only once, so that definition of some global variables, dependent loading and the like can be performed in the life cycle.
The mount is called when the application is started, and can perform operations such as page rendering, event adding and the like, and can also acquire data provided by other applications, initialization state and the like.
An unmount, which is invoked when the application is uninstalled, may do some cleaning work here, such as cancelling event listening, clearing timers, etc.
The specific solution flow diagram is described below in connection with fig. 2:
1. the whole micro-application architecture is divided into a main application and a sub-application, wherein the main application is positioned in the original back-end Java template. Wherein the content contained by the host application includes menu switching logic, login logic, global variable provision, and the like. While communicating with the sub-application, the main application annotates part of the booklet application based on the qiankun floor.
2. The sub-applications are various different domains, such as a commodity domain, a marketing domain, a counseling domain, and the like. In particular based on kobe scaffold reconstruction.
3. The host application is compatible with the traditional vm mode and the micro application mode at the same time, and is distinguished by routing. When micro scenarios are covered in the route, a micro application mode is used.
4. When a user initiates a request, the user first walks into a main application container, and the main application obtains the application name of the current sub-application through the route of the request.
5. The content of the sub-application is pulled through the applist list interface while querying whether the micro-application mode is available.
6. If yes, the micro-application mode is adopted. The sub-application is registered and started at the same time.
7. If not, js and css are directly mounted in a traditional mode.
The following technical effects can be obtained in this embodiment:
(1) Two scenes of the micro application and the common application are required to be compatible and adapted, and the route is designed to be distinguished, and two different scenes are compatible.
(2) The version number of the sub-application and the environment of the application are acquired through the three-way interface, so that each application has the capability of independent deployment and independent gray scale, and the sub-application and the application are not interfered with each other.
(3) Static resources of the sub-applications are acquired through an apple list interface, HTTP request acquisition is carried out at a server side, and the problem of mutual isolation among different domains is solved.
(4) By means of a prefetch mode, static resources such as a reaction resource are cached, some vendor (third party) files are cached, and the loading speed of the browser is increased.
(5) The original items with the front end and the back end not separated are upgraded through the spa architecture, the problem of full page brushing is solved, each item domain loads the same main application, and when the route is switched, only different sub application lists need to be registered.
Based on the resource processing method based on the micro-application architecture provided by the above embodiments, based on the same inventive concept, the embodiments of the present application further provide a resource processing device based on the micro-application architecture.
Fig. 3 is a block diagram of a resource processing device based on a micro-application architecture according to an embodiment of the present application. As shown in fig. 3, the resource processing device based on the micro-application architecture may specifically include a building module 310, a sending module 320, a pulling module 330, a searching module 340, a first rendering module 350, and a second rendering module 360.
A building module 310 for building a micro-application architecture comprising a main application and at least one sub-application; the main application comprises a first mode with separated front and back ends and a second mode with fused front and back ends;
a sending module 320, configured to send a resource request to a container of the main application in response to the resource request from a user, where the main application obtains an application name of a current sub-application through a route of the resource request;
a pulling module 330, configured to pull, according to the application name of the current sub-application, the corresponding resource content of the current sub-application through an interface of an application list;
a lookup module 340, configured to query, through the route of the resource request, whether the resource request is in the first mode;
a first rendering module 350, configured to register the current sub-application and render the current sub-application according to the resource content of the current sub-application if the resource request is in the first mode;
a second rendering module 360, configured to render a resource page in the second mode if the resource request is not in the first mode.
The embodiment of the application provides a possible implementation manner, wherein the route of the resource request comprises identification information for representing the application name of the current sub-application; the sending module 320 is further configured to:
and the main application obtains the application name of the current sub-application through the identification information used for representing the application name of the current sub-application in the route of the resource request.
One possible implementation manner is provided in the embodiment of the present application, and the pulling module 330 is further configured to:
searching a sub-interface matched with the application name of the current sub-application in the interfaces of the application list according to the application name of the current sub-application;
and pulling the corresponding resource content of the current sub-application through a sub-interface matched with the application name of the current sub-application in the interfaces of the application list.
One possible implementation manner is provided in the embodiment of the present application, and the searching module 340 is further configured to:
querying whether a field for identifying the first mode is included in the route of the resource request through the route of the resource request;
if the route of the resource request comprises a field for identifying the first mode, determining that the resource request is the first mode;
if a field for identifying the first mode is not included in the route of the resource request, determining that the resource request is not the first mode.
One possible implementation manner is provided in the embodiment of the present application, and the first rendering module 350 is further configured to:
activating the current sub-application, calling a preset rendering method to render, and unloading the sub-application rendered last;
and rendering the current sub-application according to the resource content of the current sub-application by calling a preset loading method.
One possible implementation manner is provided in the embodiment of the present application, and the first rendering module 350 is further configured to:
and according to the resource content of the current sub-application, rendering the corresponding page element definition style, the page element dynamic processing script and the global variable on the page according to the sequence of the document flow by calling a preset loading method, and executing the corresponding page element dynamic processing script by the preset script method to correspondingly render the page.
In this embodiment, as shown in fig. 4, the apparatus shown in fig. 3 may further include a buffer module 410, configured to register the current sub-application in the first rendering module 350, and after rendering the current sub-application according to the resource content of the current sub-application, buffer the resource content of the current sub-application by pre-reading a folder, and obtain the resource content of the current sub-application from the buffer when the current sub-application is rendered next time.
Based on the same inventive concept, the embodiments of the present application further provide an electronic device, including a processor and a memory, where the memory stores a computer program, and the processor is configured to run the computer program to execute the resource processing method based on the micro-application architecture of any one of the embodiments.
In an exemplary embodiment, there is provided an electronic device, as shown in fig. 5, the electronic device 500 shown in fig. 5 includes: a processor 501 and a memory 503. The processor 501 is coupled to a memory 503, such as via a bus 502. Optionally, the electronic device 500 may also include a transceiver 504. It should be noted that, in practical applications, the transceiver 504 is not limited to one, and the structure of the electronic device 500 is not limited to the embodiment of the present application.
The processor 501 may be a CPU (Central Processing Unit, central processor), general purpose processor, DSP (Digital Signal Processor, data signal processor), ASIC (Application Specific Integrated Circuit ), FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic device, transistor logic device, hardware components, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules, and circuits described in connection with this disclosure. The processor 501 may also be a combination that implements computing functionality, such as a combination comprising one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
Bus 502 may include a path to transfer information between the components. Bus 502 may be a PCI (Peripheral Component Interconnect, peripheral component interconnect Standard) bus or an EISA (Extended Industry Standard Architecture ) bus, or the like. The bus 502 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 5, but not only one bus or one type of bus.
The Memory 503 may be, but is not limited to, ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, RAM (Random Access Memory ) or other type of dynamic storage device that can store information and instructions, EEPROM (Electrically Erasable Programmable Read Only Memory ), CD-ROM (Compact Disc Read Only Memory, compact disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
The memory 503 is used to store computer program code for executing the aspects of the present application and is controlled to be executed by the processor 501. The processor 501 is arranged to execute computer program code stored in the memory 503 for implementing what is shown in the foregoing method embodiments.
Among them, electronic devices include, but are not limited to: mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 5 is only an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present application.
Based on the same inventive concept, the embodiments of the present application further provide a storage medium having a computer program stored therein, wherein the computer program is configured to execute the resource processing method based on the micro-application architecture of any one of the embodiments described above when running.
It will be clear to those skilled in the art that the specific working processes of the above-described systems, devices and modules may refer to the corresponding processes in the foregoing method embodiments, and are not described herein for brevity.
Those of ordinary skill in the art will appreciate that: the technical solution of the present application may be embodied in essence or in whole or in part in a software product stored in a storage medium, which includes program instructions for causing an electronic device (e.g., a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application when the program instructions are executed. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a read-only memory (ROM), a random-access memory (RAM), a magnetic disk, or an optical disk, etc.
Alternatively, all or part of the steps of implementing the foregoing method embodiments may be implemented by hardware (such as a personal computer, a server, or an electronic device such as a network device) associated with program instructions, where the program instructions may be stored in a computer-readable storage medium, and where the program instructions, when executed by a processor of the electronic device, perform all or part of the steps of the methods described in the embodiments of the present application.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may be modified or some or all technical features may be replaced equally within the spirit and principles of the present application; such modifications and substitutions do not depart from the scope of the present application.

Claims (10)

1. A resource processing method based on a micro-application architecture, comprising:
constructing a micro-application architecture comprising a main application and at least one sub-application; the main application comprises a first mode with separated front and back ends and a second mode with fused front and back ends;
responding to a resource request from a user, sending the resource request to a container of the main application, and obtaining an application name of a current sub-application by the main application through the route of the resource request;
pulling the corresponding resource content of the current sub-application through an interface of an application list according to the application name of the current sub-application;
querying whether the resource request is in the first mode through the route of the resource request;
if the resource request is in the first mode, registering the current sub-application, and rendering the current sub-application according to the resource content of the current sub-application;
and if the resource request is not in the first mode, rendering a resource page in the second mode.
2. The method according to claim 1, wherein the route of the resource request includes identification information for representing the application name of the current sub-application; the main application obtains the application name of the current sub-application through the route of the resource request, and the method comprises the following steps:
and the main application obtains the application name of the current sub-application through the identification information used for representing the application name of the current sub-application in the route of the resource request.
3. The method according to claim 1 or 2, wherein pulling the corresponding resource content of the current sub-application through the interface of the application list according to the application name of the current sub-application comprises:
searching a sub-interface matched with the application name of the current sub-application in the interfaces of the application list according to the application name of the current sub-application;
and pulling the corresponding resource content of the current sub-application through a sub-interface matched with the application name of the current sub-application in the interfaces of the application list.
4. A method according to any one of claims 1 to 3, wherein querying whether the resource request is in the first mode by routing the resource request comprises:
querying whether a field for identifying the first mode is included in the route of the resource request through the route of the resource request;
if the route of the resource request comprises a field for identifying the first mode, determining that the resource request is the first mode;
if a field for identifying the first mode is not included in the route of the resource request, determining that the resource request is not the first mode.
5. The method of any of claims 1 to 4, wherein registering the current sub-application and rendering the current sub-application from resource content of the current sub-application comprises:
activating the current sub-application, calling a preset rendering method to render, and unloading the sub-application rendered last;
and rendering the current sub-application according to the resource content of the current sub-application by calling a preset loading method.
6. The method of claim 5, wherein rendering the current sub-application from the resource content of the current sub-application by invoking a preset loading method comprises:
and according to the resource content of the current sub-application, rendering the corresponding page element definition style, the page element dynamic processing script and the global variable on the page according to the sequence of the document flow by calling a preset loading method, and executing the corresponding page element dynamic processing script by the preset script method to correspondingly render the page.
7. The method according to any one of claims 1 to 6, wherein after registering the current sub-application and rendering the current sub-application from the resource content of the current sub-application, the method further comprises:
and caching the resource content of the current sub-application in a pre-reading folder mode, and acquiring the resource content of the current sub-application from the cache when the current sub-application is rendered next time.
8. A resource processing device based on a micro-application architecture, comprising:
a building module for building a micro-application architecture comprising a main application and at least one sub-application; the main application comprises a first mode with separated front and back ends and a second mode with fused front and back ends;
the sending module is used for responding to a resource request from a user, sending the resource request to a container of the main application, and the main application obtains the application name of the current sub-application through the route of the resource request;
the pulling module is used for pulling the corresponding resource content of the current sub-application through an interface of the application list according to the application name of the current sub-application;
the searching module is used for searching whether the resource request is in the first mode or not through the route of the resource request;
a first rendering module, configured to register the current sub-application if the resource request is in the first mode, and render the current sub-application according to the resource content of the current sub-application;
and the second rendering module is used for rendering the resource page by adopting the second mode if the resource request is not in the first mode.
9. An electronic device comprising a processor and a memory, wherein the memory has stored therein a computer program, the processor being configured to run the computer program to perform the micro-application architecture based resource handling method of any one of claims 1 to 7.
10. A storage medium having a computer program stored therein, wherein the computer program is configured to perform the micro-application architecture based resource handling method of any one of claims 1 to 7 at run-time.
CN202311332654.XA 2023-10-13 2023-10-13 Resource processing method and device based on micro-application architecture and electronic equipment Pending CN117369910A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311332654.XA CN117369910A (en) 2023-10-13 2023-10-13 Resource processing method and device based on micro-application architecture and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311332654.XA CN117369910A (en) 2023-10-13 2023-10-13 Resource processing method and device based on micro-application architecture and electronic equipment

Publications (1)

Publication Number Publication Date
CN117369910A true CN117369910A (en) 2024-01-09

Family

ID=89403596

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311332654.XA Pending CN117369910A (en) 2023-10-13 2023-10-13 Resource processing method and device based on micro-application architecture and electronic equipment

Country Status (1)

Country Link
CN (1) CN117369910A (en)

Similar Documents

Publication Publication Date Title
CN109325195B (en) Rendering method and system for browser, computer device and computer storage medium
CN109542427B (en) System customization method and device, electronic equipment and storage medium
CN109408136B (en) Information processing method, information processing apparatus, storage medium, and electronic device
CN108228305A (en) Display methods, device, storage medium and the electronic equipment of five application page
CN106569856B (en) A kind of loading method and device of application view resource file
CN104866383A (en) Interface calling method and device and terminal
US20120071155A1 (en) Method and Apparatus for Binding Mobile Device Functionality to an Application Definition
WO2019157860A1 (en) Method and device for launching application interface, storage medium, and electronic apparatus
JP6182160B2 (en) Dynamic code insertion into a running process
WO2019019380A1 (en) Hybrid app page navigation method and apparatus, terminal and storage medium
US20140208326A1 (en) File presenting method and apparatus for a smart terminal
CN103443763B (en) Comprise to connect the ISA Bridge of the support called rewriteeing virtual function
CN111581555B (en) Document loading method, device, equipment and storage medium
CN102135895B (en) System upgrading method and system
CN110968331A (en) Method and device for running application program
CN109800370A (en) Display methods, device, computer equipment and the storage medium of Webpage
WO2021057411A1 (en) Component loading method, device, and system
US10839037B2 (en) Connected application experience
CN112764729B (en) Application software development method, device, computer equipment and readable storage medium
CN117369910A (en) Resource processing method and device based on micro-application architecture and electronic equipment
CN102184112B (en) Method and device for upgrading widget
EP3759603B1 (en) In-line event handlers across domains
CN101911003B (en) Information processing apparatus and program
CN112035095A (en) Application processing method, application processing apparatus, computer device, and medium
US20230110520A1 (en) Ui service package generation and registration method and apparatus, and ui service loading method and apparatus

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