Micro-application dynamic update method, device, computer equipment and storage medium
Dynamic update of micro-application resources by detecting loading events and obtaining micro-application index addresses, solving the problem of low update efficiency in traditional technologies, and achieving efficient updates of some modules and module sharing between different technology stacks.
Patent Information
- Application Number
- CN202210535059.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-17
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-05-17
AI Technical Summary
In traditional technology, the update efficiency of terminal applications is inefficient because the entire application needs to be updated even if some modules change.
By detecting the loading event of the target application, determine the file type and version information of the micro-application to be loaded, obtain the micro-application index address, obtain the updated version of the micro-application resources from the application platform, and load it into the target application.
It realizes the dynamic loading of updated versions of micro-application resources during the operation of the target application, improves update efficiency, and supports module sharing and parallel development between applications of different technology stacks.
Smart Images

Figure CN115113898B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device, storage medium and computer program product for dynamically updating a micro-application. Background Art
[0002] With the development of computer technology, terminal applications are widely used. In order to fix security vulnerabilities in terminal applications or to add new functions to terminal applications to enhance the interactive experience of terminal applications, terminal applications need to be updated frequently. In traditional technology, when a new version of an executable program for a terminal application is released, the terminal application is updated as a whole according to the newly released executable program. However, when a module in a terminal application is repaired or a new function is added, a new version of the update file needs to be released for the entire terminal application, that is, the update of some modules needs to be realized by updating the entire terminal application, resulting in low update efficiency. Summary of the invention
[0003] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product for dynamically updating micro-applications that can improve update efficiency in response to the above technical problems.
[0004] In a first aspect, the present application provides a method for dynamically updating a micro-application. The method comprises:
[0005] During the running of the target application, detecting a loading event of the target application;
[0006] Determine the file type and version information of the micro-application to be loaded according to the loading event;
[0007] Obtain a micro-application index address based on the version information and the file type;
[0008] According to the micro-application index address, obtain the micro-application resource corresponding to the version information from the application platform; the micro-application resource includes an application file corresponding to the micro-application that is published to the application platform and is an updated version;
[0009] Load the micro-application resource into the target application.
[0010] In a second aspect, the present application also provides a device for dynamically updating a micro-application. The device comprises:
[0011] A detection module, used for detecting a loading event of the target application during the running of the target application;
[0012] A determination module, used to determine the file type and version information of the micro-application to be loaded according to the loading event;
[0013] An acquisition module, used to obtain a micro-application index address based on the version information and the file type;
[0014] An acquisition module, configured to acquire a micro-application resource corresponding to the version information from an application platform according to the micro-application index address; the micro-application resource includes an application file corresponding to the micro-application that is published to the application platform and is an updated version;
[0015] A loading module is used to load the micro-application resources into the target application.
[0016] In one embodiment, the determining module is further used to:
[0017] Acquire a micro-application scenario identifier based on the loading event;
[0018] Reading micro-application configuration information from a configuration platform according to the micro-application scenario identifier;
[0019] If it is determined to load the micro-application according to the micro-application configuration information, the file type and version information of the micro-application are determined.
[0020] In one embodiment, the determining module is further used to:
[0021] Extracting a grayscale object identification set of the micro-application from the micro-application configuration information;
[0022] Obtaining a target object identifier registered in the target application;
[0023] If the grayscale object identifier set includes the target object identifier, it is determined to load the micro-application.
[0024] In one embodiment, the apparatus further comprises:
[0025] The acquisition module is further configured to acquire a target component of the target application program that is consistent with the function of the micro-application if it is determined not to load the micro-application according to the micro-application configuration information;
[0026] The loading module is also used to load a target component consistent with the function of the micro-application into the target application.
[0027] In one embodiment, the determining module is further used to:
[0028] Determine the file type of the micro-application, and determine the version information of the micro-application in the micro-application configuration information;
[0029] The acquisition module is further used for:
[0030] Determining an application identifier of the micro-application in the micro-application configuration information;
[0031] A micro-application index address is generated based on the version information, the file type, and the application identifier.
[0032] In one embodiment, the target application is an application on a different terminal, including a native application, a mini-program, or a public account application; the device further includes:
[0033] The acquisition module is further used to acquire the environment variables corresponding to the micro-application running the updated version in the target application; and acquire the toolkits corresponding to different end applications according to the environment variables;
[0034] A first calling module, used for calling a business program defined in a general base class based on the toolkit;
[0035] The execution module is used to execute the application business by running the called business program.
[0036] In one embodiment, the apparatus further comprises:
[0037] The acquisition module is further used to acquire the environment variables corresponding to the micro-application running the updated version in the target application, and the operation log generated by the micro-application of the updated version when running;
[0038] The reporting module is used to trigger a corresponding log reporting event according to the environment variable, so as to report the operation log to the log space corresponding to the environment variable through the log reporting event.
[0039] In one embodiment, the updated version of the micro-application includes at least one component; the apparatus further includes:
[0040] A second calling module, configured to call a shared interactive program according to the interactive instruction when the component receives the interactive instruction;
[0041] A processing module, used for processing the interaction instruction through the shared interaction program to obtain a processing result;
[0042] A display module is used to display the interactive interface corresponding to the component based on the processing result.
[0043] In one embodiment, the loading module is further used to:
[0044] Access the micro-application resources to the target application through a micro-frontend framework;
[0045] The micro-application resources are parsed to achieve integration between the updated version of the micro-application and the target application.
[0046] In one embodiment, the loading module is further used to:
[0047] Parsing the micro-application resources to obtain parsed data;
[0048] Rendering the parsed data to obtain a micro-application page;
[0049] The micro-application page is displayed through the target application to achieve integration between the updated version of the micro-application and the target application.
[0050] In one embodiment, the apparatus further comprises:
[0051] The detection module is further used to detect a page closing event of the micro-application page;
[0052] A removal module is used to remove the micro-application resource from the target application in response to the page closing event.
[0053] In one embodiment, the apparatus further comprises:
[0054] The detection module is further used to detect a communication request initiated by an external application to act on an updated version of the micro-application; the updated version of the micro-application and the external application are isolated from each other;
[0055] An establishing module, used to establish an application communication channel between the external application and the updated version of the micro-application;
[0056] A transmission module is used to transmit the interaction data between the external application and the updated version of the micro-application based on the application communication channel.
[0057] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0058] During the running of the target application, detecting a loading event of the target application;
[0059] Determine the file type and version information of the micro-application to be loaded according to the loading event;
[0060] Obtain a micro-application index address based on the version information and the file type;
[0061] According to the micro-application index address, obtain the micro-application resource corresponding to the version information from the application platform; the micro-application resource includes an application file corresponding to the micro-application that is published to the application platform and is an updated version;
[0062] Load the micro-application resource into the target application.
[0063] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0064] During the running of the target application, detecting a loading event of the target application;
[0065] Determine the file type and version information of the micro-application to be loaded according to the loading event;
[0066] Obtain a micro-application index address based on the version information and the file type;
[0067] According to the micro-application index address, obtain the micro-application resource corresponding to the version information from the application platform; the micro-application resource includes an application file corresponding to the micro-application that is published to the application platform and is an updated version;
[0068] Load the micro-application resource into the target application.
[0069] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0070] During the running of the target application, detecting a loading event of the target application;
[0071] Determine the file type and version information of the micro-application to be loaded according to the loading event;
[0072] Obtain a micro-application index address based on the version information and the file type;
[0073] According to the micro-application index address, obtain the micro-application resource corresponding to the version information from the application platform; the micro-application resource includes an application file corresponding to the micro-application that is published to the application platform and is an updated version;
[0074] Load the micro-application resource into the target application.
[0075] The above-mentioned dynamic update method, device, computer equipment, storage medium and computer program product of micro-application detect the loading event of the target application during the operation of the target application, and determine the file type and version information of the micro-application to be loaded according to the loading event. Thus, the micro-application index address can be obtained based on the version information and the file type, and the micro-application resource corresponding to the version information and the updated version can be obtained from the application platform according to the micro-application index address, and then the micro-application resource is loaded to the target application to realize the fusion of the micro-application and the target application. Therefore, the terminal can dynamically load the updated version of the micro-application to the target application during the operation of the target application, and merge the target application with the micro-application. It is not necessary to release an updated version of the target application and update the target application as a whole, and the update of some modules in the target application can be realized, thereby improving the update efficiency. Further, since the target application can share the micro-application with other applications during the operation period, the micro-application can be reused between different technology stack applications, so that there is no need to develop a set of micro-applications for each application, and module sharing between different applications is realized. In addition, since the target application can be deconstructed into multiple independent micro-applications, the coupling degree between multiple independent micro-applications is low, and development can be carried out in parallel, thereby improving development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] Figure 1 An application environment diagram of a dynamic update method of a micro-application in one embodiment;
[0077] Figure 2 A schematic diagram of a process flow of a method for dynamically updating a micro-application in one embodiment;
[0078] Figure 3a A schematic diagram of a micro application in a native application in one embodiment;
[0079] Figure 3b A schematic diagram of a micro-application in a mini-program in one embodiment;
[0080] Figure 3c A schematic diagram of a micro-application in a social application version of a mini-program in one embodiment;
[0081] Figure 4 A schematic diagram of different technology stack applications sharing micro-applications in one embodiment;
[0082] Figure 5 A schematic diagram of online synthesis of a target application by multiple micro-applications in one embodiment;
[0083] Figure 6 A schematic diagram of publishing a micro application in one embodiment;
[0084] Figure 7A schematic diagram of a flow chart of a method for generating a micro-application index address in one embodiment;
[0085] Figure 8 A schematic diagram of a process for reporting an operation log in an embodiment;
[0086] Fig. 9 A schematic diagram of components in a micro-application in one embodiment;
[0087] Fig.10 A flowchart of a method for integrating a micro-application with a target application program in one embodiment;
[0088] Fig.11 A schematic diagram of a micro-application operating environment in one embodiment;
[0089] Fig.12 A schematic diagram of the principle of a dynamic update method of a micro-application in one embodiment;
[0090] Fig.13 A schematic flow chart of a method for dynamically updating a micro-application in another embodiment;
[0091] Fig.14 is a structural block diagram of a dynamic update device for a micro-application in one embodiment;
[0092] Fig.15 It is a structural block diagram of a dynamic update device of a micro-application in another embodiment;
[0093] Fig.16 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0094] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0095] The dynamic update method of the micro-application provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the application platform 104 through the network. In the process of running the target application, the terminal 102 detects the loading event of the target application, and determines the file type and version information of the micro-application to be loaded according to the loading event. The micro-application index address is obtained based on the version information and the file type, and the micro-application resources corresponding to the version information are obtained from the application platform 104 according to the micro-application index address. The micro-application resources include application files corresponding to the micro-applications published to the application platform and updated versions. Load the micro-application resources to the target application. Among them, the terminal 102 can be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The application platform 104 can be an independent physical server or a server cluster composed of multiple service nodes in the blockchain system. Each service node forms a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP). In addition, the application platform 104 can also be a server cluster composed of multiple physical servers, which can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0096] In one embodiment, Figure 2 As shown, a dynamic update method for a micro application is provided, and the method is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0097] S202: Detect a loading event of the target application during the running of the target application.
[0098] The target application is an application that can realize various functions, which can be a front-end application, including communication application, social application, entertainment application, office application or resource exchange application, etc. The target application can be a complete application based on various technology stacks, for example, a native application deployed in various operating systems such as Android or IOS (Iphone Operation System), a small program that can be used without downloading and installing, or a public account application based on the HTML5 (HyperText Mark-up Language 5) framework, etc.
[0099] A loading event is an event used to load an application module in a target application. The loaded application module may be a micro-application, a component, or other forms of executable code blocks. For example, a loading event may be an event that loads a fund bar micro-application in a social application; for another example, a loading event may be an event that loads a comment area micro-application in a mini-program. A loading event may be an event triggered in a page of a target application. For example, a loading event may be an event triggered by clicking a control in a page of a target application. For example, Figure 3a As shown, the loading event may be a loading event triggered by clicking a "Fund" control in the target application page, and in response to the loading event, the Fund Bar micro application is loaded.
[0100] In one embodiment, the loading event is an event triggered by a page switching operation; S202 specifically includes: in the process of running the target application, detecting a page switching operation triggered by a control in the target application. Among them, the page switching operation is an operation that instructs the target application to switch to the micro-application page. When a page switching operation to switch to the micro-application page is detected, it is determined that a loading event is detected, and the micro-application is loaded according to the loading event. Therefore, when the terminal runs the target application, it does not need to fully load the micro-applications contained in the target application, but only needs to load the corresponding micro-application resources when switching to a certain micro-application page, so that on-demand loading can be achieved, which improves loading efficiency.
[0101] S204: Determine the file type and version information of the micro-application to be loaded according to the loading event.
[0102] Micro-applications are independent applications based on the micro-frontend framework, which can be independently developed and deployed, and can be reused by target applications with different technology stacks. Figure 3a As shown in FIG. 1 , the micro application may be a fund bar micro application in a stock selection application; for example, Figure 3b As shown, the micro application can be the stock selection bar micro application in the self-selected stock applet; for example, Figure 3cAs shown, the micro-application can be a discussion area micro-application for the social application version of stock selection. The micro-frontend is a Web (World Wide Web) front-end application composed of multiple independent micro-applications, which supports independent development and deployment of each micro-application. The life cycle of a micro-application includes loading micro-application resources when opening the micro-application page, parsing the micro-application resources, rendering the page, and removing the micro-application resources when closing the micro-application page. The terminal can manage the micro-application life cycle through the micro-frontend framework and provide each micro-application with an independent operating environment isolated from external applications.
[0103] The file type is the entry file type of the micro-application, which may be an HTML type or a JS (JavaScript) type. The version information is information about the updated version of the micro-application to be loaded, which may be a version identifier or version number of the micro-application to be loaded. For example, the version information is "Fund Bar V2.0".
[0104] In one embodiment, a micro-application implemented based on a set of source code can be shared by multiple target applications with different technology stacks, and has similar product expressions in different target applications. Figure 4 As shown, micro application 1 and micro application 2 are independently developed and deployed micro applications. Micro application 1 and micro application 2 can be integrated into the native application in the operating system online, or integrated into the official account application online, or can also be integrated into the mini program online. The native application, official account application and mini program in the operating system can share micro application 1 or micro application 2.
[0105] In one embodiment, there may be multiple micro-applications to be loaded in the target application, and each micro-application to be loaded implements part of the functions of the target application. Figure 5 As shown, micro-applications 1 to 4 are all independently developed and deployed micro-applications, and a complete target application can be synthesized online through micro-applications 1 to 4. The target application provides a running environment for the micro-applications through the micro-frontend framework, so that each micro-application is isolated from each other.
[0106] In one embodiment, S204 specifically includes: in response to the loading event, reading the micro-application configuration information from the configuration platform; and extracting the file type and version information of the micro-application from the micro-application configuration information.
[0107] S206, obtaining a micro-application index address based on the version information and the file type.
[0108] The micro-application index address is a network address of a micro-application resource, which may be a network address determined based on a network protocol, and the network protocol may be an HTTP (Hyper Text Transfer Protocol) protocol or an HTTPS (Hyper Text Transfer Protocol over Secure Socket Layer) protocol. For example, the micro-application index address may be https: / / wzq... / micro-app / v0.6.9 / index.html.
[0109] In one embodiment, S206 specifically includes: assembling the version information and the file type according to the network address format to obtain the micro-application index address. The network address format may be an address format determined according to a network protocol.
[0110] S208, obtaining micro-application resources corresponding to the version information from the application platform according to the micro-application index address; the micro-application resources include application files corresponding to the updated version of the micro-application that is published to the application platform.
[0111] Among them, the application platform is a platform for publishing micro-application resources, which can be a CDN (Content Delivery Network) platform. The CDN platform is an intelligent virtual network built on the basis of the existing network. It relies on edge servers deployed in various places, load balancing function modules, content distribution function modules, and scheduling function modules of the central platform to distribute content, reduce network congestion, and improve the response speed to access requests. Micro-application resources are the resources required to run micro-applications, including executable files in various formats, such as files in Java format, files in CSS (Cascading Style Sheets) format, etc.
[0112] In one embodiment, Figure 6 As shown, before S208, it also includes: debugging the source code of the micro-application through the debugging tool, and after the debugging is passed, sending the source code to the compilation platform. The source code is compiled by the compilation platform to obtain the executable file of the micro-application resource. Finally, the micro-application resource is published to the CDN application platform, and the version information corresponding to the micro-application resource is sent to the configuration platform. The configuration platform writes the version information corresponding to the updated version of the micro-application into the configuration table.
[0113] S210, loading micro-application resources into the target application program.
[0114] When the terminal obtains micro-application resources, it loads the micro-application resources into the target application and integrates the micro-application resources with the target application through the micro-front-end framework.
[0115] In one embodiment, after S210, it also includes: detecting a page close event of a micro-application page; in response to the page close event, removing the micro-application resources from the target application. Wherein, the page close event is an event used to instruct the terminal to close the micro-application page. When a page close event of a micro-application page is detected, the micro-application resources are removed from the target application, and the life cycle of the micro-application ends. When a page close event is detected, the micro-application resources are removed from the target application, which can save the memory space of the target application and improve the running speed of the target application.
[0116] In one embodiment, S210 specifically includes: obtaining a loading progress during the process of loading micro-application resources into a target application; displaying a loading progress bar on a page of the target application, and adjusting the length of the loading progress bar according to the loading progress.
[0117] In the above embodiment, in the process of running the target application, the loading event of the target application is detected, and the file type and version information of the micro-application to be loaded are determined according to the loading event. Thus, the micro-application index address can be obtained based on the version information and the file type, and according to the micro-application index address, the micro-application resource corresponding to the version information and the updated version is obtained from the application platform, and then the micro-application resource is loaded to the target application to realize the fusion of the micro-application and the target application. Therefore, the terminal can dynamically load the updated version of the micro-application to the target application during the operation of the target application, and merge the target application with the micro-application, without the need to release an updated version to the target application and update the target application as a whole, so as to realize the update of some modules in the target application, thereby improving the update efficiency. Further, since the target application can share the micro-application with other applications during the operation period, the micro-application can be reused between different technology stack applications, so that there is no need to develop a set of micro-applications for each application, and module sharing between different applications is realized. In addition, since the target application can be deconstructed into multiple independent micro-applications, the coupling degree between multiple independent micro-applications is low, and development can be carried out in parallel, thereby improving development efficiency.
[0118] In one embodiment, Figure 6 As shown, S204 specifically includes the following steps:
[0119] S602: Obtain a micro-application scenario identifier based on the loading event.
[0120] Among them, the micro-application scenario identifier is the application scenario identifier of the micro-application, which can be composed of numbers, letters, characters or special symbols. The application scenarios of micro-applications include scenarios used in various target applications. Since different updated versions of micro-applications may be used for each application scenario of the micro-application, for example, the first version of the micro-application is used for the application scenario used in the social application; the second version of the micro-application is used for the application scenario used in the communication application. When the terminal detects a loading event, it obtains the micro-application scenario identifier according to the loading event.
[0121] In one embodiment, S602 specifically includes: the terminal obtains the network address of the micro-application page based on the loading event, and determines the micro-application scenario identifier according to the network address of the micro-application page. Alternatively, the terminal obtains the UA (User Agent) value of the browser based on the loading event, and determines the micro-application scenario identifier according to the UA value.
[0122] S604: Read micro-application configuration information from the configuration platform according to the micro-application scenario identifier.
[0123] The configuration platform is a platform for managing micro-application configuration information. The micro-application configuration information is information used to configure the micro-application, including version information corresponding to the micro-application, micro-application scenario identifier, user identifier, etc., which can be stored in a configuration table of the configuration platform.
[0124] S606: If it is determined to load the micro-application according to the micro-application configuration information, the file type and version information of the micro-application are determined.
[0125] After the terminal reads the micro-application configuration information from the configuration platform, it determines whether to load the micro-application according to the micro-application configuration information. If it is determined to load the micro-application according to the micro-application configuration information, the file type and version information of the micro-application are determined.
[0126] In one embodiment, S606 specifically includes: extracting the version number of the updated version of the micro-application from the micro-application configuration information, and if the application state corresponding to the version number is an available state, determining to load the micro-application. After the updated version of the micro-application is released, the updated version of the micro-application is tested, and if the updated version of the micro-application is found to have defects during the test, the version number corresponding to the updated version of the micro-application is marked as unavailable; if no defects are found during the test, the version number corresponding to the updated version of the micro-application is marked as available.
[0127] In one embodiment, S606 specifically includes: extracting the grayscale object identification set of the micro-application from the micro-application configuration information; obtaining the target object identification registered in the target application; and determining to load the micro-application if the grayscale object identification set includes the target object identification.
[0128] Among them, the grayscale object identification set is a set of object identifications that are open to use updated versions of micro-applications. When an updated version of a micro-application is released, the newly released updated version may run unstably. In order to reduce the impact of the version upgrade, the updated version is first opened to some users to test and improve the updated version, and then opened to all users after the updated version runs stably. The terminal obtains the target object identification registered in the target application. If the grayscale object identification set contains the target object identification, the target object identification is the user object that is open to use the updated version of the micro-application, and it is determined to load the micro-application in the target application. Before opening the updated version of the micro-application to all users, the updated version of the micro-application is tested through the grayscale objects in the grayscale object identification set, which can reduce the impact of the version upgrade and improve the stability of the micro-application operation.
[0129] In one embodiment, S606 specifically includes: if it is determined to load the micro-application according to the micro-application configuration information, query the file type and version information corresponding to the micro-application scenario identifier in the micro-application configuration information to obtain the file type and version information of the micro-application.
[0130] In the above embodiment, the micro-application scenario identifier is obtained based on the loading event, and the micro-application configuration information is read from the configuration platform according to the micro-application scenario identifier. Thus, the corresponding updated version micro-application can be selected according to different micro-application scenarios. If the loading of the micro-application is determined according to the micro-application configuration information, the file type and version information of the micro-application are determined. Avoiding loading when the updated version micro-application is not available and affecting the use, improves the loading efficiency.
[0131] In one embodiment, after S606, it also includes: if it is determined not to load the micro-application according to the micro-application configuration information, obtaining a target component of the target application that is consistent with the micro-application function; and loading the target component that is consistent with the micro-application function into the target application.
[0132] Among them, the target component is a component consistent with the function of the micro-application, which can be an npm (Node Package Manager, package management tool) framework component. The target component is consistent with the function of the micro-application and is packaged in the target application when the target application is compiled. If it is determined not to load the micro-application according to the micro-application configuration information, the target component consistent with the function of the micro-application is loaded into the target application.
[0133] In one embodiment, when an updated version of a micro-application is released, a target component is released at the same time. The released target component and the updated version of the micro-application are compiled from the same set of source code. The micro-application and the target component are released at the same time during the release phase of the micro-application. When the terminal is not compatible with the micro-application or the released micro-application is unavailable, the same function as the micro-application is achieved by accessing the target component.
[0134] In the above embodiment, if it is determined not to load the micro-application according to the micro-application configuration information, the target component of the target application that is consistent with the micro-application function is obtained, and the target component that is consistent with the micro-application function is loaded into the target application. Thus, when the updated version of the micro-application is not available, the target component packaged in the target application can be used as a backup, and the same product function as the micro-application is presented, thereby avoiding failures during the loading process and improving loading efficiency.
[0135] In one embodiment, Figure 7 As shown, S606 specifically includes S702, and S206 specifically includes S704-S706:
[0136] S702, determine the file type of the micro-application, and determine the version information of the micro-application in the micro-application configuration information.
[0137] The file type of the micro application is the entry file type of the micro application, which may be an HTML Entry type or a JS Entry type. The terminal obtains the pre-configured file type and determines the version information of the micro application in the micro application configuration information. The determined version information may be the version number of the updated version of the micro application.
[0138] In one embodiment, S702 specifically includes: determining the version information of the micro-application in the micro-application configuration information according to the micro-application scenario identifier. For example, the micro-application configuration information includes "scenario identifier 1: version 3; scenario identifier 2: version 2; scenario identifier 3: version 4", if the micro-application scenario identifier is 3, the determined version information is "version 4".
[0139] S704: Determine the application identifier of the micro-application in the micro-application configuration information.
[0140] The application identifier is a unique identifier for marking each micro-application, and may be composed of numbers, letters, characters or special symbols, etc. The micro-application configuration information may include the application identifier of the micro-application, for example, the micro-application configuration information is "micro-application 1-scenario identifier 1: version 3".
[0141] S706, generate a micro-application index address based on the version information, file type and application identifier.
[0142] When the terminal determines the application identification, version information and file type of the micro-application to be loaded, it assembles the application identification, version information and file type to obtain the micro-application index address, so as to obtain the micro-application resource from the publishing platform according to the micro-application index address.
[0143] In one embodiment, S706 specifically includes: assembling the version information, file type and application identifier according to the network address format to obtain the micro-application index address. The network address format is a format defined by the network protocol, and the network protocol can be the HTTP protocol or the HTTPS protocol. The HTTP protocol is a hypertext transfer protocol running on the TCP protocol. The HTTPS protocol is a network transmission protocol that adds SSL (Secure Sockets Layer) to the HTTP protocol and can perform encrypted transmission.
[0144] The terminal assembles the version information, file type and application identifier according to the network address format to obtain the micro-application index address. For example, the micro-application index address is https: / / wzq... / micro-app / v0.6.9 / index.html, where "micro-app" is the application identifier, "v0.6.9" is the version information, and "html" is the file type.
[0145] In the above embodiment, the file type of the micro-application is determined, and the version information of the micro-application and the application identifier of the micro-application are determined in the micro-application configuration information. The micro-application index address is generated based on the version information, the file type and the application identifier. Thus, the micro-application resources can be downloaded from the application platform according to the micro-application index address, and the micro-application resources can be integrated with the target application. It is not necessary to publish an update file for the target application to achieve the update of some modules in the target application, thereby improving the update efficiency.
[0146] In one embodiment, the target application is an application on different ends, including a native application, a mini-program or a public account application; after S210, it also includes: obtaining environment variables corresponding to the micro-application running an updated version in the target application; obtaining the toolkit corresponding to the application on different ends according to the environment variables; calling the business program defined in the common base class based on the toolkit; and executing the application business by running the called business program.
[0147] Among them, environment variables are variables used to represent the operating environment corresponding to the updated version of the micro-application, and the toolkits (Software Development Kit, SDK) corresponding to different ends are mapped through environment variables. The toolkit is a collection of development tools corresponding to the application, including a collection of APIs (Application Programming Interface, application program interface) that can be called by the application, and a collection of other related documents, examples and tools. The universal base class is a base class uniformly defined for applications at different ends, and is instantiated during the operation of the application. In the universal base class, unified business programs are defined for applications at different ends. The business program is a program for executing application business, which can be implemented with the functions defined in the base class. The executed application business includes all the businesses that can be executed by applications at different ends, for example, display pages, pop-up windows, text editing, etc.
[0148] In the above embodiment, the environment variables corresponding to the micro-application running the updated version in the target application are obtained, and the toolkits corresponding to the different end applications are obtained according to the environment variables. The service program defined in the general base class is called based on the toolkit, and the application service is executed by running the called service program. Since multiple sets of toolkits that inherit the general base class are encapsulated for different end applications, the micro-application can complete the application service through the corresponding toolkit when it is running, so that the micro-application can run in different end applications, and different end applications can share the same micro-application, realizing the dynamic sharing of the same business module between applications with different technology stacks.
[0149] In one embodiment, Figure 8 As shown, after S210, the following steps are also included:
[0150] S802, obtaining the environment variables corresponding to the updated version of the micro-application running in the target application, and the running logs generated by the updated version of the micro-application during operation.
[0151] The operation log is a log used to record the running status of the micro-application, which may include data obtained by the micro-application during operation, data generated, warning information, error information, or configuration information, etc. The operation log can be used to view errors that occur when the micro-application is running, which facilitates the maintenance of the micro-application.
[0152] S804: triggering a corresponding log reporting event according to the environment variable, so as to report the operation log to the log space corresponding to the environment variable through the log reporting event.
[0153] The log reporting event is an event for reporting the operation log to the log space. The log space is a storage space for storing the operation log, which can be a disk space of the terminal.
[0154] In one embodiment, S804 specifically includes: the terminal determines the log identifier of the operation log according to the environment variable, then triggers a log reporting event, calls the tracking method in the target application through the log reporting event, and reports the operation log to the log space corresponding to the environment variable through the called tracking method.
[0155] In the above embodiment, the environment variables corresponding to the micro-application running the updated version in the target application are obtained, as well as the operation log generated by the micro-application of the updated version at runtime. The corresponding log reporting event is triggered according to the environment variable, so that the operation log is reported to the log space corresponding to the environment variable through the log reporting event. Thus, when the micro-application is running at different end applications, the generated operation log can be reported to different log spaces to distinguish the traffic from different end applications, and the same business module is dynamically shared between applications of different technology stacks.
[0156] In one embodiment, the updated version of the micro-application includes at least one component; after S210, it also includes: when the component receives an interaction instruction, calling a shared interaction program according to the interaction instruction; processing the interaction instruction through the shared interaction program to obtain a processing result; and displaying an interaction interface corresponding to the component based on the processing result.
[0157] Among them, the component in the micro application is the component of the micro application, which can be a graphical entity. Fig. 9 As shown, the "View All", "Comments" or "Discussion Area" displayed in the micro-application are components in the micro-application, and the interactive instructions for the micro-application can be triggered through the components in the micro-application. The shared interactive program is an interactive program shared between at least one component in the micro-application. Each component can execute the same processing method on the interactive instruction through the shared interactive program to obtain a processing result.
[0158] Specifically, combined Fig. 9 The above embodiment is specifically explained. When a user triggers an interaction instruction by clicking on the "Discussion Area 1" component or the "Discussion Area 2" component, the micro-application processes the interaction instructions triggered by the "Discussion Area 1" component and the "Discussion Area 2" component in the same way. Therefore, in order to save resources, the "Discussion Area 1" component and the "Discussion Area 2" component share an interaction program, and the interaction instructions triggered by these two components are processed through the shared interaction program, thereby eliminating the need to develop interaction programs separately for the "Discussion Area 1" component and the "Discussion Area 2" component, thereby avoiding waste of resources and improving program development efficiency.
[0159] In the above embodiment, when a component receives an interaction instruction, the shared interaction program is called according to the interaction instruction. The interaction instruction is processed by the shared interaction program, and the interaction interface corresponding to the component is displayed based on the processing result. There is no need to develop interaction programs for each component separately, which improves the development efficiency of micro-applications and saves resources.
[0160] In one embodiment, Fig.10 As shown, S210 specifically includes the following steps:
[0161] S1002, access the micro-application resources to the target application through the micro-frontend framework.
[0162] Among them, the micro-frontend framework is a front-end architecture created by micro-frontend technology, which is used to integrate micro-application resources with the target application, provide an operating environment for the micro-application, and manage the life cycle of the micro-application. In the micro-frontend framework, the target application can be composed of multiple micro-applications, each of which can be independently developed and deployed and run independently of each other. The terminal can access multiple micro-application resources to the target application through the micro-frontend framework, and integrate the accessed micro-application resources with the target application.
[0163] S1004, parsing the micro-application resources to achieve integration between the updated version of the micro-application and the target application.
[0164] The micro-application resources include multiple resource files. The terminal parses each resource file in turn and executes the resource file according to the parsed data to achieve the integration between the updated version of the micro-application and the target application.
[0165] In one embodiment, S1004 specifically includes: parsing the micro-application resources to obtain parsed data; rendering the parsed data to obtain a micro-application page; and displaying the micro-application page through the target application to achieve integration between the updated version of the micro-application and the target application.
[0166] Among them, the micro-application page is a network page obtained by rendering the micro-application resources, which may include text, pictures, controls, audio or video, etc. The terminal may first parse the micro-application entry file and render the page according to the parsed data, and then parse other micro-application resource files and render the page according to the parsed data. When all micro-application resource files are executed, the page rendering is completed to obtain the micro-application page. The terminal displays the micro-application page through the target application, realizes the integration between the updated version of the micro-application and the target application, and realizes the functions of the micro-application in the target application.
[0167] In the above embodiment, the micro-application resources are accessed to the target application through the micro-frontend framework, and the micro-application resources are parsed to achieve the integration between the updated version of the micro-application and the target application. Therefore, it is not necessary to release an updated version of the target application and update the target application as a whole, and the update of some modules in the target application can be achieved, thereby improving the update efficiency.
[0168] In one embodiment, S210 also includes: detecting a communication request initiated by an external application for an updated version of a micro-application; isolating the updated version of the micro-application from the external application; establishing an application communication channel between the external application and the updated version of the micro-application; and transmitting interaction data between the external application and the updated version of the micro-application based on the application communication channel.
[0169] Among them, the external application can be other applications besides the updated version of the micro-application, and can be a micro-application or an application of various technology stacks. The communication request is a request for communicating with the micro-application, including a communication request for functional interaction with the micro-application, and a communication request for data transmission with the micro-application. The terminal can establish an application communication channel between the external application and the updated version of the micro-application through the micro-frontend framework, and transmit the interaction data between the external application and the updated version of the micro-application based on the application communication channel. Fig.11 As shown, the operating environment of the micro-application is isolated from the external application, and the communication between the micro-application and the external application is realized through the communication unit in the micro-front-end framework. When the micro-application runs in an operating environment isolated from the outside, the micro-application communicates with the external application through the application communication channel, which ensures the reliability of communication and ensures that the operation of the micro-application does not affect the external application, thereby ensuring the independence of the micro-application.
[0170] In the above embodiment, a communication request initiated by an external application for an updated version of a micro-application is detected, an application communication channel between the external application and the updated version of the micro-application is established, and based on the application communication channel, the interaction data between the external application and the updated version of the micro-application is transmitted. Thus, the micro-application can be run in an operating environment isolated from the outside, avoiding conflicts between the micro-application and the external application, and realizing independent operation of the micro-application.
[0171] In one embodiment, Fig.12As shown, multiple micro-applications are developed independently, and the multiple micro-applications can synthesize the target application online. The target application can be an application of various technology stacks, including native applications, applets, or public account applications. Then the micro-application resources corresponding to each micro-application are published to the CDN platform. After the publication is successful, the version number of each micro-application is updated to the configuration platform. When an updated version of a micro-application is released, some grayscale users are first opened to verify the updated version of the micro-application. After the verification is passed, the updated version of the micro-application is opened to all users. If the updated version of the micro-application fails to pass the verification, turn on the rollback switch and roll back to the historical version of the micro-application to ensure the stability of the version upgrade process.
[0172] When compiling the front-end source code, the front-end source code can be built into an npm component version and a micro-application version respectively, and the functions of the micro-application version and the npm component version are consistent. Figure 6 As shown, micro-applications and npm framework components are built for the front-end source code respectively, so that when the update files of the micro-application version are not available, the update files of the npm version are used as a backup. Therefore, on low-version terminal devices that are not compatible with micro-applications, they can be directly downgraded to the npm method to access the corresponding functions, ensuring the stability of the upgrade process.
[0173] After the updated version of the micro-application is successfully released, during the process of running the target application, if you switch to the micro-application page corresponding to the updated version of the micro-application, obtain the micro-application configuration information according to the micro-application scenario identifier. Determine whether to load the updated version of the micro-application based on the micro-application configuration information. If it is determined to load the updated version of the micro-application, determine the file type of the micro-application, and determine the version information of the micro-application in the micro-application configuration information, assemble the version information, file type and application identifier, and obtain the micro-application index address. Obtain micro-application resources from the application platform according to the micro-application index address, load the micro-application resources into the target application, render the micro-application resources, display the micro-application page in the target application, and realize the integration of the updated version of the micro-application and the target application. If it is determined not to load the micro-application based on the micro-application configuration information, obtain the target component of the target application that is consistent with the micro-application function; load the target component that is consistent with the micro-application function into the target application.
[0174] Micro applications can run in a multi-terminal environment. During the development phase of micro applications, the corresponding SDKs are encapsulated for different terminals, and the SDKs corresponding to different terminals inherit a unified general base class. During the operation of the micro application, the SDKs corresponding to different terminals are obtained through environment variables, and the functions defined in the general base class are called to execute the application business, thereby realizing the sharing of micro applications in a multi-terminal environment. The operation logs generated by micro applications running on different terminals are reported to different log spaces at runtime to distinguish the traffic from different terminals. The log name is generated according to the environment variables corresponding to different terminals, and the log reporting event is triggered. The operation log is reported to the corresponding log space through the embedding method defined in the target application. Since the micro application is rendered by several components, the lower-level components can also be nested in the outer layer components. The events triggered in the components are dispatched outward by the innermost components, and the application state modification and interaction processing are uniformly performed at the entrance of the micro application. For the same events in different components, they are uniformly processed at the entrance of the micro application, realizing the logic reuse of each component.
[0175] In one embodiment, Fig.13 As shown, the dynamic update method of the micro application includes the following steps:
[0176] S1302: Detect a loading event of the target application during the running of the target application.
[0177] S1304, obtaining a micro-application scenario identifier based on the loading event; and reading micro-application configuration information from the configuration platform according to the micro-application scenario identifier.
[0178] S1306, extracting the grayscale object identification set of the micro-application from the micro-application configuration information; obtaining the target object identification registered in the target application; and determining to load the micro-application if the grayscale object identification set includes the target object identification.
[0179] S1308, determine the file type of the micro-application, and determine the version information of the micro-application in the micro-application configuration information; determine the application identifier of the micro-application in the micro-application configuration information.
[0180] S1310, generate a micro-application index address based on the version information, file type and application identifier.
[0181] S1312, according to the micro-application index address, obtain the micro-application resource corresponding to the version information from the application platform; load the micro-application resource to the target application program.
[0182] S1314, access the micro-application resources to the target application through the micro-front-end framework; parse the micro-application resources to obtain parsed data; render the parsed data to obtain a micro-application page.
[0183] S1316, displaying the micro-application page through the target application to achieve integration between the updated version of the micro-application and the target application.
[0184] S1318, if it is determined not to load the micro-application according to the micro-application configuration information, obtain a target component of the target application that is consistent with the micro-application function; and load the target component that is consistent with the micro-application function into the target application.
[0185] S1320, obtain the environment variables corresponding to the micro-application running the updated version in the target application.
[0186] S1322, obtaining toolkits corresponding to different end applications according to environment variables; calling the business program defined in the general base class based on the toolkit; and executing the application business by running the called business program.
[0187] S1324, detecting a page closing event of the micro-application page; in response to the page closing event, removing the micro-application resources from the target application.
[0188] For the specific contents of S1302 to S1324 above, reference may be made to the specific implementation process described above.
[0189] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0190] Based on the same inventive concept, the embodiment of the present application also provides a dynamic update device for micro-applications for implementing the dynamic update method of micro-applications involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the dynamic update device for one or more micro-applications provided below can be referred to the limitations of the dynamic update method for micro-applications above, and will not be repeated here.
[0191] In one embodiment, Fig.14As shown, a dynamic update device for a micro-application is provided, including: a detection module 1402, a determination module 1404, an acquisition module 1406, an acquisition module 1408 and a loading module 1410, wherein:
[0192] The detection module 1402 is used to detect a loading event of the target application during the running of the target application;
[0193] A determination module 1404 is used to determine the file type and version information of the micro-application to be loaded according to the loading event;
[0194] An acquisition module 1406 is used to obtain a micro-application index address based on version information and file type;
[0195] The acquisition module 1408 is used to acquire the micro-application resources corresponding to the version information from the application platform according to the micro-application index address; the micro-application resources include application files corresponding to the micro-applications published to the application platform and of updated versions;
[0196] The loading module 1410 is used to load micro-application resources into the target application program.
[0197] In the above embodiment, in the process of running the target application, the loading event of the target application is detected, and the file type and version information of the micro-application to be loaded are determined according to the loading event. Thus, the micro-application index address can be obtained based on the version information and the file type, and according to the micro-application index address, the micro-application resource corresponding to the version information and the updated version is obtained from the application platform, and then the micro-application resource is loaded to the target application to realize the fusion of the micro-application and the target application. Therefore, the terminal can dynamically load the updated version of the micro-application to the target application during the operation of the target application, and merge the target application with the micro-application, without the need to release an updated version to the target application and update the target application as a whole, so as to realize the update of some modules in the target application, thereby improving the update efficiency. Further, since the target application can share the micro-application with other applications during the operation period, the micro-application can be reused between different technology stack applications, so that there is no need to develop a set of micro-applications for each application, and module sharing between different applications is realized. In addition, since the target application can be deconstructed into multiple independent micro-applications, the coupling degree between multiple independent micro-applications is low, and development can be carried out in parallel, thereby improving development efficiency.
[0198] In one embodiment, the determination module 1404 is further configured to:
[0199] Get the micro-application scenario identifier based on the loading event;
[0200] Read micro-application configuration information from the configuration platform according to the micro-application scenario identifier;
[0201] If it is determined to load the micro-application based on the micro-application configuration information, the file type and version information of the micro-application are determined.
[0202] In the above embodiment, the micro-application scenario identifier is obtained based on the loading event, and the micro-application configuration information is read from the configuration platform according to the micro-application scenario identifier. Thus, the corresponding updated version micro-application can be selected according to different micro-application scenarios. If the loading of the micro-application is determined according to the micro-application configuration information, the file type and version information of the micro-application are determined. Avoiding loading when the updated version micro-application is not available and affecting the use, improves the loading efficiency.
[0203] In one embodiment, the determination module 1404 is further configured to:
[0204] Extracting a grayscale object identification set of the micro-application from the micro-application configuration information;
[0205] Get the target object ID registered in the target application;
[0206] If the grayscale object identifier set includes the target object identifier, it is determined to load the micro application.
[0207] In one embodiment, the apparatus further comprises:
[0208] The acquisition module 1408 is further used to acquire a target component of the target application program that is consistent with the function of the micro-application if it is determined not to load the micro-application according to the micro-application configuration information;
[0209] The loading module 1410 is also used to load the target component consistent with the micro-application function into the target application.
[0210] In the above embodiment, if it is determined not to load the micro-application according to the micro-application configuration information, the target component of the target application that is consistent with the micro-application function is obtained, and the target component that is consistent with the micro-application function is loaded into the target application. Thus, when the updated version of the micro-application is not available, the target component packaged in the target application can be used as a backup, and the same product function as the micro-application is presented, thereby avoiding failures during the loading process and improving loading efficiency.
[0211] In one embodiment, the determination module 1404 is further configured to:
[0212] Determine the file type of the micro-application, and determine the version information of the micro-application in the micro-application configuration information;
[0213] The acquisition module 1406 is further used for:
[0214] Determine the application identifier of the micro-application in the micro-application configuration information;
[0215] Generates a micro-application index address based on version information, file type, and application identifier.
[0216] In the above embodiment, the file type of the micro-application is determined, and the version information of the micro-application and the application identifier of the micro-application are determined in the micro-application configuration information. The micro-application index address is generated based on the version information, the file type and the application identifier. Thus, the micro-application resources can be downloaded from the application platform according to the micro-application index address, and the micro-application resources can be integrated with the target application. It is not necessary to publish an update file for the target application to achieve the update of some modules in the target application, thereby improving the update efficiency.
[0217] In one embodiment, the target application is an application on a different terminal, including a native application, a mini-program, or a public account application; Fig.15 As shown, the device also includes:
[0218] The acquisition module 1408 is also used to obtain the environment variables corresponding to the micro-application running the updated version in the target application; and obtain the toolkits corresponding to the different end applications according to the environment variables;
[0219] A first calling module 1412, used for calling a business program defined in a general base class based on a toolkit;
[0220] The execution module 1414 is used to execute the application service by running the called service program.
[0221] In the above embodiment, the environment variables corresponding to the micro-application running the updated version in the target application are obtained, and the toolkits corresponding to the different end applications are obtained according to the environment variables. The service program defined in the general base class is called based on the toolkit, and the application service is executed by running the called service program. Since multiple sets of toolkits that inherit the general base class are encapsulated for different end applications, the micro-application can complete the application service through the corresponding toolkit when it is running, so that the micro-application can run in different end applications, and different end applications can share the same micro-application, realizing the dynamic sharing of the same business module between applications with different technology stacks.
[0222] In one embodiment, the apparatus further comprises:
[0223] The acquisition module 1408 is further used to obtain the environment variables corresponding to the micro-application running the updated version in the target application, and the running log generated by the micro-application of the updated version when running;
[0224] The reporting module 1416 is used to trigger a corresponding log reporting event according to the environment variable, so as to report the operation log to the log space corresponding to the environment variable through the log reporting event.
[0225] In the above embodiment, the environment variables corresponding to the micro-application running the updated version in the target application are obtained, as well as the operation log generated by the micro-application of the updated version at runtime. The corresponding log reporting event is triggered according to the environment variable, so that the operation log is reported to the log space corresponding to the environment variable through the log reporting event. Thus, when the micro-application is running at different end applications, the generated operation log can be reported to different log spaces to distinguish the traffic from different end applications, and the same business module is dynamically shared between applications of different technology stacks.
[0226] In one embodiment, the updated version of the micro-application includes at least one component; the apparatus further includes:
[0227] The second calling module 1418 is used to call the shared interactive program according to the interactive instruction when the component receives the interactive instruction;
[0228] The processing module 1420 is used to process the interactive instruction through the shared interactive program to obtain a processing result;
[0229] The display module 1422 is used to display the interactive interface corresponding to the component based on the processing result.
[0230] In the above embodiment, when a component receives an interaction instruction, the shared interaction program is called according to the interaction instruction. The interaction instruction is processed by the shared interaction program, and the interaction interface corresponding to the component is displayed based on the processing result. There is no need to develop interaction programs for each component separately, which improves the development efficiency of micro-applications and saves resources.
[0231] In one embodiment, the loading module 1410 is further configured to:
[0232] Connect micro-application resources to the target application through the micro-frontend framework;
[0233] The micro-application resources are parsed to achieve integration between the updated version of the micro-application and the target application.
[0234] In one embodiment, the loading module 1410 is further configured to:
[0235] Analyze the micro-application resources to obtain analysis data;
[0236] Render the parsed data to obtain the micro-application page;
[0237] The micro-application page is displayed through the target application to achieve integration between the updated version of the micro-application and the target application.
[0238] In the above embodiment, the micro-application resources are accessed to the target application through the micro-frontend framework, and the micro-application resources are parsed to achieve the integration between the updated version of the micro-application and the target application. Therefore, it is not necessary to release an updated version of the target application and update the target application as a whole, and the update of some modules in the target application can be achieved, thereby improving the update efficiency.
[0239] In one embodiment, the apparatus further comprises:
[0240] The detection module 1402 is also used to detect a page closing event of the micro-application page;
[0241] The removal module 1424 is used to remove the micro-application resources from the target application in response to a page closing event.
[0242] In one embodiment, the apparatus further comprises:
[0243] The detection module 1402 is further used to detect a communication request initiated by an external application for an updated version of the micro-application; the updated version of the micro-application is isolated from the external application;
[0244] Establishing module 1426, for establishing an application communication channel between the external application and the updated version of the micro-application;
[0245] The transmission module 1428 is used to transmit the interaction data between the external application and the updated version of the micro-application based on the application communication channel.
[0246] In the above embodiment, a communication request initiated by an external application for an updated version of a micro-application is detected, an application communication channel between the external application and the updated version of the micro-application is established, and based on the application communication channel, the interaction data between the external application and the updated version of the micro-application is transmitted. Thus, the micro-application can be run in an operating environment isolated from the outside, avoiding conflicts between the micro-application and the external application, and realizing independent operation of the micro-application.
[0247] Each module in the above-mentioned dynamic update device of micro-application can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0248] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.16As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a dynamic update method of a micro-application is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0249] Those skilled in the art will understand that Fig.16 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0250] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0251] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0252] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0253] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0254] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0255] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0256] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for dynamically updating a micro-application, characterized in that: The method comprises: During the running of the target application, detecting a loading event of the target application for loading a micro-application; Determine the file type and version information of the micro-application to be loaded according to the loading event; Obtain a micro-application index address based on the version information and the file type; According to the micro-application index address, obtain the micro-application resource corresponding to the version information from the application platform; the micro-application resource includes an application file corresponding to the micro-application that is published to the application platform and is an updated version; Loading the micro-application resource into the target application; Obtaining environment variables corresponding to the micro-application running an updated version in the target application; Obtain toolkits corresponding to different end applications according to the environment variables; Calling a business procedure defined in a common base class based on the toolkit; The application service is executed by running the called service program.
2. The method according to claim 1, characterized in that Determining the file type and version information of the micro-application to be loaded according to the loading event includes: Acquire a micro-application scenario identifier based on the loading event; Reading micro-application configuration information from a configuration platform according to the micro-application scenario identifier; If it is determined to load the micro-application according to the micro-application configuration information, the file type and version information of the micro-application are determined.
3. The method according to claim 2, characterized in that Determining to load the micro-application according to the micro-application configuration information includes: Extracting a grayscale object identification set of the micro-application from the micro-application configuration information; Obtaining a target object identifier registered in the target application; If the grayscale object identifier set includes the target object identifier, it is determined to load the micro-application.
4. The method according to claim 2, characterized in that: The method further comprises: If it is determined not to load the micro-application according to the micro-application configuration information, obtaining a target component of the target application program that is consistent with the function of the micro-application; Load a target component consistent with the micro-application function into the target application.
5. The method according to claim 2, characterized in that: Determining the file type and version information of the micro-application includes: Determine the file type of the micro-application, and determine the version information of the micro-application in the micro-application configuration information; The obtaining of the micro-application index address based on the version information and the file type includes: Determining an application identifier of the micro-application in the micro-application configuration information; A micro-application index address is generated based on the version information, the file type, and the application identifier.
6. The method according to claim 1, characterized in that The target application is an application on different terminals, including a native application, a mini-program or a public account application.
7. The method according to claim 1, characterized in that The method further comprises: Obtaining environment variables corresponding to the updated version of the micro-application running in the target application, and a running log generated by the updated version of the micro-application when running; A corresponding log reporting event is triggered according to the environment variable, so as to report the operation log to the log space corresponding to the environment variable through the log reporting event.
8. The method according to claim 1, characterized in that The updated version of the micro-application includes at least one component; and the method further includes: When the component receives an interaction instruction, the shared interaction program is called according to the interaction instruction; the shared interaction program is an interaction program shared by the components in the micro-application; Processing the interactive instruction through the shared interactive program to obtain a processing result; An interactive interface corresponding to the component is displayed based on the processing result.
9. The method according to any one of claims 1 to 8, characterized in that: The loading of the micro-application resource to the target application comprises: Access the micro-application resources to the target application through a micro-frontend framework; The micro-application resources are parsed to achieve integration between the updated version of the micro-application and the target application.
10. The method according to claim 9, characterized in that The parsing of the micro-application resources to achieve integration between the updated version of the micro-application and the target application program includes: Parsing the micro-application resources to obtain parsed data; Rendering the parsed data to obtain a micro-application page; The micro-application page is displayed through the target application to achieve integration between the updated version of the micro-application and the target application.
11. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: Detecting a page closing event of the micro-application page; In response to the page closing event, the micro-application resource is removed from the target application.
12. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: Detecting a communication request initiated by an external application for an updated version of the micro-application; the updated version of the micro-application and the external application are isolated from each other; Establishing an application communication channel between the external application and the updated version of the micro-application; Based on the application communication channel, the interaction data between the external application and the updated version of the micro-application is transmitted.
13. A dynamic update device for micro-applications, characterized in that: The device comprises: A detection module, used to detect a loading event of the target application for loading a micro-application during the running of the target application; A determination module, used to determine the file type and version information of the micro-application to be loaded according to the loading event; An acquisition module, used to obtain a micro-application index address based on the version information and the file type; An acquisition module, configured to acquire a micro-application resource corresponding to the version information from an application platform according to the micro-application index address; the micro-application resource includes an application file corresponding to the micro-application that is published to the application platform and is an updated version; A loading module, used to load the micro-application resources into the target application; The acquisition module is also used to acquire the environment variables corresponding to the micro-application running the updated version in the target application; and acquire the toolkits corresponding to different end applications according to the environment variables; A first calling module, used for calling a business program defined in a general base class based on the toolkit; The execution module is used to execute the application business by running the called business program.
14. The device according to claim 13, characterized in that The determination module is also used to obtain a micro-application scenario identifier based on the loading event; read micro-application configuration information from a configuration platform according to the micro-application scenario identifier; if it is determined to load the micro-application according to the micro-application configuration information, determine the file type and version information of the micro-application.
15. The device according to claim 14, characterized in that The determination module is also used to extract the grayscale object identification set of the micro-application from the micro-application configuration information; obtain the target object identification registered in the target application; and determine to load the micro-application if the grayscale object identification set includes the target object identification.
16. The device according to claim 14, characterized in that The acquisition module is further used to acquire a target component of the target application program that is consistent with the function of the micro-application if it is determined not to load the micro-application according to the micro-application configuration information; The loading module is also used to load a target component consistent with the micro-application function into the target application.
17. The device according to claim 14, characterized in that The determination module is further used to: determine the file type of the micro-application, and determine the version information of the micro-application in the micro-application configuration information; The acquisition module is also used to determine the application identifier of the micro-application in the micro-application configuration information; A micro-application index address is generated based on the version information, the file type, and the application identifier.
18. The device according to claim 13, characterized in that The target application is an application on different terminals, including a native application, a mini-program or a public account application.
19. The device according to claim 13, characterized in that The acquisition module is also used to acquire the environment variables corresponding to the micro-application running the updated version in the target application, and the running log generated by the micro-application of the updated version when running; The device also includes: The reporting module is used to trigger a corresponding log reporting event according to the environment variable, so as to report the operation log to the log space corresponding to the environment variable through the log reporting event.
20. The device according to claim 13, characterized in that The updated version of the micro-application includes at least one component; the device also includes: A second calling module is used to call a shared interactive program according to the interactive instruction when the component receives the interactive instruction; the shared interactive program is an interactive program shared by the components in the micro-application; A processing module, used for processing the interaction instruction through the shared interaction program to obtain a processing result; A display module is used to display the interactive interface corresponding to the component based on the processing result.
21. The device according to any one of claims 13 to 20, characterized in that The loading module is also used to: access the micro-application resources to the target application through a micro-front-end framework; and parse the micro-application resources to achieve integration between an updated version of the micro-application and the target application.
22. The device according to claim 21, characterized in that The loading module is also used to: parse the micro-application resources to obtain parsed data; render the parsed data to obtain a micro-application page; and display the micro-application page through the target application to achieve integration between the updated version of the micro-application and the target application.
23. The device according to any one of claims 13 to 20, characterized in that The detection module is also used to detect a page closing event of the micro-application page; The device also includes: A removal module is used to remove the micro-application resource from the target application in response to the page closing event.
24. The device according to any one of claims 13 to 20, characterized in that The detection module is also used to detect a communication request initiated by an external application to act on an updated version of the micro-application; the updated version of the micro-application and the external application are isolated from each other; The device also includes: An establishing module, used to establish an application communication channel between the external application and the updated version of the micro-application; A transmission module is used to transmit the interaction data between the external application and the updated version of the micro-application based on the application communication channel.
25. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.
26. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
27. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Vehicle machine application updating method and device, equipment and medium
CN114443110A