WO2023124657A1 - Micro-application running method and apparatus, device, storage medium, and program product - Google Patents

Micro-application running method and apparatus, device, storage medium, and program product Download PDF

Info

Publication number
WO2023124657A1
WO2023124657A1 PCT/CN2022/133516 CN2022133516W WO2023124657A1 WO 2023124657 A1 WO2023124657 A1 WO 2023124657A1 CN 2022133516 W CN2022133516 W CN 2022133516W WO 2023124657 A1 WO2023124657 A1 WO 2023124657A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
action
controller
micro
application
Prior art date
Application number
PCT/CN2022/133516
Other languages
French (fr)
Chinese (zh)
Inventor
杨俊拯
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2023124657A1 publication Critical patent/WO2023124657A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt

Definitions

  • the embodiments of the present application relate to the field of application technology, and in particular to a micro-application running method, device, equipment, storage medium, and program product.
  • the user Before using the application, the user first needs to download the application installation package from the application store, and install the application on the terminal by parsing the application installation package, and then click the application icon to start the application.
  • the storage space required by the application is also increasing.
  • Embodiments of the present application provide a micro-application running method, device, device, storage medium, and program product. Described technical scheme is as follows:
  • the embodiment of the present application provides a method for running a micro-application, the method comprising:
  • the target micro-application script is composed of at least one trigger
  • the embodiment of the present application provides a micro-application running device, the device includes:
  • a script acquisition module configured to acquire a target micro-application script of the target micro-application, wherein the target micro-application script is composed of at least one trigger;
  • a trigger module configured to trigger a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event
  • a data reading module configured to read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas;
  • An action calling module configured to execute a target calling action corresponding to the target trigger based on the event parameter.
  • an embodiment of the present application provides a computer device, the computer device includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the following: The running method of the micro-application described in the above aspect.
  • an embodiment of the present application provides a computer-readable storage medium, where at least one piece of program code is stored in the computer-readable storage medium, and the program code is loaded and executed by a processor to implement the above aspects.
  • the running method of the microapp is not limited to:
  • an embodiment of the present application provides a computer program product or computer program, where the computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium.
  • the processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the micro-application running method provided in various optional implementation manners of the above aspect.
  • Fig. 1 is a schematic diagram of a micro-application software package shown in an exemplary embodiment of the present application
  • Fig. 2 is a schematic diagram of a micro-application script shown in an exemplary embodiment of the present application
  • FIG. 3 shows a system architecture diagram of a micro-application system provided by an exemplary embodiment of the present application
  • FIG. 4 shows a flowchart of a micro-application running method provided by an exemplary embodiment of the present application
  • Fig. 5 shows a schematic diagram of a trigger scope shown in an exemplary embodiment of the present application
  • FIG. 6 shows a flow chart of a micro-application running method provided by another exemplary embodiment of the present application.
  • Fig. 7 shows a schematic diagram of simple action types and combined action types shown in an exemplary embodiment of the present application
  • FIG. 8 shows a schematic diagram of a child node acting on an exemplary embodiment of the present application
  • Fig. 9 shows a schematic diagram of the relationship among sub-node scopes, trigger scopes and global scopes shown in an exemplary embodiment of the present application.
  • FIG. 10 shows a flow chart of a micro-application running method provided by another exemplary embodiment of the present application.
  • Fig. 11 shows a schematic diagram of a condition controller shown in an exemplary embodiment of the present application
  • Fig. 12 shows a schematic diagram of a cycle controller shown in an exemplary embodiment of the present application
  • Fig. 13 shows a schematic diagram of a delay controller shown in an exemplary embodiment of the present application
  • Fig. 14 shows a schematic diagram of a condition controller shown in an exemplary embodiment of the present application
  • Fig. 15 shows a schematic diagram of a selection controller shown in an exemplary embodiment of the present application
  • Fig. 16 shows a schematic diagram of a parallel controller shown in an exemplary embodiment of the present application
  • FIG. 17 shows a structural block diagram of a micro-application running device provided by an embodiment of the present application.
  • Fig. 18 shows a structural block diagram of a computer device provided by an exemplary embodiment of the present application.
  • Micro-applications can be regarded as a collection of services, which are used to implement specific business logic through calls between services, that is, micro-application functions of micro-applications. Unlike traditional applications that can only run on a specific operating system, the services of micro-apps can be services on different operating systems, that is, micro-apps support heterogeneous operating systems and can run across platforms.
  • micro-apps adopt a subscription mechanism and are bound to users. This microapp can be used.
  • the micro-application software package 100 of the micro-application consists of an application description file 110, a program file 120 (micro-application script) and an MD5 file 130, wherein the application description file 110 is used to perform some simple operations on the micro-application Description, including the author, version information, time, etc. of the micro-application; the program file 120 is used for the core file in the micro-application software package, which is the main generated part edited by the developer through the editor, and is also the scheduling object of the micro-application engine;
  • the MD5 file 130 is used for integrity verification of the micro-application software package 100 .
  • Micro-application script also known as micro-application definition, it is used to control the calling relationship between services in micro-applications, and uses scripting language to describe a general business logic.
  • the scripting language can be xml, javascript, JSON, YMAL, C++, Python, etc., or some grammatical format customized by the user.
  • micro-application script 11 is composed of several triggers 12 , and each trigger 12 is composed of trigger event 13 , control logic 14 and several services 15 controlled by control logic 14 .
  • the service in the micro-application script is not the service itself, but the service identifier of the service.
  • the service 15 may also be called a simple action or an action.
  • micro-application scripts have a lower code volume, so they occupy less storage space and are conducive to dynamic deployment and updates.
  • the screen capture service is used to realize the screen capture function of the device
  • the screen projection service is used to realize the screen projection of the display screen between devices, and so on.
  • the service invoked during the running of the micro-app may be a service on the current device or a service on other devices. For example, during the running of the micro-app, you can obtain the device screenshots of other devices by calling the screenshot service on other devices, and display the device screenshots of other devices by calling the image display service.
  • Action refers to the smallest granularity action entity that is directly invoked and executed during the running process of the micro-application.
  • Simple actions include actions provided by the micro-application system itself and service actions registered by service developers. Actions provided by the system include: device selection action, multi-action, reset application action, traversal list action, custom parameter action, parameter setting action, etc.; service action is a service developer registers a service, and the corresponding micro-app will be automatically generated Service actions, such as: screenshot action, open camera action, open screen mirroring server action, open screen mirroring client action, etc.
  • simple actions are executed through the control logic, so as to realize the invocation of the service corresponding to the simple action.
  • the services in the micro-application support dynamic deployment, that is, during the running process Based on the business logic executed by the current device, the service corresponding to the business logic is dynamically deployed to the current device.
  • the micro-application function of the same micro-application is implemented through multiple devices, since the business logic of different devices may be different, the services deployed on different devices may also be different, that is, the services in the micro-application have the characteristics of differential deployment .
  • the services constituting the micro-application may include static services and dynamic services, wherein the static services refer to the services provided by the host application and need to be pre-installed in the device, while the dynamic services refer to the services that support dynamic deployment. It can be dynamically deployed in the device during the running of the micro application.
  • Fig. 3 shows a system architecture diagram of a micro-application system provided by an exemplary embodiment of the present application.
  • the system includes at least one computer device 210 and a server 220 .
  • the computer device 210 is an electronic device with a micro-application running function.
  • the electronic device may be a smart phone, a tablet computer, a personal computer, a car machine, etc., which is not limited in this implementation.
  • the device 210 includes a smart phone, a tablet computer, and a car machine as an example for illustration, but this is not limited thereto.
  • the computer device 210 is provided with a micro-application engine 211.
  • the micro-application engine 211 serves as the core for controlling the operation of the micro-application, including a script management module 2111, an event bus module 2112, an application scheduling module 2113, and a runtime Module 2114 and service scheduling module 2115.
  • the script management module 2111 is used to manage the micro-application scripts of each micro-application stored in the computer device 210, and is responsible for analyzing the micro-application scripts, so as to determine the triggers in the micro-application scripts and the services under the triggers.
  • the script management module 2111 is further configured to download the corresponding micro-application script when receiving a micro-application subscription operation, and delete the micro-application script corresponding to the micro-application when receiving a micro-application subscription cancellation operation.
  • the event bus module 2112 is used to cooperate with the application scheduling module 2113 to implement micro-application scheduling based on trigger events.
  • triggers corresponding to multiple micro-applications are mounted under the event bus module 2112. Since the same trigger event may trigger multiple subscribing micro-applications, after the event bus module 2112 receives the trigger event, the The application scheduling module 2113 determines the micro-applications that need to be run from several micro-applications. Wherein, the application scheduling module 2113 can automatically determine the micro-application based on the scheduling strategy, or allow the user to manually select the micro-application.
  • the runtime module 2114 is used to execute the control logic in the micro-application script, so as to interact with the service scheduling module 2115 based on the control logic, and the service scheduling module 2115 makes a service call.
  • the computer device 210 is also provided with a service management module 212 , a data synchronization module 213 and a service gateway 214 .
  • the service management module 212 is used to manage the pre-installed static services in the device;
  • the data synchronization module 213 is used to update the status to other computer devices when the state of the micro-application engine 211 changes (for example, an event generated by the service causes a state change). Synchronization ensures the state consistency of the micro-application engine 211 on different computer devices.
  • the service gateway 214 is configured to perform service invocation based on the service invocation request of the service scheduling module 2115 , and specifically includes an agent management module 2141 and a life cycle management module 2142 .
  • the proxy management module 2141 is provided with different service proxies, and the service proxies are used to convert service invocation requests in a unified format to obtain requests that meet the requirements of the real service format.
  • the lifecycle management module 2142 is used to manage the lifecycle of the service, and may include a static service lifecycle management module and a dynamic service lifecycle management module.
  • the computer device 210 can not only make service calls through its own service gateway 214, but also make service calls through the service gateway 214 of other devices (determined by the business logic of the micro-application), that is, cross-device service call.
  • a static service module 216 and a dynamic service module 215 are also provided in the computer device 210 .
  • the static service module 216 is used to manage pre-installed static services
  • the dynamic service module 215 is used to manage dynamically deployed dynamic services.
  • the services contained in the dynamic service module 215 may correspond to different operating environments, different deployment forms or different programming development languages.
  • the dynamic service module 215 includes the Android dynamic service 2151 , the Web dynamic service 2152 and the container dynamic service 2153 as an example for schematic illustration, but this is not limited thereto.
  • the server 220 is a server, a service cluster composed of several servers, or a cloud computing center. According to the functions realized by each server in the server cluster, as shown in FIG. 3 , the server cluster includes a user resource management server 221 , a micro application store server 222 , a service market server 223 and a cloud service library 224 .
  • the user resource management server 221 includes a user management module 2211 , an application management module 2212 , a service management module 2213 , a device management module 2214 and a security module 2215 .
  • the user management module 2211 is used to manage the user accounts using micro-applications;
  • the application management module 2212 is used to manage the micro-applications subscribed under different user accounts;
  • the service management module 2213 is used to manage the invoked services;
  • the device management module 2214 is used to manage the binding relationship between the user account and the device;
  • the security module 2215 is used to perform security verification during the interaction process.
  • the micro application store server 222 is used to provide micro application subscription services. When a user needs to use a micro-app, he can search for the micro-app through the micro-app search engine 2221 provided by the micro-app store server 222, and then choose to subscribe to the micro-app from the search results.
  • the micro application store server 222 After the micro application store server 222 receives the subscription operation to the micro application, it sends the user account and the application identification of the subscribed micro application to the user resource management server 221, and the application management in the user resource management server 221 Module 2212 updates the subscription relationship between the user account and the micro-application. Further, the user management module 2211 and the device management module 2214 determine other devices under the user account, and push subscription notifications to other devices, so that other devices download the micro application script of the micro application from the micro application store server 222.
  • the service market server 223 is a server for developers to provide service inquiry services. Developers can search for services through the service search engine 2231 provided by the service market server 223, and apply the searched services to the developed micro-applications, and then upload the developed micro-applications to the micro-application store server 222 for other users Download and use.
  • developers can also develop dynamic services and upload the developed dynamic services to the cloud service library 224 .
  • the subsequent computer device 210 can download and deploy the dynamic service from the cloud service library 224 .
  • micro-application system may also include other computer devices (such as developer devices) or servers that implement other functions, and this embodiment does not constitute limited.
  • FIG. 4 shows a flow chart of a micro-application running method provided by an exemplary embodiment of the present application.
  • the embodiment of the present application takes the application of the method to the computer device shown in FIG. 3 as an example for illustration.
  • the method include:
  • Step 401 acquiring a target micro-application script of a target micro-application, where the target micro-application script consists of at least one trigger.
  • the computer device when receiving the startup instruction of the target micro-application, the computer device obtains the target micro-application script corresponding to the target micro-application from the locally stored micro-application script, wherein the local storage of the computer device is determined by the current The microapp script of the microapp subscribed by the logged in user account.
  • the start instruction can be triggered by the user clicking the micro-application icon, or can be triggered by interaction (such as voice, shake, tap, scene perception, etc.). way is limited.
  • a micro-application is a collection of services, and its business logic is realized by computer equipment executing micro-application scripts through a micro-application engine, wherein micro-application scripts of different micro-applications are all executed by the same micro-application engine.
  • the micro-app script is composed of several triggers, and each trigger is used to trigger under a specific trigger event, and after the trigger is triggered, the service call is performed by executing the call action corresponding to the trigger.
  • the calling action can be a simple action or a combined action. If the calling action is a simple action, when the trigger is triggered, the simple action can be directly executed to call the service; if the calling action is a combined action In the case of , when the trigger is triggered, a simple action needs to be executed through the controller to make a service call.
  • the controller is used to indicate the call logic of the simple action.
  • the micro-application script includes at least an initialization trigger and an end trigger.
  • the initialization trigger is used to trigger the micro-application to start running
  • the end trigger is used to trigger the micro-application to stop running.
  • the micro-application script also includes other triggers for implementing specific micro-application functions, which is not limited in this embodiment of the present application.
  • Step 402 triggering a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event.
  • the computer device determines the target trigger triggered by the target trigger event from the target micro-application script, thereby setting the target trigger from the untriggered state to the triggered state.
  • the computer device executes the calling action corresponding to the trigger through the micro-application engine, and calls the corresponding service to realize the corresponding business logic.
  • the target trigger event can be an event triggered by the user, such as a tap event, a shake event, etc., or an event output after calling the service, for example, the last trigger corresponding to the service returned after the call is completed event, which is not limited in this embodiment.
  • Step 403 read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas.
  • the running process of the micro-app also involves the data transmission process.
  • the "screen projection event” will carry the relevant parameter information of the source device and the destination device of the screen projection, and the parameter information will be stored in the "projection event” screen event" in the trigger scope of the corresponding trigger, so that the corresponding target call action under the trigger can access the relevant parameter information. Therefore, in a possible implementation manner, when a target trigger event is received, the event parameters corresponding to the target trigger event will also be stored in the first data storage area, so that the subsequent target call action corresponding to the target trigger can be executed During the process, the first data storage area can be accessed to obtain corresponding event parameters, and the subsequent service invocation process can be continued.
  • the micro-application contains several triggers, and different triggers are triggered by different trigger events, in order to avoid conflicts caused by too much data, or it takes a long time to find the required data during the calling process, in a possible implementation, for Different triggers set different first data storage areas (trigger scope or data scope), the event parameters related to the trigger are stored in the first data storage area corresponding to the trigger, and the event parameters corresponding to the target trigger event It can only be accessed by the target call action corresponding to the target trigger event.
  • the target call action includes multiple controllers and multiple simple actions, it can only be accessed by the controller and simple action corresponding to the target trigger.
  • the event parameter corresponding to the target trigger event can be stored in the trigger scope corresponding to the target trigger (first data store).
  • the event parameter may be the data carried by the target trigger event, for example, the relevant information of the source device and the destination device carried by the "screen casting event".
  • FIG. 5 it shows a schematic diagram of a trigger scope shown in an exemplary embodiment of the present application.
  • the trigger 501 corresponding to the target event 503 is triggered, and the event parameters corresponding to the target event 503 can be stored in the trigger scope 510, the controllers 1 to 4 associated with the trigger 501, and Actions 1 to 4 can call the event parameters; but controllers 5 to 7, and actions 5 to 9 cannot call the data stored in the trigger scope 510;
  • the target event 504 is received, the target The trigger 502 corresponding to the event 504, and the event parameters corresponding to the target event 504 can be stored in the trigger scope 520, and the controller 5-controller 7 and action 5-action 9 associated with the trigger 502 can call this event Parameters; while Controller 1-Controller 4, and Action 1-Action 4 cannot call the data existing in the trigger scope 520 .
  • the data transfer process is involved in the running process of the micro-app.
  • the event parameter for the event parameter of the screen projection event, the event parameter is required when the call action of the screen projection service is executed, and the corresponding event parameter needs to be obtained during the execution of the call action.
  • Event parameters so that the subsequent service call process can be performed based on the event parameters. Therefore, in a possible implementation manner, before executing the target call action corresponding to the target trigger, access the first data storage area, and read the event parameter corresponding to the target trigger event therefrom.
  • Step 404 based on the event parameter, execute the target invocation action corresponding to the target trigger.
  • the computer device executes the target invocation action corresponding to the target trigger based on the event parameters through the runtime module in the micro-application engine, so as to realize the invocation of the target service, and then realize the specific micro-application of the micro-application. App function.
  • the calling action in the embodiment of the present application is essentially calling a certain service.
  • the target service is called to realize the micro application function of the micro application; schematically, the target calling action is a screenshot action , the process of executing the screen capture action is the process of calling the screen capture service, and the screen capture function of the micro-app is realized by calling the screen capture service.
  • the target service invoked by the computer device may be a service of the current device or a service of an external device, that is, a cross-device service call may be realized, thereby realizing the micro-application function of the target micro-application through interaction with the external device.
  • the computer device needs to determine whether the target service has been deployed locally, and During deployment, the target service is dynamically deployed (for dynamic services).
  • the computer device when the micro-application contains multiple triggers, the computer device repeatedly executes the above steps 402 to 404, and after the end trigger is triggered, executes the control logic of the end trigger to end the running of the micro-application.
  • micro-app function of the micro-app Since the operation of micro-apps is based on micro-app scripts with low code volume, the storage space required is smaller than that of traditional applications; and the calling actions are assembled into micro-apps, and the micro-app scripts are used to manage the relationship between calling actions.
  • the call relationship realizes the componentization of micro-applications, improves the reusability of calling actions between micro-applications, and helps to reduce the development difficulty of micro-applications.
  • the data storage area enables the call action associated with the trigger to access the data storage area. While achieving the purpose of data transfer in the micro-app, it can also avoid the conflict of data corresponding to different triggers.
  • the action type of the target call action includes simple action type and combined action type.
  • the target call action under the simple action type consists of a single target simple action
  • the target call action under the combined action type consists of at least one target controller and at least one target Simple action composition, the target controller is used to instruct the target call logic of the simple action of the target;
  • Execute the target invocation action corresponding to the target trigger including:
  • the target calling action includes at least one target controller
  • at least one target simple action is controlled to be executed by the at least one target controller.
  • the target call action includes a target simple action located at the parent node and a target simple action located at the child node;
  • Perform at least one target simple action controlled by at least one target controller including:
  • the method also includes:
  • the operating environment parameters corresponding to the target micro-application are stored in the third data storage area, and the third data storage area allows access to the calling action triggered by each trigger.
  • the action type of the target call action includes simple action type and combined action type.
  • the target call action under the simple action type consists of a single target simple action
  • the target call action under the combined action type consists of at least one target controller and at least one target Simple action composition, the target controller is used to instruct the target call logic of the simple action of the target;
  • Execute the target call action corresponding to the trigger including:
  • target invocation action includes at least one target controller, determining the target invocation logic indicated by the target controller;
  • the target controller is a conditional controller, and the conditional controller is associated with at least two candidate simple actions;
  • the target simple action is determined from the candidate simple actions, and the target simple action is executed.
  • the target controller is a loop controller
  • the target controller is a delay controller
  • the target controller is a sequence controller, and the sequence controller is associated with at least two candidate simple actions;
  • the candidate simple actions are sequentially determined as the target simple actions, and each target simple action is sequentially executed.
  • Methods also include:
  • the target controller is a selection controller, and the selection controller is associated with at least two candidate simple actions;
  • the candidate simple actions are executed sequentially; if there is a candidate simple action that is successfully executed, the candidate simple action is determined as the target simple action, and the execution of other candidate simple actions is stopped.
  • the target controller is a parallel controller, and the parallel controller is associated with at least two candidate simple actions;
  • Each candidate simple action is determined as a target simple action, and each target simple action is executed in parallel.
  • the data transfer process involved in the running process of the micro-app also involves the transfer process of the service return value.
  • the "screen capture action” will return the captured image data, and the When the "action” is executed, the intercepted image data needs to be accessed; therefore, in a possible implementation, a corresponding data space scope is also set for the service return value.
  • FIG. 6 shows a flow chart of a micro-application running method provided by another exemplary embodiment of the present application.
  • the embodiment of the present application takes the application of the method to the computer device shown in FIG. 3 as an example for illustration.
  • Methods include:
  • Step 601 acquiring a target micro-application script of a target micro-application, where the target micro-application script consists of at least one trigger.
  • Step 602 triggering a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event.
  • Step 603 read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas.
  • Step 604 in the case that the target call action includes at least one target controller, based on the event parameters, at least one target simple action is controlled by the at least one target controller.
  • the action type of calling action includes simple action type and combined action type.
  • the calling action under the simple action type is composed of a single simple action
  • the calling action under the combined action type is composed of at least one controller and at least one simple action.
  • the controller is used to indicate Call logic for simple actions.
  • FIG. 7 it shows a schematic diagram of simple action types and combined action types shown in an exemplary embodiment of the present application.
  • the action type of the call action is a simple action type
  • event 1 when event 1 is received, the trigger 1 corresponding to event 1 is triggered, and the trigger 1 triggers the execution of simple action 701 to call the service;
  • the action type of the call action is combination
  • trigger 2 when event 2 is received, trigger 2 corresponding to event 2 is triggered, and trigger 2 triggers the execution of combined action 702.
  • the combined action 702 is composed of controller 1-controller 5 and action 1-action 8, where , actions 1 to 8 are simple actions; during the execution of the call action, it is necessary to control the execution of action 1 by controller 1 and controller 2; the execution of action 2 is controlled by controller 1, controller 2, and controller 4; Actions 3 to 5 are controlled by controller 1, controller 2, and control 5; actions 6 to 8 need to be controlled by controllers 1 and 3.
  • the call action of the simple action type only contains a single simple action and does not contain a controller, in a possible implementation, when the call action does not contain a controller, it can directly carry the event parameters of the target event and execute the target event. Simple actions to call the corresponding target service, and then realize the micro-application function of the micro-application.
  • the call action of the simple action type can only realize the call of a single service, but in the actual application scenario of the micro application, if a micro application function needs to be completed, it is often impossible to achieve it only by a single simple action, and it may require several simple actions to realize it together , therefore, in order to achieve more complex micro-application functions, the micro-application provides a call action mechanism for developing combined action types, and defines the call logic between simple actions through the controller to realize the combination of different simple actions, so as to achieve more Complex microapp functionality.
  • the calling action when the calling action is a combined action type, it consists of several controllers and several simple actions, as shown in Figure 7, it can be a "multi-fork tree structure; where the leaf nodes of the tree must be "simple action", the root node (the node connected to the trigger) is the controller, and the child nodes of the controller can be controllers or simple actions; the child nodes of simple actions can be simple actions or controllers.
  • the micro-application engine triggers the call action through the trigger, it will traverse the entire tree from the controller of the root node in sequence, and finally traverse to different leaf nodes (simple actions) according to the control logic of the controller, and execute the simple action.
  • the computer device For the call action of the combined action type, during the running of the micro-application, when the computer device receives the target trigger event, it triggers the target trigger corresponding to the target event, and the trigger is controlled by at least one target controller to execute at least one target simple action, so as to Realize the call to the target service, and during the execution of the target call action, both the target controller and the target simple action can read the event parameters from the first data storage area, and realize the micro application of the micro application through data transfer and action call Function.
  • step 604 may further include steps 604A to 604C.
  • Step 604A control the execution of the target simple action at the parent node through the target controller, and obtain the target service data fed back after executing the target simple action at the parent node.
  • action 7 and action 8 are the child nodes of action 6, that is, action 6 is the parent node.
  • the action needs to be executed first 6.
  • the target controller is used to control the execution of the target simple action located in the parent node If the target simple action of , if the target service data can be obtained after executing the target simple action, the target service data can be stored in a specific data storage area, so that the target service data can be referenced when the subsequent target simple action is executed.
  • the target service data fed back after executing the target simple action of the parent node will only be called by the child nodes associated with the parent node.
  • the target service data fed back by executing Action 6 will only be invoked by Action 7 and/or Action 8 associated with Action 6, while other Actions 1 to 5 in the combined Action 702 do not need to
  • a second data storage area also called a child node scope ) to store the return value data after calling the parent node action, corresponding to the child node action associated with the parent node can read the required data from the second data storage area during the calling process.
  • Step 604B read the target service data from the second data storage area.
  • the target simple action located in the parent node is different and corresponds to a different second data storage area.
  • a second data storage area is set to store and execute the The target service data fed back after the target simple action of the node.
  • different second data storage areas are set for different target simple actions located in the parent node, and the second data storage area only allows child nodes associated with target simple actions of the same parent node The target of the simple action call.
  • the target simple action before executing the target simple action located in the child node, if the target simple action needs to refer to the target service data returned by the previous node during the execution process, it first needs to be retrieved from the second data storage area Read the target service data, and then execute the target simple action located in the child node based on the target service data.
  • a special symbol is set to refer to the target service data from the child node scope (second data storage area).
  • Step 604C based on the target service data, execute the target simple action located in the child node.
  • the target simple action located at the child node can be executed by referencing the target service data to realize the target simple action Corresponds to the invocation of the target service.
  • FIG. 8 it shows a schematic diagram of the sub-node scope shown in an exemplary embodiment of the present application.
  • the controller 1 and the controller 2 control and call the screen capture action and the display picture action to realize the screen capture display function, wherein the display picture action is a child node of the screen capture action ;
  • the controller 2 controls and executes the screenshot action, obtains the target picture intercepted after executing the screenshot action, stores the target picture in the child node scope 803, and when the execution display
  • action 2 is also a child node of the screenshot action, when executing action 2, if the target picture is also needed, the target picture may also be called
  • the data space scope of the micro application also includes a third data storage area (global Scope), the third data storage area stores the operating environment parameters corresponding to the target micro-application, as well as user-defined parameters, such as the device information of the current computer device, etc., which are stored in the third data storage area to allow each trigger
  • the call action triggered by the controller is accessed, that is, the data of the global scope can be accessed by all controllers and simple actions of the micro application.
  • the micro-application 900 includes a micro-application global scope 910, a trigger scope 920, and a child node scope 930; wherein, the operating environment parameters and custom parameters of the micro-application are stored in the micro-application global scope 910, and the trigger 901 and
  • the controllers and actions associated with the trigger 902 can call data from the micro-app global scope 910; when the target event is received, the trigger 901 corresponding to the target event is triggered, and the event parameters corresponding to the target event can be stored in the trigger
  • the controller 1 ⁇ controller 4, and action 1 ⁇ action 4 associated with the trigger 901 can call the event parameter; while the controller 5 ⁇ controller 7, and action 5 ⁇ action 9 cannot call the trigger
  • the data in the scope 920 of the controller; after the execution of action 6, the service data fed back is stored in the scope 930 of the child node,
  • the concept of combined action type is introduced, and the call action is composed of several controllers and several simple actions.
  • various scheduling logics such as cycle scheduling, sequence Scheduling, conditional scheduling, etc.
  • multiple controllers indicating different scheduling logics are defined in this embodiment, and the micro-application functions of the micro-application can be further enriched through the combination of different types of controllers.
  • FIG. 10 shows a flow chart of a micro-application running method provided by another exemplary embodiment of the present application.
  • This embodiment of the present application is described by taking the method applied to the computer device shown in FIG. 3 as an example. Methods include:
  • Step 1001 acquire a target micro-application script of a target micro-application, where the target micro-application script consists of at least one trigger.
  • Step 1002 triggering a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event.
  • Step 1003 read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas.
  • step 1001 and step 1003 reference may be made to the foregoing embodiments, and details are not described in this embodiment here.
  • Step 1004 if the target invocation action includes at least one target controller, determine the target invocation logic indicated by the target controller.
  • the target controller is used to indicate the target call logic of at least one target simple action, for example, if the target controller is a loop controller, the target controller defines the target simple action
  • the loop condition is the call logic of the target simple action, which needs to be followed to call the target simple action, which is the action connected to the loop controller.
  • the child nodes of a controller can be simple actions or other controllers.
  • Step 1005 execute target simple actions based on event parameters and target invocation logic.
  • the computer device executes the target simple action based on the target invocation logic corresponding to the target controller, so as to realize the invocation of the target service, and then realize the specific application function of the micro-application; and when executing the target simple action In the process, you can refer to the event parameters of the target event.
  • the target controller may be a conditional controller, a loop controller, a delay controller, a sequential controller, a selection controller, a parallel controller, etc.
  • the embodiment of the present application does not limit the controller type of the target controller.
  • Business personnel can implement controllers with different functions according to different needs, so as to combine controllers with different functions to realize different micro-application functions.
  • step 1004 and step 1005 may be replaced by step 1004A and step 1005A.
  • Step 1004A if the target calling action includes at least one target controller, determine the target scheduling condition indicated by the target controller.
  • condition controller is set with a judgment condition, and needs to determine whether to execute the target simple action corresponding to the branch or to execute the target simple action corresponding to the no branch according to the judgment result of the condition.
  • conditional controller when a conditional controller is included in the target call action, when the conditional controller is executed, it is necessary to determine the target scheduling condition indicated by the conditional controller, and then judge based on the target scheduling condition The target simple action to perform.
  • Step 1005A based on the target scheduling condition, determine the target simple action from candidate simple actions, and execute the target simple action.
  • the target simple action to be executed is determined from at least two candidate simple actions associated with the condition controller, and then the target simple action is executed to invoke the target service.
  • the target simple action corresponding to the branch is executed; otherwise, when When the target scheduling condition is met, execute the target simple action corresponding to the No branch.
  • FIG. 11 it shows a schematic diagram of a condition controller shown in an exemplary embodiment of the present application.
  • the target calling action includes a condition controller 1101, a first controller 1102, a second action 1104 and a first action 1103; when the target calling action is executed, the condition judgment result is first determined based on the condition 1105 of the condition controller 1101, when the condition If the judgment result indicates that the condition 1105 is satisfied, then the first controller 1102 corresponding to the Yes branch will continue to control and execute the second action 1104; if the condition judgment result indicates that the condition 1105 is not met, then the first action 1103 corresponding to the No branch will be executed.
  • step 1004 and step 1005 may also be replaced by step 1004B and step 1005B.
  • Step 1004B if the target calling action includes at least one target controller, determine the target loop condition indicated by the target controller.
  • the loop controller is provided with a loop condition, and the loop scheduling mode of the simple action is limited by the loop condition. Only when the loop condition is satisfied, the execution of the target simple action can be stopped.
  • loop controller can only define loop conditions, it cannot define how to call two or more simple actions, so the loop controller only has a single child node, which will be cyclically scheduled.
  • the target call action includes a loop controller
  • the loop controller when the loop controller is executed, it is necessary to determine the target loop condition indicated by the loop controller, and then judge based on the target loop condition The stop execution timing of the target simple action.
  • Step 1005B if the execution state of the target simple action does not meet the target loop condition, continue to execute the target simple action cyclically.
  • the target controller when the target controller is a loop controller, it means that the target simple action associated with the target controller needs to be executed cyclically, and only when the execution state of the target simple action satisfies the target loop condition, the It will stop executing the target simple action. That is to say, when the loop controller is executed, it is necessary to judge whether the execution state of the target simple action meets the target loop condition. If the target loop condition is not met, continue to execute the target simple action. Otherwise, when When the target loop condition is met, stop executing the target simple action.
  • the loop controller can be divided into a count loop controller, a loop until success controller, and a loop until failure controller based on different target loop conditions.
  • the count loop controller defines the threshold of the loop execution times of simple actions.
  • the loop controller should be executed to the count loop controller, it is necessary to obtain the execution times of the target simple action and determine the Whether the number of executions reaches the number threshold indicated by the target loop condition, when the number of executions reaches the number threshold, stop executing the target simple action; otherwise, when the number of executions does not reach the number threshold, continue to execute the target simple action until the execution of the target simple action The number of times reaches the number threshold.
  • the target simple action associated with the loop controller is cyclically executed, and each time the target simple action is executed, the execution times of the target simple action + 1. Stop executing the target simple action until the number of executions reaches 10.
  • the loop until success controller defines the loop execution purpose of the simple action. Only when the simple action is executed successfully, will it stop looping and execute the target simple action; correspondingly, it should be executed until the loop until When the controller is successful, it needs to execute the target simple action in a loop, and judge whether the target service corresponding to the target simple action is called successfully. When the target service is successfully called, stop executing the target simple action; otherwise, when the target service is not successfully called, continue to execute The target simple action will not stop executing the target simple action until the target service call is successful and the target loop condition of the loop controller is met.
  • the loop until failure controller defines the loop execution purpose of the simple action. Only when the simple action fails to execute, will the loop execute the target simple action stop; correspondingly, it should be executed until the loop until When the controller fails, it needs to execute the target simple action in a loop, and judge whether the target service corresponding to the target simple action is called successfully. When the target service is successfully called, continue to execute the target simple action until the target service fails to be called; After the call fails, the execution of the target simple action will stop only if the target loop condition of the loop controller is met.
  • FIG. 12 it shows a schematic diagram of a cycle controller shown in an exemplary embodiment of the present application.
  • the first controller 1202 needs to control the loop execution of the first action 1203 until the second After the number of executions of an action 1203 reaches the number threshold, stop executing the first action 1203;
  • the target call action includes the loop until success controller 1204, the second controller 1205, and the second action 1206, the process of executing the target call action
  • the second controller 1205 needs to control the loop execution of the second action 1206 until the execution of the second action 1206 is successful, then stop the execution of the second action 1206;
  • the third controller 1208 needs to control the cyclic execution of the third action 1209, until the execution of the third action 1209 fails, the execution of the third action 1209 is stopped.
  • step 1004 and step 1005 may also be replaced with step 1004C and step 1005C.
  • Step 1004C if the target calling action includes at least one target controller, determine the target calling delay indicated by the target controller.
  • the delay controller defines a call delay, and only when the call delay is reached, the target simple action can be executed.
  • the delay controller can only define the call delay, but cannot define how to call two or more simple actions, the delay controller only has a single child node, and the child node will be delayed for a certain period of time.
  • the delay controller when the delay controller is included in the target call action, when the delay controller is executed, it is necessary to determine the target call delay indicated by the delay controller, and then extend After the target call is delayed, execute its associated target simple action.
  • the controller and/or the target simple action associated with the delay controller will be executed after an extension of 20ms.
  • Step 1005C execute the target simple action when the target call delay is reached.
  • the target controller when the target controller is a delay controller, it means that it needs to be delayed for a certain period of time to execute its associated subnodes, that is, when the delay controller is executed, temporarily stop To execute the target simple action associated with it, it is necessary to judge whether the target call delay is reached. If the target call delay is reached, the target simple action is executed. Otherwise, if the target call delay is not reached, it needs to wait until the target call delay is reached. Able to perform targeted simple actions.
  • FIG. 13 it shows a schematic diagram of a delay controller shown in an exemplary embodiment of the present application.
  • the child nodes of the delay controller can be other controllers or actions; when the target call action includes the first delay loop controller 1301 and the first action 1302, in the process of executing the target call action, it is necessary to reach the target call After the delay, execute the first action 1302; when the target call action includes the second delay controller 1303, the first controller 1304 and the second action 1305, in the process of executing the target call action, it is necessary to reach the target call delay After a period of time, the second action 1305 is executed under the control of the first controller 1304 .
  • step 1004 and step 1005 may be replaced by step 1004D and step 1005D.
  • Step 1004D if the target invocation action includes at least one target controller, determine the target invocation sequence corresponding to each candidate simple action indicated by the target controller.
  • the sequence controller is used to define the execution sequence of several simple actions. For example, if the sequence controller corresponds to simple action A and simple action B, the sequence controller defines the calling sequence of simple action A and simple action B. Call The sequence may be to execute call action B first, and then call action A.
  • a general sequence controller includes at least two child nodes, that is, the sequence controller is associated with at least two candidate simple actions, so as to define the target invocation sequence of at least two child nodes or at least two candidate simple actions.
  • the sequence controller when the sequence controller is included in the target call action, when the sequence controller is executed, it is necessary to determine the target call sequence of each candidate simple action indicated by the sequence controller, and then based on The target invocation sequence executes the target simple actions in turn.
  • Step 1005D Determine the candidate simple actions as the target simple actions in sequence based on the calling sequence of the targets, and execute each target simple action in sequence.
  • each candidate simple action is sequentially determined as the target simple action, and each target simple action is sequentially executed, that is, sequence control
  • each candidate simple action associated with the controller needs to be executed in a fixed execution sequence, and the same micro-application function can only be realized after all the candidate simple actions are executed.
  • the n+1th target simple action can be continued until all candidate simple actions are successfully executed; otherwise, when After the execution of the nth target simple action fails, the follow-up target simple action cannot be executed, and correspondingly stop the execution of the n+1th target simple action. That is to say, each child node of the sequence controller will be scheduled sequentially, and as long as there is a child node that fails to execute, the execution will stop.
  • the target call action includes a sequence controller 1401, a first controller 1402, a first action 1403, a second action 1404, a second controller 1405, and a third action 1406.
  • the sequence controller 1401 defines the call sequence between the various actions It is the first action 1403-the second action 1404-the third action 1406; when executing the target call action, firstly based on the call sequence indicated by the sequence controller 1401, the first controller 1402 controls the execution of the first action 1403 first, When the first action 1403 is executed successfully, continue to execute the second action 1404; when the second action 1404 is executed successfully, the second controller 1405 controls to execute the third action 1406.
  • the sequence controller 1401 will not complete the execution until the third action 1406 is executed.
  • the execution of the first action fails, the second action 1404 and the third action 1406 cannot be executed; if the execution of the second action 1404 fails, the execution of the third action 1406 cannot continue; if the execution of the third action 1406 fails, even
  • the first action 1403 and the second action 1404 are executed successfully, but the micro-application function corresponding to the sequence controller 1401 cannot be realized.
  • step 1004 and step 1005 may be replaced by step 1004E and step 1005E.
  • Step 1004E if the target calling action includes at least one target controller, determine the target calling sequence indicated by the target controller.
  • the selection controller can also define the execution sequence of several simple actions.
  • the general selection controller also contains at least two child nodes, that is, the selection controller is associated with at least two candidate simple actions; different from the sequence controller, The sub-nodes of the selection controller are scheduled sequentially, and return when there are sub-nodes executed successfully; that is to say, each sub-node corresponding to the selection controller can implement the same micro-application function, as long as a single sub-node call is successful, it can be realized The microapp functions without requiring all child nodes to be called successfully.
  • a selection controller when a selection controller is included in the target call action, when the selection controller is executed, it is necessary to determine the target call sequence of each candidate simple action indicated by the selection controller, and then based on The target invocation sequence executes the target simple actions in sequence until the target simple actions are successfully executed.
  • Step 1005E Execute the candidate simple actions sequentially based on the target calling sequence; if there is a candidate simple action that is successfully executed, determine the candidate simple action as the target simple action, and stop executing other candidate simple actions.
  • each candidate simple action is executed sequentially based on the execution order of each candidate simple action indicated by the target call sequence, and when there is a candidate simple action that is successfully executed, the candidate simple action is determined as the target simple action , and stop executing other candidate simple actions; on the contrary, if the candidate simple actions fail to execute, continue to execute other candidate simple actions according to the target call sequence.
  • the target call action includes a selection controller 1501, a first controller 1502, a first action 1503, a second action 1504, a second controller 1505, and a third action 1506, and the selection controller 1501 defines the calling order of each action It is the first action 1503-the second action 1504-the third action 1506; when executing the target invocation action, firstly based on the invocation order indicated by the selection controller 1501, the execution of the first action 1503 is preferentially controlled by the first controller 1502, When the first action 1503 is executed successfully, there is no need to execute the second action 1504 and the third action 1506; when the first action 1503 fails, continue to execute the second action 1504; Action 1506; if the execution of the second action 1504 fails, the second controller 1505 needs to control the execution of the third action 1506 . If the third action 1506 is executed successfully, it means that the corresponding micro-application function can be realized; if the third action 1506
  • step 1005 may be replaced with step 1005F.
  • each candidate simple action is determined as a target simple action, and each target simple action is executed in parallel.
  • a general parallel controller also includes at least two child nodes, that is, the parallel controller is associated with at least two candidate simple actions, so as to execute each candidate simple action at the same time.
  • each candidate simple action associated with the parallel controller is determined as the target simple action, and then Execute individual target simple actions in parallel.
  • FIG. 16 it shows a schematic diagram of a parallel controller shown in an exemplary embodiment of the present application.
  • the target calling action includes a parallel controller 1601, a first controller 1602, a first action 1603, a second action 1604, a second controller 1605, and a third action 1606; when the target calling action is executed, the first action 1603 is executed in parallel , the second action 1604 and the third action 1606 , that is, triggering the first controller 1602 to control the execution of the first action 1603 , triggering the execution of the second action 1604 , and triggering the second controller 1605 to execute the third action 1606 .
  • the target invocation action may contain a combination of several controllers, and may contain different types of controllers, so as to realize more complicated invocation actions.
  • the target call action including various controllers can be defined in the micro-app script as:
  • the micro-application is implemented by xml syntax, and the micro-application contains two triggers: the trigger corresponding to the event "xxx” and the trigger corresponding to the event "yyy", wherein the trigger event "xxx" corresponds to the trigger
  • the call action associated with the trigger is composed of a parallel controller, a selection controller, and actions A to E; the call action associated with the trigger event "yyy” is composed of a condition controller, action B and action C.
  • control logic of various controllers included in the call action is defined, so that the combination of several simple actions can be realized by combining various controllers to support more complex call action logic, so as to satisfy The application development requirements of developers in different complex scenarios.
  • FIG. 17 shows a structural block diagram of a micro-application running device provided by an embodiment of the present application.
  • the device can include:
  • a script acquisition module 1701 configured to acquire a target micro-application script of the target micro-application, where the target micro-application script consists of at least one trigger;
  • a trigger module 1702 configured to trigger a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event;
  • a data reading module 1703 configured to read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas;
  • the action calling module 1704 is configured to execute the target calling action corresponding to the target trigger based on the event parameter.
  • the action type of the target call action includes a simple action type and a combined action type
  • the target call action under the simple action type is composed of a single target simple action
  • the target call action under the combined action type Consisting of at least one object controller and at least one of said object simple actions, said object controller being used to instruct an object invocation logic of said object simple action;
  • the action calling module 1704 is also used for:
  • the target calling action includes at least one target controller
  • at least one target simple action is controlled by at least one target controller.
  • the target invocation action includes a target simple action located at a parent node and a target simple action located at a child node;
  • the action calling module 1704 is also used for:
  • the target simple action at the child node is executed.
  • the device also includes:
  • a data storage module configured to store the operating environment parameters corresponding to the target micro-application in a third data storage area, and the third data storage area allows access to the calling action triggered by each of the triggers.
  • the action type of the target call action includes a simple action type and a combined action type
  • the target call action under the simple action type is composed of a single target simple action
  • the target call action under the combined action type Consisting of at least one object controller and at least one of said object simple actions, said object controller being used to instruct an object invocation logic of said object simple action;
  • the action calling module 1704 is also used for:
  • target invocation action includes at least one of the target controllers, determining the target invocation logic indicated by the target controller;
  • the target simple action is executed.
  • the target controller is a conditional controller, and the conditional controller is associated with at least two candidate simple actions;
  • the action calling module 1704 is also used for:
  • the action calling module 1704 is also used for:
  • the target simple action is determined from the candidate simple actions, and the target simple action is executed.
  • the target controller is a loop controller
  • the action calling module 1704 is also used for:
  • the action calling module 1704 is also used for:
  • the action calling module 1704 is also used to:
  • the target simple action continues to be cyclically executed.
  • the target controller is a delay controller
  • the action calling module 1704 is also used for:
  • the action calling module 1704 is also used for:
  • the target simple action is executed.
  • the target controller is a sequence controller, and the sequence controller is associated with at least two candidate simple actions;
  • the action calling module 1704 is also used for:
  • the action calling module 1704 is also used for:
  • the candidate simple actions are sequentially determined as the target simple actions, and each of the target simple actions is sequentially executed.
  • the action calling module 1704 is also used to:
  • the device also includes:
  • a stop execution module configured to stop execution of the n+1th target simple action when the nth target simple action fails to be executed.
  • the target controller is a selection controller, and the selection controller is associated with at least two candidate simple actions;
  • the action calling module 1704 is also used for:
  • the action calling module 1704 is also used for:
  • the target controller is a parallel controller, and the parallel controller is associated with at least two candidate simple actions;
  • the action calling module 1704 is also used for:
  • Each of the candidate simple actions is determined as the target simple action, and each of the target simple actions is executed in parallel.
  • micro-app function of the micro-app Since the operation of micro-apps is based on micro-app scripts with low code volume, the storage space required is smaller than that of traditional applications; and the calling actions are assembled into micro-apps, and the micro-app scripts are used to manage the relationship between calling actions.
  • the call relationship realizes the componentization of micro-applications, improves the reusability of calling actions between micro-applications, and helps to reduce the development difficulty of micro-applications.
  • the data storage area enables the call action associated with the trigger to access the data storage area. While achieving the purpose of data transfer in the micro-app, it can also avoid the conflict of data corresponding to different triggers.
  • FIG. 18 shows a structural block diagram of a computer device provided by an exemplary embodiment of the present application.
  • the computer device 1800 may be implemented as a source device or a destination device in each of the foregoing embodiments.
  • Computer device 1800 may include one or more of the following components: processor 1810 and memory 1820 .
  • Processor 1810 may include one or more processing cores.
  • the processor 1810 uses various interfaces and lines to connect various parts of the entire computer device 1800, and executes by running or executing instructions, programs, code sets or instruction sets stored in the memory 1820, and calling data stored in the memory 1820.
  • the processor 1810 may adopt at least one of Digital Signal Processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). implemented in the form of hardware.
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor 1810 can integrate one or more of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), a neural network processor (Neural-network Processing Unit, NPU) and a modem, etc.
  • a central processing unit Central Processing Unit, CPU
  • an image processor Graphics Processing Unit, GPU
  • a neural network processor Neural-network Processing Unit, NPU
  • the CPU mainly handles the operating system, user interface and application programs, etc.
  • the GPU is used to render and draw the content that needs to be displayed on the touch screen
  • the NPU is used to realize the artificial intelligence (Artificial Intelligence, AI) function
  • the modem is used to process Wireless communication. It can be understood that, the above-mentioned modem may not be integrated into the processor 1810, but may be realized by a single chip.
  • the memory 1820 may include random access memory (Random Access Memory, RAM), and may also include read-only memory (Read-Only Memory, ROM).
  • the memory 1820 includes a non-transitory computer-readable storage medium.
  • the memory 1820 may be used to store instructions, programs, codes, sets of codes or sets of instructions.
  • the memory 1820 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), Instructions and the like for implementing the various method embodiments described below; the storage data area can store data created according to the use of the computer device 1800 (such as audio data, phonebook) and the like.
  • the structure of the computer device 1800 shown in the above drawings does not constitute a limitation to the computer device, and the computer device may include more or less components than those shown in the illustration, or combine certain components, or a different arrangement of components.
  • the computer device 1800 also includes a display screen, a camera component, a microphone, a speaker, a radio frequency circuit, an input unit, a sensor (such as an acceleration sensor, an angular velocity sensor, a light sensor, etc.), an audio circuit, a WiFi module, a power supply, a Bluetooth module, etc. components, which will not be repeated here.
  • the embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores at least one program code, and the program code is loaded and executed by a processor to realize the micro-application described in each of the above embodiments. run method.
  • An embodiment of the present application provides a computer program product or computer program, where the computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium.
  • the processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the micro-application running method provided in various optional implementation manners of the above aspect.
  • the "plurality” mentioned herein refers to two or more than two.
  • “And/or” describes the association relationship of associated objects, indicating that there may be three types of relationships, for example, A and/or B may indicate: A exists alone, A and B exist simultaneously, and B exists independently.
  • the character "/” generally indicates that the contextual objects are an "or” relationship.
  • the numbering of the steps described herein only exemplarily shows a possible sequence of execution among the steps. In some other embodiments, the above-mentioned steps may not be executed according to the order of the numbers, such as two different numbers The steps are executed at the same time, or two steps with different numbers are executed in the reverse order as shown in the illustration, which is not limited in this embodiment of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

