Micro application running method, device, equipment and storage medium
By parsing and rendering the view data of micro-applications through the platform server, the problem of high communication costs between micro-application developers and the platform server is solved, enabling efficient micro-application development and feature iteration.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2022-08-26
- Publication Date
- 2026-05-01
AI Technical Summary
When integrating micro-applications on an integrated platform, the communication costs between the micro-application's business server and the platform in existing technologies are high, which limits the speed of feature iteration and development efficiency.
The platform server obtains the micro-application's runtime data and protocol files, parses event declaration statements to obtain event codes, updates view data according to event handling logic, and renders the view based on the view layout, simplifying the micro-application development process.
It reduces the development difficulty and interaction costs for micro-application developers, improves the development efficiency and function iteration speed of micro-applications, and lowers development costs.
Smart Images

Figure CN115309377B_ABST
Abstract
Description
Micro-application operating methods, devices, equipment, and storage media Technical Field
[0001] This disclosure relates to the field of computer software technology, and in particular to the fields of cloud platforms and software development, specifically to a method, apparatus, device, and storage medium for operating a micro-application. Background Technology
[0002] In related technologies, integrating various micro-applications that provide business services on an integrated platform has become a mainstream business delivery model.
[0003] To address the need for integration between business scenarios and platforms, a joint development approach is currently adopted. The business server and platform provider of the micro-application need to clearly communicate and define their collaborative relationship in the platform's operation. This micro-application business service model incurs high costs in terms of manpower and time, and also limits the speed of feature iteration. Summary of the Invention
[0004] This disclosure provides a method, apparatus, device, and storage medium for operating a micro-application.
[0005] According to one aspect of this disclosure, a method for operating a micro-application is provided, comprising:
[0006] Obtain the runtime data and protocol files of the micro-application;
[0007] The event declaration statement is parsed from the protocol file, and the corresponding event code is obtained from the platform event library based on the event declaration statement;
[0008] The event code is executed according to the event handling logic in the protocol file to control the view data in the updated runtime data to be updated;
[0009] The view layout is parsed from the protocol file, and the view is rendered and generated based on the updated view data and the view layout for display.
[0010] According to another aspect of this disclosure, a device for operating a micro-application is provided, comprising:
[0011] The protocol file acquisition module is used to acquire the runtime data and protocol files of the micro-application;
[0012] The event code acquisition module is used to parse the event declaration statement from the protocol file and obtain the corresponding event code from the platform event library based on the event declaration statement;
[0013] The event code execution module is used to execute the event code according to the event handling logic in the protocol file in order to control the view data in the running data to be updated;
[0014] The view rendering module is used to parse the view layout from the protocol file, and render and generate a view based on the updated view data and the view layout for display.
[0015] According to another aspect of this disclosure, an electronic device is provided, comprising:
[0016] At least one processor; and
[0017] A memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in any one of the embodiments of this disclosure.
[0019] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the method described in any one of the embodiments of this disclosure.
[0020] According to the technical solution disclosed herein, the view data of a micro-application is determined by a platform server based on the micro-application's runtime data and protocol file. Then, according to the event declaration statements in the protocol file, the view data in the runtime data is updated. Based on the updated view data and the view layout specified in the protocol file, the view of the micro-application is displayed. This allows the platform server to provide event code, reducing the development difficulty for micro-application developers and the interaction cost of collaborative development between micro-application developers and the platform server. It simplifies the development work of integrating micro-applications into the platform server, improves the reusability of micro-application development data and general capabilities of the platform server, increases the development efficiency and functional iteration speed of micro-applications, and reduces the development cost of micro-applications.
[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0022] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0023] Figure 1 is a flowchart of a micro-application operation method provided in Embodiment 1 of this disclosure;
[0024] Figure 2 is a flowchart of another micro-application operation method provided in Embodiment 2 of this disclosure;
[0025] Figure 3 is a flowchart of another micro-application operation method provided in Embodiment 3 of this disclosure;
[0026] Figure 4 is a flowchart of another micro-application operation method provided in Embodiment 4 of this disclosure;
[0027] Figure 5 is a flowchart of another micro-application operation method provided in Embodiment 5 of this disclosure;
[0028] Figure 6 is a flowchart of another micro-application operation method provided in Embodiment Six of this disclosure;
[0029] Figure 7 is a schematic diagram of the operation process of a micro-application provided in Embodiment Six of this disclosure;
[0030] Figure 8 is an example diagram of protocol file parsing provided in Embodiment Six of this disclosure;
[0031] Figure 9 is a schematic diagram of the structure of a micro-application operating device provided in Embodiment 7 of this disclosure;
[0032] Figure 10 is a schematic diagram of the structure of an electronic device provided in Embodiment 8 of the present invention. Detailed Implementation
[0033] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0034] Example 1
[0035] Figure 1 is a flowchart of a micro-application running method provided in Embodiment 1 of this disclosure. This disclosure is applicable to situations where micro-applications run on a platform server. It is particularly applicable to micro-applications developed according to the development protocol provided by the platform, capable of utilizing the event functions provided by the platform server to call the platform's event code to implement the micro-application's functions. This method can be executed by a micro-application running device, which can be implemented in software and / or hardware, and can be integrated into the platform server to execute the method provided in this disclosure embodiment. Referring to Figure 1, the micro-application running method provided in this disclosure embodiment includes:
[0036] S110. Obtain the runtime data and protocol files of the micro-application.
[0037] The runtime data of a microapplication refers to the data required for its operation. This runtime data is provided during microapplication initialization and is updated as the application runs. During runtime, the runtime data can be provided by the microapplication's business server, the platform server, or input by the user. Initially, the runtime data is provided by the business server upon initial loading of the microapplication. Runtime data may include view data, which is used to render the microapplication's view on the platform server. Runtime data may also include control data, which represents the microapplication's running state or controls the running state—data not rendered in the view. However, control data may be processed to update view data. The state data of controls in the view can also serve as control data.
[0038] The protocol file controls the operation of the micro-application. In this embodiment, the micro-application is run through three types of objects: events, views, and data. Events can be categorized by function, and the event code that implements the event function is encapsulated and provided by the platform server, allowing the micro-application developer to write event declaration statements to call the event code. Views are used for display, and various controls can be set through view layout. Data includes, but is not limited to, runtime data, used to render and display views or control the operation of the micro-application.
[0039] Specifically, based on the development and operational needs of micro-applications, the platform server can pre-define protocol files and publish event functions that can be provided to micro-applications. When a micro-application is loaded and run on the platform server, the platform server receives the micro-application's protocol files and operational data from the business server.
[0040] S120. Parse the event declaration statement from the protocol file and obtain the corresponding event code from the platform event library based on the event declaration statement.
[0041] Event declaration statements are the invocation statements in the protocol file that call the event codes published by the platform server. The platform server can encapsulate and provide various general-purpose event codes, such as communication event codes, platform function event codes that the platform server can invoke, and event codes for processing runtime data. After parsing the event declaration statements from the protocol file, the platform server can obtain the corresponding event codes from the platform event library. The event declaration statements can include the identifier or name of the event code.
[0042] Specifically, after the platform server receives the microapplication's runtime data and protocol file, it parses the protocol file to obtain event declaration statements. There can be one or more event declaration statements, usually multiple. The event code corresponding to each event declaration statement can be loaded during initialization, or the event code can be loaded sequentially according to the microapplication's runtime progress.
[0043] S130. Execute the event code according to the event handling logic in the protocol file to control the updating of view data in the runtime data.
[0044] Event handling logic refers to the logic that calls event codes according to the required functions during the operation of a microapplication, as well as various functional logics such as data processing and view display. Event handling logic organizes various events, data, and views to realize the functionality of a microapplication. The main function of a microapplication is to interact with the user, primarily through views. Therefore, event handling logic can execute event codes as needed, controlling the updating of view data within the runtime data. For example, if a microapplication's function is to establish social relationships between users and recommend information of interest to followed users, the initial runtime data may include user information of existing followed users and information that these followed users are currently interested in, which is then rendered and displayed in the view. However, when a user triggers a control to update information through the view, the event handling logic will trigger a data update event, obtaining event codes to update the view data.
[0045] View data refers to the content data of the view used to render the microapplication on the platform server, such as the text that should be displayed in the view control, and the text, audio or video content displayed in the window of the view.
[0046] Specifically, after parsing the protocol file, the event handling logic and event codes can be obtained. The event codes are determined based on the event declaration statements, and the event codes are executed based on the event handling logic. The event handling logic may include, for example, preprocessing the data input to the event codes, postprocessing the output results of the event codes, or determining the subsequent event declaration statements to be executed based on the output results.
[0047] S140. Parse the view layout from the protocol file, and render and generate the view based on the updated view data and view layout for display.
[0048] Here, view layout refers to the layout data of various controls in the view interface. Optionally, view layout may also include defining the display area of the micro-application on the platform server's view interface, as well as the operation area for manipulating the micro-application.
[0049] Specifically, after parsing the protocol file, the view layout corresponding to the micro-application can be obtained. Based on the view layout, the controls that make up the micro-application's view are determined, along with the micro-application's display area and operation area on the platform server's view interface. The updated view data is then rendered on the micro-application's display area. Within this area, the controls corresponding to the view layout are constructed, and the micro-application's view is generated based on these controls. This view is then displayed through the platform server's view interface. Updated view data can be loaded into the corresponding controls for display according to the view layout requirements.
[0050] This embodiment of the disclosure obtains the micro-application's runtime data and protocol file; parses event declaration statements from the protocol file, and retrieves corresponding event codes from the platform's event library based on the event declaration statements; executes the event codes according to the event handling logic in the protocol file to control the updating of view data in the runtime data; parses the view layout from the protocol file, and renders and generates a view based on the updated view data and view layout for display. This embodiment of the disclosure implements event code provided by the platform server, reducing the development difficulty for micro-application developers and the interaction cost of collaborative development between micro-application developers and the platform server, simplifying the development work of integrating micro-applications into the platform server, improving the reusability of micro-application development data and general capabilities of the platform server, increasing the development efficiency and functional iteration speed of micro-applications, and reducing the development cost of micro-applications.
[0051] For example, based on the above embodiments, parsing the view layout from the protocol file includes: parsing the rendered view tree from the protocol file to obtain the view layout of each of the multiple views and the display order between the views.
[0052] The rendering view tree refers to the structural model used to represent the view layout and display order of the views in a microapplication. The display order of the views includes the navigation order and navigation logic between the views. The rendering view tree can be pre-set according to the display requirements of the microapplication.
[0053] Specifically, at least one view is displayed on the platform server's interface. The protocol file is parsed to obtain a rendered view tree, which consists of multiple nodes. These nodes represent the views of the micro-application; the connection order between nodes represents the display order of the views. Based on the nodes in the rendered view tree, the individual view layouts of the multiple views are determined; and based on the connection order of the nodes in the rendered view tree, the display order of the views is determined.
[0054] Understandably, the platform server parses the protocol file to obtain the rendering tree view tree, and obtains the view layout and display order of each view based on the rendering tree view tree. The platform server then renders the micro-application according to the view layout and display order, so that when there are multiple views in the rendering tree view tree, each view can be displayed accurately according to the display order.
[0055] Example 2
[0056] Figure 2 is a flowchart of another micro-application operation method provided in Embodiment 2 of this disclosure. This solution is based on the above solution and specifically optimizes the above step of "executing event code according to the event handling logic in the protocol file to control the updating of view data in the running data".
[0057] Referring to Figure 2, the operating method of the micro-application provided by this solution includes:
[0058] S210. Obtain the runtime data and protocol files of the micro-application.
[0059] When the micro-application is first loaded on the platform server, the view data in the running data is the initial data, and the view data updated during operation is the changed data.
[0060] Specifically, runtime data can include initial data, change data, and control data. Initial data refers to the data required by the platform server to load the micro-application; that is, the data needed by the platform server to initialize the micro-application. Change data refers to the view data that is updated during the micro-application's operation; for example, change data could be updated information data in the view. Control data is data unrelated to the micro-application's view rendering. Control data can be used to record and make decisions regarding the micro-application's state information. For example, if the current user of the micro-application is a member, and the micro-application's view displays a six-option menu, and the member selects the third option, then the control data can include: member user, function menu, six options, and selection of the third option. For non-member users, the function menu may have three options; therefore, user differentiation and menu option differentiation are recorded as control data and used for decision-making in subsequent processing.
[0061] S220. Parse the event declaration statement from the protocol file and obtain the corresponding event code from the platform event library based on the event declaration statement.
[0062] The event types can include communication events, platform function call events, and data update events.
[0063] It should be noted that different event types correspond to different event functions, and each type of event can have different event codes set for invocation. Communication events are used to execute communication interactions between the micro-application client and the business server, or any external communication interactions required by the micro-application client; platform function call events are used to invoke platform functions provided by the platform server; and data update events are used to process data according to the set processing strategy to determine the output data based on the input data, mainly used for processing view data and control data.
[0064] Specifically, communication events, platform function call events, and data update events are all event types that need to be obtained from the event file in the protocol file during the installation phase of the micro-application on the platform server. Some data used for rendering the micro-application view on the platform server can be pre-written into the data file within the protocol file. During the display of the micro-application, if updates are needed, the communication event can notify the business server to send new data.
[0065] S230. Execute the communication event code according to the event handling logic in the protocol file to communicate with the micro-application's business server, obtain new view data, and update the existing view data.
[0066] Specifically, according to the event handling logic of the communication events in the protocol file, the communication event code is executed to communicate with the micro-application's business server through the communication events, report view data or control data to the business server, and receive new view data from the business server, thereby updating the existing view data according to the new view data.
[0067] S240. Parse the view layout from the protocol file, and render and generate the view based on the updated view data and view layout for display.
[0068] Specifically, based on the view layout parsed from the protocol file and the updated view data, the view of the micro-application is rendered and displayed on the view interface of the platform server.
[0069] For example, the view layout includes control layout declarations, and the view is rendered based on the updated view data and view layout. This can also be achieved through the following sub-steps:
[0070] S2401. Obtain the corresponding control code from the platform control library based on the control layout declaration in the view layout.
[0071] Among them, the control layout declaration refers to the event declaration statement obtained after parsing the protocol file, which is used to lay out the controls in the view.
[0072] Specifically, after parsing the protocol file, the control layout declarations in the view layout are obtained. Based on the control layout declarations, the controls that need to be deployed in the view of the micro-application when the platform server renders the view of the micro-application are determined. Based on the control layout declarations, the control code required to deploy the controls in the view is called from the platform control library.
[0073] S2402. Render and generate the view based on the updated view data and control code.
[0074] For example, control types may include at least one of the following: interactive controls, input controls, and content controls.
[0075] Specifically, interactive controls are used to enable information exchange between the platform server and the user. When a user triggers an interactive event, the view of the micro-application can be adjusted based on the corresponding interactive information. The trigger event can be an event where the user initiates a function of the micro-application by pressing a button. For example, if a user needs an image provided by the micro-application, they can click the corresponding selection button, triggering the image selection event. Input controls are special interactive controls used to collect user information. The user information collected by input controls includes the user's input fields and corresponding function menus. Content controls are used to display necessary information in the micro-application's view when it is rendered on the platform server; that is, the information rendered by the micro-application on the platform server. This rendered information includes the micro-application's background color and function menus.
[0076] Specifically, based on the updated view data and control code, the view of the micro-application is rendered, and the view of the micro-application is generated on the view interface of the platform server.
[0077] Understandably, by obtaining the event declaration statements for laying out controls in the view based on the control layout declaration, the platform server can retrieve the control code required to render the micro-application's view without the involvement of the business server, through the parsing results of the protocol file. It can then render the micro-application's view based on the control code and the updated view data, further reducing the development cost of the micro-application for the business server.
[0078] This embodiment of the disclosure enables communication between the platform server and the business server by executing communication time codes. During the display of the micro-application's view, the view data can be updated according to the update data provided by the business server, thereby realizing dynamic changes in the micro-application's view.
[0079] Example 3
[0080] Figure 3 is a flowchart of another micro-application operation method provided in Embodiment 3 of this disclosure. This solution is based on the above solution and specifically optimizes the above step of "executing event code according to the event handling logic in the protocol file to control the updating of view data in the running data".
[0081] Referring to Figure 3, the micro-application operation method provided by this solution includes:
[0082] S310. Obtain the runtime data and protocol files of the micro-application.
[0083] S320. Parse the event declaration statement from the protocol file and obtain the corresponding event code from the platform event library based on the event declaration statement.
[0084] The event types can include communication events, platform function call events, and data update events.
[0085] S330. In accordance with the event handling logic in the protocol file, respond to the operation of the controls in the view before the update to obtain input data, input the input data into the data update event code, and obtain the new view data output to update the existing view data.
[0086] The input data can be user instructions obtained by interacting with input controls in the view before the update. The data update event code is the event code corresponding to the data update event in the event.
[0087] Specifically, after parsing the protocol file, the event handling logic is obtained. In response to the input data obtained from the operation of the controls in the view before the update, the event code corresponding to the data update event is executed, and the input data is input into the data update event code, thereby obtaining the new view data output. The existing view data in the data file is updated with the new view data.
[0088] S340. Parse the view layout from the protocol file, and render and generate the view based on the updated view data and view layout for display.
[0089] This solution parses the protocol file and, based on the parsing results, responds to input data obtained from operations on controls in the view before the update. It then updates event codes based on this input data and data in the event file to determine new view data, thereby updating existing view data in the data file. This solution uses controls in the view file to trigger data update events in the event file, enabling platform-based updates to existing view data. This simplifies development work for business servers when updating view data and improves the efficiency of view data updates in micro-applications.
[0090] Example 4
[0091] Figure 4 is a flowchart of another micro-application operation method provided in Embodiment 4 of this disclosure. This solution is based on the above solution and specifically optimizes the above step of "executing event code according to the event handling logic in the protocol file to control the update of view data in the running data".
[0092] Referring to Figure 4, the micro-application operation method provided by this solution includes:
[0093] S410: Obtain the runtime data and protocol files of the micro-application.
[0094] S420. Parse the event declaration statement from the protocol file and obtain the corresponding event code from the platform event library based on the event declaration statement.
[0095] The event types can include communication events, platform function call events, and data update events.
[0096] S430. According to the event handling logic in the protocol file, execute the platform function call event code to obtain the corresponding platform function feedback view data, so as to update the existing view data.
[0097] Among them, platform function call events refer to events sent by micro-applications to the platform server to invoke platform functions of the platform server. For example, querying the database provided by the platform server, utilizing storage space, and using some basic model calculation functions, such as identity recognition, image processing, and statistical calculation.
[0098] Specifically, the platform function call event is determined based on the parsing results of the protocol file. The platform function call event code is executed according to the platform function call event in the protocol file so that the platform server can process the platform function call event requirements based on the platform function and obtain the corresponding platform function feedback data. The data update event is then executed to update the existing view data in the data file.
[0099] S440. Parse the view layout from the protocol file, and render and generate the view based on the updated view data and view layout for display.
[0100] This solution parses the protocol file, obtains the platform function call event code based on the parsing results, calls the platform function according to the platform function call event code to obtain the view data fed back by the platform server, and updates the existing view data according to the view data fed back by the platform server. This improves the reusability of the platform functions provided by the platform server and reduces the development cost of micro-applications.
[0101] Example 5
[0102] Figure 5 is a flowchart of another micro-application operation method provided in Embodiment 5 of this disclosure. This solution, based on the above solution, calls event codes and platform functions according to the protocol file to display the platform function view; obtains input data, and continues to execute the event handling logic in the protocol file based on the input data. Referring to Figure 5, the micro-application operation method provided by this solution includes:
[0103] S510: Obtain the runtime data and protocol files of the micro-application.
[0104] S520: Parse the event declaration statement from the protocol file, and obtain the corresponding event code from the platform event library based on the event declaration statement.
[0105] The event types can include communication events, platform function call events, and data update events.
[0106] S530. Execute the platform function call event code according to the event handling logic in the protocol file to call the platform function and display the platform function view.
[0107] The platform function view refers to the view interface used to display the platform functions that can be invoked. For example, the platform function view may include callable data and button functions.
[0108] Specifically, based on the parsing results of the protocol file, the event declaration statements in the protocol file are obtained. The platform function call event codes to be executed are determined based on these event declaration statements. By executing the platform function call event codes, the platform functions are invoked, allowing the platform to display the invoked platform functions on the platform server's view interface through the platform function view. At this point, the view displayed on the view interface can include both the platform function view and the micro-application view. That is, the platform function view and the micro-application view can be embedded and mixed in a way when displayed on the screen.
[0109] In this embodiment, during the operation of a micro-application, it is possible not only to call the background functions of the platform server to perform data processing, but also to call the integrated functions of the platform server, which are available for the micro-application to access in the form of a platform function view. For example, based on the user database provided by the platform server, the currently logged-in user of the micro-application can make selections. In this case, not only is access to the user database and user information provided allowed, but it is also possible to directly call the user selection function view integrated by the platform server. This integrated function is reusable and can be called by multiple micro-applications.
[0110] S540: Responding to operations on controls in the platform function view, input data is obtained.
[0111] The input data can be either view data or control data. Input data refers to the data obtained in response to operations on controls in the platform's functional view. For example, if the platform's functional view displays user interaction controls, the user can input control data or view data through these controls. If the platform's functional view is used for user selection and contains option controls, then control data related to the user's selection can be input based on the user's actions on these options.
[0112] Specifically, control data is obtained in response to operations on input controls in the platform function view, or control data or view data is obtained in response to operations on interactive controls in the platform function view, or input view data is obtained in response to operations on content controls in the platform function view.
[0113] S550. Continue executing the event handling logic in the protocol file based on the input data.
[0114] Specifically, based on the input data, the event handling logic in the protocol file that needs to be executed is determined. If control data is received in response to controls in the platform's functional view, the event type triggered by the control data is determined. The corresponding event code is determined based on the parsing result of the protocol file and the event declaration statement triggered by the control data, and execution continues. If the received data is view data, the event code corresponding to the view data in the event declaration statement is executed based on the parsing result of the protocol file.
[0115] S560. Execute event code according to the event handling logic in the protocol file to control the updating of view data in the runtime data.
[0116] S570: Parse the view layout from the protocol file, and render and generate the view based on the updated view data and view layout for display.
[0117] The platform function call event code, the operation of calling the platform function, and the operation of changing the view data can be executed serially or in parallel. The event handling logic in the protocol file can be designed according to the needs of the micro-application, and this disclosure does not limit this.
[0118] This solution allows for the continued acquisition of input data in response to operations on controls within the platform's functional view during its display. Based on this input data and the event handling logic in the protocol file, the solution adjusts the view's interface accordingly. This enables the view to be automatically adjusted according to the protocol file based on input data during the display process, fully utilizing platform functionality, flexibly adjusting the view, simplifying the adjustment process for micro-application developers, and improving the efficiency of view adjustment.
[0119] Example 6
[0120] Figure 6 is a flowchart of another micro-application operation method provided in Embodiment Six of this disclosure. Based on the above solution, this solution proposes an optional implementation method that processes control data by executing event code according to the state data of controls in the updated view and the event handling logic in the protocol file. Referring to Figure 6, the micro-application operation method provided by this solution includes:
[0121] S610: Obtain the runtime data and protocol files of the micro-application.
[0122] S620. Parse the event declaration statement from the protocol file and obtain the corresponding event code from the platform event library based on the event declaration statement.
[0123] The event types can include communication events, platform function call events, and data update events.
[0124] S630. Execute the event code according to the event handling logic in the protocol file to control the updating of view data in the runtime data.
[0125] S640. Parse the view layout from the protocol file, and render and generate the view based on the updated view data and view layout for display.
[0126] S650, Get the state data of controls in the updated view.
[0127] In this context, control state data refers to the data that determines the view content of a microapplication. For example, control state data can be the data of the microapplication's menu options. A microapplication may contain multiple menu options, including main menu options and drop-down menu options. Different control state data will result in different displayed menu options. Control state data can be determined by user actions on the microapplication or by the microapplication's user attributes.
[0128] For example, if the user of the micro-application is a member user, the control's state data is member status, and the application menu provided to member users can have two main menu options and six drop-down menu options; if the user of the micro-application is a regular user, the control's state data is regular status, and the application menu provided to regular users can have one main menu option and three drop-down menu options.
[0129] Specifically, during the display of the micro-application's view on the platform server, the state data of controls in the updated view is obtained in real time. This control state data can include the state data of interactive controls, input controls, and content controls. Specifically, the state data of interactive controls in the updated view includes the interaction information corresponding to the currently received trigger events, which can be used to determine the menu options corresponding to the user's actions on the micro-application. The state data of input controls in the updated view includes the currently collected user information, which can be used to determine user attributes and, based on those attributes, the corresponding menu options. The state data of content controls in the updated view includes the information rendered by the micro-application on the platform server, which can be used to determine the menu options available in the updated view.
[0130] For example, different status data can correspond to different status values, and different status values correspond to different menu options in the application menu; for instance, the status data of a member user is status value one, and the menu options corresponding to status value one are two main menu options and six drop-down menu options; the status data of a regular user is status value two, and the menu options corresponding to status value two are one main menu option and three drop-down menu options.
[0131] S660. Execute the event code to process the status data according to the event handling logic and status data in the protocol file.
[0132] Specifically, based on the triggering logic and state data in the event handling logic, the event code corresponding to the event declaration statement is obtained and executed to process the state data.
[0133] Optionally, according to the event handling logic and state data in the protocol file, the event code is executed to process the state data, including at least one of the following steps:
[0134] S6601. Execute the communication event code according to the event handling logic and status data in the protocol file to communicate with the micro-application's business server and report the status data to the business server.
[0135] Specifically, if the event type triggered by the status data is a communication event, then the communication event code is executed according to the event handling logic corresponding to the communication event in the protocol file, so as to communicate with the micro-application's business server through the communication event, report the status data to the business server, and notify the business server to issue new view data based on the status data, so that the platform server can update the existing view data based on the new view data.
[0136] When executing communication event code, status data is reported to the business server, enabling real-time communication between the business server and the platform server to achieve timely adjustments to micro-applications.
[0137] S6602. Execute the platform function call event code according to the event handling logic and status data in the protocol file, so as to input the status data to the called platform function for processing.
[0138] Specifically, if the event type triggered by the state data is a platform function call event, then according to the event handling logic corresponding to the platform function call event in the protocol file, the platform function call event code is executed to call the platform function, the state data is processed according to the called platform function, the new view data is determined, and the platform server updates the existing view data according to the new view data.
[0139] Based on the status data, platform functions can be invoked through the protocol file. When status data is generated, platform functions can be invoked to process the status data, allowing the business server to fully utilize platform functions to process the status data.
[0140] S6603. Execute the data update event code according to the event handling logic and status data in the protocol file to control the updating of existing view data.
[0141] Specifically, if the event type triggered by the state data is a data update event, then according to the event handling logic and state data corresponding to the data update event in the protocol file, the data update event code is executed, and the existing view data is updated directly through the platform server to obtain the new view data output by the platform server.
[0142] For example, Figure 7 is a schematic diagram of the micro-application operation process provided in this embodiment. The protocol files include: a view file, an event file, and a data file. In Figure 7, the view refers to the view file, the event refers to the event file, and the data refers to the data file.
[0143] Specifically, the view file includes interactive controls, input controls, and content controls. The event file includes communication events, platform function call events, and data update events. The data file includes control data, initial data, and changed data.
[0144] When the business server of a micro-application needs to render the micro-application on the platform server, the platform server receives the micro-application's protocol file and the runtime data sent by the business server. It uses the runtime data as the data file within the protocol file and parses the protocol file to obtain event declaration statements. Based on these event declaration statements, it triggers platform function call events, retrieves the corresponding event codes from the platform event library, and triggers the platform logic corresponding to the platform function call event. This platform logic is the event handling logic corresponding to the platform function call event in the protocol file. Finally, based on the platform logic, the initial data in the runtime data, and the event codes, the micro-application's view is rendered.
[0145] If a control in the view triggers a communication event, the communication event code is executed according to the event handling logic corresponding to the communication event. This allows communication with the business server to notify the business server to send new data. The new data sent by the business server is then used as the changed data in the data file, and the view file is driven by the changed data to adjust the view of the micro-application.
[0146] If a control in the view triggers a data update event, the data update event code is executed according to the event handling logic corresponding to the data update event. The input data obtained in response to the control in the view is then entered into the data update event code in the event file, thereby obtaining the new view data output. The new view data is used as the changed data in the data file, and the view file is driven according to the changed data to adjust the view of the micro-application.
[0147] The state data of each control in the view file is used as the control data in the data file. Based on the platform logic and the control data, the data update event code is executed to obtain the updated control data. The updated control data then drives the view file to adjust the view of the micro-application.
[0148] This solution determines the event code to be executed and the control data processing method based on the event type, allowing for flexible selection of control data processing methods. It fully utilizes the platform server's platform functions, improves the communication efficiency between the business server and the platform server in collaborative development of micro-applications, simplifies the business server's control data processing steps, and reduces the business server's development cost for micro-applications.
[0149] For example, Figure 8 is a diagram illustrating a protocol file parsing example provided in an embodiment of this disclosure.
[0150] Specifically, the micro-application's business server sends runtime data and protocol files to the platform server for micro-application initialization. The runtime data refers to the raw data. The platform server parses the protocol files, obtaining the rendered view tree and event declaration statements from the protocol files based on the parsing results. It then sends these event declaration statements to the event handling center. The event handling center can be used for handling communication events, platform function call events, input value management for input controls, and data update events.
[0151] Among them, event processing of communication events refers to the execution of event processing logic corresponding to communication events through the event processing center, establishing a communication connection between the platform server and the business server, so that the business server can receive requests based on the communication information between the business server and the platform server, send update data of the micro-application to the platform server according to the data sent by the platform server, and generate view data of the micro-application based on the update data and the original data.
[0152] Input value management of input controls refers to the process where, when an input control in a view file receives user information, the event handling logic corresponding to the input value is executed through the event handling center. The control data is then processed based on the event handling logic and event code to obtain the view data for the micro-application.
[0153] Event handling for platform function call events refers to executing the event handling logic corresponding to the platform function call event through the event handling center, obtaining the view data fed back by the platform function based on the event code, updating the existing view data, and obtaining the updated view data.
[0154] Event handling for data update events refers to executing the event handling logic corresponding to the data update event through the event handling center. When input data is obtained by responding to controls in the view, the input data is entered into the data update event code to obtain the new view data output, thereby updating the existing view data and obtaining the updated view data.
[0155] The updated view data is mapped onto the view rendering tree to replace the attribute data of each node in the view rendering tree according to the updated view data, so as to render the view of the micro-application and display the view of the micro-application through the view interface of the platform server.
[0156] Example 7
[0157] Figure 9 is a schematic diagram of a micro-application running device provided in Embodiment 7 of this disclosure. This embodiment is applicable to the situation where micro-applications are running on a platform server. As shown in Figure 9, the micro-application running device provided in this embodiment includes: a protocol file acquisition module 710, an event code acquisition module 720, an event code execution module 730, and a view rendering module 740.
[0158] The protocol file acquisition module 710 is used to acquire the running data and protocol file of the micro-application.
[0159] The event code acquisition module 720 is used to parse the event declaration statement from the protocol file and obtain the corresponding event code from the platform event library based on the event declaration statement;
[0160] The event code execution module 730 is used to execute event codes according to the event handling logic in the protocol file in order to control the updating of view data in the running data;
[0161] The view rendering module 740 is used to parse the view layout from the protocol file, and render and generate the view based on the updated view data and view layout for display.
[0162] This embodiment of the disclosure obtains the micro-application's runtime data and protocol file; parses event declaration statements from the protocol file, and retrieves corresponding event codes from the platform's event library based on the event declaration statements; executes the event codes according to the event handling logic in the protocol file to control the updating of view data in the runtime data; parses the view layout from the protocol file, and renders and generates a view based on the updated view data and view layout for display. This embodiment of the disclosure implements event code provided by the platform server, reducing the development difficulty for micro-application developers and the interaction cost of collaborative development between micro-application developers and the platform server, simplifying the development work of integrating micro-applications into the platform server, improving the reusability of micro-application development data and general capabilities of the platform server, increasing the development efficiency and functional iteration speed of micro-applications, and reducing the development cost of micro-applications.
[0163] For example, event types include communication events, platform function call events, and data update events.
[0164] For example, the event code execution module 730 includes:
[0165] The communication unit is used to execute communication event codes according to the event handling logic in the protocol file to communicate with the business server of the micro-application, obtain new view data, and update the existing view data.
[0166] For example, the event code execution module 730 also includes:
[0167] The data input unit is used to input the data into the data update event code in response to the operation of the controls in the view before the update, according to the event handling logic in the protocol file, so as to obtain the new view data output to update the existing view data.
[0168] For example, the event code execution module 730 also includes:
[0169] The platform function call unit is used to execute the platform function call event code according to the event handling logic in the protocol file, and obtain the corresponding platform function feedback view data to update the existing view data.
[0170] Furthermore, the operating device for the aforementioned micro-application also includes:
[0171] The platform function display module is used to execute platform function call event code according to the event handling logic in the protocol file, call platform functions, and display the platform function view.
[0172] The data acquisition module is used to obtain input data in response to operations on controls in the platform's functional view;
[0173] The event handling logic execution module is used to continue executing the event handling logic in the protocol file based on the input data.
[0174] Furthermore, the operating device for the aforementioned micro-application also includes:
[0175] The state data acquisition module is used to acquire the state data of controls in the updated view;
[0176] The status data processing module is used to execute event codes to process status data according to the event processing logic and status data in the protocol file.
[0177] For example, the state data processing module includes at least one of the following functional units:
[0178] The communication event code execution unit is used to execute communication event codes according to the event handling logic and status data in the protocol file, so as to communicate with the business server of the micro-application and report the status data to the business server.
[0179] The status data processing unit is used to execute platform function call event code according to the event handling logic and status data in the protocol file, so as to input the status data to the called platform function for processing;
[0180] The view data update unit is used to execute data update event code according to the event handling logic and state data in the protocol file, so as to control the update of existing view data.
[0181] For example, the view rendering module 740 includes:
[0182] The render view tree acquisition unit is used to parse the render view tree from the protocol file to obtain the view layout of each of the multiple views and the display order between the views.
[0183] For example, the view layout described above includes control layout declarations, and correspondingly, the view rendering module 740 is specifically used for:
[0184] Based on the control layout declaration in the view layout, obtain the corresponding control code from the platform control library;
[0185] The view is rendered based on the updated view data and control code.
[0186] For example, the view data in the above running data is the initial data, and the updated view data is the changed data.
[0187] The micro-application running device provided in this embodiment can be applied to the micro-application running method provided in any of the above embodiments, and has corresponding functions and beneficial effects.
[0188] Example 8
[0189] Figure 10 illustrates a schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0190] As shown in Figure 10, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer programs stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0191] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0192] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the methods for running micro-applications.
[0193] In some embodiments, the method of running the microapplication may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method of running the microapplication described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the method of running the microapplication by any other suitable means (e.g., by means of firmware).
[0194] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0195] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0196] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0197] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0198] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0199] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0200] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0201] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for running a micro-application, the method comprising: Obtain the runtime data and protocol files of the micro-application; The event declaration statements are parsed from the protocol file, and the corresponding event codes are obtained from the platform event library based on the event declaration statements. The event types include platform function call events. The platform function call event code is executed according to the event handling logic in the protocol file to call the platform function and display the platform function view. Input data is obtained in response to operations on controls in the platform function view. The event handling logic in the protocol file is further executed based on the input data. The event code is executed according to the event handling logic in the protocol file to control the view data in the running data to be updated. The view layout is parsed from the protocol file, and the view is rendered and generated based on the updated view data and the view layout for display.
2. The method according to claim 1, wherein, The event types also include communication events and data update events.
3. The method according to claim 2, wherein, Executing the event code according to the event handling logic in the protocol file to control the updating of view data in the running data includes: executing communication event code according to the event handling logic in the protocol file to communicate with the micro-application's business server to obtain new view data to update the existing view data.
4. The method according to claim 2, wherein, Executing the event code according to the event handling logic in the protocol file to control the view data in the running data to be updated includes: according to the event handling logic in the protocol file, in response to the operation of the control in the view before the update, obtaining input data, inputting the input data into the data update event code, obtaining the output new view data, and updating the existing view data.
5. The method according to claim 1, wherein, Executing the event code according to the event handling logic in the protocol file to control the updating of view data in the running data includes: executing platform function call event code according to the event handling logic in the protocol file to obtain the view data fed back by the corresponding platform function, so as to update the existing view data.
6. The method according to claim 2, wherein, The method further includes: obtaining the state data of the controls in the updated view; and executing the event code according to the event handling logic in the protocol file and the state data to process the state data.
7. The method according to claim 6, wherein, According to the event handling logic in the protocol file and the status data, executing the event code to process the status data includes at least one of the following: according to the event handling logic in the protocol file and the status data, executing communication event code to communicate with the micro-application's business server and report the status data to the business server; according to the event handling logic in the protocol file and the status data, executing platform function call event code to input the status data to the called platform function for processing; According to the event handling logic and the state data in the protocol file, execute the data update event code to control the update of existing view data.
8. The method according to claim 1, wherein, The view layout obtained from the protocol file includes: parsing the rendered view tree from the protocol file to obtain the view layout of each of the multiple views and the display order between the views.
9. The method according to claim 1, wherein, The view layout includes control layout declarations. Rendering and generating a view based on the updated view data and the view layout includes: obtaining the corresponding control code from the platform control library based on the control layout declarations in the view layout; and rendering and generating the view based on the updated view data and the control code.
10. The method according to claim 1, wherein, The view data in the running data is the initial data, and the updated view data is the changed data.
11. A device for operating a micro-application, comprising: The protocol file acquisition module is used to acquire the runtime data and protocol files of the micro-application; The event code acquisition module is used to parse event declaration statements from the protocol file and obtain corresponding event codes from the platform event library based on the event declaration statements; wherein, the event type includes platform function call events; the platform function display module is used to execute the platform function call event code according to the event handling logic in the protocol file to call platform functions and display the platform function view; the data acquisition module is used to obtain input data in response to the operation of controls in the platform function view; the event handling logic execution module is used to continue to execute the event handling logic in the protocol file according to the input data; the event code execution module is used to execute the event code according to the event handling logic in the protocol file to control the view data in the running data to be updated; the view rendering module is used to parse the view layout from the protocol file and render and generate a view based on the updated view data and the view layout for display.
12. An electronic device, wherein, include: At least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-10.
13. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-10.
Citation Information
Patent Citations
Low-code application software development system and method
CN110825362A
Page rendering method and device
CN111158818A