Micro-application updating method and device, computer equipment, readable storage medium and program product
By decoupling and packaging micro-application code into modular resource packages, the method addresses the complexity of traditional updates, enabling efficient and flexible maintenance of micro-applications.
Patent Information
- Application Number
- CN202411127320.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-27
AI Technical Summary
Traditional methods for updating and maintaining micro-applications are complex and inefficient, especially in large projects, due to the need to recompile and redeploy the entire application upon changes in the framework or components, leading to increased loading times and maintenance difficulties.
Decouple micro-application code into multiple modules based on logical structure and function, package these modules into resource packages, and update only the target module resource package upon detection of an event, allowing independent updates and reducing dependencies between system parts.
This approach improves maintainability and extensibility by allowing each module to be updated independently, reducing development and maintenance complexity, and enhancing flexibility and efficiency of micro-application updates.
Smart Images

Figure CN119201158A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of micro-application development technology, and in particular to a micro-application updating method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the rapid development of Web technology, single-page applications (SPA) have gradually become mainstream. Micro applications have played an important role in software development due to their lightweight and easy-to-use advantages. However, as the scale of projects increases, the difficulty of updating and maintaining micro applications and the loading time also increase significantly. Traditional update methods are difficult to meet the performance and maintainability requirements of large projects.
[0003] In addition, frequent changes in the basic framework and components are the norm during the development and maintenance of micro-applications. The traditional approach is to compile and deploy the entire micro-application as a whole. Once the basic framework or a component changes, even if the change is small, the entire micro-application needs to be recompiled and launched, and the micro-applications that use the same basic framework and components in production need to be recompiled and launched at the same time. This makes the development and maintenance of micro-applications very complex. Therefore, an effective sub-packaging strategy is needed to optimize resource management, code updates, and improve project loading performance. Summary of the invention
[0004] Based on this, it is necessary to provide a micro-application update method, apparatus, computer device, computer-readable storage medium and computer program product that can reduce the complexity of development and maintenance when updating micro-applications in response to the above technical problems.
[0005] In a first aspect, the present application provides a micro-application update method, comprising:
[0006] Get the micro-application code corresponding to the micro-application;
[0007] Decoupling the micro-application code into multiple code modules according to the logical structure and code function of the micro-application code;
[0008] The plurality of code modules are packaged to obtain and store a plurality of module resource packages; each of the module resource packages is generated based on at least one code module matching the code function;
[0009] When a micro-application update event is detected, a target module resource package among the stored multiple module resource packages is updated, and the updated target module resources are sent to the client, so that the client updates the micro-application on the client based on the updated target module resource package.
[0010] In one embodiment, decoupling the micro-application code into multiple code modules according to the logical structure and code function of the micro-application code includes:
[0011] Obtaining a micro-application code segmentation rule; the micro-application code segmentation rule is determined according to the logical result and code function of the micro-application code;
[0012] The micro-application code is segmented according to the micro-application code segmentation rule to obtain a plurality of decoupled code modules.
[0013] In one embodiment, the micro-application code is segmented according to the micro-application code segmentation rule to obtain a plurality of decoupled code modules, including:
[0014] According to the micro-application code segmentation rule, the framework logic code and library file code corresponding to the micro-application are segmented from the micro-application code;
[0015] A framework code module is obtained according to the framework logic code and the library file code.
[0016] In one embodiment, the micro-application code is segmented according to the micro-application code segmentation rule to obtain a plurality of decoupled code modules, including:
[0017] According to the micro-application code segmentation rule, segmenting the reused component code from the common part of the micro-application code;
[0018] A component code module is obtained according to the reused component code.
[0019] In one embodiment, compressing the extracted code module includes:
[0020] Divide the multiple code modules into multiple module sets, compress the multiple module sets respectively, and obtain the corresponding module resource packages; each module set includes multiple code modules matching the micro-application functions;
[0021] or,
[0022] Each code module is compressed separately to obtain the corresponding module resource package.
[0023] In one embodiment, updating the target module resource package in the stored multiple module packages includes:
[0024] Acquire the update module resource package uploaded by the developer, and determine the target module resource package to be updated among the stored multiple module resource packages;
[0025] The target module resource package is replaced by the update module resource package while keeping other module resource packages unchanged; the other module resource packages are module resource packages other than the target module resource package among the multiple module resource packages.
[0026] In a second aspect, the present application also provides a micro-application update method, comprising:
[0027] In the case of detecting a micro-application update event, obtaining a target module resource package from a server; wherein the micro-application is obtained based on a plurality of module resource packages, the plurality of module resource packages are obtained by the server performing sub-packaging processing on a plurality of code modules of the micro-application, each of the module resource packages is generated based on at least one code module matching a micro-application function, and the code module is obtained by segmenting the micro-application code according to the logical structure of the micro-application code and the code functions of the code fragments in the micro-application code;
[0028] The micro-application on the client is updated according to the target module resource package.
[0029] In a third aspect, the present application also provides a micro-application updating device, including:
[0030] A code acquisition module is used to obtain the micro-application code corresponding to the micro-application;
[0031] A code decoupling module, used for decoupling the micro-application code into multiple code modules according to the logical structure and code function of the micro-application code;
[0032] A sub-packaging management module is used to perform sub-packaging processing on the multiple code modules to obtain and store multiple module resource packages; each of the module resource packages is generated based on at least one code module matching the code function;
[0033] The application update module is used to update the target module resource package among the stored multiple module resource packages when a micro-application update event is detected, and send the updated target module resources to the client, so that the client can update the micro-application on the client based on the updated target module resource package.
[0034] In a fourth aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above-described micro-application updating methods when executing the computer program.
[0035] In a fifth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the micro-application updating method described in any one of the above items are implemented.
[0036] In a sixth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the micro-application updating methods described above.
[0037] The above-mentioned micro-application updating method, device, computer equipment, computer-readable storage medium and computer program product obtain the micro-application code corresponding to the micro-application; decouple the micro-application code into multiple code modules according to the logical structure and code function of the micro-application code; subpackage the multiple code modules to obtain multiple module resource packages and store them; each module resource package is generated based on at least one code module matching the code function; when a micro-application update event is detected, the target module resource package in the stored multiple module resource packages is updated, and the updated target module resource is sent to the client, so that the client updates the micro-application on the client based on the updated target module resource package, thereby realizing the decoupling of the logical structure and code function of the micro-application code, significantly improving the maintainability and extensibility of the code, and at the same time reducing the dependency between the various parts of the system through a modular update method, so that each module can be updated and run independently, thereby achieving the effect of reducing the complexity of the development and maintenance of micro-application updates, and improving the flexibility and efficiency of micro-application updates. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings used in the embodiments of the present application or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 An application environment diagram of a micro-application updating method in one embodiment;
[0040] Figure 2 A schematic diagram of a flow chart of a micro-application updating method in one embodiment;
[0041] Figure 3 A schematic diagram of a flow chart of a micro-application updating method in another embodiment;
[0042] Figure 4 It is a structural block diagram of a micro-application updating device in one embodiment;
[0043] Figure 5 It is a structural block diagram of a micro-application updating device in another embodiment;
[0044] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0045] 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.
[0046] The micro-application update method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data processed by the server 104. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server can obtain the micro-application code from the code warehouse or the code submitted by the developer, and decouple the code into multiple independent code modules according to the logical structure and function of the micro-application code. The server performs sub-packaging processing on the decoupled multiple code modules, generates multiple module resource packages, and stores the generated module resource packages in the data storage system. The server continuously monitors update events, such as developers submitting new code, regular update checks, etc. The server sends the updated target module resource package to the terminal device, and the terminal device updates the micro-application based on the updated target module resource package. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the portable wearable devices can be smart watches, smart bracelets, etc. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0047] In an exemplary embodiment, Figure 2 As shown, a micro-application update method is provided, which is applied to Figure 1 The server in the example is used to illustrate, including the following steps S202 to S208. Among them:
[0048] Step S202, obtaining the micro-application code corresponding to the micro-application.
[0049] Among them, a micro application is a small, independent application that runs in a larger system or platform, has independent functions and logic, and can be developed and deployed separately. The micro application code can include at least one of the following: front-end code and back-end code.
[0050] Exemplarily, the server accesses the version control system and performs a code pull operation through a command line tool or a graphical interface tool to obtain the latest micro-application code. Exemplarily, the version control system may include at least one of the following: Git (distributed version control system), SVN (centralized version control system), and the version control system can effectively manage version changes and history records of the code.
[0051] Step S204, decoupling the micro-application code into multiple code modules according to the logical structure and code function of the micro-application code.
[0052] Among them, the logical structure is the organization of various modules and components in the code and the dependencies between them. The logical structure affects the readability, maintainability and extensibility of the code. A clear logical structure helps developers quickly understand and modify the code.
[0053] Code functions are the specific business logic and operations implemented by the code, which may include at least one of the following: user login, data storage, chart rendering, etc. Code functions determine the behavior of the application and user experience. Different code functions correspond to different business needs and user operations.
[0054] Decoupling means separating highly coupled code into independent modules so that they can be developed, tested, and deployed separately. Decoupled modules communicate through clear interfaces to reduce mutual dependence.
[0055] In the specific implementation, on the one hand, the association relationship of each code fragment in the micro-application code can be determined according to the logical structure of the micro-application code. For example, it can be determined according to the logical structure whether code fragment A is related to code fragment B or not. For code fragments that are not related in the logical structure, they can be divided into different code modules respectively; on the other hand, the code functions of different code fragments in the micro-application code can also be determined. For example, code fragment A and code fragment C are both used to build the framework of the micro-application, and they can be considered to be divided into the same code module when dividing. Furthermore, according to the logical structure of the micro-application code and the code functions of each code fragment, multiple code fragments in the micro-application code can be divided to obtain multiple decoupled code modules.
[0056] For example, first analyze the logical structure of the micro-application code to identify the basic framework, basic components, business components, and business layer. Use tools to draw a dependency graph between these layers and clarify the interaction between each layer. Then, according to the code function, functions such as user authentication, data processing, and view rendering are divided into independent modules. Finally, reconstruct the code in an interactive way to ensure that each module can run independently, and define the interface between modules to complete the decoupling of the code.
[0057] Step S206, multiple code modules are packaged to obtain and store multiple module resource packages; each module resource package is generated based on at least one code module that matches the code function.
[0058] The subpackaging process is the process of packaging the code modules according to the subpackaging rules, which may include module matching, packaging, naming and storage. The module resource package is an independent resource package generated by packaging according to the subpackaging rules, which contains one or more function-related code modules.
[0059] Optionally, according to the subpackaging rules, the user interface module, business logic module and data access module are packaged into independent resource packages. The user interface module resource package contains the code related to the user interface, the business logic module resource package contains the business logic implementation code, and the data access module resource package contains the data processing and database operation code. Then package these modules into a ZIP (compressed package) file and upload it to the file server.
[0060] Step S208, when a micro-application update event is detected, a target module resource package among the stored multiple module resource packages is updated, and the updated target module resource package is sent to the client, so that the client updates the micro-application on the client based on the updated target module resource package.
[0061] Among them, update events are various situations that trigger micro-application updates, which can include code changes, function upgrades, security patches, etc. The server system monitors the code repository, function changes, and security vulnerabilities, and triggers the update process when an update event is detected. The target module resource package is the specific module resource package of the update, which contains the code and resources related to the update event.
[0062] Exemplarily, the server-side system monitors that the business logic module of the micro-application has a new function update. After detecting the update event, it determines that the target module resource package for the update is the business logic module. The server-side system modifies and repackages the code of the business logic module, generates a new module resource package, and uploads it to the distribution server. Subsequently, the server-side system notifies the client to update. After receiving the notification, the client downloads the new business logic module resource package, replaces the local old version file, and completes the update of the micro-application.
[0063] In the above-mentioned micro-application updating method, the micro-application code corresponding to the micro-application is obtained; according to the logical structure and code function of the micro-application code, the micro-application code is decoupled into multiple code modules; the multiple code modules are packaged to obtain multiple module resource packages and stored; each module resource package is generated based on at least one code module matching the code function; when a micro-application update event is detected, the target module resource package in the stored multiple module resource packages is updated, and the updated target module resource is sent to the client, so that the client updates the micro-application on the client based on the updated target module resource package. In this embodiment, by decoupling the logical structure and code function of the micro-application code, the maintainability and scalability of the code are significantly improved, and at the same time, the dependency between the various parts of the system is reduced through a modular update method, so that each module can be updated and run independently, thereby achieving the effect of reducing the complexity of the development and maintenance of the micro-application update, and improving the flexibility and efficiency of the micro-application update.
[0064] In an exemplary embodiment, step S204 decouples the micro-application code into multiple code modules according to the logical structure and code function of the micro-application code, including: obtaining micro-application code segmentation rules; determining the micro-application code segmentation rules according to the logical results and code functions of the micro-application code; and segmenting the micro-application code according to the micro-application code segmentation rules to obtain multiple decoupled code modules.
[0065] Among them, the micro-application code segmentation rules are standards and specifications for dividing the code into multiple modules, which may include aspects such as functional division, logical structure, and dependencies. The micro-application code segmentation rules ensure code modularization and improve the maintainability and extensibility of the code.
[0066] Exemplarily, the micro-application code segmentation rules of the micro-application code can be obtained, and the code is divided based on the three main functional modules of user interface, business logic and data access. According to these rules, the developer analyzes the logical structure of the code and determines the specific implementation part of each functional module. Then, the code is reconstructed according to the segmentation rules, and the user interface-related code is divided into the user interface module, the business logic-related code is divided into the business logic module, and the data access-related code is divided into the data access module, ensuring that each module is independent and has clear functions.
[0067] In this embodiment, by obtaining the micro-application code segmentation rules and segmenting the code according to these rules, the maintainability and scalability of the code can be significantly improved. The modular code structure allows each module to be independently developed, tested and deployed, reducing the coupling of the system and improving development efficiency and system flexibility.
[0068] In an exemplary embodiment, step S204 splits the micro-application code according to the micro-application code splitting rules to obtain multiple decoupled code modules, including: according to the micro-application code splitting rules, splitting the framework logic code and library file code corresponding to the micro-application from the micro-application code, and obtaining the framework code module according to the framework logic code and the library file code.
[0069] The framework logic code is the code part used to implement the core functions and logic in the micro-application, which can include at least one of the following: routing management, state management, dependency injection and other framework logic codes; the framework logic code provides the basic operating framework and core function support of the micro-application, which is the basis for the operation of the application. The library file code is the various third-party dependency libraries and tool library codes used in the micro-application.
[0070] Specifically, formulate segmentation rules to specify which parts of the code belong to the framework logic and which belong to the library files, identify that the routing management code and the state management code belong to the framework logic, and the third-party library files belong to the library file code, and according to the segmentation rules, separate the framework logic code and the library file code from the micro-application code, integrate the segmented framework logic code and library file code to form an independent framework code module.
[0071] In this embodiment, the framework logic code and library file code corresponding to the micro-application are separated from the micro-application code to achieve independent management of the core framework and the third-party library, so that the core function module is decoupled from the business logic module, and the degree of modularization is improved. At the same time, the framework code module is obtained according to the framework logic code and the library file code, and the independent existence of the framework code module is achieved, making the maintenance and update of the framework more convenient. At the same time, it can be reused by multiple micro-applications, reducing the workload of repeated development and maintenance.
[0072] In an exemplary embodiment, the micro-application code is segmented according to the micro-application code segmentation rule to obtain multiple decoupled code modules, including: according to the micro-application code segmentation rule, the reused component code is segmented from the common part of the micro-application code; and the component code module is obtained according to the reused component code.
[0073] The common part is the code shared by all modules or components in a micro-application. Reusable component code refers to the code that can be reused in multiple micro-applications or multiple modules, including UI components, general function libraries, etc.
[0074] In this embodiment, by dividing the common part code to form a reusable component code module, the reusability of the code is improved and repeated development work is reduced. By dividing the common part code into independent component code modules, each module can be optimized and resource configured separately, thereby improving the utilization rate of system resources.
[0075] In an exemplary embodiment, step S206 compresses the extracted code modules, including: dividing multiple code modules into multiple module sets, compressing the multiple module sets separately to obtain corresponding module resource packages; each module set includes multiple code modules matching the micro-application functions; or, compressing each code module separately to obtain a corresponding module resource package.
[0076] In actual applications, compression rules are formulated to specify how to select and combine modules for compression. According to the compression rules, the user interface module, business logic module and data access module are extracted from multiple code modules and compressed as a whole to generate a ZIP file. At the same time, for some independent function modules, such as the log module and the authentication module, they are compressed separately to generate multiple files in ZIP file format.
[0077] In this embodiment, the file size of the code module is reduced by compression processing, the resource utilization efficiency is improved, and the transmission and storage costs are reduced. The coupling between different modules is reduced by function matching compression processing, and the stability and scalability of the system are improved.
[0078] In an exemplary embodiment, step S208 updates the target module resource package among the stored multiple module packages, including: obtaining the update module resource package uploaded by the developer, and determining the target module resource package to be updated among the stored multiple module resource packages; while keeping other module resource packages unchanged, replacing the target module resource package with the update module resource package; the other module resource packages are the module resource packages other than the target module resource package among the multiple module resource packages.
[0079] Specifically, first, determine the business logic module resource package as the target module resource package. Then, download the new business logic module resource package from the server and replace the old business logic module resource package with the new resource package. While keeping the user interface module and data access module unchanged, reconfigure the micro application so that it can correctly load and run the new business logic module resource package. Finally, perform testing and verification to ensure that the updated micro application can work properly.
[0080] In this embodiment, by updating only the target module resource package and keeping other module resource packages unchanged, the system change range is reduced and the stability of the update process is improved. Keeping other module resource packages unchanged during the update process ensures the stability of other functions of the micro-application during the update and reduces the risk of system failure.
[0081] In an exemplary embodiment, Figure 3 As shown, another micro-application update method is provided, which is applied to Figure 1The client in the example is used to illustrate, including the following steps S302 to S304. Among them:
[0082] Step S302: Detect a micro-application update event and obtain a target module resource package from a server.
[0083] Exemplarily, the client system detects the update event of the micro-application, chooses to use WebSocket (network interface) for real-time monitoring, and the client establishes a WebSocket connection with the server to receive update event notifications in real time. When the server detects that a new business logic module has been released, it immediately sends an update event notification to the client via WebSocket. The client system detects that the server has released an update event for a business logic module. The client sends a request to obtain the target module resource package to the server's interface via HTTP POST (network request). After receiving the request, the server searches for the latest business logic module resource package from the storage system and returns it to the client via HTTP (communication protocol) response. After receiving the response, the client downloads the business logic module resource package to the local storage directory and prepares for the update operation.
[0084] Step S304: Update the micro-application on the client according to the target module resource package.
[0085] Specifically, after the client system detects an update event, it obtains the latest target module resource package from the server. Before updating, the client backs up the existing business logic module resource package to the local backup directory. Then, the client deletes the old business logic module resource package and places the new resource package in the original location. Next, the client updates the micro-application configuration file and reloads the micro-application to apply the new module resource package. Finally, the client executes the automated test script to verify that all functions and performance of the business logic module are normal. If a problem is found, the client will delete the new module, restore the backed-up old module, and restart the micro-application.
[0086] In this embodiment, by downloading and updating only the target module resource package, the amount of data transmitted and the update time are reduced; modular updates reduce the impact on other parts of the system, reduce system downtime, and improve update efficiency; by backing up existing modules and rolling back processing, the system is ensured to be secure during the update process to prevent system unavailability due to update failure.
[0087] In order to enable those skilled in the art to better understand the above steps, the embodiment of the present application is illustrated below by using an example, but it should be understood that the embodiment of the present application is not limited to this.
[0088] Specifically, the server system continuously monitors the code repository, function changes, and security vulnerabilities of the micro-application. After detecting an update event, the code is modularized into multiple independent modules according to the logical structure and function division of the micro-application code. These modules are packaged into multiple module resource packages based on the function matching principle, including framework logic code, library file code, common component code, and specific business logic code. The server subpackages these module resource packages and uploads them to the specified storage location, recording the version information and storage path.
[0089] When the client system detects an update event for a micro-application, the client requests the target module resource package from the server through the API (Application Programming Interface). After receiving the request, the server searches for the corresponding target module resource package from the storage system, packages it, and returns it to the client through the API interface. After the client downloads the target module resource package, it backs up the existing module resource package, replaces the old module resource package, and reconfigures and loads the micro-application to ensure that the new module resource package works properly. The client then performs functional testing, performance testing, and regression testing to verify the functionality and performance of the updated micro-application. If problems are found during testing or after the update, the client can roll back to the previously backed-up version to ensure the stability and availability of the system.
[0090] In this embodiment, through this modular update and management approach, the server can effectively reduce the degree of correlation between system codes, improve the independence and reusability of codes, optimize resource utilization, and enhance the maintainability and scalability of the system. The client ensures that micro-applications can be updated in a timely and secure manner through an efficient detection and update mechanism, thereby improving the stability of the system.
[0091] 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.
[0092] Based on the same inventive concept, the embodiment of the present application also provides a micro-application update device for implementing the micro-application update method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more micro-application device embodiments provided below can refer to the limitations of the micro-application method above, and will not be repeated here.
[0093] In an exemplary embodiment, Figure 4 As shown, a micro-application update device is provided, including: a code acquisition module, a code decoupling module, a sub-package management module and an application update module, wherein:
[0094] The code acquisition module 420 is used to acquire the micro-application code corresponding to the micro-application;
[0095] A code decoupling module 440 is used to decouple the micro-application code into multiple code modules according to the logical structure and code function of the micro-application code;
[0096] The sub-packaging management module 460 is used to perform sub-packaging processing on multiple code modules to obtain and store multiple module resource packages; each module resource package is generated based on at least one code module matching the code function;
[0097] The application update module 480 is used to update the target module resource package in the stored multiple module resource packages when a micro-application update event is detected, and send the updated target module resources to the client so that the client can update the micro-application on the client based on the updated target module resource package.
[0098] In one embodiment, the code decoupling module 440 is used to:
[0099] A micro-application code segmentation rule is obtained; the micro-application code segmentation rule is determined according to the logical result and code function of the micro-application code; the micro-application code is segmented according to the micro-application code segmentation rule to obtain multiple decoupled code modules.
[0100] In one embodiment, the code decoupling module 440 is used to:
[0101] According to the micro-application code segmentation rules, the framework logic code and library file code corresponding to the micro-application are segmented from the micro-application code, and the framework code module is obtained according to the framework logic code and the library file code.
[0102] In one embodiment, the code decoupling module 440 is used to:
[0103] According to the micro-application code segmentation rule, reusable component codes are segmented from the common part of the micro-application, and component code modules are obtained based on the reusable component codes.
[0104] In one embodiment, the sub-contract management module 460 is used to:
[0105] Extract multiple code modules based on micro-application function matching from multiple code modules, and compress the extracted multiple code modules; or, compress each code module separately to obtain a corresponding module resource package.
[0106] In one embodiment, the application update module 480 is used to:
[0107] Determine a target module resource package to be updated among multiple module resource packages; update the micro-application using the target module resource package while keeping other module resource packages unchanged; the other module resource packages are module resource packages other than the target module resource package among the multiple module resource packages.
[0108] In an exemplary embodiment, Figure 5 As shown, another micro-application updating device is provided, comprising:
[0109] The update detection module 520 is used to obtain a target module resource package from the server when a micro-application update event is detected; wherein the micro-application is obtained based on multiple module resource packages, and the multiple module resource packages are obtained by the server by subpackaging multiple code modules of the micro-application, and each module resource package is generated based on at least one code module matching the micro-application function, and the code module is obtained by segmenting the micro-application code according to the logical structure of the micro-application code and the code function of the code fragment in the micro-application code;
[0110] The update execution module 540 is used to update the micro-application on the client according to the target module resource package.
[0111] Each module in the above-mentioned micro-application updating device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0112] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. 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. 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, near field communication (Near Field Communication, NFC) or other technologies. When the computer program is executed by the processor, a micro-application update method is implemented.
[0113] Those skilled in the art will understand that Figure 6 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.
[0114] 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.
[0115] 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.
[0116] 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.
[0117] 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 regulations.
[0118] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method 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 memory 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), magnetic 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, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0119] The technical features of the above embodiments may be combined arbitrarily. 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 application.
[0120] 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 understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations 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 micro-application updating method, characterized in that: The method comprises: Get the micro-application code corresponding to the micro-application; Decoupling the micro-application code into multiple code modules according to the logical structure and code function of the micro-application code; The plurality of code modules are packaged to obtain and store a plurality of module resource packages; each of the module resource packages is generated based on at least one code module matching the code function; When a micro-application update event is detected, a target module resource package among the stored multiple module resource packages is updated, and the updated target module resource package is sent to the client, so that the client updates the micro-application on the client based on the updated target module resource package.
2. The method according to claim 1, characterized in that Decoupling the micro-application code into multiple code modules according to the logical structure and code function of the micro-application code includes: Obtaining a micro-application code segmentation rule; the micro-application code segmentation rule is determined according to the logical result and code function of the micro-application code; The micro-application code is segmented according to the micro-application code segmentation rule to obtain a plurality of decoupled code modules.
3. The method according to claim 2, characterized in that The micro-application code is segmented according to the micro-application code segmentation rule to obtain a plurality of decoupled code modules, including: According to the micro-application code segmentation rule, the framework logic code and library file code corresponding to the micro-application are segmented from the micro-application code; A framework code module is obtained according to the framework logic code and the library file code.
4. The method according to claim 2, characterized in that: The micro-application code is segmented according to the micro-application code segmentation rule to obtain a plurality of decoupled code modules, including: According to the micro-application code segmentation rule, segmenting the reused component code from the common part of the micro-application code; A component code module is obtained according to the reused component code.
5. The method according to claim 1, characterized in that The step of compressing the extracted code module comprises: Divide the multiple code modules into multiple module sets, compress the multiple module sets respectively, and obtain the corresponding module resource packages; each module set includes multiple code modules matching the micro-application functions; or, Each code module is compressed separately to obtain the corresponding module resource package.
6. The method according to any one of claims 1 to 5, characterized in that The updating of the target module resource package in the stored multiple module packages includes: Acquire the update module resource package uploaded by the developer, and determine the target module resource package to be updated among the stored multiple module resource packages; The target module resource package is replaced by the update module resource package while keeping other module resource packages unchanged; the other module resource packages are module resource packages other than the target module resource package among the multiple module resource packages.
7. A micro-application updating method, characterized in that: The method comprises: In the case of detecting a micro-application update event, obtaining a target module resource package from a server; wherein the micro-application is obtained based on a plurality of module resource packages, the plurality of module resource packages are obtained by the server performing sub-packaging processing on a plurality of code modules of the micro-application, each of the module resource packages is generated based on at least one code module matching a micro-application function, and the code module is obtained by segmenting the micro-application code according to the logical structure of the micro-application code and the code functions of the code fragments in the micro-application code; The micro-application on the client is updated according to the target module resource package.
8. A micro-application updating device, characterized in that: The device comprises: A code acquisition module is used to obtain the micro-application code corresponding to the micro-application; A code decoupling module, used for decoupling the micro-application code into multiple code modules according to the logical structure and code function of the micro-application code; A sub-packaging management module is used to perform sub-packaging processing on the multiple code modules to obtain and store multiple module resource packages; each of the module resource packages is generated based on at least one code module matching the code function; The application update module is used to update the target module resource package among the stored multiple module resource packages when a micro-application update event is detected, and send the updated target module resources to the client, so that the client can update the micro-application on the client based on the updated target module resource package.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 or the steps of the method according to claim 7 are implemented.
10. 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 6 or the steps of the method according to claim 7 are implemented.