A micro-application running method and apparatus, a device, a storage medium, and a program product, which belong to the technical field of applications. The method comprises: acquiring a target micro-application script of a target micro-application (401); in response to a target trigger event, triggering a target trigger corresponding to the target trigger event in the target micro-application script (402); reading from a first data storage area an event parameter corresponding to the target trigger event, wherein different triggers correspond to different first data storage areas (403); and on the basis of the event parameter, executing a target call action corresponding to the target trigger (404). The micro-application running method can avoid the conflict problem of data corresponding to different triggers during a micro-application running process.

Description

微应用的运行方法、装置、设备、存储介质及程序产品Operation method, device, device, storage medium and program product of micro-application
本申请要求于2021年12月30日提交的申请号为202111651803.X、发明名称为“微应用的运行方法、装置、设备、存储介质及程序产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on December 30, 2021 with the application number 202111651803.X and the title of the invention is "Operation method, device, equipment, storage medium and program product of micro-application", the entire content of which Incorporated in this application by reference.
技术领域technical field
本申请实施例涉及应用技术领域,特别涉及一种微应用的运行方法、装置、设备、存储介质及程序产品。The embodiments of the present application relate to the field of application technology, and in particular to a micro-application running method, device, equipment, storage medium, and program product.
背景技术Background technique
随着应用(Application)技术的不断发展,越来越多功能丰富的应用应运而生,为人们的日常生活带来便利。With the continuous development of application technology, more and more multi-functional applications emerge as the times require, bringing convenience to people's daily life.
用户在使用应用之前,首先需要从应用商店下载应用安装包,并通过解析应用安装包将应用安装在终端中,然后点击应用图标以启动应用。然而,随着应用质量的不断提高,应用所需占用的存储空间也越来越大。Before using the application, the user first needs to download the application installation package from the application store, and install the application on the terminal by parsing the application installation package, and then click the application icon to start the application. However, with the continuous improvement of application quality, the storage space required by the application is also increasing.
发明内容Contents of the invention
本申请实施例提供了一种微应用的运行方法、装置、设备、存储介质及程序产品。所述技术方案如下:Embodiments of the present application provide a micro-application running method, device, device, storage medium, and program product. Described technical scheme is as follows:
一方面,本申请实施例提供了一种微应用的运行方法,所述方法包括:On the one hand, the embodiment of the present application provides a method for running a micro-application, the method comprising:
获取目标微应用的目标微应用脚本,所述目标微应用脚本由至少一个触发器构成;acquiring a target micro-application script of the target micro-application, wherein the target micro-application script is composed of at least one trigger;
响应于目标触发事件,触发所述目标微应用脚本中所述目标触发事件对应的目标触发器;triggering a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event;
从第一数据存储区中读取所述目标触发事件对应的事件参数,不同触发器对应不同第一数据存储区;Reading event parameters corresponding to the target trigger event from the first data storage area, where different triggers correspond to different first data storage areas;
基于所述事件参数,执行所述目标触发器对应的目标调用动作。Based on the event parameters, execute the target invocation action corresponding to the target trigger.
另一方面,本申请实施例提供了一种微应用的运行装置,所述装置包括:On the other hand, the embodiment of the present application provides a micro-application running device, the device includes:
脚本获取模块,用于获取目标微应用的目标微应用脚本,所述目标微应用脚本由至少一个触发器构成;A script acquisition module, configured to acquire a target micro-application script of the target micro-application, wherein the target micro-application script is composed of at least one trigger;
触发模块,用于响应于目标触发事件,触发所述目标微应用脚本中所述目标触发事件对应的目标触发器;A trigger module, configured to trigger a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event;
数据读取模块,用于从第一数据存储区中读取所述目标触发事件对应的事件参数,不同触发器对应不同第一数据存储区;A data reading module, configured to read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas;
动作调用模块,用于基于所述事件参数,执行所述目标触发器对应的目标调用动作。An action calling module, configured to execute a target calling action corresponding to the target trigger based on the event parameter.
另一方面,本申请实施例提供了一种计算机设备,所述计算机设备包括处理器和存储器;所述存储器存储有至少一条指令,所述至少一条指令用于被所述处理器执行以实现如上述方面所述的微应用的运行方法。On the other hand, an embodiment of the present application provides a computer device, the computer device includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the following: The running method of the micro-application described in the above aspect.
另一方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一条程序代码,所述程序代码由处理器加载并执行以实现如上述方面所述的微应用的运行方法。On the other hand, an embodiment of the present application provides a computer-readable storage medium, where at least one piece of program code is stored in the computer-readable storage medium, and the program code is loaded and executed by a processor to implement the above aspects. The running method of the microapp.
另一方面,本申请实施例提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述方面的各种可选实现方式中提供的微应用的运行方法。On the other hand, an embodiment of the present application provides a computer program product or computer program, where the computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the micro-application running method provided in various optional implementation manners of the above aspect.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without creative effort.
图1是本申请一个示例性实施例示出的微应用软件包的示意图;Fig. 1 is a schematic diagram of a micro-application software package shown in an exemplary embodiment of the present application;
图2是本申请一个示例性实施例示出的微应用脚本的示意图;Fig. 2 is a schematic diagram of a micro-application script shown in an exemplary embodiment of the present application;
图3示出了本申请一个示例性实施例提供的微应用系统的系统架构图;FIG. 3 shows a system architecture diagram of a micro-application system provided by an exemplary embodiment of the present application;
图4示出了本申请一个示例性实施例提供的微应用的运行方法的流程图;FIG. 4 shows a flowchart of a micro-application running method provided by an exemplary embodiment of the present application;
图5示出了本申请一个示例性实施例示出的触发器作用域的示意图;Fig. 5 shows a schematic diagram of a trigger scope shown in an exemplary embodiment of the present application;
图6示出了本申请另一个示例性实施例提供的微应用的运行方法的流程图;FIG. 6 shows a flow chart of a micro-application running method provided by another exemplary embodiment of the present application;
图7示出了本申请一个示例性实施例示出的简单动作类型和组合动作类型的示意图;Fig. 7 shows a schematic diagram of simple action types and combined action types shown in an exemplary embodiment of the present application;
图8示出了本申请一个示例性实施例示出的子节点作用于的示意图;FIG. 8 shows a schematic diagram of a child node acting on an exemplary embodiment of the present application;
图9示出了本申请一个示例性实施例示出的子节点作用域、触发器作用域和全局作用域之间的关系示意图;Fig. 9 shows a schematic diagram of the relationship among sub-node scopes, trigger scopes and global scopes shown in an exemplary embodiment of the present application;
图10示出了本申请另一个示例性实施例提供的微应用的运行方法的流程图;FIG. 10 shows a flow chart of a micro-application running method provided by another exemplary embodiment of the present application;
图11示出了本申请一个示例性实施例示出的条件控制器的示意图;Fig. 11 shows a schematic diagram of a condition controller shown in an exemplary embodiment of the present application;
图12示出了本申请一个示例性实施例示出的循环控制器的示意图;Fig. 12 shows a schematic diagram of a cycle controller shown in an exemplary embodiment of the present application;
图13示出了本申请一个示例性实施例示出的延时控制器的示意图;Fig. 13 shows a schematic diagram of a delay controller shown in an exemplary embodiment of the present application;
图14示出了本申请一个示例性实施例示出的条件控制器的示意图;Fig. 14 shows a schematic diagram of a condition controller shown in an exemplary embodiment of the present application;
图15示出了本申请一个示例性实施例示出的选择控制器的示意图;Fig. 15 shows a schematic diagram of a selection controller shown in an exemplary embodiment of the present application;
图16示出了本申请一个示例性实施例示出的并行控制器的示意图;Fig. 16 shows a schematic diagram of a parallel controller shown in an exemplary embodiment of the present application;
图17示出了本申请一个实施例提供的微应用的运行装置的结构框图;FIG. 17 shows a structural block diagram of a micro-application running device provided by an embodiment of the present application;
图18示出了本申请一个示例性实施例提供的计算机设备的结构方框图。Fig. 18 shows a structural block diagram of a computer device provided by an exemplary embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the purpose, technical solution and advantages of the present application clearer, the implementation manners of the present application will be further described in detail below in conjunction with the accompanying drawings.
为了方便理解,下面对本申请实施例中涉及的名词进行说明。For the convenience of understanding, the nouns involved in the embodiments of the present application are described below.
微应用:微应用可以看做是由服务构成的集合,用于通过服务之间的调用实现特定的业务逻辑,即微应用的微应用功能。不同于传统应用只能运行在特定操作系统上,微应用的服务可以是不同操作系统上的服务,即微应用支持异构操作系统,可以实现跨平台运行。Micro-applications: Micro-applications can be regarded as a collection of services, which are used to implement specific business logic through calls between services, that is, micro-application functions of micro-applications. Unlike traditional applications that can only run on a specific operating system, the services of micro-apps can be services on different operating systems, that is, micro-apps support heterogeneous operating systems and can run across platforms.
不同于传统应用在使用前需要下载,并与设备绑定,微应用采用订阅机制,并与用户绑定,即通过用户帐号下的某一设备订阅微应用后,该用户帐号下的各个设备均可以使用该微应用。Unlike traditional applications that need to be downloaded before use and bound to devices, micro-apps adopt a subscription mechanism and are bound to users. This microapp can be used.
如图1所示,微应用的微应用软件包100由应用描述文件110、程序文件120(微应用脚本)和MD5文件130构成,其中,应用描述文件110用于对该微应用做一些简单的描述,包括微应用的作者、版本信息、时间等;程序文件120用于微应用软件包中最核心的文件,它是开发者通过编辑器编辑的主要生成件,也是微应用引擎的调度对象;MD5文件130用于微应用软件包100的完整性校验。As shown in Figure 1, the micro-application software package 100 of the micro-application consists of an application description file 110, a program file 120 (micro-application script) and an MD5 file 130, wherein the application description file 110 is used to perform some simple operations on the micro-application Description, including the author, version information, time, etc. of the micro-application; the program file 120 is used for the core file in the micro-application software package, which is the main generated part edited by the developer through the editor, and is also the scheduling object of the micro-application engine; The MD5 file 130 is used for integrity verification of the micro-application software package 100 .
微应用脚本:又称为微应用定义,用于控制微应用中服务之间的调用关系,采用脚本语言描述了一段通用的业务逻辑。其中,该脚本语言可以为xml、javascript、JSON、YMAL、C++、Python等,也可以是用户自定义的一些语法格式。Micro-application script: also known as micro-application definition, it is used to control the calling relationship between services in micro-applications, and uses scripting language to describe a general business logic. Wherein, the scripting language can be xml, javascript, JSON, YMAL, C++, Python, etc., or some grammatical format customized by the user.
如图2所示,微应用脚本11由若干触发器12构成,而每个触发器12又是由触发事件13、控制逻辑14以及控制逻辑14所控制的若干服务15构成。其中,微应用脚本中的服务并非服务本身,而是服务的服务标识。可选的,本实施例中,服务15也可以称为简单动作或动作。As shown in FIG. 2 , micro-application script 11 is composed of several triggers 12 , and each trigger 12 is composed of trigger event 13 , control logic 14 and several services 15 controlled by control logic 14 . Wherein, the service in the micro-application script is not the service itself, but the service identifier of the service. Optionally, in this embodiment, the service 15 may also be called a simple action or an action.
不同于传统应用在运行前需要下载并安装应用安装包,比如,在运行安卓应用前,需要下载apk包,微应用在运行前只需要下载对应的微应用脚本,微应用过程中,即通过微应用引擎执行该微应用脚本,实现微应用功能。相较于传统应用,微应用脚本的代码量更低,因此占用的存储空间较小,且有利于动态部署和更新。Different from traditional applications that need to download and install the application installation package before running, for example, before running an Android application, you need to download the apk package. Before running a micro application, you only need to download the corresponding micro application script. The application engine executes the micro-application script to realize the function of the micro-application. Compared with traditional applications, micro-application scripts have a lower code volume, so they occupy less storage space and are conducive to dynamic deployment and updates.
服务:作为微应用运行过程中的最小单元,用于实现特定任务。比如,截屏服务用于实现设备截屏功能、投屏服务用于实现设备间的显示画面投屏等等。并且,微应用运行过程中调用的服务可以为当前设备上的服务,也可以是其他设备上的服务。比如,微应用运行过程中,可以通过调用其他设备上的截屏服务,获取其他设备的设备截屏,并通过调用图片显示服务,对其他设备的设备截屏进行显示。Service: As the smallest unit in the running process of micro-applications, it is used to achieve specific tasks. For example, the screen capture service is used to realize the screen capture function of the device, and the screen projection service is used to realize the screen projection of the display screen between devices, and so on. Moreover, the service invoked during the running of the micro-app may be a service on the current device or a service on other devices. For example, during the running of the micro-app, you can obtain the device screenshots of other devices by calling the screenshot service on other devices, and display the device screenshots of other devices by calling the image display service.
动作(简单动作):是指微应用运行过程中直接调用执行的最小粒度动作实体。简单动作包括了微应用系统自身提供的动作和服务开发者注册的服务动作。系统提供的动作包括:设备选择动作、多动作、重置应用动作、遍历列表动作、自定义参数动作、参数设置动作等;服务动作是服务开发者注册一个服务,在微应用中会自动生成对应的服务动作,比如:截屏动作、打开摄像头动作、打开投屏服务端动作、打开投屏客户端动作等。本实施例中,微应用运行过程中,通过控制逻辑执行简单动作,以实现对简单动作对应服务的调用,比如,微应用运行过程中,可以通过执行截屏动作,调用其他设备上的截屏服务,获取其他设备的设备截屏,并通过执行显示动作,调用图片显示服务,对其他设备的设备截屏进行显示;需要说明的是,在微应用中,执行调用动作本质上就是调用一个服务。Action (simple action): refers to the smallest granularity action entity that is directly invoked and executed during the running process of the micro-application. Simple actions include actions provided by the micro-application system itself and service actions registered by service developers. Actions provided by the system include: device selection action, multi-action, reset application action, traversal list action, custom parameter action, parameter setting action, etc.; service action is a service developer registers a service, and the corresponding micro-app will be automatically generated Service actions, such as: screenshot action, open camera action, open screen mirroring server action, open screen mirroring client action, etc. In this embodiment, during the running process of the micro-app, simple actions are executed through the control logic, so as to realize the invocation of the service corresponding to the simple action. Obtain the device screenshots of other devices, and display the device screenshots of other devices by executing the display action and calling the image display service; it should be noted that in the micro-app, executing the call action is essentially calling a service.
不同于传统应用安装过程中,需要将运行过程中使用到的所有服务预先安装在本地,由于微应用的业务逻辑在运行过程中动态组装,因此微应用中的服务支持动态部署,即在运行过程基于当前设备所执行的业务逻辑,将业务逻辑对应的服务动态部署至当前设备。相应的,当通过多个设备实现同一微应用的微应用功能时,由于不同设备的业务逻辑可能不同,因此不同设备处部署的服务也可能存在差异,即微应用中的服务具有差分部署的特性。Different from the traditional application installation process, all the services used in the running process need to be pre-installed locally. Since the business logic of the micro-application is dynamically assembled during the running process, the services in the micro-application support dynamic deployment, that is, during the running process Based on the business logic executed by the current device, the service corresponding to the business logic is dynamically deployed to the current device. Correspondingly, when the micro-application function of the same micro-application is implemented through multiple devices, since the business logic of different devices may be different, the services deployed on different devices may also be different, that is, the services in the micro-application have the characteristics of differential deployment .
本申请实施例中,构成微应用的服务可以包括静态服务和动态服务,其中,静态服务指由宿主应用提供的服务,需要预安装在设备中,而动态服务则是指支持动态部署的服务,可以在微应用运行过程中动态部署在设备中。In the embodiment of the present application, the services constituting the micro-application may include static services and dynamic services, wherein the static services refer to the services provided by the host application and need to be pre-installed in the device, while the dynamic services refer to the services that support dynamic deployment. It can be dynamically deployed in the device during the running of the micro application.
图3示出了本申请一个示例性实施例提供的微应用系统的系统架构图。该系统中包括至少一个计算机设备210以及服务器220。Fig. 3 shows a system architecture diagram of a micro-application system provided by an exemplary embodiment of the present application. The system includes at least one computer device 210 and a server 220 .
计算机设备210是具有微应用运行功能的电子设备,该电子设备可以是智能手机、平板电脑、个人计算机、车机等等,本实施对此不作限定。图3中以设备210包括智能手机、平板电脑以及车机为例进行说明,但并不对此构成限定。The computer device 210 is an electronic device with a micro-application running function. The electronic device may be a smart phone, a tablet computer, a personal computer, a car machine, etc., which is not limited in this implementation. In FIG. 3 , the device 210 includes a smart phone, a tablet computer, and a car machine as an example for illustration, but this is not limited thereto.
在一种可能的实施方式中,计算机设备210中设置有微应用引擎211,微应用引擎211作为控制微应用运行的核心,包括脚本管理模块2111、事件总线模块2112、应用调度模块2113、运行时模块2114以及服务调度模块2115。In a possible implementation, the computer device 210 is provided with a micro-application engine 211. The micro-application engine 211 serves as the core for controlling the operation of the micro-application, including a script management module 2111, an event bus module 2112, an application scheduling module 2113, and a runtime Module 2114 and service scheduling module 2115.
脚本管理模块2111用于管理计算机设备210中存储的各个微应用的微应用脚本,并负责对微应用脚本进行解析,以此确定该微应用脚本中的触发器以及触发器下的服务。可选的,脚本管理模块2111还用于在接收到对微应用的订阅操作时,下载相应的微应用脚本,在接收到对微应用的订阅取消操作时,删除微应用对应的微应用脚本。The script management module 2111 is used to manage the micro-application scripts of each micro-application stored in the computer device 210, and is responsible for analyzing the micro-application scripts, so as to determine the triggers in the micro-application scripts and the services under the triggers. Optionally, the script management module 2111 is further configured to download the corresponding micro-application script when receiving a micro-application subscription operation, and delete the micro-application script corresponding to the micro-application when receiving a micro-application subscription cancellation operation.
事件总线模块2112用于与应用调度模块2113进行配合,基于触发事件实现微应用调度。在一些实施例中,事件总线模块2112下挂载有多个微应用对应的触发器,由于同一触发事件可能会触发多个订阅的微应用,因此事件总线模块2112接收到触发事件后,交由应用调度模块2113从若干个微应用中确定出需要运行的微应用。其中,应用调度模块2113可以基于调度策略自动确定微应用,也可以交由用户手动选择微应用。The event bus module 2112 is used to cooperate with the application scheduling module 2113 to implement micro-application scheduling based on trigger events. In some embodiments, triggers corresponding to multiple micro-applications are mounted under the event bus module 2112. Since the same trigger event may trigger multiple subscribing micro-applications, after the event bus module 2112 receives the trigger event, the The application scheduling module 2113 determines the micro-applications that need to be run from several micro-applications. Wherein, the application scheduling module 2113 can automatically determine the micro-application based on the scheduling strategy, or allow the user to manually select the micro-application.
运行时模块2114用于执行微应用脚本中的控制逻辑,从而基于该控制逻辑与服务调度模块2115进行交互,由服务调度模块2115进行服务调用。The runtime module 2114 is used to execute the control logic in the micro-application script, so as to interact with the service scheduling module 2115 based on the control logic, and the service scheduling module 2115 makes a service call.
此外除了设置有微应用引擎211外,计算机设备210中还设置有服务治理模块212、数据同步模块213以及服务网关214。In addition, in addition to the micro-application engine 211 , the computer device 210 is also provided with a service management module 212 , a data synchronization module 213 and a service gateway 214 .
其中,服务治理模块212用于管理设备中预安装的静态服务;数据同步模块213用于在微应用引擎211的状态发生变更时(比如服务产生的事件导致状态变更),向其他计算机设备进行状态同步,确保不同计算机设备处微应用引擎211的状态一致性。Among them, the service management module 212 is used to manage the pre-installed static services in the device; the data synchronization module 213 is used to update the status to other computer devices when the state of the micro-application engine 211 changes (for example, an event generated by the service causes a state change). Synchronization ensures the state consistency of the micro-application engine 211 on different computer devices.
服务网关214用于基于服务调度模块2115的服务调用请求进行服务调用,具体包括代理管理模块2141以及生命周期管理模块2142。代理管理模块2141中设置有不同的服务代理,服务代理用于将统一格式的服务调用请求进行转换,得到符合真实服务格式要求的请求。生命周期管理模块2142用于管理服务的生命周期,可以包括静态服务生命周期管理模块以及动态服务生命周期管理模块。The service gateway 214 is configured to perform service invocation based on the service invocation request of the service scheduling module 2115 , and specifically includes an agent management module 2141 and a life cycle management module 2142 . The proxy management module 2141 is provided with different service proxies, and the service proxies are used to convert service invocation requests in a unified format to obtain requests that meet the requirements of the real service format. The lifecycle management module 2142 is used to manage the lifecycle of the service, and may include a static service lifecycle management module and a dynamic service lifecycle management module.
微应用运行过程中,计算机设备210除了可以通过自身的服务网关214进行服务调用外,还可以通过其他设备的服务网关214进行服务调用(由微应用的业务逻辑决定),即可以实现跨设备的服务调用。During the running process of the micro-application, the computer device 210 can not only make service calls through its own service gateway 214, but also make service calls through the service gateway 214 of other devices (determined by the business logic of the micro-application), that is, cross-device service call.
针对不同部署方式的服务,如图3所示,计算机设备210中还设置有静态服务模块216和动态服务模块215。静态服务模块216用于管理预安装的静态服务,动态服务模块215则用于管理动态部署的动态服务。For services in different deployment modes, as shown in FIG. 3 , a static service module 216 and a dynamic service module 215 are also provided in the computer device 210 . The static service module 216 is used to manage pre-installed static services, and the dynamic service module 215 is used to manage dynamically deployed dynamic services.
在一些实施例中,动态服务模块215中包含的服务可以对应不同运行环境、不同部署形态或不同编程开发语言。图3中以动态服务模块215包含安卓动态服务2151、Web动态服务2152以及容器动态服务2153为例进行示意性说明,但并不对此构成限定。In some embodiments, the services contained in the dynamic service module 215 may correspond to different operating environments, different deployment forms or different programming development languages. In FIG. 3 , the dynamic service module 215 includes the Android dynamic service 2151 , the Web dynamic service 2152 and the container dynamic service 2153 as an example for schematic illustration, but this is not limited thereto.
服务器220是一台服务器、若干台服务器构成的服务集群或云计算中心。根据服务器集群中各服务器所实现功能进行划分,如图3所示,服务器集群中包括用户资源管理服务器221、微应用商店服务器222、服务市场服务器223以及云端服务库224。The server 220 is a server, a service cluster composed of several servers, or a cloud computing center. According to the functions realized by each server in the server cluster, as shown in FIG. 3 , the server cluster includes a user resource management server 221 , a micro application store server 222 , a service market server 223 and a cloud service library 224 .
用户资源管理服务器221中包括用户管理模块2211、应用管理模块2212、服务管理模块2213、设备管理模块2214以及安全模块2215。用户管理模块2211用于对使用微应用的用户帐号进行管理;应用管理模块2212用于对不同用户帐号下订阅的微应用进行管理;服务管理模块2213用于对调用的服务进行管理;设备管理模块2214用于对用户帐号与设备之间的绑定关系进行管理;安全模块2215则用于在交互过程中进行安全性验证。The user resource management server 221 includes a user management module 2211 , an application management module 2212 , a service management module 2213 , a device management module 2214 and a security module 2215 . The user management module 2211 is used to manage the user accounts using micro-applications; the application management module 2212 is used to manage the micro-applications subscribed under different user accounts; the service management module 2213 is used to manage the invoked services; the device management module 2214 is used to manage the binding relationship between the user account and the device; the security module 2215 is used to perform security verification during the interaction process.
微应用商店服务器222用于提供微应用订阅服务。用户需要使用微应用时,可以通过微应用商店服务器222提供的微应用搜索引擎2221进行微应用搜索,进而从搜索结果中选择订阅微应用。The micro application store server 222 is used to provide micro application subscription services. When a user needs to use a micro-app, he can search for the micro-app through the micro-app search engine 2221 provided by the micro-app store server 222, and then choose to subscribe to the micro-app from the search results.
在一些实施例中,微应用商店服务器222接收到对微应用的订阅操作后,将用户帐号与所订阅微应用的应用标识发送至用户资源管理服务器221,由用户资源管理服务器221中的应用管理模块2212更新用户帐号与微应用的订阅关系。进一步的,用户管理模块2211与设备管理模块2214,确定该用户帐号下的其 他设备,并向其他设备推送订阅通知,以便其他设备从微应用商店服务器222处下载微应用的微应用脚本。示意性的,如图3所示,用户“张三”通过智能手机订阅微应用后,登陆“张三”这一用户帐号的车机和平板电脑接收到用户资源管理服务器221推送的订阅通知,从而基于通知中的应用标识下载微应用的微应用脚本。In some embodiments, after the micro application store server 222 receives the subscription operation to the micro application, it sends the user account and the application identification of the subscribed micro application to the user resource management server 221, and the application management in the user resource management server 221 Module 2212 updates the subscription relationship between the user account and the micro-application. Further, the user management module 2211 and the device management module 2214 determine other devices under the user account, and push subscription notifications to other devices, so that other devices download the micro application script of the micro application from the micro application store server 222. Schematically, as shown in Figure 3, after the user "Zhang San" subscribes to the micro-app through the smart phone, the car and tablet computer that logs in to the user account of "Zhang San" receive the subscription notification pushed by the user resource management server 221, The micro-app script of the micro-app is thereby downloaded based on the app identification in the notification.
服务市场服务器223是面向开发者,用于提供服务查询服务的服务器。开发者可以通过服务市场服务器223提供的服务搜索引擎2231进行服务搜索,并将搜索到的服务应用于开发的微应用中,进而将开发完成的微应用上传至微应用商店服务器222,供其他用户下载使用。The service market server 223 is a server for developers to provide service inquiry services. Developers can search for services through the service search engine 2231 provided by the service market server 223, and apply the searched services to the developed micro-applications, and then upload the developed micro-applications to the micro-application store server 222 for other users Download and use.
除此之外,开发者也可以进行动态服务开发,并将开发的动态服务上传至云端服务库224。后续计算机设备210即可从云端服务库224处下载并部署动态服务。In addition, developers can also develop dynamic services and upload the developed dynamic services to the cloud service library 224 . The subsequent computer device 210 can download and deploy the dynamic service from the cloud service library 224 .
需要说明的是,上述实施例仅对微应用系统的基础架构进行了说明,微应用系统中还可以包括其他计算机设备(比如开发者设备)或实现其他功能的服务器,本实施例并不对此构成限定。It should be noted that the above embodiments only illustrate the basic structure of the micro-application system, and the micro-application system may also include other computer devices (such as developer devices) or servers that implement other functions, and this embodiment does not constitute limited.
请参考图4,其示出了本申请一个示例性实施例提供的微应用的运行方法的流程图,本申请实施例以该方法应用于图3所示的计算机设备为例进行说明,该方法包括:Please refer to FIG. 4 , which shows a flow chart of a micro-application running method provided by an exemplary embodiment of the present application. The embodiment of the present application takes the application of the method to the computer device shown in FIG. 3 as an example for illustration. The method include:
步骤401,获取目标微应用的目标微应用脚本,目标微应用脚本由至少一个触发器构成。 Step 401, acquiring a target micro-application script of a target micro-application, where the target micro-application script consists of at least one trigger.
在一种可能的实施方式中,当接收到目标微应用的启动指令时,计算机设备从本地存储的微应用脚本中,获取目标微应用对应的目标微应用脚本,其中,计算机设备本地存储由当前登陆的用户帐号所订阅的微应用的微应用脚本。In a possible implementation manner, when receiving the startup instruction of the target micro-application, the computer device obtains the target micro-application script corresponding to the target micro-application from the locally stored micro-application script, wherein the local storage of the computer device is determined by the current The microapp script of the microapp subscribed by the logged in user account.
可选的,该启动指令可以由用户通过点击微应用图标触发,可以由交互触发(比如语音、摇一摇、敲击、场景感知等等),本申请实施例并不对启动目标微应用的具体方式进行限定。Optionally, the start instruction can be triggered by the user clicking the micro-application icon, or can be triggered by interaction (such as voice, shake, tap, scene perception, etc.). way is limited.
本申请实施例中,微应用作为一种由服务构成的集合,其业务逻辑由计算机设备通过微应用引擎执行微应用脚本实现,其中,不同微应用的微应用脚本均由同一微应用引擎执行。In the embodiment of the present application, a micro-application is a collection of services, and its business logic is realized by computer equipment executing micro-application scripts through a micro-application engine, wherein micro-application scripts of different micro-applications are all executed by the same micro-application engine.
微应用脚本作为一种低代码量的脚本文件,由若干触发器构成,且各个触发器用于在特定的触发事件下触发,并在触发后通过执行触发器对应的调用动作进行服务调用。As a low-code script file, the micro-app script is composed of several triggers, and each trigger is used to trigger under a specific trigger event, and after the trigger is triggered, the service call is performed by executing the call action corresponding to the trigger.
可选的,调用动作可以是简单动作,也可以是组合动作,在调用动作是简单动作的情况下,当触发器被触发后,可以直接执行该简单动作进行服务调用;在调用动作是组合动作的情况下,当触发器被触发后,需要通过控制器执行简单动作,以进行服务调用,该控制器用于指示简单动作的调用逻辑。Optionally, the calling action can be a simple action or a combined action. If the calling action is a simple action, when the trigger is triggered, the simple action can be directly executed to call the service; if the calling action is a combined action In the case of , when the trigger is triggered, a simple action needs to be executed through the controller to make a service call. The controller is used to indicate the call logic of the simple action.
在一些实施例中,微应用脚本中至少包括初始化触发器和结束触发器,初始化触发器用于触发微应用开始运行,结束触发器则用于触发微应用结束运行。除了初始化触发器和结束触发器以外,微应用脚本中还包括实现具体微应用功能的其它触发器,本申请实施例对此不作限定。In some embodiments, the micro-application script includes at least an initialization trigger and an end trigger. The initialization trigger is used to trigger the micro-application to start running, and the end trigger is used to trigger the micro-application to stop running. In addition to the initialization trigger and the end trigger, the micro-application script also includes other triggers for implementing specific micro-application functions, which is not limited in this embodiment of the present application.
步骤402,响应于目标触发事件,触发目标微应用脚本中目标触发事件对应的目标触发器。 Step 402, triggering a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event.
微应用运行过程中,当接收到目标触发事件时,计算机设备从目标微应用脚本中确定出该目标触发事件所触发的目标触发器,从而将该目标触发器由未触发状态设置为触发状态。触发状态下,计算机设备即通过微应用引擎执行触发器对应的调用动作,调用对应服务以实现相应地业务逻辑。When the micro-application is running, when the target trigger event is received, the computer device determines the target trigger triggered by the target trigger event from the target micro-application script, thereby setting the target trigger from the untriggered state to the triggered state. In the triggered state, the computer device executes the calling action corresponding to the trigger through the micro-application engine, and calls the corresponding service to realize the corresponding business logic.
可选的,该目标触发事件可以是用户触发的事件,比如敲击事件、摇一摇事件等等,也可以是调用服务后输出的事件,比如,上一触发器对应服务调用完成后返回的事件,本实施例对此不作限定。Optionally, the target trigger event can be an event triggered by the user, such as a tap event, a shake event, etc., or an event output after calling the service, for example, the last trigger corresponding to the service returned after the call is completed event, which is not limited in this embodiment.
步骤403,从第一数据存储区中读取目标触发事件对应的事件参数,不同触发器对应不同第一数据存储区。 Step 403, read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas.
在微应用运行过程中除了执行调用动作之外,还涉及到数据传递过程,比如,“投屏事件”会携带投屏的源设备和目的设备的相关参数信息,该参数信息会存储在“投屏事件”对应触发器的触发器作用域中,以便该触发器下对应的目标调用动作可以访问该相关参数信息。因此,在一种可能的实施方式中,当接收到目标触发事件时,也会将目标触发事件对应的事件参数存储在第一数据存储区中,以便后续该目标触发器对应的目标调用动作执行过程中,可以访问该第一数据存储区,以获取对应的事件参数,继续执行后续服务调用过程。In addition to the execution of the call action, the running process of the micro-app also involves the data transmission process. For example, the "screen projection event" will carry the relevant parameter information of the source device and the destination device of the screen projection, and the parameter information will be stored in the "projection event" screen event" in the trigger scope of the corresponding trigger, so that the corresponding target call action under the trigger can access the relevant parameter information. Therefore, in a possible implementation manner, when a target trigger event is received, the event parameters corresponding to the target trigger event will also be stored in the first data storage area, so that the subsequent target call action corresponding to the target trigger can be executed During the process, the first data storage area can be accessed to obtain corresponding event parameters, and the subsequent service invocation process can be continued.
由于微应用包含若干触发器,不同触发器由不同触发事件触发,为了避免过多的数据产生冲突,或者在调用过程中需要长时间的查找所需数据,在一种可能的实施方式中,针对不同触发器设置不同第一数据存储区(触发器作用域或数据作用域),与触发器相关的事件参数存储在该触发器对应的第一数据存储区中,则目标触发事件对应的事件参数仅可以被目标触发事件对应的目标调用动作访问到。可选的,在目标调用动作包括多个控制器和多个简单动作时,则仅可以被目标触发器对应的控制器和简单动作访问到。Since the micro-application contains several triggers, and different triggers are triggered by different trigger events, in order to avoid conflicts caused by too much data, or it takes a long time to find the required data during the calling process, in a possible implementation, for Different triggers set different first data storage areas (trigger scope or data scope), the event parameters related to the trigger are stored in the first data storage area corresponding to the trigger, and the event parameters corresponding to the target trigger event It can only be accessed by the target call action corresponding to the target trigger event. Optionally, when the target call action includes multiple controllers and multiple simple actions, it can only be accessed by the controller and simple action corresponding to the target trigger.
需要说明的是,当接收到目标触发事件时,触发目标微应用脚本中目标触发事件对应的目标触发器的同时,可以将目标触发事件对应的事件参数存储在目标触发器对应的触发器作用域(第一数据存储区)中。It should be noted that when a target trigger event is received, while the target trigger corresponding to the target trigger event in the target micro-app script is triggered, the event parameter corresponding to the target trigger event can be stored in the trigger scope corresponding to the target trigger (first data store).
在一些示例性的例子中,事件参数可以是目标触发事件所携带的数据,比如,“投屏事件”所携带的源设备和目的设备的相关信息。In some illustrative examples, the event parameter may be the data carried by the target trigger event, for example, the relevant information of the source device and the destination device carried by the "screen casting event".
如图5所示,其示出了本申请一个示例性实施例示出的触发器作用域的示意图。当接收到目标事件503,触发该目标事件503对应的触发器501,目标事件503对应的事件参数可以存储在触发器作用域510中,该触发器501关联的控制器1~控制器4,以及动作1~动作4均可以调用该事件参数;而控制器5~控制器7,以及动作5~动作9无法调用存储在触发器作用域510中的数据;当接收到目标事件504,触发该目标事件504对应的触发器502,目标事件504对应的事件参数可以存储在触发器作用域520中,该触发器502关联的控制器5~控制器7,以及动作5~动作9均可以调用该事件参数;而控制器1~控制器4,以及动作1~动作4无法调用存在在触发器作用域520中的数据。As shown in FIG. 5 , it shows a schematic diagram of a trigger scope shown in an exemplary embodiment of the present application. When the target event 503 is received, the trigger 501 corresponding to the target event 503 is triggered, and the event parameters corresponding to the target event 503 can be stored in the trigger scope 510, the controllers 1 to 4 associated with the trigger 501, and Actions 1 to 4 can call the event parameters; but controllers 5 to 7, and actions 5 to 9 cannot call the data stored in the trigger scope 510; when the target event 504 is received, the target The trigger 502 corresponding to the event 504, and the event parameters corresponding to the target event 504 can be stored in the trigger scope 520, and the controller 5-controller 7 and action 5-action 9 associated with the trigger 502 can call this event Parameters; while Controller 1-Controller 4, and Action 1-Action 4 cannot call the data existing in the trigger scope 520 .
在微应用运行过程中涉及到数据传递过程,比如,对于投屏事件的事件参数,在执行投屏服务的调用动作时,需要该事件参数,对应在执行调用动作的过程中,需要获取到该事件参数,以便后续基于该事件参数进行后续的服务调用过程。因此,在一种可能的实施方式中,在执行目标触发器对应的目标调用动作之前,访问第一数据存储区,从中读取到目标触发事件对应的事件参数。The data transfer process is involved in the running process of the micro-app. For example, for the event parameter of the screen projection event, the event parameter is required when the call action of the screen projection service is executed, and the corresponding event parameter needs to be obtained during the execution of the call action. Event parameters, so that the subsequent service call process can be performed based on the event parameters. Therefore, in a possible implementation manner, before executing the target call action corresponding to the target trigger, access the first data storage area, and read the event parameter corresponding to the target trigger event therefrom.
步骤404,基于事件参数,执行目标触发器对应的目标调用动作。 Step 404, based on the event parameter, execute the target invocation action corresponding to the target trigger.
在一种可能的实施方式中,计算机设备通过微应用引擎中的运行时模块,基于事件参数,执行目标触发器对应的目标调用动作,以实现对目标服务的调用,进而实现微应用的特定微应用功能。In a possible implementation, the computer device executes the target invocation action corresponding to the target trigger based on the event parameters through the runtime module in the micro-application engine, so as to realize the invocation of the target service, and then realize the specific micro-application of the micro-application. App function.
需要说明的是,本申请实施例中的调用动作本质上是调用某个服务,通过执行目标调用动作,调用目标服务,以实现微应用的微应用功能;示意性的,目标调用动作为截屏动作,则执行截屏动作的过程就是截屏服务的调用过程,通过调用截屏服务以实现微应用的截屏功能。It should be noted that the calling action in the embodiment of the present application is essentially calling a certain service. By executing the target calling action, the target service is called to realize the micro application function of the micro application; schematically, the target calling action is a screenshot action , the process of executing the screen capture action is the process of calling the screen capture service, and the screen capture function of the micro-app is realized by calling the screen capture service.
本申请实施例中,计算机设备调用的目标服务可以是当前设备的服务,也可以是外部设备的服务,即可以实现跨设备服务调用,从而通过与外部设备交互实现目标微应用的微应用功能。In the embodiment of the present application, the target service invoked by the computer device may be a service of the current device or a service of an external device, that is, a cross-device service call may be realized, thereby realizing the micro-application function of the target micro-application through interaction with the external device.
此外,本申请实施例中,由于微应用的服务除了支持静态部署外,还支持在运行过程中动态部署,因此在调用目标服务前,计算机设备需要确定目标服务是否已部署在本地,并在未部署时对该目标服务进行动态部署(针对动态服务)。In addition, in the embodiment of this application, since the service of the micro-application supports dynamic deployment during operation in addition to static deployment, before invoking the target service, the computer device needs to determine whether the target service has been deployed locally, and During deployment, the target service is dynamically deployed (for dynamic services).
需要说明的是,当微应用中包含多个触发器时,计算机设备重复执行上述步骤402至404,并在触发结束触发器后,执行结束触发器的控制逻辑,以结束运行微应用。It should be noted that, when the micro-application contains multiple triggers, the computer device repeatedly executes the above steps 402 to 404, and after the end trigger is triggered, executes the control logic of the end trigger to end the running of the micro-application.
综上所述,本申请实施例中,在微应用运行过程中,通过获取微应用的微应用脚本,并基于触发事件触发微应用脚本中对应的触发器,进而执行该触发器对应的调用动作,以实现微应用的微应用功能。由于微应用的运行基于低代码量的微应用脚本,因此相较于传统应用所需占用的存储空间更小;并且,将调用动作组装成微应用,并利用微应用脚本管理调用动作之间的调用关系,实现了微应用的组件化,提高了微应用间调用动作的复用性,有助于降低微应用的开发难度,此外,在微应用运行过程中为不同触发器提供有专有的数据存储区,使得该触发器关联的调用动作可以访问该数据存储区,在实现微应用内数据传递目的的同时,也可以避免不同触发器对应数据的冲突问题。To sum up, in the embodiment of this application, during the running process of the micro-application, by obtaining the micro-application script of the micro-application, and triggering the corresponding trigger in the micro-application script based on the trigger event, and then executing the call action corresponding to the trigger , to implement the micro-app function of the micro-app. Since the operation of micro-apps is based on micro-app scripts with low code volume, the storage space required is smaller than that of traditional applications; and the calling actions are assembled into micro-apps, and the micro-app scripts are used to manage the relationship between calling actions The call relationship realizes the componentization of micro-applications, improves the reusability of calling actions between micro-applications, and helps to reduce the development difficulty of micro-applications. The data storage area enables the call action associated with the trigger to access the data storage area. While achieving the purpose of data transfer in the micro-app, it can also avoid the conflict of data corresponding to different triggers.
可选的,目标调用动作的动作类型包括简单动作类型和组合动作类型,简单动作类型下目标调用动作由单个目标简单动作构成,组合动作类型下目标调用动作由至少一个目标控制器和至少一个目标简单动作构成,目标控制器用于指示目标简单动作的目标调用逻辑;Optionally, the action type of the target call action includes simple action type and combined action type. The target call action under the simple action type consists of a single target simple action, and the target call action under the combined action type consists of at least one target controller and at least one target Simple action composition, the target controller is used to instruct the target call logic of the simple action of the target;
执行目标触发器对应的目标调用动作,包括:Execute the target invocation action corresponding to the target trigger, including:
在目标调用动作包括至少一个目标控制器的情况下,通过至少一个目标控制器控制执行至少一个目标简单动作。In the case that the target calling action includes at least one target controller, at least one target simple action is controlled to be executed by the at least one target controller.
可选的,目标调用动作包括位于父节点的目标简单动作和位于子节点的目标简单动作;Optionally, the target call action includes a target simple action located at the parent node and a target simple action located at the child node;
通过至少一个目标控制器控制执行至少一个目标简单动作,包括:Perform at least one target simple action controlled by at least one target controller, including:
通过目标控制器控制执行位于父节点的目标简单动作,以及获取执行位于父节点的目标简单动作后反馈的目标服务数据;Control the execution of the target simple action at the parent node through the target controller, and obtain the target service data fed back after executing the target simple action at the parent node;
从第二数据存储区中读取目标服务数据,位于父节点的目标简单动作不同,对应不同第二数据存储区;Reading the target service data from the second data storage area, the target simple action located in the parent node is different, and corresponds to a different second data storage area;
基于目标服务数据,执行位于子节点的目标简单动作。Based on the target service data, execute the target simple action located in the child node.
可选的,方法还包括:Optionally, the method also includes:
将目标微应用对应的运行环境参数存储在第三数据存储区,第三数据存储区允许由各个触发器触发的调用动作访问。The operating environment parameters corresponding to the target micro-application are stored in the third data storage area, and the third data storage area allows access to the calling action triggered by each trigger.
可选的,目标调用动作的动作类型包括简单动作类型和组合动作类型,简单动作类型下目标调用动作由单个目标简单动作构成,组合动作类型下目标调用动作由至少一个目标控制器和至少一个目标简单动作构成,目标控制器用于指示目标简单动作的目标调用逻辑;Optionally, the action type of the target call action includes simple action type and combined action type. The target call action under the simple action type consists of a single target simple action, and the target call action under the combined action type consists of at least one target controller and at least one target Simple action composition, the target controller is used to instruct the target call logic of the simple action of the target;
执行标触发器对应的目标调用动作,包括:Execute the target call action corresponding to the trigger, including:
在目标调用动作包括至少一个目标控制器的情况下,确定目标控制器所指示的目标调用逻辑;Where the target invocation action includes at least one target controller, determining the target invocation logic indicated by the target controller;
基于目标调用逻辑,执行目标简单动作。Based on the target call logic, execute the target simple action.
可选的,目标控制器为条件控制器,条件控制器与至少两个候选简单动作关联;Optionally, the target controller is a conditional controller, and the conditional controller is associated with at least two candidate simple actions;
确定目标控制器所指示的目标调用逻辑,包括:Determine the target invocation logic indicated by the target controller, including:
确定目标控制器所指示的目标调度条件;determining the target scheduling conditions indicated by the target controller;
基于目标调用逻辑,执行目标简单动作,包括:Based on the target invocation logic, execute the simple actions of the target, including:
基于目标调度条件,从候选简单动作中确定出目标简单动作,以及执行目标简单动作。Based on the target scheduling condition, the target simple action is determined from the candidate simple actions, and the target simple action is executed.
可选的,目标控制器为循环控制器;Optionally, the target controller is a loop controller;
确定目标控制器所指示的目标调用逻辑,包括:Determine the target invocation logic indicated by the target controller, including:
确定目标控制器所指示的目标循环条件;determining target cycle conditions indicated by the target controller;
基于目标调用逻辑,执行目标简单动作,包括:Based on the target invocation logic, execute the simple actions of the target, including:
在目标简单动作的执行状态未满足目标循环条件的情况下,继续循环执行目标简单动作。In the case that the execution state of the target simple action does not meet the target loop condition, continue to execute the target simple action cyclically.
可选的,在目标简单动作的执行状态未满足目标循环条件的情况下,继续执行目标简单动作,包括如下任意一种:Optionally, when the execution state of the target simple action does not meet the target cycle condition, continue to execute the target simple action, including any of the following:
在目标简单动作的执行次数未达到次数阈值的情况下,继续循环执行目标简单动作;When the number of executions of the target simple action does not reach the number threshold, continue to execute the target simple action in a loop;
在目标简单动作对应的目标服务未调用成功的情况下,继续循环执行目标简单动作;If the target service corresponding to the target simple action is not called successfully, continue to execute the target simple action in a loop;
在目标简单动作对应的目标服务未调用失败的情况下,继续循环执行目标简单动作。In the case that the target service corresponding to the target simple action does not fail to be called, continue to execute the target simple action in a loop.
可选的,目标控制器为延时控制器;Optionally, the target controller is a delay controller;
确定目标控制器所指示的目标调用逻辑,包括:Determine the target invocation logic indicated by the target controller, including:
确定目标控制器所指示的目标调用延时;determining the target invocation latency indicated by the target controller;
基于目标调用逻辑,执行目标简单动作,包括:Based on the target invocation logic, execute the simple actions of the target, including:
在达到目标调用延时的情况下,执行目标简单动作。In case the target call delay is reached, execute the target simple action.
可选的,目标控制器为顺序控制器,顺序控制器与至少两个候选简单动作关联;Optionally, the target controller is a sequence controller, and the sequence controller is associated with at least two candidate simple actions;
确定目标控制器所指示的目标调用逻辑,包括:Determine the target invocation logic indicated by the target controller, including:
确定目标控制器所指示的各个候选简单动作对应的目标调用顺序;Determine the target invocation sequence corresponding to each candidate simple action indicated by the target controller;
基于目标调用逻辑,执行目标简单动作,包括:Based on the target invocation logic, execute the simple actions of the target, including:
基于目标调用顺序,依次将候选简单动作确定为目标简单动作,以及依次执行各个目标简单动作。Based on the target calling sequence, the candidate simple actions are sequentially determined as the target simple actions, and each target simple action is sequentially executed.
可选的,依次执行各个目标简单动作,包括:Optionally, execute the simple actions of each target in sequence, including:
在第n目标简单动作执行成功的情况下,继续执行第n+1目标简单动作;When the nth target simple action is successfully executed, continue to execute the n+1th target simple action;
方法还包括:Methods also include:
在第n目标简单动作执行失败的情况下,停止执行第n+1目标简单动作。In the case that the execution of the nth target simple action fails, the execution of the n+1th target simple action is stopped.
可选的,目标控制器为选择控制器,选择控制器与至少两个候选简单动作关联;Optionally, the target controller is a selection controller, and the selection controller is associated with at least two candidate simple actions;
确定目标控制器所指示的目标调用逻辑,包括:Determine the target invocation logic indicated by the target controller, including:
确定目标控制器所指示的目标调用顺序;determine the sequence of target invocations indicated by the target controller;
基于目标调用逻辑,执行目标简单动作,包括:Based on the target invocation logic, execute the simple actions of the target, including:
基于目标调用顺序,依次执行候选简单动作;在存在候选简单动作执行成功的情况下,将候选简单动作确定为目标简单动作,以及停止执行其他候选简单动作。Based on the target invocation sequence, the candidate simple actions are executed sequentially; if there is a candidate simple action that is successfully executed, the candidate simple action is determined as the target simple action, and the execution of other candidate simple actions is stopped.
可选的,目标控制器为并行控制器,并行控制器与至少两个候选简单动作关联;Optionally, the target controller is a parallel controller, and the parallel controller is associated with at least two candidate simple actions;
基于目标调用逻辑,执行目标简单动作,包括:Based on the target invocation logic, execute the simple actions of the target, including:
将各个候选简单动作确定为目标简单动作,以及并行执行各个目标简单动作。Each candidate simple action is determined as a target simple action, and each target simple action is executed in parallel.
微应用运行过程中所涉及到的数据传递过程除了事件参数的传递过程之外,还涉及到服务返回值的传递过程,比如,“截屏动作”会返回截取到的图片数据,而在“图片显示动作”执行时,需要访问截取到的图片数据;因此,在一种可能的实施方式中,针对该服务返回值也设置有对应的数据空间作用域。In addition to the event parameter transfer process, the data transfer process involved in the running process of the micro-app also involves the transfer process of the service return value. For example, the "screen capture action" will return the captured image data, and the When the "action" is executed, the intercepted image data needs to be accessed; therefore, in a possible implementation, a corresponding data space scope is also set for the service return value.
请参考图6,其示出了本申请另一个示例性实施例提供的微应用的运行方法的流程图,本申请实施例以该方法应用于图3所示的计算机设备为例进行说明,该方法包括:Please refer to FIG. 6, which shows a flow chart of a micro-application running method provided by another exemplary embodiment of the present application. The embodiment of the present application takes the application of the method to the computer device shown in FIG. 3 as an example for illustration. Methods include:
步骤601,获取目标微应用的目标微应用脚本,目标微应用脚本由至少一个触发器构成。 Step 601 , acquiring a target micro-application script of a target micro-application, where the target micro-application script consists of at least one trigger.
步骤602,响应于目标触发事件,触发目标微应用脚本中目标触发事件对应的目标触发器。 Step 602, triggering a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event.
步骤603,从第一数据存储区中读取目标触发事件对应的事件参数,不同触发器对应不同第一数据存储区。 Step 603, read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas.
步骤601至步骤603的实施方式可以参考上文实施例,本实施例在此不做赘述。For implementation manners of steps 601 to 603, reference may be made to the foregoing embodiments, and details are not described herein in this embodiment.
步骤604,在目标调用动作包括至少一个目标控制器的情况下,基于事件参数,通过至少一个目标控制器控制执行至少一个目标简单动作。 Step 604, in the case that the target call action includes at least one target controller, based on the event parameters, at least one target simple action is controlled by the at least one target controller.
其中,调用动作的动作类型包括简单动作类型和组合动作类型,简单动作类型下调用动作由单个简单动作构成,组合动作类型下调用动作由至少一个控制器和至少一个简单动作构成,控制器用于指示简单动 作的调用逻辑。Among them, the action type of calling action includes simple action type and combined action type. The calling action under the simple action type is composed of a single simple action, and the calling action under the combined action type is composed of at least one controller and at least one simple action. The controller is used to indicate Call logic for simple actions.
如图7所示,其示出了本申请一个示例性实施例示出的简单动作类型和组合动作类型的示意图。当调用动作的动作类型为简单动作类型时,当接收到事件1时,触发事件1对应的触发器1,由触发器1触发执行简单动作701,以调用服务;当调用动作的动作类型为组合动作类型时,当接收到事件2,触发事件2对应的触发器2,由触发器2触发执行组合动作702,该组合动作702由控制器1~控制器5和动作1~动作8构成,其中,动作1~动作8均为简单动作;在调用动作执行过程中,需要由控制器1和控制器2控制执行动作1;由控制器1、控制器2和控制器4控制执行动作2;需要由控制器1、控制器2和控制5控制执行动作3~动作5;需要由控制器1和控制器3控制执行动作6~动作8。As shown in FIG. 7 , it shows a schematic diagram of simple action types and combined action types shown in an exemplary embodiment of the present application. When the action type of the call action is a simple action type, when event 1 is received, the trigger 1 corresponding to event 1 is triggered, and the trigger 1 triggers the execution of simple action 701 to call the service; when the action type of the call action is combination For the action type, when event 2 is received, trigger 2 corresponding to event 2 is triggered, and trigger 2 triggers the execution of combined action 702. The combined action 702 is composed of controller 1-controller 5 and action 1-action 8, where , actions 1 to 8 are simple actions; during the execution of the call action, it is necessary to control the execution of action 1 by controller 1 and controller 2; the execution of action 2 is controlled by controller 1, controller 2, and controller 4; Actions 3 to 5 are controlled by controller 1, controller 2, and control 5; actions 6 to 8 need to be controlled by controllers 1 and 3.
由于简单动作类型的调用动作中仅包含单个简单动作,不包含控制器,因此,在一种可能的实施方式中,当调用动作不包含控制器时,可以直接携带目标事件的事件参数,执行目标简单动作,以调用对应的目标服务,进而实现微应用的微应用功能。Since the call action of the simple action type only contains a single simple action and does not contain a controller, in a possible implementation, when the call action does not contain a controller, it can directly carry the event parameters of the target event and execute the target event. Simple actions to call the corresponding target service, and then realize the micro-application function of the micro-application.
简单动作类型的调用动作仅可以实现单一服务的调用,但是在微应用的实际应用场景中,若需要完成某项微应用功能,仅靠单一的简单动作往往无法实现,可能需要若干简单动作共同实现,因此,为了实现更复杂的微应用功能,微应用提供了开发组合动作类型的调用动作机制,通过控制器定义各个简单动作之间的调用逻辑,以实现对不同简单动作的组合,从而实现更复杂的微应用功能。The call action of the simple action type can only realize the call of a single service, but in the actual application scenario of the micro application, if a micro application function needs to be completed, it is often impossible to achieve it only by a single simple action, and it may require several simple actions to realize it together , therefore, in order to achieve more complex micro-application functions, the micro-application provides a call action mechanism for developing combined action types, and defines the call logic between simple actions through the controller to realize the combination of different simple actions, so as to achieve more Complex microapp functionality.
需要说明的是,当调用动作为组合动作类型时,其由若干控制器和若干简单动作构成,如图7所示其可以是“多叉树的结构;其中,树的叶子节点一定是“简单动作”,根节点(与触发器相连的节点)为控制器,控制器的子节点可以是控制器,也可以是简单动作;简单动作的子节点可以是简单动作,也可以是控制器。当微应用引擎通过触发器触发该调用动作时,会从根节点的控制器依次遍历整棵树,根据控制器的控制逻辑,最终遍历到不同的叶子节点(简单动作),并执行该简单动作。It should be noted that when the calling action is a combined action type, it consists of several controllers and several simple actions, as shown in Figure 7, it can be a "multi-fork tree structure; where the leaf nodes of the tree must be "simple action", the root node (the node connected to the trigger) is the controller, and the child nodes of the controller can be controllers or simple actions; the child nodes of simple actions can be simple actions or controllers. When When the micro-application engine triggers the call action through the trigger, it will traverse the entire tree from the controller of the root node in sequence, and finally traverse to different leaf nodes (simple actions) according to the control logic of the controller, and execute the simple action.
对于组合动作类型的调用动作,在微应用运行过程中,当计算机设备接收到目标触发事件后,触发目标事件对应的目标触发器,触发通过至少一个目标控制器控制执行至少一个目标简单动作,以实现对目标服务的调用,且在目标调用动作执行过程中,目标控制器和目标简单动作均可以从第一数据存储区中读取事件参数,通过数据传递以及动作调用,实现微应用的微应用功能。For the call action of the combined action type, during the running of the micro-application, when the computer device receives the target trigger event, it triggers the target trigger corresponding to the target event, and the trigger is controlled by at least one target controller to execute at least one target simple action, so as to Realize the call to the target service, and during the execution of the target call action, both the target controller and the target simple action can read the event parameters from the first data storage area, and realize the micro application of the micro application through data transfer and action call Function.
微应用运行过程中所涉及到的数据传递过程除了事件参数的传递过程之外,还涉及到服务返回值的传递过程,比如,“截屏动作”会返回截取到的图片数据,而在“图片显示动作”执行时,需要访问截取到的图片数据;因此,在一种可能的实施方式中,针对该服务返回值也设置有对应的数据空间作用域。在一个示例性的例子中,步骤604还可以包括步骤604A~步骤604C。In addition to the event parameter transfer process, the data transfer process involved in the running process of the micro-app also involves the transfer process of the service return value. For example, the "screen capture action" will return the captured image data, and the When the "action" is executed, the intercepted image data needs to be accessed; therefore, in a possible implementation, a corresponding data space scope is also set for the service return value. In an exemplary example, step 604 may further include steps 604A to 604C.
步骤604A,通过目标控制器控制执行位于父节点的目标简单动作,以及获取执行位于父节点的目标简单动作后反馈的目标服务数据。Step 604A, control the execution of the target simple action at the parent node through the target controller, and obtain the target service data fed back after executing the target simple action at the parent node.
如图7所示,在组合动作702中,动作7和动作8是动作6的子节点,也即动作6是父节点,在执行该组合动作702的过程中,按照调度逻辑,需要先执行动作6,再执行动作8和/或动作7,而在执行动作7或动作8的过程中,可能需要执行动作6后所反馈的服务数据;示意性的,当目标调用动作中包含如动作6和动作7之间关系的简单动作时,确定目标调用动作中包含位于父节点的目标简单动作和位于子节点的目标简单动作;对应在微应用运行过程中,首先通过目标控制器控制执行位于父节点的目标简单动作,若执行该目标简单动作后可以得到反馈的目标服务数据,则可以将目标服务数据存储在特定数据存储区中,以便执行后续的目标简单动作时可以引用该目标服务数据。As shown in Figure 7, in combined action 702, action 7 and action 8 are the child nodes of action 6, that is, action 6 is the parent node. In the process of executing the combined action 702, according to the scheduling logic, the action needs to be executed first 6. Perform action 8 and/or action 7 again, and during the process of performing action 7 or action 8, the service data fed back after performing action 6 may be required; schematically, when the target call action includes actions such as action 6 and For the simple action of the relationship between actions 7, it is determined that the target call action includes the target simple action located in the parent node and the target simple action located in the child node; corresponding to the running process of the micro application, firstly, the target controller is used to control the execution of the target simple action located in the parent node If the target simple action of , if the target service data can be obtained after executing the target simple action, the target service data can be stored in a specific data storage area, so that the target service data can be referenced when the subsequent target simple action is executed.
由于执行父节点的目标简单动作后所反馈的目标服务数据,仅会被与该父节点关联的子节点所调用。比如,如图7所示,对于执行动作6所反馈的目标服务数据,仅会被与动作6关联的动作7和/或动作8调用,而该组合动作702中的其他动作1~动作5无需该动作6所反馈的目标服务数据,则为了区分存储不同父节点动作所反馈的目标服务数据,在一种可能的实施方式中,设置有第二数据存储区(也可以称为子节点作用域),以存储调用父节点动作后的返回值数据,对应与该父节点关联的子节点动作在调用过程中可以从该第二数据存储区中读取所需数据。The target service data fed back after executing the target simple action of the parent node will only be called by the child nodes associated with the parent node. For example, as shown in Figure 7, the target service data fed back by executing Action 6 will only be invoked by Action 7 and/or Action 8 associated with Action 6, while other Actions 1 to 5 in the combined Action 702 do not need to The target service data fed back by action 6, in order to distinguish and store the target service data fed back by different parent node actions, in a possible implementation, a second data storage area (also called a child node scope ) to store the return value data after calling the parent node action, corresponding to the child node action associated with the parent node can read the required data from the second data storage area during the calling process.
步骤604B,从第二数据存储区中读取目标服务数据位于父节点的目标简单动作不同,对应不同第二数据存储区。Step 604B, read the target service data from the second data storage area. The target simple action located in the parent node is different and corresponds to a different second data storage area.
为了便于位于父节点的目标简单动作所反馈的目标服务数据,可以传递至位于子节点的目标简单动作,在一种可能的实施方式中,设置有第二数据存储区,用于存储执行位于父节点的目标简单动作后所反馈的目标服务数据。In order to facilitate the target service data fed back by the target simple action located at the parent node, it can be transferred to the target simple action located at the child node. In a possible implementation, a second data storage area is set to store and execute the The target service data fed back after the target simple action of the node.
可选的,为了避免数据冲突,为不同的位于父节点的目标简单动作,设置有不同的第二数据存储区,该第二数据存储区仅允许同一父节点的目标简单动作下关联的子节点的目标简单动作调用。Optionally, in order to avoid data conflicts, different second data storage areas are set for different target simple actions located in the parent node, and the second data storage area only allows child nodes associated with target simple actions of the same parent node The target of the simple action call.
在一种可能的实施方式中,在执行位于子节点的目标简单动作之前,若该目标简单动作在执行过程中需要引用上一节点返回的目标服务数据,则首先需要从第二数据存储区中读取目标服务数据,进而基于该目标服务数据,执行位于子节点的目标简单动作。In a possible implementation, before executing the target simple action located in the child node, if the target simple action needs to refer to the target service data returned by the previous node during the execution process, it first needs to be retrieved from the second data storage area Read the target service data, and then execute the target simple action located in the child node based on the target service data.
可选的,在微应用中,设置有特殊符号,从子节点作用域(第二数据存储区)中引用该目标服务数据,示意性的,该特殊符号可以是$,比如“showPicture=$picture”,表示显示图片动作引用子节点作用域中的图片。Optionally, in the micro-application, a special symbol is set to refer to the target service data from the child node scope (second data storage area). Schematically, the special symbol can be $, such as "showPicture=$picture ", which means that the display image action refers to the image in the scope of the child node.
步骤604C,基于目标服务数据,执行位于子节点的目标简单动作。Step 604C, based on the target service data, execute the target simple action located in the child node.
在一种可能的实施方式中,当获取到上一节点(父节点)反馈的目标服务数据后,可以通过引用该目标服务数据,以执行位于子节点的目标简单动作,实现对该目标简单动作对应目标服务的调用。In a possible implementation, after obtaining the target service data fed back by the previous node (parent node), the target simple action located at the child node can be executed by referencing the target service data to realize the target simple action Corresponds to the invocation of the target service.
如图8所示,其示出了本申请一个示例性实施例示出的子节点作用域的示意图。当接收到事件801后,触发事件801对应的触发器802,通过控制器1和控制器2控制调用截屏动作和显示图片动作,以实现截屏显示功能,其中,显示图片动作是截屏动作的子节点;对应在该截屏显示功能的实现过程中,首先通过控制器2控制执行截屏动作,获取执行截屏动作后所截取到的目标图片,将该目标图片存储在子节点作用域803中,当执行显示图片动作时,需要对截屏动作所反馈的目标图片进行显示,就需要从子节点作用域803中调用目标图片,将目标图片作为入参传递,用于图片显示。可选的,由于动作2也是截屏动作的子节点,则在执行动作2时,若也需要目标图片,也可以从子节点作用域803中调用目标图片。As shown in FIG. 8 , it shows a schematic diagram of the sub-node scope shown in an exemplary embodiment of the present application. After receiving the event 801, the trigger 802 corresponding to the event 801 is triggered, and the controller 1 and the controller 2 control and call the screen capture action and the display picture action to realize the screen capture display function, wherein the display picture action is a child node of the screen capture action ; Correspondingly, in the realization process of the screenshot display function, at first, the controller 2 controls and executes the screenshot action, obtains the target picture intercepted after executing the screenshot action, stores the target picture in the child node scope 803, and when the execution display When performing an image action, it is necessary to display the target image fed back by the screen capture action, and it is necessary to call the target image from the child node scope 803 and pass the target image as an input parameter for displaying the image. Optionally, since action 2 is also a child node of the screenshot action, when executing action 2, if the target picture is also needed, the target picture may also be called from the child node scope 803 .
可选的,微应用的数据空间作用域除了上述的第一数据存储区(触发器作用域)和第二数据存储区(子节点作用域)之外,还包含有第三数据存储区(全局作用域),该第三数据存储区中存储有目标微应用对应的运行环境参数,以及用户自定义的参数,比如,当前计算机设备的设备信息等,存储在第三数据存储区允许由各个触发器触发的调用动作访问,也即全局作用域的数据可以被微应用的所用控制器和简单动作访问到。Optionally, in addition to the above-mentioned first data storage area (trigger scope) and second data storage area (child node scope), the data space scope of the micro application also includes a third data storage area (global Scope), the third data storage area stores the operating environment parameters corresponding to the target micro-application, as well as user-defined parameters, such as the device information of the current computer device, etc., which are stored in the third data storage area to allow each trigger The call action triggered by the controller is accessed, that is, the data of the global scope can be accessed by all controllers and simple actions of the micro application.
如图9所示,其示出了本申请一个示例性实施例示出的子节点作用域、触发器作用域和全局作用域之间的关系示意图。微应用900中包含微应用全局作用域910、触发器作用域920以及子节点作用域930;其中,微应用的运行环境参数、自定义参数存储在微应用全局作用域910中,触发器901和触发器902所关联的控制器和动作均可以从微应用全局作用域910中调用数据;当接收到目标事件,触发该目标事件对应的触发器901,目标事件对应的事件参数可以存储在触发器作用域920中,该触发器901关联的控制器1~控制器4,以及动作1~动作4均可以调用该事件参数;而控制器5~控制器7,以及动作5~动作9无法调用触发器作用域920中的数据;在执行动作6后所反馈的服务数据存储在子节点作用域930中,允许动作7~动作9在执行时调用子节点作用域930中的数据;而动作5无法调用子节点作用域930中的数据,且触发器901对应的控制器1~控制器4以及动作1~动作4也无法调用子节点作用域930中的数据。可选的,触发器902也对应有自身的触发器作用域(图中未示出),仅允许与触发器902关联的控制器5~控制器7以及动作5~动作9调用存储在该触发器作用域中的事件参数。As shown in FIG. 9 , it shows a schematic diagram of the relationship among the child node scope, the trigger scope and the global scope shown in an exemplary embodiment of the present application. The micro-application 900 includes a micro-application global scope 910, a trigger scope 920, and a child node scope 930; wherein, the operating environment parameters and custom parameters of the micro-application are stored in the micro-application global scope 910, and the trigger 901 and The controllers and actions associated with the trigger 902 can call data from the micro-app global scope 910; when the target event is received, the trigger 901 corresponding to the target event is triggered, and the event parameters corresponding to the target event can be stored in the trigger In the scope 920, the controller 1~controller 4, and action 1~action 4 associated with the trigger 901 can call the event parameter; while the controller 5~controller 7, and action 5~action 9 cannot call the trigger The data in the scope 920 of the controller; after the execution of action 6, the service data fed back is stored in the scope 930 of the child node, allowing actions 7 to 9 to call the data in the scope 930 of the child node during execution; while action 5 cannot The data in the child node scope 930 is called, and the controllers 1 to 4 and actions 1 to 4 corresponding to the trigger 901 cannot call the data in the child node scope 930 . Optionally, the trigger 902 also has its own trigger scope (not shown in the figure), and only the controllers 5 to 7 and actions 5 to 9 associated with the trigger 902 are allowed to call the Event parameters in the scope of the controller.
本实施例中,通过划分全局作用域、触发器作用域以及子节点作用域,并定义不同作用域之间的数据引用关系或限制,在实现微应用内部数据传递目的的同时可以避免过多数据所产生的冲突。In this embodiment, by dividing the global scope, trigger scope, and child node scope, and defining data reference relationships or restrictions between different scopes, excessive data can be avoided while achieving the purpose of internal data transfer in the micro-application the resulting conflict.
为了实现更复杂的微应用功能,引入组合动作类型的概念,由若干控制器和若干简单动作组合构成调用动作,而在实际应用过程中,存在多种多样的调度逻辑,比如,循环调度、顺序调度、条件调度等,则为了实现该调度逻辑,本实施例中定义了多种指示不同调度逻辑的控制器,通过不同类型控制器的组合,可以进一步丰富微应用的微应用功能。In order to realize more complex micro-application functions, the concept of combined action type is introduced, and the call action is composed of several controllers and several simple actions. In the actual application process, there are various scheduling logics, such as cycle scheduling, sequence Scheduling, conditional scheduling, etc., in order to realize the scheduling logic, multiple controllers indicating different scheduling logics are defined in this embodiment, and the micro-application functions of the micro-application can be further enriched through the combination of different types of controllers.
请参考图10,其示出了本申请另一个示例性实施例提供的微应用的运行方法的流程图,本申请实施例以该方法应用于图3所示的计算机设备为例进行说明,该方法包括:Please refer to FIG. 10 , which shows a flow chart of a micro-application running method provided by another exemplary embodiment of the present application. This embodiment of the present application is described by taking the method applied to the computer device shown in FIG. 3 as an example. Methods include:
步骤1001,获取目标微应用的目标微应用脚本,目标微应用脚本由至少一个触发器构成。 Step 1001, acquire a target micro-application script of a target micro-application, where the target micro-application script consists of at least one trigger.
步骤1002,响应于目标触发事件,触发目标微应用脚本中目标触发事件对应的目标触发器。 Step 1002, triggering a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event.
步骤1003,从第一数据存储区中读取目标触发事件对应的事件参数,不同触发器对应不同第一数据存储区。 Step 1003, read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas.
步骤1001和步骤1003的实施方式可以参考上文实施例,本实施例在此不做赘述。For implementation manners of step 1001 and step 1003, reference may be made to the foregoing embodiments, and details are not described in this embodiment here.
步骤1004,在目标调用动作包括至少一个目标控制器的情况下,确定目标控制器所指示的目标调用逻辑。 Step 1004, if the target invocation action includes at least one target controller, determine the target invocation logic indicated by the target controller.
当目标调用动作包括至少一个目标控制器时,该目标控制器用于指示至少一个目标简单动作的目标调用逻辑,比如,若目标控制器为循环控制器时,该目标控制器即定义了目标简单动作的循环条件,循环条件即目标简单动作的调用逻辑,需要遵循该循环条件以调用目标简单动作,该目标简单动作是与该循环控制器相连的动作。When the target call action includes at least one target controller, the target controller is used to indicate the target call logic of at least one target simple action, for example, if the target controller is a loop controller, the target controller defines the target simple action The loop condition is the call logic of the target simple action, which needs to be followed to call the target simple action, which is the action connected to the loop controller.
可选的,控制器的子节点可以是简单动作,也可以是其他控制器。Optionally, the child nodes of a controller can be simple actions or other controllers.
步骤1005,基于事件参数和目标调用逻辑,执行目标简单动作。 Step 1005, execute target simple actions based on event parameters and target invocation logic.
在一种可能的实施方式中,计算机设备基于目标控制器所对应的目标调用逻辑,执行目标简单动作,以实现对目标服务的调用,进而实现微应用的特定应用功能;且在执行目标简单动作的过程中,可以引用 目标事件的事件参数。In a possible implementation, the computer device executes the target simple action based on the target invocation logic corresponding to the target controller, so as to realize the invocation of the target service, and then realize the specific application function of the micro-application; and when executing the target simple action In the process, you can refer to the event parameters of the target event.
其中,目标控制器可以是条件控制器、循环控制器、延时控制器、顺序控制器、选择控制器、并行控制器等,本申请实施例对目标控制器的控制器类型不构成限定。业务人员可以根据不同需求实现不同功能的控制器,以便组合不同功能的控制器实现不同的微应用功能。Wherein, the target controller may be a conditional controller, a loop controller, a delay controller, a sequential controller, a selection controller, a parallel controller, etc. The embodiment of the present application does not limit the controller type of the target controller. Business personnel can implement controllers with different functions according to different needs, so as to combine controllers with different functions to realize different micro-application functions.
以目标控制器为条件控制器为例,在一个示例性的例子中,步骤1004和步骤1005可以被替换为步骤1004A和步骤1005A。Taking the target controller as the conditional controller as an example, in an exemplary example, step 1004 and step 1005 may be replaced by step 1004A and step 1005A.
步骤1004A,在目标调用动作包括至少一个目标控制器的情况下,确定目标控制器所指示的目标调度条件。Step 1004A, if the target calling action includes at least one target controller, determine the target scheduling condition indicated by the target controller.
其中,条件控制器设置有判断条件,需要根据条件判断结果,确定执行是分支对应的目标简单动作,或者执行否分支对应的目标简单动作。Wherein, the condition controller is set with a judgment condition, and needs to determine whether to execute the target simple action corresponding to the branch or to execute the target simple action corresponding to the no branch according to the judgment result of the condition.
在一种可能的实施方式中,在目标调用动作中包括条件控制器的情况下,当执行到该条件控制器时,需要确定条件控制器所指示的目标调度条件,进而基于该目标调度条件判断需要执行的目标简单动作。In a possible implementation, when a conditional controller is included in the target call action, when the conditional controller is executed, it is necessary to determine the target scheduling condition indicated by the conditional controller, and then judge based on the target scheduling condition The target simple action to perform.
步骤1005A,基于目标调度条件,从候选简单动作中确定出目标简单动作,以及执行目标简单动作。Step 1005A, based on the target scheduling condition, determine the target simple action from candidate simple actions, and execute the target simple action.
在一种可能的实施方式中,基于目标调度条件,从该条件控制器关联的至少两个候选简单动作中确定出需要执行的目标简单动作,进而执行该目标简单动作,以调用目标服务。In a possible implementation manner, based on the target scheduling condition, the target simple action to be executed is determined from at least two candidate simple actions associated with the condition controller, and then the target simple action is executed to invoke the target service.
进一步的,在基于目标调度条件,确定执行的目标简单动作时,需要判断事件参数是否满足目标调度条件,当满足该目标调度条件时,则执行是分支对应的目标简单动作;反之,当不满足目标调度条件时,则执行否分支对应的目标简单动作。Furthermore, when determining the target simple action to be executed based on the target scheduling condition, it is necessary to judge whether the event parameter satisfies the target scheduling condition. When the target scheduling condition is met, the target simple action corresponding to the branch is executed; otherwise, when When the target scheduling condition is met, execute the target simple action corresponding to the No branch.
如图11所示,其示出了本申请一个示例性实施例示出的条件控制器的示意图。目标调用动作包括条件控制器1101、第一控制器1102、第二动作1104和第一动作1103;当执行该目标调用动作时,首先基于条件控制器1101的条件1105,确定条件判断结果,当条件判断结果指示满足该条件1105,则继续由是分支对应的第一控制器1102控制执行第二动作1104;若条件判断结果指示不满足条件1105,则执行否分支对应的第一动作1103。As shown in FIG. 11 , it shows a schematic diagram of a condition controller shown in an exemplary embodiment of the present application. The target calling action includes a condition controller 1101, a first controller 1102, a second action 1104 and a first action 1103; when the target calling action is executed, the condition judgment result is first determined based on the condition 1105 of the condition controller 1101, when the condition If the judgment result indicates that the condition 1105 is satisfied, then the first controller 1102 corresponding to the Yes branch will continue to control and execute the second action 1104; if the condition judgment result indicates that the condition 1105 is not met, then the first action 1103 corresponding to the No branch will be executed.
以目标控制器为循环控制器为例,在一个示例性的例子中,步骤1004和步骤1005还可以被替换为步骤1004B和步骤1005B。Taking the target controller as a loop controller as an example, in an exemplary example, step 1004 and step 1005 may also be replaced by step 1004B and step 1005B.
步骤1004B,在目标调用动作包括至少一个目标控制器的情况下,确定目标控制器所指示的目标循环条件。Step 1004B, if the target calling action includes at least one target controller, determine the target loop condition indicated by the target controller.
其中,循环控制器设置有循环条件,通过该循环条件限定简单动作的循环调度方式,只有在满足该循环条件的情况下,才可以停止执行目标简单动作。Wherein, the loop controller is provided with a loop condition, and the loop scheduling mode of the simple action is limited by the loop condition. Only when the loop condition is satisfied, the execution of the target simple action can be stopped.
需要说明的是,由于循环控制器仅可以定义循环条件,无法定义两个及以上简单动作如何调用,则循环控制器仅存在单个子节点,该子节点会被循环调度。It should be noted that since the loop controller can only define loop conditions, it cannot define how to call two or more simple actions, so the loop controller only has a single child node, which will be cyclically scheduled.
在一种可能的实施方式中,在目标调用动作中包括循环控制器的情况下,当执行到该循环控制器时,需要确定循环控制器所指示的目标循环条件,进而基于该目标循环条件判断目标简单动作的停止执行时机。In a possible implementation, when the target call action includes a loop controller, when the loop controller is executed, it is necessary to determine the target loop condition indicated by the loop controller, and then judge based on the target loop condition The stop execution timing of the target simple action.
步骤1005B,在目标简单动作的执行状态未满足目标循环条件的情况下,继续循环执行目标简单动作。Step 1005B, if the execution state of the target simple action does not meet the target loop condition, continue to execute the target simple action cyclically.
在一种可能的实施方式中,当目标控制器为循环控制器时,表示需要循环执行与该目标控制器关联的目标简单动作,且只有在目标简单动作的执行状态满足目标循环条件时,才会停止执行目标简单动作,也就是说,当执行到循环控制器时,需要判断目标简单动作的执行状态是否满足目标循环条件,当未满足目标循环条件时,继续执行目标简单动作,反之,当满足目标循环条件时,停止执行目标简单动作。In a possible implementation, when the target controller is a loop controller, it means that the target simple action associated with the target controller needs to be executed cyclically, and only when the execution state of the target simple action satisfies the target loop condition, the It will stop executing the target simple action. That is to say, when the loop controller is executed, it is necessary to judge whether the execution state of the target simple action meets the target loop condition. If the target loop condition is not met, continue to execute the target simple action. Otherwise, when When the target loop condition is met, stop executing the target simple action.
可选的,循环控制器基于目标循环条件的不同,可以分为次数循环控制器、循环直到成功控制器以及循环直到失败控制器。Optionally, the loop controller can be divided into a count loop controller, a loop until success controller, and a loop until failure controller based on different target loop conditions.
在循环控制器为次数循环控制器的情况下,该次数循环控制器限定了简单动作的循环执行次数阈值,对应当执行到次数循环控制器时,需要获取目标简单动作的执行次数,并判断该执行次数是否达到目标循环条件所指示的次数阈值,当执行次数达到次数阈值时,停止执行目标简单动作;反之,当执行次数未达到次数阈值时,继续执行目标简单动作,直至目标简单动作的执行次数达到次数阈值。示例性的,若次数阈值为10次,则在指定到该循环控制器时,循环执行与该循环控制器关联的目标简单动作,每执行一次该目标简单动作,该目标简单动作的执行次数+1,直至执行次数达到10次,停止执行该目标简单动作。In the case that the loop controller is a count loop controller, the count loop controller defines the threshold of the loop execution times of simple actions. When the loop controller should be executed to the count loop controller, it is necessary to obtain the execution times of the target simple action and determine the Whether the number of executions reaches the number threshold indicated by the target loop condition, when the number of executions reaches the number threshold, stop executing the target simple action; otherwise, when the number of executions does not reach the number threshold, continue to execute the target simple action until the execution of the target simple action The number of times reaches the number threshold. Exemplarily, if the number of times threshold is 10 times, when assigned to the loop controller, the target simple action associated with the loop controller is cyclically executed, and each time the target simple action is executed, the execution times of the target simple action + 1. Stop executing the target simple action until the number of executions reaches 10.
在循环控制器为循环直到成功控制器的情况下,该循环直到成功控制器限定了简单动作的循环执行目的,只有简单动作执行成功,才会停止循环执行目标简单动作;对应当执行到循环直到成功控制器时,需要循环执行目标简单动作,并判断目标简单动作对应的目标服务是否调用成功,当该目标服务调用成功后,停止执行目标简单动作;反之,当目标服务调用未成功,继续执行目标简单动作,直至目标服务调用成功,满足该循环控制器的目标循环条件,才会停止执行目标简单动作。In the case that the loop controller is a loop until success controller, the loop until success controller defines the loop execution purpose of the simple action. Only when the simple action is executed successfully, will it stop looping and execute the target simple action; correspondingly, it should be executed until the loop until When the controller is successful, it needs to execute the target simple action in a loop, and judge whether the target service corresponding to the target simple action is called successfully. When the target service is successfully called, stop executing the target simple action; otherwise, when the target service is not successfully called, continue to execute The target simple action will not stop executing the target simple action until the target service call is successful and the target loop condition of the loop controller is met.
在循环控制器为循环直到失败控制器的情况下,该循环直到失败控制器限定了简单动作的循环执行目 的,只有简单动作执行失败,才会停止循环执行目标简单动作;对应当执行到循环直到失败控制器时,需要循环执行目标简单动作,并判断目标简单动作对应的目标服务是否调用成功,当该目标服务调用成功后,继续执行目标简单动作,直至目标服务调用失败;反之,当目标服务调用失败后,满足该循环控制器的目标循环条件,才会停止执行目标简单动作。In the case that the loop controller is a loop until failure controller, the loop until failure controller defines the loop execution purpose of the simple action. Only when the simple action fails to execute, will the loop execute the target simple action stop; correspondingly, it should be executed until the loop until When the controller fails, it needs to execute the target simple action in a loop, and judge whether the target service corresponding to the target simple action is called successfully. When the target service is successfully called, continue to execute the target simple action until the target service fails to be called; After the call fails, the execution of the target simple action will stop only if the target loop condition of the loop controller is met.
如图12所示,其示出了本申请一个示例性实施例示出的循环控制器的示意图。当目标调用动作包括次数循环控制器1201、第一控制器1202以及第一动作1203时,在执行该目标调用动作的过程中,需要由第一控制器1202控制循环执行第一动作1203,直至第一动作1203的执行次数达到次数阈值后,停止执行第一动作1203;当目标调用动作包括循环直到成功控制器1204、第二控制器1205以及第二动作1206时,在执行该目标调用动作的过程中,需要由第二控制器1205控制循环执行第二动作1206,直至第二动作1206执行成功后,停止执行第二动作1206;当目标调用动作包括循环直到失败控制器1207、第三控制器1208以及第三动作1209时,在执行该目标调用动作的过程中,需要由第三控制器1208控制循环执行第三动作1209,直至第三动作1209执行失败后,停止执行第三动作1209。As shown in FIG. 12 , it shows a schematic diagram of a cycle controller shown in an exemplary embodiment of the present application. When the target call action includes the number of cycle controller 1201, the first controller 1202, and the first action 1203, in the process of executing the target call action, the first controller 1202 needs to control the loop execution of the first action 1203 until the second After the number of executions of an action 1203 reaches the number threshold, stop executing the first action 1203; when the target call action includes the loop until success controller 1204, the second controller 1205, and the second action 1206, the process of executing the target call action In the process, the second controller 1205 needs to control the loop execution of the second action 1206 until the execution of the second action 1206 is successful, then stop the execution of the second action 1206; And for the third action 1209, in the process of executing the target call action, the third controller 1208 needs to control the cyclic execution of the third action 1209, until the execution of the third action 1209 fails, the execution of the third action 1209 is stopped.
以目标控制器为延时控制器为例,在一个示例性的例子中,步骤1004和步骤1005还可以被替换为步骤1004C和步骤1005C。Taking the target controller as a delay controller as an example, in an exemplary example, step 1004 and step 1005 may also be replaced with step 1004C and step 1005C.
步骤1004C,在目标调用动作包括至少一个目标控制器的情况下,确定目标控制器所指示的目标调用延时。Step 1004C, if the target calling action includes at least one target controller, determine the target calling delay indicated by the target controller.
其中,延时控制器定义有调用延时,只有在达到该调用延时的情况下,才可以执行目标简单动作。Among them, the delay controller defines a call delay, and only when the call delay is reached, the target simple action can be executed.
需要说明的是,由于延时控制器仅可以定义调用延时,无法定义两个及以上简单动作如何调用,则延时控制器仅存在单个子节点,该子节点会被延迟一定的时间执行。It should be noted that since the delay controller can only define the call delay, but cannot define how to call two or more simple actions, the delay controller only has a single child node, and the child node will be delayed for a certain period of time.
在一种可能的实施方式中,在目标调用动作中包括延时控制器的情况下,当执行到该延时控制器时,需要确定延时控制器所指示的目标调用延时,进而在延长该目标调用延时后,执行其关联的目标简单动作。In a possible implementation, when the delay controller is included in the target call action, when the delay controller is executed, it is necessary to determine the target call delay indicated by the delay controller, and then extend After the target call is delayed, execute its associated target simple action.
示例性的,若目标调用延时为20ms时,则在执行到该延时控制器时,延长20ms后,再执行与该延时控制器关联的控制器和/或目标简单动作。Exemplarily, if the target call delay is 20ms, when the delay controller is executed, the controller and/or the target simple action associated with the delay controller will be executed after an extension of 20ms.
步骤1005C,在达到目标调用延时的情况下,执行目标简单动作。Step 1005C, execute the target simple action when the target call delay is reached.
在一种可能的实施方式中,当目标控制器为延时控制器时,表示需要延时一定时间才可以执行其关联的子节点,也就是说,当执行到延时控制器时,暂不执行与其关联的目标简单动作,需要判断是否达到目标调用延时,若达到目标调用延时后,执行目标简单动作,反之,若未达到目标调用延时,需要等待达到目标调用延时后,才可以执行目标简单动作。In a possible implementation, when the target controller is a delay controller, it means that it needs to be delayed for a certain period of time to execute its associated subnodes, that is, when the delay controller is executed, temporarily stop To execute the target simple action associated with it, it is necessary to judge whether the target call delay is reached. If the target call delay is reached, the target simple action is executed. Otherwise, if the target call delay is not reached, it needs to wait until the target call delay is reached. Able to perform targeted simple actions.
如图13所示,其示出了本申请一个示例性实施例示出的延时控制器的示意图。延时控制器的子节点可以是其他控制器,或动作;当目标调用动作包括第一延时循环控制器1301和第一动作1302时,在执行该目标调用动作的过程中,需要达到目标调用延时后,执行第一动作1302;当目标调用动作包括第二延时控制器1303、第一控制器1304以及第二动作1305时,在执行该目标调用动作的过程中,需要达到目标调用延时后,由第一控制器1304控制执行第二动作1305。As shown in FIG. 13 , it shows a schematic diagram of a delay controller shown in an exemplary embodiment of the present application. The child nodes of the delay controller can be other controllers or actions; when the target call action includes the first delay loop controller 1301 and the first action 1302, in the process of executing the target call action, it is necessary to reach the target call After the delay, execute the first action 1302; when the target call action includes the second delay controller 1303, the first controller 1304 and the second action 1305, in the process of executing the target call action, it is necessary to reach the target call delay After a period of time, the second action 1305 is executed under the control of the first controller 1304 .
以目标控制器为顺序控制器为例,在一个示例性的例子中,步骤1004和步骤1005可以被替换为步骤1004D和步骤1005D。Taking the target controller as the sequence controller as an example, in an exemplary example, step 1004 and step 1005 may be replaced by step 1004D and step 1005D.
步骤1004D,在目标调用动作包括至少一个目标控制器的情况下,确定目标控制器所指示的各个候选简单动作对应的目标调用顺序。Step 1004D, if the target invocation action includes at least one target controller, determine the target invocation sequence corresponding to each candidate simple action indicated by the target controller.
其中,顺序控制器用于定义若干简单动作的执行顺序,比如,若该顺序控制器下对应有简单动作A和简单动作B,则顺序控制器定义了简单动作A和简单动作B的调用顺序,调用顺序可以是先执行调用动作B,再执行调用动作A。对应,一般顺序控制器至少包含两个子节点,也即顺序控制器与至少两个候选简单动作关联,以定义至少两个子节点或至少两个候选简单动作的目标调用顺序。Among them, the sequence controller is used to define the execution sequence of several simple actions. For example, if the sequence controller corresponds to simple action A and simple action B, the sequence controller defines the calling sequence of simple action A and simple action B. Call The sequence may be to execute call action B first, and then call action A. Correspondingly, a general sequence controller includes at least two child nodes, that is, the sequence controller is associated with at least two candidate simple actions, so as to define the target invocation sequence of at least two child nodes or at least two candidate simple actions.
在一种可能的实施方式中,在目标调用动作中包括顺序控制器的情况下,当执行到该顺序控制器时,需要确定顺序控制器所指示的各个候选简单动作的目标调用顺序,进而基于该目标调用顺序依次执行目标简单动作。In a possible implementation, when the sequence controller is included in the target call action, when the sequence controller is executed, it is necessary to determine the target call sequence of each candidate simple action indicated by the sequence controller, and then based on The target invocation sequence executes the target simple actions in turn.
步骤1005D,基于目标调用顺序,依次将候选简单动作确定为目标简单动作,以及依次执行各个目标简单动作。Step 1005D: Determine the candidate simple actions as the target simple actions in sequence based on the calling sequence of the targets, and execute each target simple action in sequence.
在一种可能的实施方式中,基于目标调用顺序所指示的各个候选简单动作的执行顺序,并依次将各个候选简单动作确定为目标简单动作,依次执行各个目标简单动作,也就是说,顺序控制器关联的各个候选简单动作均需要执行,且执行时需要按照固定的执行顺序,且只有候选简单动作全部执行完成后才可以实现同一微应用功能。In a possible implementation manner, based on the execution order of each candidate simple action indicated by the target call sequence, each candidate simple action is sequentially determined as the target simple action, and each target simple action is sequentially executed, that is, sequence control Each candidate simple action associated with the controller needs to be executed in a fixed execution sequence, and the same micro-application function can only be realized after all the candidate simple actions are executed.
进一步的,在基于目标调用顺序执行目标简单动作的过程中,当第n目标简单动作执行成功后,才可以继续执行第n+1目标简单动作,直至各个候选简单动作均执行成功;反之,当第n目标简单动作执行失败后,无法继续执行后续目标简单动作,对应停止执行第n+1目标简单动作。也就是说,顺序控制器的各 个子节点会被依次调度,只要存在子节点执行失败就停止执行。Further, in the process of executing the target simple action based on the target call sequence, when the nth target simple action is successfully executed, the n+1th target simple action can be continued until all candidate simple actions are successfully executed; otherwise, when After the execution of the nth target simple action fails, the follow-up target simple action cannot be executed, and correspondingly stop the execution of the n+1th target simple action. That is to say, each child node of the sequence controller will be scheduled sequentially, and as long as there is a child node that fails to execute, the execution will stop.
如图14所示,其示出了本申请一个示例性实施例示出的条件控制器的示意图。目标调用动作包括顺序控制器1401、第一控制器1402、第一动作1403、第二动作1404、第二控制器1405以及第三动作1406,该顺序控制器1401定义了各个动作之间的调用顺序为第一动作1403-第二动作1404-第三动作1406;当执行该目标调用动作时,首先基于顺序控制器1401所指示的调用顺序,优先由第一控制器1402控制执行第一动作1403,当第一动作1403执行成功后,继续执行第二动作1404;当第二动作1404执行成功后,由第二控制器1405控制执行第三动作1406。直至第三动作1406执行完成后,该顺序控制器1401才会执行完成。可选的,若第一动作执行失败,则无法执行第二动作1404和第三动作1406;若第二动作1404执行失败,则无法继续执行第三动作1406,若第三动作1406执行失败,即使第一动作1403和第二动作1404执行成功,也无法实现该顺序控制器1401所对应的微应用功能。As shown in FIG. 14 , it shows a schematic diagram of a condition controller shown in an exemplary embodiment of the present application. The target call action includes a sequence controller 1401, a first controller 1402, a first action 1403, a second action 1404, a second controller 1405, and a third action 1406. The sequence controller 1401 defines the call sequence between the various actions It is the first action 1403-the second action 1404-the third action 1406; when executing the target call action, firstly based on the call sequence indicated by the sequence controller 1401, the first controller 1402 controls the execution of the first action 1403 first, When the first action 1403 is executed successfully, continue to execute the second action 1404; when the second action 1404 is executed successfully, the second controller 1405 controls to execute the third action 1406. The sequence controller 1401 will not complete the execution until the third action 1406 is executed. Optionally, if the execution of the first action fails, the second action 1404 and the third action 1406 cannot be executed; if the execution of the second action 1404 fails, the execution of the third action 1406 cannot continue; if the execution of the third action 1406 fails, even The first action 1403 and the second action 1404 are executed successfully, but the micro-application function corresponding to the sequence controller 1401 cannot be realized.
以目标控制器为选择控制器为例,在一个示例性的例子中,步骤1004和步骤1005可以被替换为步骤1004E和步骤1005E。Taking the target controller as the selection controller as an example, in an exemplary example, step 1004 and step 1005 may be replaced by step 1004E and step 1005E.
步骤1004E,在目标调用动作包括至少一个目标控制器的情况下,确定目标控制器所指示的目标调用顺序。Step 1004E, if the target calling action includes at least one target controller, determine the target calling sequence indicated by the target controller.
其中,选择控制器也可以定义若干简单动作的执行顺序,对应,一般选择控制器也至少包含两个子节点,也即选择控制器与至少两个候选简单动作关联;与顺序控制器不同的是,选择控制器的子节点被依次调度,当存在子节点执行成功后即返回;也就是说,选择控制器对应的每个子节点均可以实现同一微应用功能,只要单一子节点调用成功,即可实现该微应用功能,而无需全部子节点调用成功。Among them, the selection controller can also define the execution sequence of several simple actions. Correspondingly, the general selection controller also contains at least two child nodes, that is, the selection controller is associated with at least two candidate simple actions; different from the sequence controller, The sub-nodes of the selection controller are scheduled sequentially, and return when there are sub-nodes executed successfully; that is to say, each sub-node corresponding to the selection controller can implement the same micro-application function, as long as a single sub-node call is successful, it can be realized The microapp functions without requiring all child nodes to be called successfully.
在一种可能的实施方式中,在目标调用动作中包括选择控制器的情况下,当执行到该选择控制器时,需要确定选择控制器所指示的各个候选简单动作的目标调用顺序,进而基于该目标调用顺序依次执行目标简单动作,直至目标简单动作执行成功。In a possible implementation, when a selection controller is included in the target call action, when the selection controller is executed, it is necessary to determine the target call sequence of each candidate simple action indicated by the selection controller, and then based on The target invocation sequence executes the target simple actions in sequence until the target simple actions are successfully executed.
步骤1005E,基于目标调用顺序,依次执行候选简单动作;在存在候选简单动作执行成功的情况下,将候选简单动作确定为目标简单动作,并停止执行其他候选简单动作。Step 1005E: Execute the candidate simple actions sequentially based on the target calling sequence; if there is a candidate simple action that is successfully executed, determine the candidate simple action as the target simple action, and stop executing other candidate simple actions.
在一种可能的实施方式中,基于目标调用顺序所指示的各个候选简单动作的执行顺序,依次执行各个候选简单动作,当存在候选简单动作执行成功后,将该候选简单动作确定为目标简单动作,并停止执行其他候选简单动作;反之,若候选简单动作执行失败后,则继续按照目标调用顺序执行其他候选简单动作。In a possible implementation manner, each candidate simple action is executed sequentially based on the execution order of each candidate simple action indicated by the target call sequence, and when there is a candidate simple action that is successfully executed, the candidate simple action is determined as the target simple action , and stop executing other candidate simple actions; on the contrary, if the candidate simple actions fail to execute, continue to execute other candidate simple actions according to the target call sequence.
如图15所示,其示出了本申请一个示例性实施例示出的选择控制器的示意图。目标调用动作包括选择控制器1501、第一控制器1502、第一动作1503、第二动作1504、第二控制器1505以及第三动作1506,该选择控制器1501定义了各个动作之间的调用顺序为第一动作1503-第二动作1504-第三动作1506;当执行该目标调用动作时,首先基于选择控制器1501所指示的调用顺序,优先由第一控制器1502控制执行第一动作1503,当第一动作1503执行成功后,无需执行第二动作1504和第三动作1506;当第一动作1503执行失败后,继续执行第二动作1504;当第二动作1504执行成功后,无需执行第三动作1506;若第二动作1504执行失败,则需要由第二控制器1505控制执行第三动作1506。若第三动作1506执行成功,则表示可以实现对应的微应用功能,若第三动作1506执行失败,则表示无法实现微应用功能。As shown in FIG. 15 , it shows a schematic diagram of a selection controller shown in an exemplary embodiment of the present application. The target call action includes a selection controller 1501, a first controller 1502, a first action 1503, a second action 1504, a second controller 1505, and a third action 1506, and the selection controller 1501 defines the calling order of each action It is the first action 1503-the second action 1504-the third action 1506; when executing the target invocation action, firstly based on the invocation order indicated by the selection controller 1501, the execution of the first action 1503 is preferentially controlled by the first controller 1502, When the first action 1503 is executed successfully, there is no need to execute the second action 1504 and the third action 1506; when the first action 1503 fails, continue to execute the second action 1504; Action 1506; if the execution of the second action 1504 fails, the second controller 1505 needs to control the execution of the third action 1506 . If the third action 1506 is executed successfully, it means that the corresponding micro-application function can be realized; if the third action 1506 fails to be executed, it means that the micro-application function cannot be realized.
以目标控制器为并行控制器为例,在一个示例性的例子中,步骤1005可以被替换为步骤1005F。Taking the target controller as a parallel controller as an example, in an exemplary example, step 1005 may be replaced with step 1005F.
步骤1005F,将各个候选简单动作确定为目标简单动作,以及并行执行各个目标简单动作。In step 1005F, each candidate simple action is determined as a target simple action, and each target simple action is executed in parallel.
其中,并行控制器表示需要并行执行若干简单动作,对应,一般并行控制器也至少包含两个子节点,也即并控制器与至少两个候选简单动作关联,以便同时执行各个候选简单动作。Among them, the parallel controller indicates that several simple actions need to be executed in parallel. Correspondingly, a general parallel controller also includes at least two child nodes, that is, the parallel controller is associated with at least two candidate simple actions, so as to execute each candidate simple action at the same time.
在一种可能的实施方式中,在目标调用动作中包括并行控制器的情况下,当执行到该并行控制器时,将该并行控制器所关联的各个候选简单动作确定为目标简单动作,进而并行执行各个目标简单动作。In a possible implementation manner, when the target call action includes a parallel controller, when the parallel controller is executed, each candidate simple action associated with the parallel controller is determined as the target simple action, and then Execute individual target simple actions in parallel.
如图16所示,其示出了本申请一个示例性实施例示出的并行控制器的示意图。目标调用动作包括并行控制器1601、第一控制器1602、第一动作1603、第二动作1604、第二控制器1605以及第三动作1606;当执行该目标调用动作时,并行执行第一动作1603、第二动作1604以及第三动作1606,也即同时触发第一控制器1602控制执行第一动作1603、触发执行第二动作1604,以及触发第二控制器1605执行第三动作1606。As shown in FIG. 16 , it shows a schematic diagram of a parallel controller shown in an exemplary embodiment of the present application. The target calling action includes a parallel controller 1601, a first controller 1602, a first action 1603, a second action 1604, a second controller 1605, and a third action 1606; when the target calling action is executed, the first action 1603 is executed in parallel , the second action 1604 and the third action 1606 , that is, triggering the first controller 1602 to control the execution of the first action 1603 , triggering the execution of the second action 1604 , and triggering the second controller 1605 to execute the third action 1606 .
可选的,目标调用动作中可以包含若干控制器的组合,且可以包含不同种类的控制器,以实现更加复杂的调用动作。示意性的,包含多种控制器的目标调用动作在微应用脚本中定义可以为:Optionally, the target invocation action may contain a combination of several controllers, and may contain different types of controllers, so as to realize more complicated invocation actions. Schematically, the target call action including various controllers can be defined in the micro-app script as:
Figure PCTCN2022133516-appb-000001
Figure PCTCN2022133516-appb-000001
Figure PCTCN2022133516-appb-000002
Figure PCTCN2022133516-appb-000002
由该定义可知,该微应用由xml语法实现,该微应用包含两个触发器:事件“xxx”对应的触发器和事件“yyy”对应的触发器,其中,触发器事件“xxx”对应触发器关联的调用动作由并行控制器、选择控制器和动作A~动作E构成;触发器事件“yyy”对应触发器关联的调用动作由条件控制器、动作B和动作C构成。It can be seen from this definition that the micro-application is implemented by xml syntax, and the micro-application contains two triggers: the trigger corresponding to the event "xxx" and the trigger corresponding to the event "yyy", wherein the trigger event "xxx" corresponds to the trigger The call action associated with the trigger is composed of a parallel controller, a selection controller, and actions A to E; the call action associated with the trigger event "yyy" is composed of a condition controller, action B and action C.
本实施例中,定义了调用动作中包含的各种控制器的控制逻辑,使得可以通过组合各种控制器,实现对若干简单动作的组合,以支持更加复杂的调用动作的编排逻辑,从而满足开发者不同复杂场景下的应用开发需求。In this embodiment, the control logic of various controllers included in the call action is defined, so that the combination of several simple actions can be realized by combining various controllers to support more complex call action logic, so as to satisfy The application development requirements of developers in different complex scenarios.
下述为本申请装置实施例,可以用于执行本申请方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请方法实施例。The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
请参考图17,其示出了本申请一个实施例提供的微应用的运行装置的结构框图。该装置可以包括:Please refer to FIG. 17 , which shows a structural block diagram of a micro-application running device provided by an embodiment of the present application. The device can include:
脚本获取模块1701,用于获取目标微应用的目标微应用脚本,所述目标微应用脚本由至少一个触发器构成;A script acquisition module 1701, configured to acquire a target micro-application script of the target micro-application, where the target micro-application script consists of at least one trigger;
触发模块1702,用于响应于目标触发事件,触发所述目标微应用脚本中所述目标触发事件对应的目标触发器;A trigger module 1702, configured to trigger a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event;
数据读取模块1703,用于从第一数据存储区中读取所述目标触发事件对应的事件参数,不同触发器对应不同第一数据存储区;A data reading module 1703, configured to read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas;
动作调用模块1704,用于基于所述事件参数,执行所述目标触发器对应的目标调用动作。The action calling module 1704 is configured to execute the target calling action corresponding to the target trigger based on the event parameter.
可选的,所述目标调用动作的动作类型包括简单动作类型和组合动作类型,所述简单动作类型下所述目标调用动作由单个目标简单动作构成,所述组合动作类型下所述目标调用动作由至少一个目标控制器和至少一个所述目标简单动作构成,所述目标控制器用于指示所述目标简单动作的目标调用逻辑;Optionally, the action type of the target call action includes a simple action type and a combined action type, the target call action under the simple action type is composed of a single target simple action, and the target call action under the combined action type Consisting of at least one object controller and at least one of said object simple actions, said object controller being used to instruct an object invocation logic of said object simple action;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
在所述目标调用动作包括至少一个所述目标控制器的情况下,通过至少一个所述目标控制器控制执行至少一个所述目标简单动作。In the case that the target calling action includes at least one target controller, at least one target simple action is controlled by at least one target controller.
可选的,所述目标调用动作包括位于父节点的目标简单动作和位于子节点的目标简单动作;Optionally, the target invocation action includes a target simple action located at a parent node and a target simple action located at a child node;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
通过所述目标控制器控制执行所述位于父节点的目标简单动作,以及获取执行所述位于父节点的目标简单动作后反馈的目标服务数据;controlling and executing the target simple action located at the parent node through the target controller, and acquiring target service data fed back after executing the target simple action located at the parent node;
从第二数据存储区中读取所述目标服务数据,位于父节点的目标简单动作不同,对应不同第二数据存储区;Reading the target service data from the second data storage area, the target simple actions located in the parent node are different, and correspond to different second data storage areas;
基于所述目标服务数据,执行所述位于子节点的目标简单动作。Based on the target service data, the target simple action at the child node is executed.
可选的,所述装置还包括:Optionally, the device also includes:
数据存储模块,用于将所述目标微应用对应的运行环境参数存储在第三数据存储区,所述第三数据存储区允许由各个所述触发器触发的所述调用动作访问。A data storage module, configured to store the operating environment parameters corresponding to the target micro-application in a third data storage area, and the third data storage area allows access to the calling action triggered by each of the triggers.
可选的,所述目标调用动作的动作类型包括简单动作类型和组合动作类型,所述简单动作类型下所述目标调用动作由单个目标简单动作构成,所述组合动作类型下所述目标调用动作由至少一个目标控制器和至少一个所述目标简单动作构成,所述目标控制器用于指示所述目标简单动作的目标调用逻辑;Optionally, the action type of the target call action includes a simple action type and a combined action type, the target call action under the simple action type is composed of a single target simple action, and the target call action under the combined action type Consisting of at least one object controller and at least one of said object simple actions, said object controller being used to instruct an object invocation logic of said object simple action;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
在所述目标调用动作包括至少一个所述目标控制器的情况下,确定所述目标控制器所指示的所述目标调用逻辑;Where the target invocation action includes at least one of the target controllers, determining the target invocation logic indicated by the target controller;
基于所述目标调用逻辑,执行所述目标简单动作。Based on the target invocation logic, the target simple action is executed.
可选的,所述目标控制器为条件控制器,所述条件控制器与至少两个候选简单动作关联;Optionally, the target controller is a conditional controller, and the conditional controller is associated with at least two candidate simple actions;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
确定所述目标控制器所指示的目标调度条件;determining a target scheduling condition indicated by the target controller;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
基于所述目标调度条件,从所述候选简单动作中确定出所述目标简单动作,以及执行所述目标简单动作。Based on the target scheduling condition, the target simple action is determined from the candidate simple actions, and the target simple action is executed.
可选的,所述目标控制器为循环控制器;Optionally, the target controller is a loop controller;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
确定所述目标控制器所指示的目标循环条件;determining a target cycle condition indicated by the target controller;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
在所述目标简单动作的执行状态未满足所述目标循环条件的情况下,继续循环执行所述目标简单动作。If the execution state of the target simple action does not meet the target cycle condition, continue to execute the target simple action cyclically.
可选的,所述动作调用模块1704,还用于:Optionally, the action calling module 1704 is also used to:
在所述目标简单动作的执行次数未达到次数阈值的情况下,继续循环执行所述目标简单动作;In the case that the number of executions of the target simple action does not reach the number threshold, continue to execute the target simple action in a loop;
在所述目标简单动作对应的所述目标服务未调用成功的情况下,继续循环执行所述目标简单动作;If the target service corresponding to the target simple action is not invoked successfully, continue to execute the target simple action in a loop;
在所述目标简单动作对应的所述目标服务未调用失败的情况下,继续循环执行所述目标简单动作。If the target service corresponding to the target simple action does not fail to be invoked, the target simple action continues to be cyclically executed.
可选的,所述目标控制器为延时控制器;Optionally, the target controller is a delay controller;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
确定所述目标控制器所指示的目标调用延时;determining a target invocation latency indicated by the target controller;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
在达到所述目标调用延时的情况下,执行所述目标简单动作。In case the target call delay is reached, the target simple action is executed.
可选的,所述目标控制器为顺序控制器,所述顺序控制器与至少两个候选简单动作关联;Optionally, the target controller is a sequence controller, and the sequence controller is associated with at least two candidate simple actions;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
确定所述目标控制器所指示的各个所述候选简单动作对应的目标调用顺序;determining the target invocation sequence corresponding to each of the candidate simple actions indicated by the target controller;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
基于所述目标调用顺序,依次将所述候选简单动作确定为所述目标简单动作,以及依次执行各个所述目标简单动作。Based on the target calling sequence, the candidate simple actions are sequentially determined as the target simple actions, and each of the target simple actions is sequentially executed.
可选的,所述动作调用模块1704,还用于:Optionally, the action calling module 1704 is also used to:
在第n目标简单动作执行成功的情况下,继续执行所述第n+1目标简单动作;If the nth target simple action is successfully executed, continue to execute the n+1th target simple action;
所述装置还包括:The device also includes:
停止执行模块,用于在所述第n目标简单动作执行失败的情况下,停止执行所述第n+1目标简单动作。A stop execution module, configured to stop execution of the n+1th target simple action when the nth target simple action fails to be executed.
可选的,所述目标控制器为选择控制器,所述选择控制器与至少两个候选简单动作关联;Optionally, the target controller is a selection controller, and the selection controller is associated with at least two candidate simple actions;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
确定所述目标控制器所指示的目标调用顺序;determining the target invocation sequence indicated by the target controller;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
基于所述目标调用顺序,依次执行所述候选简单动作;executing the candidate simple actions sequentially based on the target invocation sequence;
在存在所述候选简单动作执行成功的情况下,将所述候选简单动作确定为所述目标简单动作,以及停止执行其他所述候选简单动作。If there is a candidate simple action that is successfully executed, determine the candidate simple action as the target simple action, and stop executing other candidate simple actions.
可选的,所述目标控制器为并行控制器,所述并行控制器与至少两个所述候选简单动作关联;Optionally, the target controller is a parallel controller, and the parallel controller is associated with at least two candidate simple actions;
所述动作调用模块1704,还用于:The action calling module 1704 is also used for:
将各个所述候选简单动作确定为所述目标简单动作,以及并行执行各个所述目标简单动作。Each of the candidate simple actions is determined as the target simple action, and each of the target simple actions is executed in parallel.
综上所述,本申请实施例中,在微应用运行过程中,通过获取微应用的微应用脚本,并基于触发事件触发微应用脚本中对应的触发器,进而执行该触发器对应的调用动作,以实现微应用的微应用功能。由于 微应用的运行基于低代码量的微应用脚本,因此相较于传统应用所需占用的存储空间更小;并且,将调用动作组装成微应用,并利用微应用脚本管理调用动作之间的调用关系,实现了微应用的组件化,提高了微应用间调用动作的复用性,有助于降低微应用的开发难度,此外,在微应用运行过程中为不同触发器提供有专有的数据存储区,使得该触发器关联的调用动作可以访问该数据存储区,在实现微应用内数据传递目的的同时,也可以避免不同触发器对应数据的冲突问题。To sum up, in the embodiment of this application, during the running process of the micro-application, by obtaining the micro-application script of the micro-application, and triggering the corresponding trigger in the micro-application script based on the trigger event, and then executing the call action corresponding to the trigger , to implement the micro-app function of the micro-app. Since the operation of micro-apps is based on micro-app scripts with low code volume, the storage space required is smaller than that of traditional applications; and the calling actions are assembled into micro-apps, and the micro-app scripts are used to manage the relationship between calling actions The call relationship realizes the componentization of micro-applications, improves the reusability of calling actions between micro-applications, and helps to reduce the development difficulty of micro-applications. The data storage area enables the call action associated with the trigger to access the data storage area. While achieving the purpose of data transfer in the micro-app, it can also avoid the conflict of data corresponding to different triggers.
请参考图18,其示出了本申请一个示例性实施例提供的计算机设备的结构方框图。该计算机设备1800可以实现成为上述各个实施例中的源端设备或目的端设备。计算机设备1800可以包括一个或多个如下部件:处理器1810和存储器1820。Please refer to FIG. 18 , which shows a structural block diagram of a computer device provided by an exemplary embodiment of the present application. The computer device 1800 may be implemented as a source device or a destination device in each of the foregoing embodiments. Computer device 1800 may include one or more of the following components: processor 1810 and memory 1820 .
处理器1810可以包括一个或者多个处理核心。处理器1810利用各种接口和线路连接整个计算机设备1800内的各个部分,通过运行或执行存储在存储器1820内的指令、程序、代码集或指令集,以及调用存储在存储器1820内的数据,执行计算机设备1800的各种功能和处理数据。可选地,处理器1810可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器1810可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)、神经网络处理器(Neural-network Processing Unit,NPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责触摸显示屏所需要显示的内容的渲染和绘制;NPU用于实现人工智能(Artificial Intelligence,AI)功能;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器1810中,单独通过一块芯片进行实现。 Processor 1810 may include one or more processing cores. The processor 1810 uses various interfaces and lines to connect various parts of the entire computer device 1800, and executes by running or executing instructions, programs, code sets or instruction sets stored in the memory 1820, and calling data stored in the memory 1820. Various functions of the computer device 1800 and processing data. Optionally, the processor 1810 may adopt at least one of Digital Signal Processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). implemented in the form of hardware. The processor 1810 can integrate one or more of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), a neural network processor (Neural-network Processing Unit, NPU) and a modem, etc. The combination. Among them, the CPU mainly handles the operating system, user interface and application programs, etc.; the GPU is used to render and draw the content that needs to be displayed on the touch screen; the NPU is used to realize the artificial intelligence (Artificial Intelligence, AI) function; the modem is used to process Wireless communication. It can be understood that, the above-mentioned modem may not be integrated into the processor 1810, but may be realized by a single chip.
存储器1820可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory,ROM)。可选地,该存储器1820包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器1820可用于存储指令、程序、代码、代码集或指令集。存储器1820可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等;存储数据区可存储根据计算机设备1800的使用所创建的数据(比如音频数据、电话本)等。The memory 1820 may include random access memory (Random Access Memory, RAM), and may also include read-only memory (Read-Only Memory, ROM). Optionally, the memory 1820 includes a non-transitory computer-readable storage medium. The memory 1820 may be used to store instructions, programs, codes, sets of codes or sets of instructions. The memory 1820 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), Instructions and the like for implementing the various method embodiments described below; the storage data area can store data created according to the use of the computer device 1800 (such as audio data, phonebook) and the like.
除此之外,本领域技术人员可以理解,上述附图所示出的计算机设备1800的结构并不构成对计算机设备的限定,计算机设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。比如,计算机设备1800中还包括显示屏、摄像组件、麦克风、扬声器、射频电路、输入单元、传感器(比如加速度传感器、角速度传感器、光线传感器等等)、音频电路、WiFi模块、电源、蓝牙模块等部件,在此不再赘述。In addition, those skilled in the art can understand that the structure of the computer device 1800 shown in the above drawings does not constitute a limitation to the computer device, and the computer device may include more or less components than those shown in the illustration, or combine certain components, or a different arrangement of components. For example, the computer device 1800 also includes a display screen, a camera component, a microphone, a speaker, a radio frequency circuit, an input unit, a sensor (such as an acceleration sensor, an angular velocity sensor, a light sensor, etc.), an audio circuit, a WiFi module, a power supply, a Bluetooth module, etc. components, which will not be repeated here.
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质存储有至少一条程序代码,所述程序代码由处理器加载并执行以实现如上各个实施例所述的微应用的运行方法。The embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores at least one program code, and the program code is loaded and executed by a processor to realize the micro-application described in each of the above embodiments. run method.
本申请实施例提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述方面的各种可选实现方式中提供的微应用的运行方法。An embodiment of the present application provides a computer program product or computer program, where the computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the micro-application running method provided in various optional implementation manners of the above aspect.
应当理解的是,在本文中提及的“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。另外,本文中描述的步骤编号,仅示例性示出了步骤间的一种可能的执行先后顺序,在一些其它实施例中,上述步骤也可以不按照编号顺序来执行,如两个不同编号的步骤同时执行,或者两个不同编号的步骤按照与图示相反的顺序执行,本申请实施例对此不作限定。It should be understood that the "plurality" mentioned herein refers to two or more than two. "And/or" describes the association relationship of associated objects, indicating that there may be three types of relationships, for example, A and/or B may indicate: A exists alone, A and B exist simultaneously, and B exists independently. The character "/" generally indicates that the contextual objects are an "or" relationship. In addition, the numbering of the steps described herein only exemplarily shows a possible sequence of execution among the steps. In some other embodiments, the above-mentioned steps may not be executed according to the order of the numbers, such as two different numbers The steps are executed at the same time, or two steps with different numbers are executed in the reverse order as shown in the illustration, which is not limited in this embodiment of the present application.
以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above are only optional embodiments of the application, and are not intended to limit the application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the application shall be included in the protection of the application. within range.

Claims (20)

  1. 一种微应用的运行方法,所述方法包括:A method for running a micro-application, the method comprising:
    获取目标微应用的目标微应用脚本,所述目标微应用脚本由至少一个触发器构成;acquiring a target micro-application script of the target micro-application, wherein the target micro-application script is composed of at least one trigger;
    响应于目标触发事件,触发所述目标微应用脚本中所述目标触发事件对应的目标触发器;triggering a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event;
    从第一数据存储区中读取所述目标触发事件对应的事件参数,不同触发器对应不同第一数据存储区;Reading event parameters corresponding to the target trigger event from the first data storage area, where different triggers correspond to different first data storage areas;
    基于所述事件参数,执行所述目标触发器对应的目标调用动作。Based on the event parameters, execute the target invocation action corresponding to the target trigger.
  2. 根据权利要求1所述的方法,其中,所述目标调用动作的动作类型包括简单动作类型和组合动作类型,所述简单动作类型下所述目标调用动作由单个目标简单动作构成,所述组合动作类型下所述目标调用动作由至少一个目标控制器和至少一个所述目标简单动作构成,所述目标控制器用于指示所述目标简单动作的目标调用逻辑;The method according to claim 1, wherein the action types of the target call actions include simple action types and combined action types, the target call action under the simple action type is composed of a single target simple action, and the combined action The target invocation action under type is composed of at least one target controller and at least one target simple action, and the target controller is used to indicate the target invocation logic of the target simple action;
    所述执行所述目标触发器对应的目标调用动作,包括:The execution of the target invocation action corresponding to the target trigger includes:
    在所述目标调用动作包括至少一个所述目标控制器的情况下,通过至少一个所述目标控制器控制执行至少一个所述目标简单动作。In the case that the target calling action includes at least one target controller, at least one target simple action is controlled by at least one target controller.
  3. 根据权利要求2所述的方法,其中,所述目标调用动作包括位于父节点的目标简单动作和位于子节点的目标简单动作;The method according to claim 2, wherein the target invocation action includes a target simple action located at a parent node and a target simple action located at a child node;
    所述通过至少一个所述目标控制器控制执行至少一个所述目标简单动作,包括:The performing at least one target simple action controlled by at least one target controller includes:
    通过所述目标控制器控制执行所述位于父节点的目标简单动作,以及获取执行所述位于父节点的目标简单动作后反馈的目标服务数据;controlling and executing the target simple action located at the parent node through the target controller, and acquiring target service data fed back after executing the target simple action located at the parent node;
    从第二数据存储区中读取所述目标服务数据,位于父节点的目标简单动作不同,对应不同第二数据存储区;Reading the target service data from the second data storage area, the target simple actions located in the parent node are different, and correspond to different second data storage areas;
    基于所述目标服务数据,执行所述位于子节点的目标简单动作。Based on the target service data, the target simple action at the child node is executed.
  4. 根据权利要求1所述的方法,其中,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    将所述目标微应用对应的运行环境参数存储在第三数据存储区,所述第三数据存储区允许由各个所述触发器触发的所述调用动作访问。The operating environment parameters corresponding to the target micro-application are stored in a third data storage area, and the third data storage area allows access to the calling action triggered by each of the triggers.
  5. 根据权利要求1至4任一所述的方法,其中,所述目标调用动作的动作类型包括简单动作类型和组合动作类型,所述简单动作类型下所述目标调用动作由单个目标简单动作构成,所述组合动作类型下所述目标调用动作由至少一个目标控制器和至少一个所述目标简单动作构成,所述目标控制器用于指示所述目标简单动作的目标调用逻辑;The method according to any one of claims 1 to 4, wherein the action type of the target invocation action includes a simple action type and a combined action type, and the target invocation action under the simple action type is composed of a single target simple action, The target invocation action under the combined action type is composed of at least one target controller and at least one target simple action, and the target controller is used to indicate the target invocation logic of the target simple action;
    所述执行所述目标触发器对应的目标调用动作,包括:The execution of the target invocation action corresponding to the target trigger includes:
    在所述目标调用动作包括至少一个所述目标控制器的情况下,确定所述目标控制器所指示的所述目标调用逻辑;Where the target invocation action includes at least one of the target controllers, determining the target invocation logic indicated by the target controller;
    基于所述目标调用逻辑,执行所述目标简单动作。Based on the target invocation logic, the target simple action is executed.
  6. 根据权利要求5所述的方法,其中,所述目标控制器为条件控制器,所述条件控制器与至少两个候选简单动作关联;The method according to claim 5, wherein the target controller is a conditional controller, and the conditional controller is associated with at least two candidate simple actions;
    所述确定所述目标控制器所指示的所述目标调用逻辑,包括:The determining the target calling logic indicated by the target controller includes:
    确定所述目标控制器所指示的目标调度条件;determining a target scheduling condition indicated by the target controller;
    所述基于所述目标调用逻辑,执行所述目标简单动作,包括:The step of invoking logic based on the target and executing the simple action of the target includes:
    基于所述目标调度条件,从所述候选简单动作中确定出所述目标简单动作,以及执行所述目标简单动作。Based on the target scheduling condition, the target simple action is determined from the candidate simple actions, and the target simple action is executed.
  7. 根据权利要求5所述的方法,其中,所述目标控制器为循环控制器;The method according to claim 5, wherein the target controller is a loop controller;
    所述确定所述目标控制器所指示的所述目标调用逻辑,包括:The determining the target calling logic indicated by the target controller includes:
    确定所述目标控制器所指示的目标循环条件;determining a target cycle condition indicated by the target controller;
    所述基于所述目标调用逻辑,执行所述目标简单动作,包括:The step of invoking logic based on the target and executing the simple action of the target includes:
    在所述目标简单动作的执行状态未满足所述目标循环条件的情况下,继续循环执行所述目标简单动作。If the execution state of the target simple action does not meet the target cycle condition, continue to execute the target simple action cyclically.
  8. 根据权利要求7所述的方法,其中,所述在所述目标简单动作的执行状态未满足所述目标循环条件的情况下,继续执行所述目标简单动作,包括如下任意一种:The method according to claim 7, wherein when the execution state of the target simple action does not meet the target cycle condition, continuing to execute the target simple action comprises any of the following:
    在所述目标简单动作的执行次数未达到次数阈值的情况下,继续循环执行所述目标简单动作;In the case that the number of executions of the target simple action does not reach the number threshold, continue to execute the target simple action in a loop;
    在所述目标简单动作对应的所述目标服务未调用成功的情况下,继续循环执行所述目标简单动作;If the target service corresponding to the target simple action is not invoked successfully, continue to execute the target simple action in a loop;
    在所述目标简单动作对应的所述目标服务未调用失败的情况下,继续循环执行所述目标简单动作。If the target service corresponding to the target simple action does not fail to be invoked, the target simple action continues to be cyclically executed.
  9. 根据权利要求5所述的方法,其中,所述目标控制器为延时控制器;The method according to claim 5, wherein the target controller is a delay controller;
    所述确定所述目标控制器所指示的所述目标调用逻辑,包括:The determining the target calling logic indicated by the target controller includes:
    确定所述目标控制器所指示的目标调用延时;determining a target invocation latency indicated by the target controller;
    所述基于所述目标调用逻辑,执行所述目标简单动作,包括:The step of invoking logic based on the target and executing the simple action of the target includes:
    在达到所述目标调用延时的情况下,执行所述目标简单动作。In case the target call delay is reached, the target simple action is executed.
  10. 根据权利要求5所述的方法,其中,所述目标控制器为顺序控制器,所述顺序控制器与至少两个候选简单动作关联;The method according to claim 5, wherein the target controller is a sequence controller, and the sequence controller is associated with at least two candidate simple actions;
    所述确定所述目标控制器所指示的所述目标调用逻辑,包括:The determining the target calling logic indicated by the target controller includes:
    确定所述目标控制器所指示的各个所述候选简单动作对应的目标调用顺序;determining the target invocation sequence corresponding to each of the candidate simple actions indicated by the target controller;
    所述基于所述目标调用逻辑,执行所述目标简单动作,包括:The step of invoking logic based on the target and executing the simple action of the target includes:
    基于所述目标调用顺序,依次将所述候选简单动作确定为所述目标简单动作,以及依次执行各个所述目标简单动作。Based on the target calling sequence, the candidate simple actions are sequentially determined as the target simple actions, and each of the target simple actions is sequentially executed.
  11. 根据权利要求10所述的方法,其中,所述依次执行各个所述目标简单动作,包括:The method according to claim 10, wherein said sequentially performing each of said target simple actions comprises:
    在第n目标简单动作执行成功的情况下,继续执行所述第n+1目标简单动作;If the nth target simple action is successfully executed, continue to execute the n+1th target simple action;
    所述方法还包括:The method also includes:
    在所述第n目标简单动作执行失败的情况下,停止执行所述第n+1目标简单动作。If the execution of the nth target simple action fails, the execution of the n+1th target simple action is stopped.
  12. 根据权利要求5所述的方法,其中,所述目标控制器为选择控制器,所述选择控制器与至少两个候选简单动作关联;The method according to claim 5, wherein the target controller is a selection controller, and the selection controller is associated with at least two candidate simple actions;
    所述确定所述目标控制器所指示的所述目标调用逻辑,包括:The determining the target calling logic indicated by the target controller includes:
    确定所述目标控制器所指示的目标调用顺序;determining the target invocation sequence indicated by the target controller;
    所述基于所述目标调用逻辑,执行所述目标简单动作,包括:The step of invoking logic based on the target and executing the simple action of the target includes:
    基于所述目标调用顺序,依次执行所述候选简单动作;在存在所述候选简单动作执行成功的情况下,将所述候选简单动作确定为所述目标简单动作,以及停止执行其他所述候选简单动作。Based on the target invocation sequence, execute the candidate simple actions in sequence; if there is a candidate simple action that is successfully executed, determine the candidate simple action as the target simple action, and stop executing other candidate simple actions action.
  13. 根据权利要求5所述的方法,其中,所述目标控制器为并行控制器,所述并行控制器与至少两个所述候选简单动作关联;The method according to claim 5, wherein the target controller is a parallel controller, and the parallel controller is associated with at least two of the candidate simple actions;
    所述基于所述目标调用逻辑,执行所述目标简单动作,包括:The step of invoking logic based on the target and executing the simple action of the target includes:
    将各个所述候选简单动作确定为所述目标简单动作,以及并行执行各个所述目标简单动作。Each of the candidate simple actions is determined as the target simple action, and each of the target simple actions is executed in parallel.
  14. 一种微应用的运行装置,所述装置包括:A micro-application running device, the device comprising:
    脚本获取模块,用于获取目标微应用的目标微应用脚本,所述目标微应用脚本由至少一个触发器构成;A script acquisition module, configured to acquire a target micro-application script of the target micro-application, wherein the target micro-application script is composed of at least one trigger;
    触发模块,用于响应于目标触发事件,触发所述目标微应用脚本中所述目标触发事件对应的目标触发器;A trigger module, configured to trigger a target trigger corresponding to the target trigger event in the target micro-application script in response to the target trigger event;
    数据读取模块,用于从第一数据存储区中读取所述目标触发事件对应的事件参数,不同触发器对应不同第一数据存储区;A data reading module, configured to read event parameters corresponding to the target trigger event from the first data storage area, and different triggers correspond to different first data storage areas;
    动作调用模块,用于基于所述事件参数,执行所述目标触发器对应的目标调用动作。An action calling module, configured to execute a target calling action corresponding to the target trigger based on the event parameter.
  15. 根据权利要求14所述的装置,其中,所述目标调用动作的动作类型包括简单动作类型和组合动作类型,所述简单动作类型下所述目标调用动作由单个目标简单动作构成,所述组合动作类型下所述目标调用动作由至少一个目标控制器和至少一个所述目标简单动作构成,所述目标控制器用于指示所述目标简单动作的目标调用逻辑;The device according to claim 14, wherein the action type of the target-invoking action includes a simple action type and a combined action type, the target-invoking action under the simple action type is composed of a single target simple action, and the combined action The target invocation action under type is composed of at least one target controller and at least one target simple action, and the target controller is used to indicate the target invocation logic of the target simple action;
    所述动作调用模块,还用于:The action call module is also used for:
    在所述目标调用动作包括至少一个所述目标控制器的情况下,通过至少一个所述目标控制器控制执行 至少一个所述目标简单动作。In the case where the target call action includes at least one target controller, at least one target simple action is controlled by at least one target controller.
  16. 根据权利要求15所述的装置,其中,所述目标调用动作包括位于父节点的目标简单动作和位于子节点的目标简单动作;The apparatus according to claim 15, wherein the target invocation action comprises a target simple action located at a parent node and a target simple action located at a child node;
    所述动作调用模块,还用于:The action call module is also used for:
    通过所述目标控制器控制执行所述位于父节点的目标简单动作,以及获取执行所述位于父节点的目标简单动作后反馈的目标服务数据;controlling and executing the target simple action located at the parent node through the target controller, and acquiring target service data fed back after executing the target simple action located at the parent node;
    从第二数据存储区中读取所述目标服务数据,位于父节点的目标简单动作不同,对应不同第二数据存储区;Reading the target service data from the second data storage area, the target simple actions located in the parent node are different, and correspond to different second data storage areas;
    基于所述目标服务数据,执行所述位于子节点的目标简单动作。Based on the target service data, the target simple action at the child node is executed.
  17. 根据权利要求14所述的装置,其中,所述装置还包括:The apparatus according to claim 14, wherein said apparatus further comprises:
    数据存储模块,用于将所述目标微应用对应的运行环境参数存储在第三数据存储区,所述第三数据存储区允许由各个所述触发器触发的所述调用动作访问。A data storage module, configured to store the operating environment parameters corresponding to the target micro-application in a third data storage area, and the third data storage area allows access to the calling action triggered by each of the triggers.
  18. 一种计算机设备,其特征在于,所述计算机设备包括处理器和存储器;所述存储器存储有至少一条指令,所述至少一条指令用于被所述处理器执行以实现如权利要求1至13任一所述的微应用的运行方法。A computer device, characterized in that the computer device includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement any of claims 1 to 13. A running method of the micro-application.
  19. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有至少一条程序代码,所述程序代码由处理器加载并执行以实现如权利要求1至13任一所述的微应用的运行方法。A computer-readable storage medium, characterized in that at least one piece of program code is stored in the computer-readable storage medium, and the program code is loaded and executed by a processor to implement the method described in any one of claims 1 to 13. How the microapp runs.
  20. 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机指令,所述计算机指令存储在计算机可读存储介质中;计算机设备的处理器从所述计算机可读存储介质读取所述计算机指令,所述处理器执行所述计算机指令,使得所述计算机设备执行如权利要求1至13任一所述的微应用的运行方法。A computer program product, characterized in that the computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium; a processor of a computer device reads the computer-readable Instructions, the processor executes the computer instructions, so that the computer device executes the micro-application running method according to any one of claims 1 to 13.
PCT/CN2022/133516 2021-12-30 2022-11-22 Micro-application running method and apparatus, device, storage medium, and program product WO2023124657A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111651803.XA CN114356520A (en) 2021-12-30 2021-12-30 Running method, device, equipment, storage medium and program product of micro application
CN202111651803.X 2021-12-30

Publications (1)

Publication Number Publication Date
WO2023124657A1 true WO2023124657A1 (en) 2023-07-06

Family

ID=81103940

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/133516 WO2023124657A1 (en) 2021-12-30 2022-11-22 Micro-application running method and apparatus, device, storage medium, and program product

Country Status (2)

Country Link
CN (1) CN114356520A (en)
WO (1) WO2023124657A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114356520A (en) * 2021-12-30 2022-04-15 Oppo广东移动通信有限公司 Running method, device, equipment, storage medium and program product of micro application

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070088836A1 (en) * 2005-07-29 2007-04-19 Verizon Business Financial Management Corp. Application service invocation based on filter criteria
CN101384995A (en) * 2006-02-13 2009-03-11 国际商业机器公司 Administration automation in application servers
US20130073614A1 (en) * 2011-09-21 2013-03-21 Actian Corporation Method and apparatus for the development, delivery and deployment of action-oriented business applications supported by a cloud based action server platform
US9313643B1 (en) * 2015-02-11 2016-04-12 Sprint Communications Company L.P. Dynamic subscriber identity module
CN105847552A (en) * 2016-03-25 2016-08-10 乐视控股(北京)有限公司 Application operation method of mobile terminal and mobile terminal
CN114356520A (en) * 2021-12-30 2022-04-15 Oppo广东移动通信有限公司 Running method, device, equipment, storage medium and program product of micro application

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070088836A1 (en) * 2005-07-29 2007-04-19 Verizon Business Financial Management Corp. Application service invocation based on filter criteria
CN101384995A (en) * 2006-02-13 2009-03-11 国际商业机器公司 Administration automation in application servers
US20130073614A1 (en) * 2011-09-21 2013-03-21 Actian Corporation Method and apparatus for the development, delivery and deployment of action-oriented business applications supported by a cloud based action server platform
US9313643B1 (en) * 2015-02-11 2016-04-12 Sprint Communications Company L.P. Dynamic subscriber identity module
CN105847552A (en) * 2016-03-25 2016-08-10 乐视控股(北京)有限公司 Application operation method of mobile terminal and mobile terminal
CN114356520A (en) * 2021-12-30 2022-04-15 Oppo广东移动通信有限公司 Running method, device, equipment, storage medium and program product of micro application

Also Published As

Publication number Publication date
CN114356520A (en) 2022-04-15

Similar Documents

Publication Publication Date Title
CN111026396B (en) Page rendering method and device, electronic equipment and storage medium
CN111158818B (en) Page rendering method and device
WO2023093429A1 (en) Micro-application running method and apparatus, and device, storage medium and program product
WO2023093414A1 (en) Micro-application development method and apparatus, and device, storage medium and program product
CN110990075B (en) Method, device, equipment and storage medium for starting fast application
CN111737032A (en) Subprogram running method and device based on microkernel system and electronic equipment
US10564988B1 (en) Deploying cross-platform applications on mobile devices with native and web components
CN112051993B (en) Method, device, medium and equipment for generating state machine template and processing task
CN111026490B (en) Page rendering method and device, electronic equipment and storage medium
CN110990105A (en) Interface display method and device, electronic equipment and storage medium
CN110874217A (en) Interface display method and device for fast application and storage medium
CN111026491A (en) Interface display method and device, electronic equipment, server and storage medium
CN110928543A (en) Page processing method and device and storage medium
WO2023124657A1 (en) Micro-application running method and apparatus, device, storage medium, and program product
CN110971974B (en) Configuration parameter creating method, device, terminal and storage medium
CN110865863B (en) Interface display method and device for fast application and storage medium
CN111078325B (en) Application program running method and device, electronic equipment and storage medium
Mancini et al. iGateLink: a gateway library for linking IoT, edge, fog, and cloud computing environments
CN114968406A (en) Plug-in management method and device, electronic equipment and storage medium
CN111008057A (en) Page display method and device and storage medium
CN113656001A (en) Platform component development method and device, computer equipment and storage medium
CN111008050B (en) Page task execution method, device, terminal and storage medium
WO2021097683A1 (en) Android system starting method and apparatus, device, and storage medium
CN113050962B (en) Mobile service upgrading method, device and terminal
CN110262912B (en) Calling method and device for procedure call gRPC

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22913915

Country of ref document: EP

Kind code of ref document: A1