WO2023093429A1 - Micro-application running method and apparatus, and device, storage medium and program product - Google Patents
Micro-application running method and apparatus, and device, storage medium and program product Download PDFInfo
- Publication number
- WO2023093429A1 WO2023093429A1 PCT/CN2022/127460 CN2022127460W WO2023093429A1 WO 2023093429 A1 WO2023093429 A1 WO 2023093429A1 CN 2022127460 W CN2022127460 W CN 2022127460W WO 2023093429 A1 WO2023093429 A1 WO 2023093429A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- service
- target
- micro
- application
- candidate
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/146—Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72484—User interfaces specially adapted for cordless or mobile telephones wherein functions are triggered by incoming communication events
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 of the target micro-application is a collection of services
- the target micro-application script is composed of triggers
- the triggers are used to perform service calls by executing control logic under trigger events ;
- the embodiment of the present application provides a micro-application running device, the device includes:
- the script obtaining module is used to obtain the target micro-application script of the target micro-application, the target micro-application is a collection of services, the target micro-application script is composed of a trigger, and the trigger is used to pass Execute control logic to make service calls;
- a trigger module configured to trigger a target trigger corresponding to the target trigger event in the target micro-application script when the target trigger event is received;
- the service calling module is used to execute the target control logic corresponding to the target trigger, and call the target service to realize the micro-application function of the target micro-application.
- 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 program, and the at least one program 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 program is stored in the computer-readable storage medium, and the at least one program is loaded and executed by a processor to implement the above-mentioned The running method of the microapp.
- an embodiment of the present application provides a computer program product, the computer program product includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor of a computer device reads the computer-readable storage medium from the computer-readable storage medium.
- a computer instruction 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 foregoing aspect.
- Fig. 1 is a schematic diagram of a micro-application script shown in an exemplary embodiment of the present application
- FIG. 2 shows a system architecture diagram of a micro-application system provided by an exemplary embodiment of the present application
- FIG. 3 shows a flow chart of a micro-application running method provided by an exemplary embodiment of the present application
- Fig. 4 is a schematic interface diagram of a micro-application subscription process shown in an exemplary embodiment of the present application
- Fig. 5 is an implementation schematic diagram of a micro-application subscription process shown in an exemplary embodiment of the present application
- Fig. 6 is an implementation schematic diagram of a micro-application unsubscribing process shown in an exemplary embodiment of the present application
- FIG. 7 is a flow chart of a target service determination process shown in an exemplary embodiment of the present application.
- Fig. 8 is an implementation schematic diagram of a service invocation process shown in an exemplary embodiment of the present application.
- FIG. 9 is a schematic diagram of an implementation process of a service agent invoking a service process shown in an exemplary embodiment of the present application.
- Fig. 10 is a flowchart of a static service invocation process shown in an exemplary embodiment of the present application.
- Fig. 11 is a flowchart of a dynamic service invocation process shown in an exemplary embodiment of the present application.
- Fig. 12 is a schematic diagram of implementation of service differential deployment shown in an exemplary embodiment of the present application.
- Fig. 13 is an implementation schematic diagram of an engine state synchronization process shown in an exemplary embodiment of the present application.
- Fig. 14 is a flowchart of a micro-app script acquisition process shown in an exemplary embodiment of the present application.
- Fig. 15 is a schematic diagram of a target micro-application determination process shown in an exemplary embodiment of the present application.
- FIG. 16 shows a structural block diagram of a micro-application running device provided by an embodiment of the present application
- Fig. 17 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. 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.
- 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 may be xml or javascript.
- 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.
- 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-application 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.
- 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. 2 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 vehicle 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 lifecycle 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. 2 , 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 micro-app scripts of micro-apps from the micro-app 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. 3 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. 2 as an example for illustration.
- the method include:
- Step 301 acquire the target micro-application script of the target micro-application.
- the target micro-application is a collection of services, and the target micro-application script is composed of triggers, and the triggers are used to call services by executing control logic under trigger events.
- 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-application script is composed of several triggers, and each trigger is used to trigger under a specific trigger event, and after triggering, the service call is made through the corresponding control logic of the trigger.
- 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 302 in the case of receiving the target trigger event, trigger the target trigger corresponding to the target trigger event in the target micro-application script.
- 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 control logic corresponding to the trigger through the micro-application engine 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 303 execute the target control logic corresponding to the target trigger, and call the target service, so as to realize the micro-application function of the target micro-application.
- the computer device executes the target control logic corresponding to the target trigger through the runtime module in the micro-application engine, and then the target control logic invokes the target service.
- the services called by the target control logic include at least two services, the at least two services will be called sequentially according to the business logic.
- 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 repeatedly executes the above steps 302 and 303, and after the end trigger is triggered, executes the control logic of the end trigger to end the running of the micro-application.
- the computer device when running a micro-application composed of several services, the computer device obtains the micro-application script of the micro-application, and triggers the corresponding trigger in the micro-application script based on the received trigger event, Then, by executing the control logic corresponding to the trigger, the corresponding service is called to realize the micro-application function of the micro-application. Since the operation of micro-applications is based on micro-application scripts with low code volume, it requires less storage space than traditional applications; moreover, assemble services into micro-applications, and use micro-application scripts to manage the calling relationship between services , realizing the componentization of micro-applications, improving the reusability of services between micro-applications, and helping to reduce the difficulty of developing micro-applications.
- the method before invoking the target service, the method includes:
- the target service is determined from the candidate services in the candidate service list.
- a list of candidate services including:
- a candidate service list is generated based on the candidate static services and the candidate dynamic services.
- the target service is determined from the candidate services in the candidate service list, including:
- the target service is determined from the candidate services in the candidate service list.
- call the target service including:
- the target service is invoked through the target service gateway, where the target service gateway is the service gateway of the current device, and/or, the service gateway of an external device other than the current device, and the target micro-application script is set in the external device.
- call the target service through the target service gateway including:
- the target service gateway is the service gateway of the current device
- the service invocation request is obtained through the target service gateway
- the target service proxy corresponding to the target service is determined through the target service gateway; based on the service invocation request, the target service is invoked through the target service proxy;
- the target service gateway is the service gateway of the external device
- the service call request is sent to the external device, and the external device is used to determine the target service proxy corresponding to the target service through the target service gateway, and based on the service call request, through the target service proxy call target service;
- different service agents correspond to different programming development languages, or different service agents correspond to different deployment forms, or different service agents correspond to different operating environments.
- the target service is invoked through the target service proxy, including:
- the target service is invoked through the target service proxy to obtain the original output parameters of the target service;
- the original output parameters are converted by the target service agent to obtain the target output parameters, and the target output parameters adopt a unified parameter format.
- the method further includes:
- the target service is a static service
- the method further includes:
- the target service is a dynamic service
- the target service If the target service is not deployed, download the target service from the cloud service library, and load the target service through the host service.
- the method further includes:
- the target service is a synchronous call service
- obtain the service return value of the target service call the next service based on the service return value
- the target service is an asynchronous call service
- the service output event of the target service is obtained; the trigger in the target micro-application script is triggered by the service output event.
- the method includes:
- the target microapp script of the target microapp is downloaded based on the application identifier in the subscription push message.
- the subscription push message is sent to the user account when the server detects that the microapp subscribed by the user account has changed. Each device under push.
- the method further includes:
- the initialization service is deployed, and the initialization service is the service invoked by the initialization trigger.
- the method also includes:
- a subscription cancellation instruction is sent to the server, and the server is configured to push a subscription cancellation message to each device under the user account based on the subscription cancellation instruction, so that each terminal deletes the target micro-app script.
- obtain the target microapp script of the target microapp including:
- At least one candidate micro-application corresponding to the initialization trigger event is determined, and the initialization trigger event is used to trigger an initialization trigger of at least one candidate micro-application;
- determining a target micro-application from at least one candidate micro-application includes:
- microapplication selection list based on at least one candidate microapplication; determining the selected candidate microapplication as a target microapplication in response to a selection operation on the microapplication selection list; or,
- a target micro-application is determined from at least one candidate micro-application.
- micro-app Since the micro-app is not bound to the device but to the user, before using the target micro-app, it is first necessary to subscribe to the micro-app through the user account, so as to download the target micro-app script corresponding to the target micro-app to the individual devices.
- the subscription initiator device in response to a subscription operation on the target micro-application, downloads the target micro-application script of the target micro-application.
- the subscription initiator device can obtain a micro-app list including all micro-apps by accessing the micro-app store server, and download the micro-app from the micro-app store server when receiving a subscription operation to the target micro-app in the micro-app list Target microapp script.
- the subscription initiator device can also use the micro-app search engine of the micro-app store server to search for micro-apps by inputting micro-app keywords, and then initiate a subscription operation to the target micro-app from the search results.
- the subscription operation may be a click operation on a subscription control corresponding to the target micro-application.
- the subscription initiator device accesses the micro-app store, and displays each micro-app in the micro-app list on the micro-app store interface 41 , including micro-apps subscribed and unsubscribed by the current user account.
- the user may enter a micro-application keyword in the search bar of the micro-application store interface 41, and click the search control 43 to trigger the micro-application store server to feed back micro-applications containing the micro-application keyword.
- the subscription initiator device downloads the target micro-application script from the micro-application store server according to the application identifier of the target micro-application.
- the computer device downloads the target The micro-application script, wherein the subscription push message is pushed to each device under the user account when the server detects that the micro-application subscribed to by the user account changes.
- the user resource management server updates the subscription relationship between the user account and the micro-application based on the user account logged in by the subscription initiator device and the application identifier of the target micro-application, and Based on inquiring about the devices under the user account, a subscription push message is sent to each of the queried devices, and the subscription push message at least includes the application identifier of the target micro-application.
- the computer device After the computer device receives the subscription push message, it knows that other devices that log in to the same user account as itself have subscribed to the target micro-app, and then downloads the target micro-app script of the target micro-app from the micro-app store server based on the application identifier in the subscription push message .
- the application management module 511 in the user resource management server 51 adds "Zhang San”
- the subscription relationship with the micro-app, and through the device management module 512, it is found that the user account "Zhang San” also includes device B and device C, so as to send subscription push messages to device B and device C.
- device B and device C receive the subscription push message, they automatically download the micro application script from the micro application store server 52 through the micro application engine.
- the initialization trigger in the micro-app script needs to be executed immediately, and the The service called by the initial trigger is deployed on the current device, so as to ensure the normal operation of the micro application.
- an initialization service is deployed based on an initialization trigger in the target micro-application script, where the initialization service is a service called by the initialization trigger, and The quantity of the initialization service is at least one.
- the micro-application script of the micro-application when the micro-application is used to realize cross-device screen capture by tapping with two fingers, the micro-application script of the micro-application includes an initialization trigger, a trigger for tapping with two fingers, and an end trigger. Since the two-finger tap service needs to be invoked in the initialization trigger, the double-finger tap service needs to be pre-deployed on the device to avoid failure to capture the double-finger tap event due to the non-pre-deployment of the two-finger tap service, which in turn cannot trigger the two-finger tap Hit the trigger, which eventually leads to the problem that the micro application cannot run.
- the computer device can also unsubscribe from the micro-application.
- the computer device in response to the unsubscribing operation of the target micro-application, deletes the target micro-application script of the target micro-application, so as to prevent the unsubscribed target micro-application script from occupying device storage space.
- the computer device also needs to send a subscription cancellation instruction to the server, so that the server can push a subscription cancellation message to each device under the user account based on the subscription cancellation instruction, so that Each terminal deletes the target microapp script.
- the subscription cancellation instruction at least includes the application identification of the target micro-application.
- the device A cancels the subscription to the micro-app, and then sends a subscription cancel instruction to the user resource management server 51, and the application management module 511 in the user resource management server 51 bases on the
- the subscription cancellation instruction deletes the subscription relationship between "Zhang San” and the micro-app, and through the device management module 512, it is found that the user account "Zhang San” also includes device B and device C, so that by sending subscriptions to device B and device C cancel message.
- device B and device C delete the micro-app script of the micro-app.
- the micro-app scripts in each device under the same user account are kept consistent, avoiding the problem of abnormal use of micro-apps due to inconsistent micro-app scripts on different device sides, and ensuring The availability of micro-apps and the consistency of user experience on different device sides.
- the initialization service is pre-deployed to ensure the normal operation of subsequent micro-applications.
- the called service is defined in the micro-application script, but in actual situations, there may be multiple specific service instances for realizing the same service function.
- the payment function can be realized through the payment service A provided by the payment application, the payment service B provided by the instant messaging application, or the payment dynamic service C. Therefore, before invoking the target service, the computer device first needs to determine the target service from several candidate services. In a possible implementation manner, as shown in FIG. 7 , the process for the computer device to determine the target service includes the following steps.
- Step 701 Determine a candidate service list based on the service ID of the service invoked by the target control logic, and the candidate service list includes at least one candidate service matching the service ID.
- the target control logic in the target micro-application script includes the service identifier of the called service, and when the runtime module in the micro-application engine executes the target control logic, it obtains the service identifier, thereby passing the service
- the scheduling module determines at least one candidate service matching the service identifier.
- the service identifier may be a service name or a service ID, which is not limited in this embodiment.
- this step may include the following sub-steps:
- the static service is a pre-installed service, and its invocation depends on the host application, that is, the static service can be invoked only when the host application is installed.
- the service management module is used to manage the static services provided by the host application in the local device. After obtaining the service identifier, the service scheduling module queries the local device for candidate services that match the service identifier through the service management module. static service.
- the service management module determines the payment service A provided by the payment application and the payment service B provided by the instant messaging application as candidate static services (the computer device is installed with payment application A and instant messaging Communication application B).
- the service scheduling module queries the cloud service library for candidate dynamic services matching the service identifier.
- the service dispatching module queries the payment dynamic service C from the cloud service library based on the service name "payment”, and determines the payment dynamic service C as a candidate dynamic service.
- the computer device does not directly download the service, but performs service download when the target service is determined and belongs to the candidate dynamic service.
- the computer device combines the queried candidate dynamic services and candidate static services to obtain a candidate service list.
- Step 702 determine the target service from the candidate services in the candidate service list.
- the computer device when the candidate service list contains only one candidate service, the computer device directly determines the candidate service as the target service; when the candidate service list contains at least two candidate services, the computer device needs to determine the target service therefrom.
- the computer device displays a list of candidate services, and the user selects a target service to call from the list of candidate services.
- the computer device determines the selected candidate service as the target service.
- the computer device may display a list of candidate services in the form of a pop-up window, and determine a target service when receiving a click operation on a candidate service in the list of candidate services.
- the embodiment of the present application does not limit the display manner of the candidate service list.
- the computer device may automatically determine the target service from the candidate services based on the service selection policy.
- the computer device may determine the target service based on at least one of user information, device information, historical use records, and service information. This embodiment does not limit the specific service selection strategy.
- the computer device will determine the payment service A with the highest frequency of use. serve the purpose.
- the computer device may, based on the location relationship between the current device and each device (which can be determined based on information such as location and network location), select the service provided by the nearest device.
- the service identified as the target service may be based on the location relationship between the current device and each device (which can be determined based on information such as location and network location).
- the computer device After the target service is determined, the computer device further invokes the target service.
- the target service is a static service
- the computer device does not need to dynamically download the target service
- the target service is a dynamic service
- the computer device needs to determine whether to download and deploy in real time based on the deployment of the dynamic service.
- the runtime module 801 requests the service scheduling module 802 to call the service based on the service identifier of the service called by the control logic.
- the service scheduling module 802 searches for available candidate services from the service management module 803 and the cloud service library 804 respectively based on the service identifier.
- the server scheduling module 802 can display a candidate service list 805 for the user to select a target application to be invoked, and can also determine a target service from several candidate services based on a service selection strategy. When the determined target service is service 1 of the C device, the service scheduling module 802 further calls service 1 in the C device through the service gateway 806 .
- the computer device based on the service identifier of the invoked service, queries the static service and dynamic service that match the service identifier, and further determines the target service from the queried static service and dynamic service, which enriches the service invocation. types, increasing the diversity of service implementations.
- the service invocation can be realized by the service gateway, and the computer device can not only invoke the local service through its own service gateway, but also invoke the service through the service gateway of other devices, so as to realize the cross-terminal service invocation.
- the computer device invokes the target service, it determines the target device providing the target service, so as to invoke the target server through the target service gateway.
- the target service gateway can be the service gateway of the current device, and/or the service gateway of an external device other than the current device (determined by the business logic of the micro-application), and the target micro-application script is set in the external device, that is, the external device Both the device and the current device are capable of running the target microapp.
- service invocation requests in a uniform format must be used when invoking services.
- the service gateway needs to convert service invocation requests in the same format into real Service calls (because different operating systems have their own different process upper layer abstraction methods, and different call methods between processes), that is, service calls that conform to the current platform service specification.
- the computer device obtains the service invocation request through the target service gateway, so as to determine the target service agent corresponding to the target service through the target service gateway. Further, based on the service invocation request, the target service is invoked through the target service proxy.
- the computer device sends a service invocation request to the external device, and the external device determines the target service agent corresponding to the target service through the target service gateway, and based on the service invocation request, through the target service
- the proxy invokes the target service.
- the computer device may obtain the gateway address of the service gateway of the external device through the user resource management server (device management module), so as to send the service call request based on the gateway address.
- the user resource management server device management module
- the computer device can be deployed with different service agents as needed (for example, there is no need to deploy an Android service agent on a Windows system device), where different service agents correspond to different Programming development languages (such as java, js, php, C, C++, etc.), or, different service agents correspond to different deployment forms (such as applets, browser plug-ins, applications, etc.), or, different service agents Corresponding to different operating environments (such as virtual machines, browsers, operating systems, containers, etc.).
- different service agents correspond to different Programming development languages (such as java, js, php, C, C++, etc.)
- different service agents correspond to different deployment forms (such as applets, browser plug-ins, applications, etc.)
- different service agents Corresponding to different operating environments (such as virtual machines, browsers, operating systems, containers, etc.).
- the proxy management module 91 of the service gateway 90 is provided with an Android Service proxy 911, a cloud restful proxy 912, an Android dynamic service proxy 913 and a Web dynamic service proxy 914.
- the target service gateway determines whether a target service proxy corresponding to the target service is deployed based on the service information of the target service. If the target service proxy is deployed, the service call is made through the target service proxy; if the target service proxy is not deployed, the service call cannot be made.
- the invocation process may include the following steps:
- the service proxy defines how to call the service, including how to convert the original call parameters into the parameters required by the real service, how to access the service of the specified process in the operating system, and how to convert the parameters returned by the real service into a unified format parameters and so on. Since the original input parameters in the unified parameter format in the server invocation request do not conform to the parameter input format of the target service, the target service agent first needs to convert the original input parameters to obtain the target input parameters that conform to the parameter format specified by the target service.
- the service gateway 90 converts the original input parameters through the Android dynamic service agent 913, and calls the Android dynamic service 93 based on the converted parameters Service A in; when service B in Web dynamic service 94 needs to be invoked, service gateway 90 converts the original input parameters through Web dynamic service proxy 914, and invokes service B in Web dynamic service 94 based on the converted parameters.
- the target service is invoked through the target service agent to obtain the original output parameters of the target service.
- the target service proxy invokes the target service based on the target input parameter, thereby obtaining the original output parameter of the target server, wherein the original output parameter conforms to the parameter input format of the target service.
- the target service agent needs to convert the original output parameters to obtain the target output parameters, and then feed the target output parameters back to the micro-application engine.
- the service gateway 90 converts the parameters output by service A in the Android dynamic service 93 through the Android dynamic service agent 913, and feeds back to the micro-application engine; the service gateway 90 passes the Web dynamic service agent 914 to the The parameters output by service B in the Web dynamic service 94 are converted and fed back to the micro application engine.
- the service gateway calls the service through the service agent, and the service agent performs parameter conversion on the calling parameters, so that the converted parameters meet the parameter requirements of the real service, ensuring that the service can be called correctly;
- the parameters are converted so that the converted parameters conform to the unified parameter format, which ensures the normal interaction between devices under different operating systems, platforms and operating environments, and realizes the cross-platform deployment of micro-applications.
- the computer device uses a static service manager (as shown in FIG. 9, a static service manager 951 is provided in the life cycle management module 95 of the service gateway 90) Obtain the service status of the target service, and start the target service when the service status is not started.
- the computer device may determine the deployment mode of the target service based on the description information of the target service.
- the static service manager is used to manage the life cycle of the static service. For example, when the static service is not invoked within the target duration, the static service manager ends the life cycle of the static service.
- the computer device determines the target service agent corresponding to the target service according to the description information of the target service, and performs parameter conversion through the target service agent, so that based on the host application and access information corresponding to the target service Path to invoke the target service.
- the computer device will give a failure prompt if the target service fails to start, or the target service does not meet the pre-installation conditions (for example, the host application is abnormal and the target service is unavailable).
- the invocation process of the static service is shown in FIG. 10 .
- Step 1001 the micro application engine initiates a service call request to the service gateway.
- Step 1002 the service gateway verifies whether the request is legal; if it is legal, execute step 1003; if not, execute step 1010.
- Step 1003 check whether the target service is started; if it is started, execute step 1005; if not, start the target service, and execute step 1004.
- Step 1004 check whether the target service is started successfully; if the start is successful, execute step 1005; if fail to start, execute step 1010.
- Step 1005 check whether there is a target service proxy corresponding to the target service; if yes, execute step 1006; if not, execute step 1010.
- Step 1006 convert the input parameters through the target service proxy.
- Step 1007 calling the target service based on the converted input parameters.
- Step 1008 convert the output parameters through the target service proxy.
- Step 1009 return the service call result to the micro application engine.
- Step 1010 return call failure.
- the computer device uses a dynamic service manager (as shown in FIG. 9, a dynamic service manager 952 is provided in the life cycle management module 95 of the service gateway 90) Get the service status of the host service corresponding to the target service.
- a dynamic service manager 952 is provided in the life cycle management module 95 of the service gateway 90
- the operation of the dynamic service depends on its corresponding host service.
- the computer device obtains the service status of the container service.
- the embodiment of the present application does not limit the specific type of hosting service.
- the computer device starts the host service. Further, the computer device queries the deployment status of the target service through the host service.
- the computer device downloads the target service from the cloud service library, and loads the target service through the host service.
- the target service it may be cached locally when the target service is called historically
- the computer device directly loads the target service through the host service.
- the computer device needs to determine the target service proxy corresponding to the target service according to the description information of the target service, and perform parameter conversion through the target service proxy, so as to transfer the converted parameters to the host service, so that the host service can call target service.
- the calling process of the dynamic service is shown in FIG. 11 .
- Step 1101 the micro application engine initiates a service call request to the service gateway.
- Step 1102 the service gateway verifies whether the request is legal; if it is legal, execute step 1103; if not, execute step 1112.
- Step 1103 check whether the host service of the target service is started; if it is started, execute step 1105 ; if not, start the host service, and execute step 1104 .
- Step 1104 check whether the host service is started successfully; if the start is successful, perform step 1105 ; if fail to start, perform step 1112 .
- Step 1105 check whether there is a target service agent corresponding to the target service; if yes, execute step 1106; if not, execute step 1112.
- Step 1106 convert the input parameters through the target service agent.
- Step 1107 check whether the target service is deployed through the host service; if deployed, execute step 1108; if not deployed, execute step 1109.
- Step 1108 call the target service based on the converted input parameters.
- Step 1109 download the target service from the cloud service library.
- Step 1110 convert the output parameters through the target service proxy.
- Step 1111 return the service call result to the micro application engine.
- Step 1112 return call failure.
- the services deployed on different device sides may also be different to achieve different functions, that is, during the running of the same micro-application , Differential deployment of services in different devices.
- the services invoked to realize the cross-device screen capture include two-finger tap service, picture display service and screen capture service.
- the mobile phone determines that the executed business logic should be image display based on the micro-app script, downloads and dynamically deploys the image display service, and requests to call the screenshot service on the other device side.
- the tablet, car machine and TV receive the service call request, based on the micro-app script, it is determined that the executed business logic should be to capture and send the screen, so as to download and dynamically deploy the screen capture service, and call the screen capture service to capture the screen of the current device and give feedback to the phone.
- the mobile phone receives the screenshot image fed back by other devices, it calls the image display service to realize the screenshot display.
- the computer device obtains the service return value of the target service, so as to call the next service based on the service return value (until the call of all services under the trigger is completed ); when the target service is an asynchronous call service, the computer device obtains the service output event of the target service, so as to trigger the trigger in the target micro-application script through the service output event.
- the service return value can be data, files, instructions, etc.
- the return value of the screenshot service can be the captured picture;
- the trigger triggered by the service output event can be a trigger other than the target trigger, or it can be the target Trigger, which is not limited in this embodiment.
- micro-application engines on different devices are peer-to-peer, all the state information required during the running of the micro-applications needs to be maintained, so when the state of the micro-application engine on a certain device changes (may be output by the service result in state changes), the micro-application engine needs to synchronize the state changes to other devices through the data synchronization module.
- device A deploys service 1 and service 2
- device B deploys service 1 and service 3
- device C deploys service 4 and serve 5.
- service 1 is invoked in device B
- the service output event output by service 1 changes the engine state of the micro-application engine 1301, and the micro-application engine 1301 on the device B side synchronizes the engine state to device A and device A through the data synchronization module 1302 C, so that device A and device C update the engine state of their own micro-application engine 1301 .
- the service output event output by service 5 changes the engine state of the micro-application engine 1301, and the micro-application engine 1301 on the side of device C synchronizes the engine state to device A and device A through the data synchronization module 1302 B, so that device A and device B update the engine state of their own micro-application engine 1301 .
- each device under the user account is equal, and the disconnection of a single device will not affect the operation of the micro application. For example, when two-finger tapping captures the screen of other devices and sends it to the current device, the user can tap any device to complete this operation, and if any device is offline, it will not affect the normal screenshot of other devices.
- micro-apps can also be launched by other interactive methods.
- the computer device needs to determine the target micro-application that actually needs to be started based on the multiple micro-applications, and then obtain the target micro-application The target microapp script for .
- the process for the computer device to obtain the target micro-application script may include the following steps.
- Step 1401 if an initialization trigger event is received, at least one candidate micro-application corresponding to the initialization trigger event is determined, and the initialization trigger event is used to trigger a trigger of at least one candidate micro-application.
- the computer device determines, from at least one subscribed micro-application, a candidate micro-application containing a trigger corresponding to the initialization trigger event, that is, a candidate micro-application that can be triggered by the initialization trigger event
- the micro-application that is triggered to run is determined as a candidate micro-application.
- the initialization triggering event may be an event triggered by voice output, an event triggered by a gesture operation (such as shaking, touching) or an event triggered by situational awareness (such as detecting returning home, arriving at an office location, etc.), This embodiment does not limit it.
- Step 1402 determining a target micro-application from at least one candidate micro-application.
- the target micro-application may be specified by the user, or automatically determined by the computer device based on an application selection policy.
- the computer device displays a micro-application selection list based on at least one candidate micro-application; when a selection operation on the micro-application selection list is received, the selected candidate micro-application is determined as a target micro-application.
- micro-application A and micro-application B when the user triggers micro-application A and micro-application B to run by shaking the terminal, when the user shakes the terminal, the terminal displays the application icons of micro-application A and micro-application B through a pop-up window for the user to choose and use.
- the computer device determines a target micro-application from at least one candidate micro-application based on an application selection policy.
- the computer device may determine the target micro-application based on at least one item of user information, device information, geographic location information, and time information. For example, when the user shakes the terminal, if the terminal is at home, micro-application A is determined as the target micro-application based on the application selection strategy; if the terminal is located at the office, micro-application B is determined as the target micro-application based on the application selection policy .
- micro-application C is determined as the target micro-application based on the application selection strategy; if it is currently in the afternoon time period, then micro-application D is determined as the target micro-application based on the application selection strategy micro app.
- the embodiment of the present application does not limit the specific application selection strategy.
- the event bus module 1502 of the micro application engine 1501 is loaded with triggers corresponding to multiple micro applications.
- the initialization trigger event causes the event bus module 1502 to
- the event bus module 1502 determines the candidate micro-applications from the micro-applications A, B, and C based on the triggered trigger, and instructs the application scheduling module 1503 to perform application scheduling.
- the application scheduling module 1503 can display a micro-application selection list for the user to select, and can also determine micro-application C as the target micro-application based on the application selection policy.
- Step 1403 acquiring the target micro-application script of the target micro-application.
- the computer device acquires the target micro-application script locally based on the application identification of the target micro-application.
- FIG. 16 shows a structural block diagram of a micro-application running device provided by an embodiment of the present application.
- the device can include:
- the script acquisition module 1601 is used to acquire the target micro-application script of the target micro-application, the target micro-application is a collection of services, the target micro-application script is composed of triggers, and the triggers are used to Service invocation by executing control logic;
- a trigger module 1602 configured to trigger a target trigger corresponding to the target trigger event in the target micro-application script when the target trigger event is received;
- the service calling module 1603 is configured to execute the target control logic corresponding to the target trigger, and call the target service to realize the micro-application function of the target micro-application.
- the device also includes:
- a candidate service determining module configured to determine a candidate service list based on the service identifier of the service invoked by the target control logic, the candidate service list including at least one candidate service matching the service identifier;
- a target service determining module configured to determine the target service from the candidate services in the candidate service list.
- the candidate service determination module is configured to:
- the list of candidate services is generated based on the candidate static services and the candidate dynamic services.
- the target service determination module is configured to:
- the target service is determined from the candidate services in the candidate service list based on a service selection policy.
- the service calling module 1603 is configured to:
- the target service is invoked through the target service gateway, where the target service gateway is the service gateway of the current device, and/or, the service gateway of an external device other than the current device, and the target micro-application script is set in the external device.
- the service calling module 1603 includes:
- the first invocation unit is configured to obtain a service invocation request through the target service gateway when the target service gateway is the service gateway of the current device; determine the target service agent corresponding to the target service through the target service gateway ; Based on the service invocation request, invoking the target service through the target service agent;
- the second invoking unit is configured to send a service invocation request to the external device when the target service gateway is a service gateway of an external device, and the external device is configured to determine the target service through the target service gateway A corresponding target service proxy, and based on the service invocation request, invoke the target service through the target service proxy;
- different service agents correspond to different programming development languages, or different service agents correspond to different deployment forms, or different service agents correspond to different operating environments.
- the first calling unit or the second calling unit is used for:
- the original input parameters in the service call request are converted by the target service proxy to obtain target input parameters, wherein the original input parameters adopt a unified parameter format, and the target input parameters conform to the parameter format of the target service ;
- the original output parameter is converted by the target service agent to obtain a target output parameter, and the target output parameter adopts the unified parameter format.
- the device also includes:
- the first service starting module is used to obtain the service status of the target service through the static service manager when the target service is a static service; and start the service status when the service status is not started. target service.
- the device also includes:
- the second service starting module is used to obtain the service status of the host service corresponding to the target service through the dynamic service manager when the target service is a dynamic service; when the service status is not started, Start the host service; query the deployment status of the target service through the host service; if the target service is not deployed, download the target service from the cloud service library, and load the target service through the host service target service.
- the service calling module 1603 is further configured to obtain a service return value of the target service when the target service is a synchronous call service; call the next service based on the service return value;
- the triggering module 1602 is further configured to obtain a service output event of the target service when the target service is an asynchronous call service; trigger a trigger in the target micro-application script through the service output event.
- the device also includes:
- a first download module configured to download the target micro-application script of the target micro-application in response to a subscription operation to the target micro-application;
- the second download module is configured to download the target micro-application script of the target micro-application based on the application identifier in the subscription push message when a subscription push message is received, and the subscription push message is sent by the server at When it is detected that the micro-application subscribed by the user account changes, push it to each device under the user account.
- the device also includes:
- the initialization deployment module is configured to deploy an initialization service based on the initialization trigger in the target micro-application script, and the initialization service is a service invoked by the initialization trigger.
- the device also includes:
- a deletion module configured to delete the target micro-application script of the target micro-application in response to an unsubscribe operation on the target micro-application
- An instruction sending module configured to send a subscription cancellation instruction to the server, and the server is configured to push a subscription cancellation message to each device under the user account based on the subscription cancellation instruction, so that each terminal deletes the target micro-application script.
- the script acquisition module 1601 includes:
- a candidate application determining unit configured to determine at least one candidate micro-application corresponding to the initialization trigger event in the case of receiving an initialization trigger event, and the initialization trigger event is used to trigger an initialization trigger of at least one candidate micro-application ;
- a target application determining unit configured to determine the target micro-application from at least one of the candidate micro-applications
- An acquiring unit configured to acquire the target micro-application script of the target micro-application.
- the target application determining unit is configured to:
- micro-application selection list based on at least one of the candidate micro-applications; in response to a selection operation on the micro-application selection list, determining the selected candidate micro-application as the target micro-application; or,
- the target micro-application is determined from at least one of the candidate micro-applications based on an application selection strategy.
- micro-applications when running a micro-application composed of several services, 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 trigger
- the corresponding control logic of the controller is used to call the corresponding service to realize the micro-application function of the micro-application. Since the operation of micro-applications is based on micro-application scripts with low code volume, it requires less storage space than traditional applications; moreover, assemble services into micro-applications, and use micro-application scripts to manage the calling relationship between services , realizing the componentization of micro-applications, improving the reusability of services between micro-applications, and helping to reduce the difficulty of developing micro-applications.
- FIG. 17 shows a structural block diagram of a computer device provided by an exemplary embodiment of the present application.
- the computer device 1700 may be implemented as a source device or a destination device in each of the foregoing embodiments.
- Computer device 1700 may include one or more of the following components: processor 1710 and memory 1720 .
- Processor 1710 may include one or more processing cores.
- the processor 1710 uses various interfaces and lines to connect various parts of the entire computer device 1700, and executes by running or executing instructions, programs, code sets or instruction sets stored in the memory 1720, and calling data stored in the memory 1720.
- the processor 1710 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 1710 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 foregoing modem may also not be integrated into the processor 1710, but implemented by a single chip.
- the memory 1720 may include random access memory (Random Access Memory, RAM), and may also include read-only memory (Read-Only Memory, ROM).
- the memory 1720 includes a non-transitory computer-readable storage medium (non-transitory computer-readable storage medium).
- the memory 1720 may be used to store instructions, programs, codes, sets of codes or sets of instructions.
- the memory 1720 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 1700 (such as audio data, phonebook) and the like.
- 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 1700 (such as audio data, phonebook) and the like.
- the structure of the computer device 1700 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 1700 also includes a display screen, a camera assembly, 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 wireless fidelity (Wireless Fidelity, WiFi ) module, power supply, bluetooth module and other 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, and the at least one program is loaded and executed by a processor to realize the micro-application described in each embodiment above. run method.
- An embodiment of the present application provides a computer program product, the computer program product includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and processes The computer executes the computer instructions, so that the computer device executes the micro-application running method provided in various optional implementation manners of the above aspects.
- 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)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Stored Programmes (AREA)
Abstract
Description
本申请要求于2021年11月29日提交的申请号为202111434742.1、发明名称为“微应用的运行方法、装置、设备、存储介质及程序产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202111434742.1 and the title of the invention "Operation method, device, equipment, storage medium and program product of micro-application" filed on November 29, 2021, the entire contents of which are incorporated by reference incorporated in this application.
本申请实施例涉及应用技术领域,特别涉及一种微应用的运行方法、装置、设备、存储介质及程序产品。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.
随着应用(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:
获取目标微应用的目标微应用脚本,所述目标微应用是由服务构成的集合,所述目标微应用脚本由触发器构成,且所述触发器用于在触发事件下通过执行控制逻辑进行服务调用;Acquire the target micro-application script of the target micro-application, the target micro-application is a collection of services, the target micro-application script is composed of triggers, and the triggers are used to perform service calls by executing control logic under trigger events ;
在接收到目标触发事件的情况下,触发所述目标微应用脚本中所述目标触发事件对应的目标触发器;In the case of receiving a target trigger event, trigger a target trigger corresponding to the target trigger event in the target micro-application script;
执行所述目标触发器对应的目标控制逻辑,并调用目标服务,以实现所述目标微应用的微应用功能。Execute the target control logic corresponding to the target trigger, and call the target service, so as to realize the micro-application function of the target micro-application.
另一方面,本申请实施例提供了一种微应用的运行装置,所述装置包括:On the other hand, the embodiment of the present application provides a micro-application running device, the device includes:
脚本获取模块,用于获取目标微应用的目标微应用脚本,所述目标微应用是由服务构成的集合,所述目标微应用脚本由触发器构成,且所述触发器用于在触发事件下通过执行控制逻辑进行服务调用;The script obtaining module is used to obtain the target micro-application script of the target micro-application, the target micro-application is a collection of services, the target micro-application script is composed of a trigger, and the trigger is used to pass Execute control logic to make service calls;
触发模块,用于在接收到目标触发事件的情况下,触发所述目标微应用脚本中所述目标触发事件对应的目标触发器;A trigger module, configured to trigger a target trigger corresponding to the target trigger event in the target micro-application script when the target trigger event is received;
服务调用模块,用于执行所述目标触发器对应的目标控制逻辑,并调用目标服务,以实现所述目标微应用的微应用功能。The service calling module is used to execute the target control logic corresponding to the target trigger, and call the target service to realize the micro-application function of the target micro-application.
另一方面,本申请实施例提供了一种计算机设备,所述计算机设备包括处理器和存储器;所述存储器存储有至少一段程序,所述至少一段程序用于被所述处理器执行以实现如上述方面所述的微应用的运行方法。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 program, and the at least one program 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 program is stored in the computer-readable storage medium, and the at least one program is loaded and executed by a processor to implement the above-mentioned The running method of the microapp.
另一方面,本申请实施例提供了一种计算机程序产品,该计算机程序产品包括计算机指令,该计算机指令存储在计算机可读存储介质中;计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述方面的各种可选实现方式中提供的微应用的运行方法。On the other hand, an embodiment of the present application provides a computer program product, the computer program product includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor of a computer device reads the computer-readable storage medium from the computer-readable storage medium. A computer instruction, 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 foregoing aspect.
图1是本申请一个示例性实施例示出的微应用脚本的示意图;Fig. 1 is a schematic diagram of a micro-application script shown in an exemplary embodiment of the present application;
图2示出了本申请一个示例性实施例提供的微应用系统的系统架构图;FIG. 2 shows a system architecture diagram of a micro-application system provided by an exemplary embodiment of the present application;
图3示出了本申请一个示例性实施例提供的微应用的运行方法的流程图;FIG. 3 shows a flow chart of a micro-application running method provided by an exemplary embodiment of the present application;
图4是本申请一个示例性实施例示出的微应用订阅过程的界面示意图;Fig. 4 is a schematic interface diagram of a micro-application subscription process shown in an exemplary embodiment of the present application;
图5是本申请一个示例性实施例示出的微应用订阅过程的实施示意图;Fig. 5 is an implementation schematic diagram of a micro-application subscription process shown in an exemplary embodiment of the present application;
图6是本申请一个示例性实施例示出的微应用取消订阅过程的实施示意图;Fig. 6 is an implementation schematic diagram of a micro-application unsubscribing process shown in an exemplary embodiment of the present application;
图7是本申请一个示例性实施例示出的目标服务确定过程的流程图;FIG. 7 is a flow chart of a target service determination process shown in an exemplary embodiment of the present application;
图8是本申请一个示例性实施例示出的服务调用过程的实施示意图;Fig. 8 is an implementation schematic diagram of a service invocation process shown in an exemplary embodiment of the present application;
图9是本申请一个示例性实施例示出的服务代理调用服务过程的实施示意图;FIG. 9 is a schematic diagram of an implementation process of a service agent invoking a service process shown in an exemplary embodiment of the present application;
图10是本申请一个示例性实施例示出的静态服务调用过程的流程图;Fig. 10 is a flowchart of a static service invocation process shown in an exemplary embodiment of the present application;
图11是本申请一个示例性实施例示出的动态服务调用过程的流程图;Fig. 11 is a flowchart of a dynamic service invocation process shown in an exemplary embodiment of the present application;
图12是本申请一个示例性实施例示出的服务差分部署的实施示意图;Fig. 12 is a schematic diagram of implementation of service differential deployment shown in an exemplary embodiment of the present application;
图13是本申请一个示例性实施例示出的引擎状态同步过程的实施示意图;Fig. 13 is an implementation schematic diagram of an engine state synchronization process shown in an exemplary embodiment of the present application;
图14是本申请一个示例性实施例示出的微应用脚本获取过程的流程图;Fig. 14 is a flowchart of a micro-app script acquisition process shown in an exemplary embodiment of the present application;
图15是本申请一个示例性实施例示出的目标微应用确定过程的示意图;Fig. 15 is a schematic diagram of a target micro-application determination process shown in an exemplary embodiment of the present application;
图16示出了本申请一个实施例提供的微应用的运行装置的结构框图;FIG. 16 shows a structural block diagram of a micro-application running device provided by an embodiment of the present application;
图17示出了本申请一个示例性实施例提供的计算机设备的结构方框图。Fig. 17 shows a structural block diagram of a computer device provided by an exemplary embodiment of the present application.
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。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. 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.
微应用脚本:又称为微应用定义,用于控制微应用中服务之间的调用关系,采用脚本语言描述了一段通用的业务逻辑。其中,该脚本语言可以为xml、javascript。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 may be xml or javascript.
如图1所示,微应用脚本11由若干触发器12构成,而每个触发器12又是由触发事件13、控制逻辑14以及控制逻辑14所控制的若干服务15构成。其中,微应用脚本中的服务并未服务本身,而是服务的服务标识。As shown in FIG. 1 ,
不同于传统应用在运行前需要下载并安装应用安装包,比如,在运行安卓应用前,需要下载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-application 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.
不同于传统应用安装过程中,需要将运行过程中使用到的所有服务预先安装在本地,由于微应用的业务逻辑在运行过程中动态组装,因此微应用中的服务支持动态部署,即在运行过程基于当前设备所执行的业务逻辑,将业务逻辑对应的服务动态部署至当前设备。相应的,当通过多个设备实现同一微应用的微应用功能时,由于不同设备的业务逻辑可能不同,因此不同设备处部署的服务也可能存在差异,即微应用中的服务具有差分部署的特性。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.
图2示出了本申请一个示例性实施例提供的微应用系统的系统架构图。该系统中包括至少一个计算机设备210以及服务器220。Fig. 2 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
计算机设备210是具有微应用运行功能的电子设备,该电子设备可以是智能手机、平板电脑、个人计算机、车机等等,本实施对此不作限定。图2中以设备210包括智能手机、平板电脑以及车机为例进行说明,但并不对此构成限定。The
在一种可能的实施方式中,计算机设备210中设置有微应用引擎211,微应用引擎211作为控制微应用运行的核心,包括脚本管理模块2111、事件总线模块2112、应用调度模块2113、运行时模块2114以及服务调度模块2115。In a possible implementation, the
脚本管理模块2111用于管理计算机设备210中存储的各个微应用的微应用脚本,并负责对微应用脚本进行解析,以此确定该微应用脚本中的触发器以及触发器下的服务。可选的,脚本管理模块2111还用于在接收到对微应用的订阅操作时,下载相应的微应用脚本,在接收到对微应用的订阅取消操作时,删除微应用对应的微应用脚本。The script management module 2111 is used to manage the micro-application scripts of each micro-application stored in the
事件总线模块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
其中,服务治理模块212用于管理设备中预安装的静态服务;数据同步模块213用于在微应用引擎211的状态发生变更时(比如服务产生的事件导致状态变更),向其他计算机设备进行状态同步,确保不同计算机设备处微应用引擎211的状态一致性。Among them, the
服务网关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 lifecycle 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
针对不同部署方式的服务,如图2所示,计算机设备210中还设置有静态服务模块216和动态服务模块215。静态服务模块216用于管理预安装的静态服务,动态服务模块215则用于管理动态部署的动态服务。For services in different deployment modes, as shown in FIG. 2 , a static service module 216 and a dynamic service module 215 are also provided in the
在一些实施例中,动态服务模块215中包含的服务可以对应不同运行环境、不同部署形态或不同编程开发语言。图2中以动态服务模块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. 2 , 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是一台服务器、若干台服务器构成的服务集群或云计算中心。根据服务器集群中各服务器所实现功能进行划分,如图2所示,服务器集群中包括用户资源管理服务器221、微应用商店服务器222、服务市场服务器223以及云端服务库224。The
用户资源管理服务器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
微应用商店服务器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处下载微应用的微应用脚本。示意性的,如图2所示,用户“张三”通过智能手机订阅微应用后,登陆“张三”这一用户帐号的车机和平板电脑接收到用户资源管理服务器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 micro-app scripts of micro-apps from the micro-app store server 222 . Schematically, as shown in Figure 2, 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
需要说明的是,上述实施例仅对微应用系统的基础架构进行了说明,微应用系统中还可以包括其他计算机设备(比如开发者设备)或实现其他功能的服务器,本实施例并不对此构成限定。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.
请参考图3,其示出了本申请一个示例性实施例提供的微应用的运行方法的流程图,本申请实施例以该方法应用于图2所示的计算机设备为例进行说明,该方法包括:Please refer to FIG. 3 , 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. 2 as an example for illustration. The method include:
步骤301,获取目标微应用的目标微应用脚本,目标微应用是由服务构成的集合,目标微应用脚本由触发器构成,且触发器用于在触发事件下通过执行控制逻辑进行服务调用。
在一种可能的实施方式中,当接收到目标微应用的启动指令时,计算机设备从本地存储的微应用脚本中,获取目标微应用对应的目标微应用脚本,其中,计算机设备本地存储由当前登陆的用户帐号所订阅的微应用的微应用脚本。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-application script is composed of several triggers, and each trigger is used to trigger under a specific trigger event, and after triggering, the service call is made through the corresponding control logic of the trigger.
在一些实施例中,微应用脚本中至少包括初始化触发器和结束触发器,初始化触发器用于触发微应用开始运行,结束触发器则用于触发微应用结束运行。除了初始化触发器和结束触发器以外,微应用脚本中还包括实现具体微应用功能的其它触发器,本申请实施例对此不作限定。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.
步骤302,在接收到目标触发事件的情况下,触发目标微应用脚本中目标触发事件对应的目标触发器。
微应用运行过程中,当接收到目标触发事件时,计算机设备从目标微应用脚本中确定出该目标触发事件所触发的目标触发器,从而将该目标触发器由未触发状态设置为触发状态。触发状态下,计算机设备即通过微应用引擎执行触发器对应的控制逻辑,以实现相应地业务逻辑。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 control logic corresponding to the trigger through the micro-application engine 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.
步骤303,执行目标触发器对应的目标控制逻辑,并调用目标服务,以实现目标微应用的微应用功能。
在一种可能的实施方式中,计算机设备通过微应用引擎中的运行时模块执行目标触发器对应的目标控制逻辑,进而由目标控制逻辑调用目标服务。可选的,当目标控制逻辑所调用的服务包括至少两个时,至少两个服务将按照业务逻辑按序调用。In a possible implementation manner, the computer device executes the target control logic corresponding to the target trigger through the runtime module in the micro-application engine, and then the target control logic invokes the target service. Optionally, when the services called by the target control logic include at least two services, the at least two services will be called sequentially according to the business logic.
本申请实施例中,计算机设备调用的目标服务可以是当前设备的服务,也可以是外部设备的服务,即可以实现跨设备服务调用,从而通过与外部设备交互实现目标微应用的微应用功能。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).
需要说明的是,当微应用中包含多个触发器时,计算机设备重复执行上述步骤302和303,并在触发结束触发器后,执行结束触发器的控制逻辑,以结束运行微应用。It should be noted that when the micro-application contains multiple triggers, the computer device repeatedly executes the
综上所述,本申请实施例中,在运行由若干服务构成的微应用时,计算机设备通过获取微应用的微应用脚本,并基于接收到的触发事件触发微应用脚本中对应的触发器,进而通过执行该触发器对应的控制逻辑,调用相应的服务以实现微应用的微应用功能。由于微应用的运行基于低代码量的微应用脚本,因此相较于传统应用所需占用的存储空间更小;并且,将服务组装成微应用,并利用微应用脚本管理服务之间的调用关系,实现了微应用的组件化,提高了微应用间服务的复用性,有助于降低微应用的开发难度。To sum up, in the embodiment of the present application, when running a micro-application composed of several services, the computer device obtains the micro-application script of the micro-application, and triggers the corresponding trigger in the micro-application script based on the received trigger event, Then, by executing the control logic corresponding to the trigger, the corresponding service is called to realize the micro-application function of the micro-application. Since the operation of micro-applications is based on micro-application scripts with low code volume, it requires less storage space than traditional applications; moreover, assemble services into micro-applications, and use micro-application scripts to manage the calling relationship between services , realizing the componentization of micro-applications, improving the reusability of services between micro-applications, and helping to reduce the difficulty of developing micro-applications.
可选的,调用目标服务之前,方法包括:Optionally, before invoking the target service, the method includes:
基于目标控制逻辑所调用服务的服务标识,确定候选服务列表,候选服务列表中包含至少一个与服务标识匹配的候选服务;Determining a candidate service list based on the service identifier of the service invoked by the target control logic, where at least one candidate service matching the service identifier is included in the candidate service list;
从候选服务列表的候选服务中确定目标服务。The target service is determined from the candidate services in the candidate service list.
可选的,基于目标控制逻辑所调用服务的服务标识,确定候选服务列表,包括:Optionally, based on the service identifier of the service invoked by the target control logic, determine a list of candidate services, including:
确定当前设备中与服务标识匹配的候选静态服务,其中,静态服务为设备中宿主应用所提供的服务;Determine a candidate static service that matches the service identifier in the current device, where the static service is a service provided by a host application in the device;
从云端服务库中确定与服务标识匹配的候选动态服务,其中,动态服务为支持动态部署至设备的服务;Determining a candidate dynamic service matching the service identifier from the cloud service library, wherein the dynamic service is a service that supports dynamic deployment to the device;
基于候选静态服务和候选动态服务生成候选服务列表。A candidate service list is generated based on the candidate static services and the candidate dynamic services.
可选的,从候选服务列表的候选服务中确定目标服务,包括:Optionally, the target service is determined from the candidate services in the candidate service list, including:
显示候选服务列表;Display a list of candidate services;
响应于对候选服务列表中候选服务的选择操作,将选中的候选服务确定为目标服务;或,determining the selected candidate service as the target service in response to a selection operation on the candidate service in the candidate service list; or,
基于服务选择策略,从候选服务列表的候选服务中确定目标服务。Based on the service selection strategy, the target service is determined from the candidate services in the candidate service list.
可选的,调用目标服务,包括:Optionally, call the target service, including:
通过目标服务网关调用目标服务,目标服务网关为当前设备的服务网关,和/或,当前设备以外的外部设备的服务网关,外部设备中设置有目标微应用脚本。The target service is invoked through the target service gateway, where the target service gateway is the service gateway of the current device, and/or, the service gateway of an external device other than the current device, and the target micro-application script is set in the external device.
可选的,通过目标服务网关调用目标服务,包括:Optionally, call the target service through the target service gateway, including:
在目标服务网关为当前设备的服务网关的情况下,通过目标服务网关获取服务调用请求;通过目标服务网关确定目标服务对应的目标服务代理;基于服务调用请求,通过目标服务代理调用目标服务;When the target service gateway is the service gateway of the current device, the service invocation request is obtained through the target service gateway; the target service proxy corresponding to the target service is determined through the target service gateway; based on the service invocation request, the target service is invoked through the target service proxy;
在目标服务网关为外部设备的服务网关的情况下,向外部设备发送服务调用请求,外部设备用于通过目标服务网关确定目标服务对应的目标服务代理,并基于服务调用请求,通过目标服务代理调用目标服务;When the target service gateway is the service gateway of the external device, the service call request is sent to the external device, and the external device is used to determine the target service proxy corresponding to the target service through the target service gateway, and based on the service call request, through the target service proxy call target service;
其中,不同的服务代理对应不同的编程开发语言,或,不同的服务代理对应不同的部署形态,或,不同的服务代理对应不同的运行环境。Wherein, different service agents correspond to different programming development languages, or different service agents correspond to different deployment forms, or different service agents correspond to different operating environments.
可选的,基于服务调用请求,通过目标服务代理调用目标服务,包括:Optionally, based on the service invocation request, the target service is invoked through the target service proxy, including:
通过目标服务代理对服务调用请求中的原始输入参数进行转换,得到目标输入参数,其中,原始输入参数采用统一参数格式,目标输入参数符合目标服务的参数格式;Convert the original input parameters in the service call request through the target service agent to obtain the target input parameters, wherein the original input parameters adopt a unified parameter format, and the target input parameters conform to the parameter format of the target service;
基于目标输入参数,通过目标服务代理调用目标服务,得到目标服务的原始输出参数;Based on the target input parameters, the target service is invoked through the target service proxy to obtain the original output parameters of the target service;
通过目标服务代理对原始输出参数进行转换,得到目标输出参数,目标输出参数采用统一参数格式。The original output parameters are converted by the target service agent to obtain the target output parameters, and the target output parameters adopt a unified parameter format.
可选的,基于服务调用请求,通过目标服务代理调用目标服务之前,方法还包括:Optionally, based on the service invocation request, before invoking the target service through the target service proxy, the method further includes:
在目标服务为静态服务的情况下,通过静态服务管理器获取目标服务的服务状态;When the target service is a static service, obtain the service status of the target service through the static service manager;
在服务状态为未启动状态的情况下,启动目标服务。When the service status is not started, start the target service.
可选的,基于服务调用请求,通过目标服务代理调用目标服务之前,方法还包括:Optionally, based on the service invocation request, before invoking the target service through the target service proxy, the method further includes:
在目标服务为动态服务的情况下,通过动态服务管理器获取目标服务对应宿主服务的服务状态;When the target service is a dynamic service, obtain the service status of the host service corresponding to the target service through the dynamic service manager;
在服务状态为未启动状态的情况下,启动宿主服务;When the service status is not started, start the host service;
通过宿主服务查询目标服务的部署情况;Query the deployment status of the target service through the host service;
在未部署目标服务的情况下,从云端服务库下载目标服务,并通过宿主服务加载目标服务。If the target service is not deployed, download the target service from the cloud service library, and load the target service through the host service.
可选的,调用目标服务之后,方法还包括:Optionally, after invoking the target service, the method further includes:
在目标服务为同步调用服务的情况下,获取目标服务的服务返回值;基于服务返回值调用下一服务;When the target service is a synchronous call service, obtain the service return value of the target service; call the next service based on the service return value;
在目标服务为异步调用服务的情况下,获取目标服务的服务输出事件;通过服务输出事件触发目标微应用脚本中的触发器。In the case that the target service is an asynchronous call service, the service output event of the target service is obtained; the trigger in the target micro-application script is triggered by the service output event.
可选的,获取目标微应用的目标微应用脚本之前,方法包括:Optionally, before obtaining the target micro-application script of the target micro-application, the method includes:
响应于对目标微应用的订阅操作,下载目标微应用的目标微应用脚本;或,downloading a target microapplication script for the target microapplication in response to a subscribe operation to the target microapplication; or,
在接收到订阅推送消息的情况下,基于订阅推送消息中的应用标识,下载目标微应用的目标微应用脚本,订阅推送消息由服务器在检测到用户帐号订阅的微应用发生变更时,向用户帐号下的各个设备推送。When a subscription push message is received, the target microapp script of the target microapp is downloaded based on the application identifier in the subscription push message. The subscription push message is sent to the user account when the server detects that the microapp subscribed by the user account has changed. Each device under push.
可选的,下载目标微应用的目标微应用脚本之后,方法还包括:Optionally, after downloading the target micro-application script of the target micro-application, the method further includes:
基于目标微应用脚本中的初始化触发器,部署初始化服务,初始化服务为初始化触发器所调用的服务。Based on the initialization trigger in the target micro-application script, the initialization service is deployed, and the initialization service is the service invoked by the initialization trigger.
可选的,方法还包括:Optionally, the method also includes:
响应于对目标微应用的取消订阅操作,删除目标微应用的目标微应用脚本;deleting the target microapplication script of the target microapplication in response to an unsubscribe operation on the target microapplication;
向服务器发送订阅取消指令,服务器用于基于订阅取消指令,向用户帐号下的各个设备推送订阅取消消息,以便各个终端删除目标微应用脚本。A subscription cancellation instruction is sent to the server, and the server is configured to push a subscription cancellation message to each device under the user account based on the subscription cancellation instruction, so that each terminal deletes the target micro-app script.
可选的,获取目标微应用的目标微应用脚本,包括:Optionally, obtain the target microapp script of the target microapp, including:
在接收到初始化触发事件的情况下,确定初始化触发事件对应的至少一个候选微应用,初始化触发事件用于触发至少一个候选微应用的初始化触发器;When an initialization trigger event is received, at least one candidate micro-application corresponding to the initialization trigger event is determined, and the initialization trigger event is used to trigger an initialization trigger of at least one candidate micro-application;
从至少一个候选微应用中确定目标微应用;determining a target microapplication from at least one candidate microapplication;
获取目标微应用的目标微应用脚本。Get the target microapp script for the target microapp.
可选的,从至少一个候选微应用中确定目标微应用,包括:Optionally, determining a target micro-application from at least one candidate micro-application includes:
基于至少一个候选微应用显示微应用选择列表;响应于对微应用选择列表的选择操作,将选中的候选微应用确定为目标微应用;或,displaying a microapplication selection list based on at least one candidate microapplication; determining the selected candidate microapplication as a target microapplication in response to a selection operation on the microapplication selection list; or,
基于应用选择策略,从至少一个候选微应用中确定目标微应用。Based on the application selection strategy, a target micro-application is determined from at least one candidate micro-application.
由于微应用并非与设备绑定,而是与用户绑定,因此在使用目标微应用前首先需要通过用户帐号进行微应用订阅,从而将目标微应用对应的目标微应用脚本下载至用户帐号下的各个设备。Since the micro-app is not bound to the device but to the user, before using the target micro-app, it is first necessary to subscribe to the micro-app through the user account, so as to download the target micro-app script corresponding to the target micro-app to the individual devices.
对于订阅发起方设备,在一种可能的实施方式中,响应于对目标微应用的订阅操作,订阅发起方设备下载目标微应用的目标微应用脚本。For the subscription initiator device, in a possible implementation manner, in response to a subscription operation on the target micro-application, the subscription initiator device downloads the target micro-application script of the target micro-application.
可选的,订阅发起方设备可以通过访问微应用商店服务器,获取包含所有微应用的微应用列表,并在接收到对微应用列表中目标微应用的订阅操作时,从微应用商店服务器处下载目标微应用脚本。Optionally, the subscription initiator device can obtain a micro-app list including all micro-apps by accessing the micro-app store server, and download the micro-app from the micro-app store server when receiving a subscription operation to the target micro-app in the micro-app list Target microapp script.
可选的,订阅发起方设备也可以借助微应用商店服务器的微应用搜索引擎,通过输入微应用关键字进行微应用搜索,进而从搜索结果中发起对目标微应用的订阅操作。Optionally, the subscription initiator device can also use the micro-app search engine of the micro-app store server to search for micro-apps by inputting micro-app keywords, and then initiate a subscription operation to the target micro-app from the search results.
其中,该订阅操作可以是对目标微应用对应订阅控件的点击操作。Wherein, the subscription operation may be a click operation on a subscription control corresponding to the target micro-application.
示意性的,如图4所示,订阅发起方设备访问微应用商店,在微应用商店界面41中显示微应用列表中的各个微应用,其中包含当前用户帐号已订阅和未订阅的微应用。或者,用户可以在微应用商店界面41的搜索栏中输入微应用关键字,并点击搜索控件43,触发微应用商店服务器反馈包含微应用关键字的微应用。当接收到对目标微应用对应订阅控件42的点击操作时,订阅发起方设备即根据目标微应用的应用标识,从微应用商店服务器处下载目标微应用脚本。Schematically, as shown in FIG. 4 , the subscription initiator device accesses the micro-app store, and displays each micro-app in the micro-app list on the
对于与订阅发起方设备登陆同一用户帐号的其他设备,在一种可能的实施方式中,在接收到订阅推送消息的情况下,计算机设备基于订阅推送消息中的应用标识,下载目标微应用的目标微应用脚本,其中,该订阅推送消息由服务器在检测到用户帐号订阅的微应用发生变更时,向用户帐号下的各个设备推送。For other devices that log in to the same user account as the subscription initiator device, in a possible implementation manner, when receiving the subscription push message, the computer device downloads the target The micro-application script, wherein the subscription push message is pushed to each device under the user account when the server detects that the micro-application subscribed to by the user account changes.
可选的,订阅发起方设备完成目标微应用订阅后,用户资源管理服务器基于订阅发起方设备所登陆的用户帐号以及目标微应用的应用标识,更新用户帐号与微应用之间的订阅关系,并基于查询该用户帐号下 的设备,从而向查询到的各个设备发送订阅推送消息,该订阅推送消息中至少包含目标微应用的应用标识。Optionally, after the subscription initiator device finishes subscribing to the target micro-application, the user resource management server updates the subscription relationship between the user account and the micro-application based on the user account logged in by the subscription initiator device and the application identifier of the target micro-application, and Based on inquiring about the devices under the user account, a subscription push message is sent to each of the queried devices, and the subscription push message at least includes the application identifier of the target micro-application.
计算机设备接收到订阅推送消息后,知悉与自身登陆同一用户帐号的其他设备订阅了目标微应用,从而基于订阅推送消息中的应用标识,从微应用商店服务器处下载目标微应用的目标微应用脚本。After the computer device receives the subscription push message, it knows that other devices that log in to the same user account as itself have subscribed to the target micro-app, and then downloads the target micro-app script of the target micro-app from the micro-app store server based on the application identifier in the subscription push message .
示意性的,如图5所示,登陆用户帐号“张三”的设备A通过访问微应用商店服务器52,并订阅微应用后,用户资源管理服务器51中的应用管理模块511添加“张三”与微应用之间的订阅关系,并通过设备管理模块512查询到用户帐号“张三”下还包括设备B和设备C,从而通过向设备B和设备C发送订阅推送消息。设备B和设备C接收到订阅推送消息后,通过微应用引擎自动从微应用商店服务器52处下载微应用脚本。Schematically, as shown in FIG. 5 , after device A logging in to the user account "Zhang San" accesses the micro-app store server 52 and subscribes to the micro-app, the application management module 511 in the user resource management server 51 adds "Zhang San" The subscription relationship with the micro-app, and through the device management module 512, it is found that the user account "Zhang San" also includes device B and device C, so as to send subscription push messages to device B and device C. After device B and device C receive the subscription push message, they automatically download the micro application script from the micro application store server 52 through the micro application engine.
由于微应用中的服务由业务逻辑串联,且在运行时才能够决定服务所部属的设备,因此在下载微应用的微应用脚本后,需要立即执行微应用脚本中的初始化触发器,并预先将该初始触发器所调用的服务部署在当前设备,以此保证微应用的正常运行。Since the services in the micro-app are connected in series by the business logic, and the device to which the service is deployed can only be determined at runtime, after the micro-app script of the micro-app is downloaded, the initialization trigger in the micro-app script needs to be executed immediately, and the The service called by the initial trigger is deployed on the current device, so as to ensure the normal operation of the micro application.
在一种可能的实施方式中,计算机设备下载目标微应用的目标微应用脚本之后,基于目标微应用脚本中的初始化触发器,部署初始化服务,该初始化服务为初始化触发器所调用的服务,且该初始化服务的数量为至少一个。In a possible implementation manner, after the computer device downloads the target micro-application script of the target micro-application, an initialization service is deployed based on an initialization trigger in the target micro-application script, where the initialization service is a service called by the initialization trigger, and The quantity of the initialization service is at least one.
在一个示意性的例子中,当微应用用于实现双指叩击跨端截屏时,该微应用的微应用脚本中包括初始化触发器、双指叩击触发器以及结束触发器。由于初始化触发器中需要调用双指叩击服务,因此双击叩击服务需要预先部署在设备中,避免因未预先部署双指叩击服务导致无法捕获双击叩击事件,进而导致无法触发双指叩击触发器,最终导致微应用无法运行的问题。In an illustrative example, when the micro-application is used to realize cross-device screen capture by tapping with two fingers, the micro-application script of the micro-application includes an initialization trigger, a trigger for tapping with two fingers, and an end trigger. Since the two-finger tap service needs to be invoked in the initialization trigger, the double-finger tap service needs to be pre-deployed on the device to avoid failure to capture the double-finger tap event due to the non-pre-deployment of the two-finger tap service, which in turn cannot trigger the two-finger tap Hit the trigger, which eventually leads to the problem that the micro application cannot run.
除了能够对微应用进行订阅外,计算机设备还可以在取消对微应用的订阅。在一种可能的实施方式中,响应于对目标微应用的取消订阅操作,计算机设备删除目标微应用的目标微应用脚本,避免取消订阅后的目标微应用脚本占用设备存储空间。In addition to being able to subscribe to the micro-application, the computer device can also unsubscribe from the micro-application. In a possible implementation manner, in response to the unsubscribing operation of the target micro-application, the computer device deletes the target micro-application script of the target micro-application, so as to prevent the unsubscribed target micro-application script from occupying device storage space.
同时,为了保证同一用户帐号下各个设备中微应用脚本的一致性,计算机设备还需要向服务器发送订阅取消指令,以便服务器基于该订阅取消指令,向用户帐号下的各个设备推送订阅取消消息,以便各个终端删除目标微应用脚本。其中,订阅取消指令中至少包含目标微应用的应用标识。At the same time, in order to ensure the consistency of micro-application scripts in each device under the same user account, the computer device also needs to send a subscription cancellation instruction to the server, so that the server can push a subscription cancellation message to each device under the user account based on the subscription cancellation instruction, so that Each terminal deletes the target microapp script. Wherein, the subscription cancellation instruction at least includes the application identification of the target micro-application.
示意性的,如图6所示,登陆用户帐号“张三”的设备A取消订阅微应用后,向用户资源管理服务器51发送订阅取消指令,用户资源管理服务器51中的应用管理模块511基于该订阅取消指令删除“张三”与微应用之间的订阅关系,并通过设备管理模块512查询到用户帐号“张三”下还包括设备B和设备C,从而通过向设备B和设备C发送订阅取消消息。设备B和设备C接收到订阅取消消息后,删除微应用的微应用脚本。Schematically, as shown in FIG. 6 , after logging in to the user account "Zhang San", the device A cancels the subscription to the micro-app, and then sends a subscription cancel instruction to the user resource management server 51, and the application management module 511 in the user resource management server 51 bases on the The subscription cancellation instruction deletes the subscription relationship between "Zhang San" and the micro-app, and through the device management module 512, it is found that the user account "Zhang San" also includes device B and device C, so that by sending subscriptions to device B and device C cancel message. After receiving the subscription cancellation message, device B and device C delete the micro-app script of the micro-app.
本实施例中,通过订阅、推送以及取消订阅机制,使同一用户帐号下各个设备中的微应用脚本保持一致,避免出现因不同设备侧微应用脚本不一致,导致微应用使用异常的问题,保证了微应用的可用性以及不同设备侧使用体验的一致性。此外,计算机设备在下载微应用脚本后,基于微应用脚本中初始化触发器所调用的服务,预先部署初始化服务,确保后续微应用的正常运行。In this embodiment, through the subscription, push and unsubscribe mechanisms, the micro-app scripts in each device under the same user account are kept consistent, avoiding the problem of abnormal use of micro-apps due to inconsistent micro-app scripts on different device sides, and ensuring The availability of micro-apps and the consistency of user experience on different device sides. In addition, after the computer device downloads the micro-application script, based on the service called by the initialization trigger in the micro-application script, the initialization service is pre-deployed to ensure the normal operation of subsequent micro-applications.
本申请实施例中,微应用脚本中定义了所调用的服务,而实际情况中可能存在多种具体的服务实例用以实现相同的服务功能。比如,可以通过支付应用提供的支付服务A、即时通信应用提供的支付服务B或支付动态服务C实现支付功能。因此在调用目标服务之前,计算机设备首先需要从若干候选服务中确定出目标服务。在一种可能的实施方式中,如图7所示,计算机设备确定目标服务的过程包括如下步骤。In the embodiment of the present application, the called service is defined in the micro-application script, but in actual situations, there may be multiple specific service instances for realizing the same service function. For example, the payment function can be realized through the payment service A provided by the payment application, the payment service B provided by the instant messaging application, or the payment dynamic service C. Therefore, before invoking the target service, the computer device first needs to determine the target service from several candidate services. In a possible implementation manner, as shown in FIG. 7 , the process for the computer device to determine the target service includes the following steps.
步骤701,基于目标控制逻辑所调用服务的服务标识,确定候选服务列表,候选服务列表中包含至少一个与服务标识匹配的候选服务。Step 701: Determine a candidate service list based on the service ID of the service invoked by the target control logic, and the candidate service list includes at least one candidate service matching the service ID.
在一种可能的实施方式中,目标微应用脚本中的目标控制逻辑下包括所调用服务的服务标识,微应用引擎中的运行时模块执行该目标控制逻辑时,获取该服务标识,从而通过服务调度模块确定与该服务标识匹配的至少一个候选服务。其中,服务标识可以为服务名称或者服务ID,本实施例对此不作限定。In a possible implementation, the target control logic in the target micro-application script includes the service identifier of the called service, and when the runtime module in the micro-application engine executes the target control logic, it obtains the service identifier, thereby passing the service The scheduling module determines at least one candidate service matching the service identifier. Wherein, the service identifier may be a service name or a service ID, which is not limited in this embodiment.
由于控制逻辑所调用的服务既可能是静态服务,也可能是动态服务,因此计算机设备需要从本地和云端查询可用的候选服务。可选的,本步骤可以包括如下子步骤:Since the service invoked by the control logic may be either a static service or a dynamic service, the computer device needs to query available candidate services locally and from the cloud. Optionally, this step may include the following sub-steps:
1、确定当前设备中与服务标识匹配的候选静态服务,其中,静态服务为设备中宿主应用所提供的服务。1. Determine the candidate static service matching the service identifier in the current device, wherein the static service is a service provided by the host application in the device.
静态服务作为一种预安装服务,其调用依赖于宿主应用,即在安装有宿主应用的情况下,该静态服务才能够被调用。在一种可能的实施方式中,服务治理模块用于管理本地设备中由宿主应用提供的静态服务,获取到服务标识后,服务调度模块通过服务治理模块,查询本地设备中与服务标识匹配的候选静态服务。The static service is a pre-installed service, and its invocation depends on the host application, that is, the static service can be invoked only when the host application is installed. In a possible implementation manner, the service management module is used to manage the static services provided by the host application in the local device. After obtaining the service identifier, the service scheduling module queries the local device for candidate services that match the service identifier through the service management module. static service.
在一个示意性的例子中,服务治理模块基于服务名“支付”,将支付应用提供的支付服务A以及即时通信应用提供的支付服务B确定为候选静态服务(计算机设备安装有支付应用A和即时通信应用B)。In an illustrative example, based on the service name "payment", the service management module determines the payment service A provided by the payment application and the payment service B provided by the instant messaging application as candidate static services (the computer device is installed with payment application A and instant messaging Communication application B).
2、从云端服务库中确定与服务标识匹配的候选动态服务,其中,动态服务为支持动态部署至设备的 服务。2. Determine the candidate dynamic service that matches the service identifier from the cloud service library, where the dynamic service is a service that supports dynamic deployment to the device.
动态服务作为一种支持动态部署的服务,其调用并不依赖预先安装的应用,且可供调用的动态服务统一存储在云端服务库中。在一种可能的实施方式中,服务调度模块基于服务标识,从云端服务库中查询与服务标识相匹配的候选动态服务。As a service that supports dynamic deployment, dynamic services do not depend on pre-installed applications, and the dynamic services that can be called are uniformly stored in the cloud service library. In a possible implementation manner, based on the service identifier, the service scheduling module queries the cloud service library for candidate dynamic services matching the service identifier.
在一个示意性的例子中,服务调度模块基于服务名“支付”,从云端服务库中查询到支付动态服务C,并将支付动态服务C确定为候选动态服务。In an illustrative example, the service dispatching module queries the payment dynamic service C from the cloud service library based on the service name "payment", and determines the payment dynamic service C as a candidate dynamic service.
需要说明的是,确定出候选动态服务后,计算机设备并不会直接进行下载,而是在确定出目标服务,且目标服务属于候选动态服务时进行服务下载。It should be noted that after the candidate dynamic service is determined, the computer device does not directly download the service, but performs service download when the target service is determined and belongs to the candidate dynamic service.
3、基于候选静态服务和候选动态服务生成候选服务列表。3. Generate a candidate service list based on the candidate static service and the candidate dynamic service.
进一步的,计算机设备对查询到的候选动态服务和候选静态服务进行合并,得到候选服务列表。Further, the computer device combines the queried candidate dynamic services and candidate static services to obtain a candidate service list.
步骤702,从候选服务列表的候选服务中确定目标服务。
可选的,当候选服务列表中仅包含一个候选服务时,计算机设备直接将该候选服务确定为目标服务;当候选服务列表中包含至少两个候选服务时,计算机设备需要从中确定出目标服务。Optionally, when the candidate service list contains only one candidate service, the computer device directly determines the candidate service as the target service; when the candidate service list contains at least two candidate services, the computer device needs to determine the target service therefrom.
在一种可能的实施方式中,计算机设备显示候选服务列表,由用户从候选服务列表中自行选择调用的目标服务。响应于对候选服务列表中候选服务的选择操作,计算机设备将选中的候选服务确定为目标服务。In a possible implementation manner, the computer device displays a list of candidate services, and the user selects a target service to call from the list of candidate services. In response to a selection operation on a candidate service in the candidate service list, the computer device determines the selected candidate service as the target service.
在一些实施例中,计算机设备可以以弹窗的形式显示候选服务列表,并在接收到候选服务列表中候选服务的点击操作时,确定目标服务。本申请实施例并不对候选服务列表的显示方式进行限定。In some embodiments, the computer device may display a list of candidate services in the form of a pop-up window, and determine a target service when receiving a click operation on a candidate service in the list of candidate services. The embodiment of the present application does not limit the display manner of the candidate service list.
在另一种可能的实施方式中,计算机设备可以基于服务选择策略,从候选服务中自动确定出目标服务。可选的,计算机设备可以基于用户信息、设备信息、历史使用记录、服务信息中的至少一种确定目标服务,本实施例并不对具体的服务选择策略进行限定。In another possible implementation manner, the computer device may automatically determine the target service from the candidate services based on the service selection policy. Optionally, the computer device may determine the target service based on at least one of user information, device information, historical use records, and service information. This embodiment does not limit the specific service selection strategy.
比如,当候选服务列表中包含支付应用提供的支付服务A、即时通信应用提供的支付服务B以及支付动态服务C时,基于当前设备的历史支付记录,计算机设备将使用频率最高的支付服务A确定为目标服务。For example, when the candidate service list includes the payment service A provided by the payment application, the payment service B provided by the instant messaging application, and the payment dynamic service C, based on the historical payment records of the current device, the computer device will determine the payment service A with the highest frequency of use. serve the purpose.
又比如,当候选服务列表中包含不同类型设备提供的服务时,计算机设备可以基于当前设备与各个设备之间的位置关系(可以基于定位、网络位置等信息确定得到),将距离最近设备所提供的服务确定为目标服务。For another example, when the list of candidate services includes services provided by different types of devices, the computer device may, based on the location relationship between the current device and each device (which can be determined based on information such as location and network location), select the service provided by the nearest device. The service identified as the target service.
确定出目标服务后,计算机设备进一步调用该目标服务。其中,当目标服务为静态服务时,计算机设备无需动态下载目标服务,而当目标服务为动态服务时,计算机设备需要基于动态服务的部署情况,确定是否需要实时下载并部署。After the target service is determined, the computer device further invokes the target service. Wherein, when the target service is a static service, the computer device does not need to dynamically download the target service, and when the target service is a dynamic service, the computer device needs to determine whether to download and deploy in real time based on the deployment of the dynamic service.
在一个示意性的例子中,如图8所示,运行时模块801在执行控制逻辑过程中,基于控制逻辑所调用服务的服务标识请求服务调度模块802进行服务调用。服务调度模块802基于服务标识分别从服务治理模块803和云端服务库804处查找可用的候选服务。服务器调度模块802可以显示候选服务列表805,供用户选择所要调用的目标应用,也可以基于服务选择策略,从若干候选服务中确定出目标服务。当确定出的目标服务为C设备的服务1时,服务调度模块802进一步通过服务网关806调用C设备中的服务1。In a schematic example, as shown in FIG. 8 , during execution of the control logic, the runtime module 801 requests the service scheduling module 802 to call the service based on the service identifier of the service called by the control logic. The service scheduling module 802 searches for available candidate services from the
本实施例中,计算机设备基于所调用服务的服务标识,查询与该服务标识匹配的静态服务和动态服务,并进一步从查询到的静态服务和动态服务中确定出目标服务,丰富了服务调用的种类,提高了服务实现的多样性。In this embodiment, based on the service identifier of the invoked service, the computer device queries the static service and dynamic service that match the service identifier, and further determines the target service from the queried static service and dynamic service, which enriches the service invocation. types, increasing the diversity of service implementations.
本申请实施例中,服务的调用可以由服务网关实现,且计算机设备除了能够通过自身的服务网关调用本地服务外,还可以通过其他设备的服务网关进行服务调用,从而实现跨端服务调用。在一种可能的实施方式中,计算机设备在调用目标服务时,确定提供目标服务的目标设备,从而通过目标服务网关调用目标服务器。其中,目标服务网关可以是当前设备的服务网关,和/或,当前设备以外的外部设备的服务网关(由微应用的业务逻辑决定),且外部设备中设置有目标微应用脚本,即该外部设备和当前设备均能够运行目标微应用。In the embodiment of the present application, the service invocation can be realized by the service gateway, and the computer device can not only invoke the local service through its own service gateway, but also invoke the service through the service gateway of other devices, so as to realize the cross-terminal service invocation. In a possible implementation manner, when the computer device invokes the target service, it determines the target device providing the target service, so as to invoke the target server through the target service gateway. Wherein, the target service gateway can be the service gateway of the current device, and/or the service gateway of an external device other than the current device (determined by the business logic of the micro-application), and the target micro-application script is set in the external device, that is, the external device Both the device and the current device are capable of running the target microapp.
为了使微应用支持异构操作系统,从而实现跨平台运行,在进行服务调用时需要采用统一格式的服务调用请求,服务网关需要通过本地部署的服务代理,将同一格式的服务调用请求转换为真实的服务调用(因为不同操作系统有自身不同的进程上层抽象方式,以及进程间不同的调用方式),即符合当前平台服务规范的服务调用。In order to enable micro-applications to support heterogeneous operating systems and achieve cross-platform operation, service invocation requests in a uniform format must be used when invoking services. The service gateway needs to convert service invocation requests in the same format into real Service calls (because different operating systems have their own different process upper layer abstraction methods, and different call methods between processes), that is, service calls that conform to the current platform service specification.
在目标服务网关为当前设备的服务网关的情况下,在一种可能的实施方式中,计算机设备通过目标服务网关获取服务调用请求,从而通过目标服务网关确定目标服务对应的目标服务代理。进一步的,基于服务调用请求,通过目标服务代理调用目标服务。When the target service gateway is the service gateway of the current device, in a possible implementation manner, the computer device obtains the service invocation request through the target service gateway, so as to determine the target service agent corresponding to the target service through the target service gateway. Further, based on the service invocation request, the target service is invoked through the target service proxy.
而在目标服务网关为外部设备的服务网关的情况下,计算机设备向外部设备发送服务调用请求,由外部设备通过目标服务网关确定目标服务对应的目标服务代理,并基于服务调用请求,通过目标服务代理调用目标服务。In the case where the target service gateway is the service gateway of the external device, the computer device sends a service invocation request to the external device, and the external device determines the target service agent corresponding to the target service through the target service gateway, and based on the service invocation request, through the target service The proxy invokes the target service.
可选的,当目标服务网关为外部设备的服务网关时,计算机设备可以通过用户资源管理服务器(设备管理模块)获取外部设备的服务网关的网关地址,从而基于该网关地址发送服务调用请求。Optionally, when the target service gateway is the service gateway of the external device, the computer device may obtain the gateway address of the service gateway of the external device through the user resource management server (device management module), so as to send the service call request based on the gateway address.
在一些实施例中,基于所需提供服务的服务类型,计算机设备可以按需部署有不同的服务代理(比如在window系统的设备上无需部署安卓服务代理),其中,不同的服务代理对应不同的编程开发语言(比如java、js、php、C、C++等等),或,不同的服务代理对应不同的部署形态(比如小程序、浏览器插件、应用程序等等),或,不同的服务代理对应不同的运行环境(比如虚拟机、浏览器、操作系统、容器等等)。In some embodiments, based on the type of service that needs to be provided, the computer device can be deployed with different service agents as needed (for example, there is no need to deploy an Android service agent on a Windows system device), where different service agents correspond to different Programming development languages (such as java, js, php, C, C++, etc.), or, different service agents correspond to different deployment forms (such as applets, browser plug-ins, applications, etc.), or, different service agents Corresponding to different operating environments (such as virtual machines, browsers, operating systems, containers, etc.).
示意性的,如图9所示,服务网关90的代理管理模块91中设置有Android Service代理911、云端restful代理912、Android动态服务代理913以及Web动态服务代理914。Schematically, as shown in Figure 9, the proxy management module 91 of the service gateway 90 is provided with an Android Service proxy 911, a cloud restful proxy 912, an Android dynamic service proxy 913 and a Web dynamic service proxy 914.
可选的,目标服务网关获取到服务调用请求后,基于目标服务的服务信息,确定是否部署有目标服务对应的目标服务代理。若部署有目标服务代理,则通过目标服务代理进行服务调用;若未部署目标服务代理,则无法进行服务调用。Optionally, after the target service gateway obtains the service invocation request, it determines whether a target service proxy corresponding to the target service is deployed based on the service information of the target service. If the target service proxy is deployed, the service call is made through the target service proxy; if the target service proxy is not deployed, the service call cannot be made.
关于目标服务代理调用目标服务的具体方式,在一种可能的实施方式中,该调用过程可以包括如下步骤:Regarding the specific manner in which the target service proxy invokes the target service, in a possible implementation manner, the invocation process may include the following steps:
1、通过目标服务代理对服务调用请求中的原始输入参数进行转换,得到目标输入参数,其中,原始输入参数采用统一参数格式,目标输入参数符合目标服务的参数格式。1. Convert the original input parameters in the service call request through the target service proxy to obtain the target input parameters, wherein the original input parameters adopt a unified parameter format, and the target input parameters conform to the parameter format of the target service.
可选的,服务代理中定义了如何调用服务,包括如何对原始的调用参数转换为真实服务所需的参数、如何访问操作系统中指定进程的服务、如何将真实服务返回的参数转换为统一格式的参数等等。由于服务器调用请求中统一参数格式的原始输入参数并不符合目标服务的参数输入格式,因此目标服务代理首先需要对原始输入参数进行转换,得到符合目标服务所规定的参数格式的目标输入参数。Optionally, the service proxy defines how to call the service, including how to convert the original call parameters into the parameters required by the real service, how to access the service of the specified process in the operating system, and how to convert the parameters returned by the real service into a unified format parameters and so on. Since the original input parameters in the unified parameter format in the server invocation request do not conform to the parameter input format of the target service, the target service agent first needs to convert the original input parameters to obtain the target input parameters that conform to the parameter format specified by the target service.
示意性的,如图9所示,当需要调用Android动态服务93中的服务A时,服务网关90通过Android动态服务代理913对原始输入参数进行转换,并基于转换后的参数调用Android动态服务93中的服务A;当需要调用Web动态服务94中的服务B时,服务网关90通过Web动态服务代理914对原始输入参数进行转换,并基于转换后的参数调用Web动态服务94中的服务B。Schematically, as shown in Figure 9, when service A in the Android dynamic service 93 needs to be called, the service gateway 90 converts the original input parameters through the Android dynamic service agent 913, and calls the Android dynamic service 93 based on the converted parameters Service A in; when service B in Web dynamic service 94 needs to be invoked, service gateway 90 converts the original input parameters through Web dynamic service proxy 914, and invokes service B in Web dynamic service 94 based on the converted parameters.
2、基于目标输入参数,通过目标服务代理调用目标服务,得到目标服务的原始输出参数。2. Based on the target input parameters, the target service is invoked through the target service agent to obtain the original output parameters of the target service.
进一步的,目标服务代理基于目标输入参数调用目标服务,从而得到目标服务器的原始输出参数,其中,该原始输出参数符合目标服务的参数输入格式。Further, the target service proxy invokes the target service based on the target input parameter, thereby obtaining the original output parameter of the target server, wherein the original output parameter conforms to the parameter input format of the target service.
3、通过目标服务代理对原始输出参数进行转换,得到目标输出参数,目标输出参数采用统一参数格式。3. Convert the original output parameters through the target service agent to obtain the target output parameters, and the target output parameters adopt a unified parameter format.
由于最终向微应用引擎反馈的数据需要符合同一参数格式,因此目标服务代理需要对原始输出参数进行转换,得到目标输出参数,进而将目标输出参数反馈至微应用引擎。Since the data finally fed back to the micro-application engine needs to conform to the same parameter format, the target service agent needs to convert the original output parameters to obtain the target output parameters, and then feed the target output parameters back to the micro-application engine.
示意性的,如图9所示,服务网关90通过Android动态服务代理913对Android动态服务93中服务A输出的参数进行转换,并反馈至微应用引擎;服务网关90通过Web动态服务代理914对Web动态服务94中服务B输出的参数进行转换,并反馈至微应用引擎。Schematically, as shown in Figure 9, the service gateway 90 converts the parameters output by service A in the Android dynamic service 93 through the Android dynamic service agent 913, and feeds back to the micro-application engine; the service gateway 90 passes the Web dynamic service agent 914 to the The parameters output by service B in the Web dynamic service 94 are converted and fed back to the micro application engine.
本实施例中,服务网关通过服务代理进行服务调用,由服务代理对调用参数进行参数转换,使转换后的参数符合真实服务的参数要求,保证服务能够被正确调用;由服务代理对服务输出的参数进行转换,使转换后的参数符合统一参数格式,保证不同操作系统、平台以及运行环境下的设备之间能够正常交互,实现了微应用的跨平台部署。In this embodiment, the service gateway calls the service through the service agent, and the service agent performs parameter conversion on the calling parameters, so that the converted parameters meet the parameter requirements of the real service, ensuring that the service can be called correctly; The parameters are converted so that the converted parameters conform to the unified parameter format, which ensures the normal interaction between devices under different operating systems, platforms and operating environments, and realizes the cross-platform deployment of micro-applications.
针对不同部署方式(静态部署和动态部署)的服务,其调用方式存在差异,下面分别对静态服务以及动态服务的调用方式进行说明。For services with different deployment methods (static deployment and dynamic deployment), there are differences in their invocation methods. The invocation methods of static services and dynamic services are described below.
在一种可能的实施方式中,在目标服务为静态服务的情况下,计算机设备通过静态服务管理器(图9所示,服务网关90的生命周期管理模块95中设置有静态服务管理器951)获取目标服务的服务状态,并在服务状态为未启动状态的情况下,启动目标服务。其中,计算机设备可以基于目标服务的描述信息,确定目标服务的部署方式。In a possible implementation, when the target service is a static service, the computer device uses a static service manager (as shown in FIG. 9, a static service manager 951 is provided in the life cycle management module 95 of the service gateway 90) Obtain the service status of the target service, and start the target service when the service status is not started. Wherein, the computer device may determine the deployment mode of the target service based on the description information of the target service.
可选的,静态服务管理器用于管理静态服务的生命周期。比如,当静态服务在目标时长内未被调用,静态服务管理器则结束静态服务的生命周期。Optionally, the static service manager is used to manage the life cycle of the static service. For example, when the static service is not invoked within the target duration, the static service manager ends the life cycle of the static service.
可选的,若目标服务启动成功,计算机设备则根据目标服务的描述信息,确定该目标服务对应的目标服务代理,并通过该目标服务代理进行参数转换,从而基于目标服务对应的宿主应用及访问路径,调用该目标服务。Optionally, if the target service is successfully started, the computer device determines the target service agent corresponding to the target service according to the description information of the target service, and performs parameter conversion through the target service agent, so that based on the host application and access information corresponding to the target service Path to invoke the target service.
可选的,若目标服务启动失败,或目标服务不满足预安装条件(比如宿主应用异常导致目标服务不可使用),计算机设备则进行失败提示。Optionally, if the target service fails to start, or the target service does not meet the pre-installation conditions (for example, the host application is abnormal and the target service is unavailable), the computer device will give a failure prompt.
在一个示意性的例子中,静态服务的调用过程如图10所示。In a schematic example, the invocation process of the static service is shown in FIG. 10 .
步骤1001,微应用引擎向服务网关发起服务调用请求。Step 1001, the micro application engine initiates a service call request to the service gateway.
步骤1002,服务网关验证请求是否合法;若合法,则执行步骤1003,若不合法,则执行步骤1010。Step 1002, the service gateway verifies whether the request is legal; if it is legal, execute step 1003; if not, execute step 1010.
步骤1003,检测目标服务是否启动;若启动,则执行步骤1005;若未启动,则启动目标服务,并执行步骤1004。Step 1003, check whether the target service is started; if it is started, execute step 1005; if not, start the target service, and execute step 1004.
步骤1004,检测目标服务是否启动成功;若启动成功,则执行步骤1005;若启动失败,则执行步骤1010。Step 1004, check whether the target service is started successfully; if the start is successful, execute step 1005; if fail to start, execute step 1010.
步骤1005,检测是否存在目标服务对应的目标服务代理;若存在,则执行步骤1006;若不存在,则执行步骤1010。Step 1005, check whether there is a target service proxy corresponding to the target service; if yes, execute step 1006; if not, execute step 1010.
步骤1006,通过目标服务代理进行输入参数转换。Step 1006, convert the input parameters through the target service proxy.
步骤1007,基于转换后的输入参数调用目标服务。Step 1007, calling the target service based on the converted input parameters.
步骤1008,通过目标服务代理进行输出参数转换。Step 1008, convert the output parameters through the target service proxy.
步骤1009,向微应用引擎返回服务调用结果。Step 1009, return the service call result to the micro application engine.
步骤1010,返回调用失败。Step 1010, return call failure.
在一种可能的实施方式中,在目标服务为动态服务的情况下,计算机设备通过动态服务管理器(图9所示,服务网关90的生命周期管理模块95中设置有动态服务管理器952)获取目标服务对应宿主服务的服务状态。In a possible implementation, when the target service is a dynamic service, the computer device uses a dynamic service manager (as shown in FIG. 9, a dynamic service manager 952 is provided in the life cycle management module 95 of the service gateway 90) Get the service status of the host service corresponding to the target service.
其中,该动态服务的运行依赖于其对应的宿主服务。比如,当动态服务为容器创建服务时,计算机设备获取容器服务的服务状态。本申请实施例对具体的宿主服务的类型不作限定。Wherein, the operation of the dynamic service depends on its corresponding host service. For example, when a dynamic service creates a service for a container, the computer device obtains the service status of the container service. The embodiment of the present application does not limit the specific type of hosting service.
因此,在宿主服务的服务状态为未启动状态的情况下,计算机设备启动宿主服务。进一步的,计算机设备通过宿主服务查询目标服务的部署情况。Therefore, when the service status of the host service is not started, the computer device starts the host service. Further, the computer device queries the deployment status of the target service through the host service.
在未部署目标服务的情况下,计算机设备从云端服务库下载目标服务,并通过宿主服务加载目标服务。在已部署目标服务的情况下(可能是历史调用目标服务时缓存在本地),计算机设备直接通过宿主服务加载目标服务。When the target service is not deployed, the computer device downloads the target service from the cloud service library, and loads the target service through the host service. In the case that the target service has been deployed (it may be cached locally when the target service is called historically), the computer device directly loads the target service through the host service.
可选的,计算机设备需要根据目标服务的描述信息,确定该目标服务对应的目标服务代理,并通过该目标服务代理进行参数转换,从而向宿主服务传递转换后的参数,以便宿主服务基于参数调用目标服务。Optionally, the computer device needs to determine the target service proxy corresponding to the target service according to the description information of the target service, and perform parameter conversion through the target service proxy, so as to transfer the converted parameters to the host service, so that the host service can call target service.
在一个示意性的例子中,动态服务的调用过程如图11所示。In a schematic example, the calling process of the dynamic service is shown in FIG. 11 .
步骤1101,微应用引擎向服务网关发起服务调用请求。Step 1101, the micro application engine initiates a service call request to the service gateway.
步骤1102,服务网关验证请求是否合法;若合法,则执行步骤1103,若不合法,则执行步骤1112。Step 1102, the service gateway verifies whether the request is legal; if it is legal, execute step 1103; if not, execute step 1112.
步骤1103,检测目标服务的宿主服务是否启动;若启动,则执行步骤1105;若未启动,则启动宿主服务,并执行步骤1104。Step 1103 , check whether the host service of the target service is started; if it is started, execute step 1105 ; if not, start the host service, and execute step 1104 .
步骤1104,检测宿主服务是否启动成功;若启动成功,则执行步骤1105;若启动失败,则执行步骤1112。Step 1104 , check whether the host service is started successfully; if the start is successful, perform step 1105 ; if fail to start, perform step 1112 .
步骤1105,检测是否存在目标服务对应的目标服务代理;若存在,则执行步骤1106;若不存在,则执行步骤1112。Step 1105, check whether there is a target service agent corresponding to the target service; if yes, execute step 1106; if not, execute step 1112.
步骤1106,通过目标服务代理进行输入参数转换。Step 1106, convert the input parameters through the target service agent.
步骤1107,通过宿主服务检测是否部署由目标服务;若已部署,则执行步骤1108;若未部署,则执行步骤1109。Step 1107, check whether the target service is deployed through the host service; if deployed, execute step 1108; if not deployed, execute step 1109.
步骤1108,基于转换后的输入参数调用目标服务。Step 1108, call the target service based on the converted input parameters.
步骤1109,从云端服务库下载目标服务。Step 1109, download the target service from the cloud service library.
步骤1110,通过目标服务代理进行输出参数转换。Step 1110, convert the output parameters through the target service proxy.
步骤1111,向微应用引擎返回服务调用结果。Step 1111, return the service call result to the micro application engine.
步骤1112,返回调用失败。Step 1112, return call failure.
当微应用由不同设备进行交互以实现微应用功能时,由于不同设备侧的业务逻辑可能不同,因此不同设备侧部署的服务也可能存在差异,以实现不同的功能,即同一微应用运行过程中,不同设备中的服务差分部署。示意性的,如图12所示,对于跨端截屏微应用,实现跨端截屏所调用的服务包括双指叩击服务、图片显示服务以及截屏服务。当用户帐号订阅了跨端截屏微应用后,该用户帐号下的手机、平板、车机以及电视均会下载对应的微应用脚本,且在下载微应用脚本后均会预先基于初始触发器部署双指叩击服务。When micro-applications interact with different devices to realize micro-application functions, since the business logic on different device sides may be different, the services deployed on different device sides may also be different to achieve different functions, that is, during the running of the same micro-application , Differential deployment of services in different devices. Schematically, as shown in FIG. 12 , for the cross-device screen capture micro-application, the services invoked to realize the cross-device screen capture include two-finger tap service, picture display service and screen capture service. When a user account subscribes to the cross-device screenshot micro-app, the mobile phone, tablet, car, and TV under the user account will download the corresponding micro-app script, and after downloading the micro-app script, they will deploy dual Refers to tap service.
当用户双指叩击手机的屏幕时,手机基于微应用脚本,确定执行的业务逻辑应该是图片显示,从而下载并动态部署图片显示服务,并请求调用其他设备侧的截屏服务。平板、车机以及电视接收到服务调用请求后,基于微应用脚本,确定执行的业务逻辑应该是截屏并发送,从而下载并动态部署截屏服务,并调用截屏服务对当前设备画面进行截屏,并反馈至手机。手机接收到其他设备反馈的截屏图片后,调用图片显示服务实现截屏展示。When the user taps the screen of the mobile phone with two fingers, the mobile phone determines that the executed business logic should be image display based on the micro-app script, downloads and dynamically deploys the image display service, and requests to call the screenshot service on the other device side. After the tablet, car machine and TV receive the service call request, based on the micro-app script, it is determined that the executed business logic should be to capture and send the screen, so as to download and dynamically deploy the screen capture service, and call the screen capture service to capture the screen of the current device and give feedback to the phone. After the mobile phone receives the screenshot image fed back by other devices, it calls the image display service to realize the screenshot display.
针对不同的服务调用类型,计算机设备完成服务调用后的后续步骤也存在差异。在一种可能的实施方 式中,在目标服务为同步调用服务的情况下,计算机设备获取目标服务的服务返回值,从而基于服务返回值调用下一服务(直至完成该触发器下所有服务的调用);在目标服务为异步调用服务的情况下,计算机设备获取目标服务的服务输出事件,从而通过服务输出事件触发目标微应用脚本中的触发器。For different service invocation types, there are also differences in subsequent steps after the computer device completes the service invocation. In a possible implementation manner, when the target service is a synchronous call service, the computer device obtains the service return value of the target service, so as to call the next service based on the service return value (until the call of all services under the trigger is completed ); when the target service is an asynchronous call service, the computer device obtains the service output event of the target service, so as to trigger the trigger in the target micro-application script through the service output event.
其中,服务返回值可以是数据、文件、指令等等,比如截屏服务的返回值可以为截取到的图片;服务输出事件所触发的触发器可以为目标触发器以外的触发器,也可以为目标触发器,本实施例对此不作限定。Among them, the service return value can be data, files, instructions, etc. For example, the return value of the screenshot service can be the captured picture; the trigger triggered by the service output event can be a trigger other than the target trigger, or it can be the target Trigger, which is not limited in this embodiment.
并且,由于不同设备侧的微应用引擎是对等的,需要保持微应用运行过程中所需要的所有状态信息,因此当某一设备上微应用引擎的状态发生变化时(可能是由服务输出事件导致状态变化),微应用引擎需要通过数据同步模块将状态变化情况同步至其他设备。Moreover, since the micro-application engines on different devices are peer-to-peer, all the state information required during the running of the micro-applications needs to be maintained, so when the state of the micro-application engine on a certain device changes (may be output by the service result in state changes), the micro-application engine needs to synchronize the state changes to other devices through the data synchronization module.
示意性的,如图13所示,同一用户帐号下的不同设备在运行同一微应用时,设备A部署了服务1和服务2,设备B部署了服务1和服务3,而设备C部署了服务4和服务5。当设备B中服务1被调用后,服务1输出的服务输出事件改变了微应用引擎1301的引擎状态,设备B侧的微应用引擎1301即通过数据同步模块1302将引擎状态同步至设备A和设备C,以便设备A和设备C更新自身微应用引擎1301的引擎状态。当设备C中服务5被调用后,服务5输出的服务输出事件改变了微应用引擎1301的引擎状态,设备C侧的微应用引擎1301即通过数据同步模块1302将引擎状态同步至设备A和设备B,以便设备A和设备B更新自身微应用引擎1301的引擎状态。Schematically, as shown in Figure 13, when different devices under the same user account are running the same micro-app, device A deploys service 1 and service 2, device B deploys service 1 and service 3, and device C deploys service 4 and serve 5. After service 1 is invoked in device B, the service output event output by service 1 changes the engine state of the
通过上述同步机制,用户帐号下的各个设备对等,单个设备的掉线,并不会不影响微应用的运行。比如,当通过双指叩击截取其他设备的屏幕并发送到当前设备时,用户叩击任意一台设备都能完成此操作,并且任意设备掉线,并不会不影响其他设备的正常截屏。Through the above synchronization mechanism, each device under the user account is equal, and the disconnection of a single device will not affect the operation of the micro application. For example, when two-finger tapping captures the screen of other devices and sends it to the current device, the user can tap any device to complete this operation, and if any device is offline, it will not affect the normal screenshot of other devices.
微应用除了能够像传统应用一样通过图标点击操作来启动外,还可以通过其他交互方式启动。当用户执行特定交互动作,且计算机设备中多个微应用均可以由该特定交互动作启动时,计算机设备需要基于多个微应用中确定出实际需要启动的目标微应用,进而获取该目标微应用的目标微应用脚本。In addition to being launched by clicking on icons like traditional applications, micro-apps can also be launched by other interactive methods. When the user performs a specific interactive action, and multiple micro-applications in the computer device can be started by the specific interactive action, the computer device needs to determine the target micro-application that actually needs to be started based on the multiple micro-applications, and then obtain the target micro-application The target microapp script for .
在一种可能的实施方式中,如图14所示,计算机设备获取目标微应用脚本的过程可以包括如下步骤。In a possible implementation manner, as shown in FIG. 14 , the process for the computer device to obtain the target micro-application script may include the following steps.
步骤1401,在接收到初始化触发事件的情况下,确定初始化触发事件对应的至少一个候选微应用,初始化触发事件用于触发至少一个候选微应用的触发器。
在一种可能的实施方式中,当接收到初始化触发事件时,计算机设备从订阅的至少一个微应用中,确定出包含该初始化触发事件对应触发器的候选微应用,即将能够由该初始化触发事件触发运行的微应用确定为候选微应用。其中,该初始化触发事件可以是语音输出触发的事件、手势操作触发的事件(比如摇一摇、碰一碰)或情景感知触发的事件(比如检测到回到家中、达到办公地点等等),本实施例对此不作限定。In a possible implementation manner, when an initialization trigger event is received, the computer device determines, from at least one subscribed micro-application, a candidate micro-application containing a trigger corresponding to the initialization trigger event, that is, a candidate micro-application that can be triggered by the initialization trigger event The micro-application that is triggered to run is determined as a candidate micro-application. Wherein, the initialization triggering event may be an event triggered by voice output, an event triggered by a gesture operation (such as shaking, touching) or an event triggered by situational awareness (such as detecting returning home, arriving at an office location, etc.), This embodiment does not limit it.
步骤1402,从至少一个候选微应用中确定目标微应用。
可选的,该目标微应用可以由用户自行指定,也可以由计算机设备基于应用选择策略自动确定得到。Optionally, the target micro-application may be specified by the user, or automatically determined by the computer device based on an application selection policy.
在一种可能的实施方式中,计算机设备基于至少一个候选微应用显示微应用选择列表;当接收到对微应用选择列表的选择操作时,将选中的候选微应用确定为目标微应用。In a possible implementation manner, the computer device displays a micro-application selection list based on at least one candidate micro-application; when a selection operation on the micro-application selection list is received, the selected candidate micro-application is determined as a target micro-application.
比如,当用户摇一摇操作用户触发微应用A和微应用B运行时,当用户摇一摇终端时,终端通过弹窗显示显示微应用A和微应用B的应用图标,供用户选择使用。For example, when the user triggers micro-application A and micro-application B to run by shaking the terminal, when the user shakes the terminal, the terminal displays the application icons of micro-application A and micro-application B through a pop-up window for the user to choose and use.
在另一种可能的实施方式中,计算机设备基于应用选择策略,从至少一个候选微应用中确定目标微应用。In another possible implementation manner, the computer device determines a target micro-application from at least one candidate micro-application based on an application selection policy.
可选的,计算机设备可以基于用户信息、设备信息、地理位置信息、时间信息中的至少一项,确定目标微应用。比如,当用户摇一摇终端时,若终端位于家中,则基于应用选择策略将微应用A确定为目标微应用;若终端位于办公地点,则基于应用选择策略将微应用B确定为目标微应用。Optionally, the computer device may determine the target micro-application based on at least one item of user information, device information, geographic location information, and time information. For example, when the user shakes the terminal, if the terminal is at home, micro-application A is determined as the target micro-application based on the application selection strategy; if the terminal is located at the office, micro-application B is determined as the target micro-application based on the application selection policy .
又比如,当用户摇一摇终端时,若当前处于上午时段,则基于应用选择策略将微应用C确定为目标微应用;若当前处于下午时段,则基于应用选择策略将微应用D确定为目标微应用。本申请实施例并不对具体的应用选择策略进行限定。For another example, when the user shakes the terminal, if it is currently in the morning time period, micro-application C is determined as the target micro-application based on the application selection strategy; if it is currently in the afternoon time period, then micro-application D is determined as the target micro-application based on the application selection strategy micro app. The embodiment of the present application does not limit the specific application selection strategy.
示意性的,如图15所示,微应用引擎1501的事件总线模块1502下挂载有多个微应用对应的触发器,当接收到初始化触发事件,且该初始化触发事件导致事件总线模块1502下的触发器被触发时,事件总线模块1502基于被触发的触发器,将微应用A、B、C确定候选微应用,并指示应用调度模块1503进行应用调度。应用调度模块1503可以显示微应用选择列表供用户进行选择,也可以基于应用选择策略将微应用C确定为目标微应用。Schematically, as shown in Figure 15, the event bus module 1502 of the micro application engine 1501 is loaded with triggers corresponding to multiple micro applications. When an initialization trigger event is received, and the initialization trigger event causes the event bus module 1502 to When the trigger of is triggered, the event bus module 1502 determines the candidate micro-applications from the micro-applications A, B, and C based on the triggered trigger, and instructs the
步骤1403,获取目标微应用的目标微应用脚本。
进一步的,计算机设备基于目标微应用的应用标识,从本地获取目标微应用脚本。Further, the computer device acquires the target micro-application script locally based on the application identification of the target micro-application.
下述为本申请装置实施例,可以用于执行本申请方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请方法实施例。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.
请参考图16,其示出了本申请一个实施例提供的微应用的运行装置的结构框图。该装置可以包括:Please refer to FIG. 16 , which shows a structural block diagram of a micro-application running device provided by an embodiment of the present application. The device can include:
脚本获取模块1601,用于获取目标微应用的目标微应用脚本,所述目标微应用是由服务构成的集合,所述目标微应用脚本由触发器构成,且所述触发器用于在触发事件下通过执行控制逻辑进行服务调用;The
触发模块1602,用于在接收到目标触发事件的情况下,触发所述目标微应用脚本中所述目标触发事件对应的目标触发器;A
服务调用模块1603,用于执行所述目标触发器对应的目标控制逻辑,并调用目标服务,以实现所述目标微应用的微应用功能。The
可选的,所述装置还包括:Optionally, the device also includes:
候选服务确定模块,用于基于所述目标控制逻辑所调用服务的服务标识,确定候选服务列表,所述候选服务列表中包含至少一个与所述服务标识匹配的候选服务;A candidate service determining module, configured to determine a candidate service list based on the service identifier of the service invoked by the target control logic, the candidate service list including at least one candidate service matching the service identifier;
目标服务确定模块,用于从所述候选服务列表的所述候选服务中确定所述目标服务。A target service determining module, configured to determine the target service from the candidate services in the candidate service list.
可选的,所述候选服务确定模块,用于:Optionally, the candidate service determination module is configured to:
确定当前设备中与所述服务标识匹配的候选静态服务,其中,静态服务为设备中宿主应用所提供的服务;Determine a candidate static service that matches the service identifier in the current device, where the static service is a service provided by a host application in the device;
从云端服务库中确定与所述服务标识匹配的候选动态服务,其中,动态服务为支持动态部署至设备的服务;Determining a candidate dynamic service matching the service identifier from the cloud service library, wherein the dynamic service is a service that supports dynamic deployment to the device;
基于所述候选静态服务和所述候选动态服务生成所述候选服务列表。The list of candidate services is generated based on the candidate static services and the candidate dynamic services.
可选的,所述目标服务确定模块,用于:Optionally, the target service determination module is configured to:
显示所述候选服务列表;响应于对所述候选服务列表中候选服务的选择操作,将选中的所述候选服务确定为所述目标服务;或,displaying the candidate service list; in response to a selection operation on candidate services in the candidate service list, determining the selected candidate service as the target service; or,
基于服务选择策略,从所述候选服务列表的所述候选服务中确定所述目标服务。The target service is determined from the candidate services in the candidate service list based on a service selection policy.
可选的,所述服务调用模块1603,用于:Optionally, the
通过目标服务网关调用所述目标服务,所述目标服务网关为当前设备的服务网关,和/或,当前设备以外的外部设备的服务网关,所述外部设备中设置有所述目标微应用脚本。The target service is invoked through the target service gateway, where the target service gateway is the service gateway of the current device, and/or, the service gateway of an external device other than the current device, and the target micro-application script is set in the external device.
可选的,所述服务调用模块1603,包括:Optionally, the
第一调用单元,用于在所述目标服务网关为当前设备的服务网关的情况下,通过所述目标服务网关获取服务调用请求;通过所述目标服务网关确定所述目标服务对应的目标服务代理;基于所述服务调用请求,通过所述目标服务代理调用所述目标服务;The first invocation unit is configured to obtain a service invocation request through the target service gateway when the target service gateway is the service gateway of the current device; determine the target service agent corresponding to the target service through the target service gateway ; Based on the service invocation request, invoking the target service through the target service agent;
第二调用单元,用于在所述目标服务网关为外部设备的服务网关的情况下,向所述外部设备发送服务调用请求,所述外部设备用于通过所述目标服务网关确定所述目标服务对应的目标服务代理,并基于所述服务调用请求,通过所述目标服务代理调用所述目标服务;The second invoking unit is configured to send a service invocation request to the external device when the target service gateway is a service gateway of an external device, and the external device is configured to determine the target service through the target service gateway A corresponding target service proxy, and based on the service invocation request, invoke the target service through the target service proxy;
其中,不同的服务代理对应不同的编程开发语言,或,不同的服务代理对应不同的部署形态,或,不同的服务代理对应不同的运行环境。Wherein, different service agents correspond to different programming development languages, or different service agents correspond to different deployment forms, or different service agents correspond to different operating environments.
可选的,所述第一调用单元或第二调用单元,用于:Optionally, the first calling unit or the second calling unit is used for:
通过所述目标服务代理对所述服务调用请求中的原始输入参数进行转换,得到目标输入参数,其中,所述原始输入参数采用统一参数格式,所述目标输入参数符合所述目标服务的参数格式;The original input parameters in the service call request are converted by the target service proxy to obtain target input parameters, wherein the original input parameters adopt a unified parameter format, and the target input parameters conform to the parameter format of the target service ;
基于所述目标输入参数,通过所述目标服务代理调用所述目标服务,得到所述目标服务的原始输出参数;Invoking the target service through the target service proxy based on the target input parameters to obtain original output parameters of the target service;
通过所述目标服务代理对所述原始输出参数进行转换,得到目标输出参数,所述目标输出参数采用所述统一参数格式。The original output parameter is converted by the target service agent to obtain a target output parameter, and the target output parameter adopts the unified parameter format.
可选的,所述装置还包括:Optionally, the device also includes:
第一服务启动模块,用于在所述目标服务为静态服务的情况下,通过静态服务管理器获取所述目标服务的服务状态;在所述服务状态为未启动状态的情况下,启动所述目标服务。The first service starting module is used to obtain the service status of the target service through the static service manager when the target service is a static service; and start the service status when the service status is not started. target service.
可选的,所述装置还包括:Optionally, the device also includes:
第二服务启动模块,用于在所述目标服务为动态服务的情况下,通过动态服务管理器获取所述目标服务对应宿主服务的服务状态;在所述服务状态为未启动状态的情况下,启动所述宿主服务;通过所述宿主服务查询所述目标服务的部署情况;在未部署所述目标服务的情况下,从云端服务库下载所述目标服务,并通过所述宿主服务加载所述目标服务。The second service starting module is used to obtain the service status of the host service corresponding to the target service through the dynamic service manager when the target service is a dynamic service; when the service status is not started, Start the host service; query the deployment status of the target service through the host service; if the target service is not deployed, download the target service from the cloud service library, and load the target service through the host service target service.
可选的,所述服务调用模块1603,还用于在所述目标服务为同步调用服务的情况下,获取所述目标服务的服务返回值;基于所述服务返回值调用下一服务;Optionally, the
所述触发模块1602,还用于在所述目标服务为异步调用服务的情况下,获取所述目标服务的服务输出事件;通过所述服务输出事件触发所述目标微应用脚本中的触发器。The triggering
可选的,所述装置还包括:Optionally, the device also includes:
第一下载模块,用于响应于对所述目标微应用的订阅操作,下载所述目标微应用的所述目标微应用脚本;或,A first download module, configured to download the target micro-application script of the target micro-application in response to a subscription operation to the target micro-application; or,
第二下载模块,用于在接收到订阅推送消息的情况下,基于所述订阅推送消息中的应用标识,下载所述目标微应用的所述目标微应用脚本,所述订阅推送消息由服务器在检测到用户帐号订阅的微应用发生变更时,向所述用户帐号下的各个设备推送。The second download module is configured to download the target micro-application script of the target micro-application based on the application identifier in the subscription push message when a subscription push message is received, and the subscription push message is sent by the server at When it is detected that the micro-application subscribed by the user account changes, push it to each device under the user account.
可选的,所述装置还包括:Optionally, the device also includes:
初始化部署模块,用于基于所述目标微应用脚本中的初始化触发器,部署初始化服务,所述初始化服务为所述初始化触发器所调用的服务。The initialization deployment module is configured to deploy an initialization service based on the initialization trigger in the target micro-application script, and the initialization service is a service invoked by the initialization trigger.
可选的,所述装置还包括:Optionally, the device also includes:
删除模块,用于响应于对所述目标微应用的取消订阅操作,删除所述目标微应用的所述目标微应用脚本;A deletion module, configured to delete the target micro-application script of the target micro-application in response to an unsubscribe operation on the target micro-application;
指令发送模块,用于向所述服务器发送订阅取消指令,所述服务器用于基于所述订阅取消指令,向所述用户帐号下的各个设备推送订阅取消消息,以便各个终端删除所述目标微应用脚本。An instruction sending module, configured to send a subscription cancellation instruction to the server, and the server is configured to push a subscription cancellation message to each device under the user account based on the subscription cancellation instruction, so that each terminal deletes the target micro-application script.
可选的,所述脚本获取模块1601,包括:Optionally, the
候选应用确定单元,用于在接收到初始化触发事件的情况下,确定所述初始化触发事件对应的至少一个候选微应用,所述初始化触发事件用于触发至少一个所述候选微应用的初始化触发器;A candidate application determining unit, configured to determine at least one candidate micro-application corresponding to the initialization trigger event in the case of receiving an initialization trigger event, and the initialization trigger event is used to trigger an initialization trigger of at least one candidate micro-application ;
目标应用确定单元,用于从至少一个所述候选微应用中确定所述目标微应用;a target application determining unit, configured to determine the target micro-application from at least one of the candidate micro-applications;
获取单元,用于获取所述目标微应用的所述目标微应用脚本。An acquiring unit, configured to acquire the target micro-application script of the target micro-application.
可选的,所述目标应用确定单元,用于:Optionally, the target application determining unit is configured to:
基于至少一个所述候选微应用显示微应用选择列表;响应于对所述微应用选择列表的选择操作,将选中的所述候选微应用确定为所述目标微应用;或,displaying a micro-application selection list based on at least one of the candidate micro-applications; in response to a selection operation on the micro-application selection list, determining the selected candidate micro-application as the target micro-application; or,
基于应用选择策略,从至少一个所述候选微应用中确定所述目标微应用。The target micro-application is determined from at least one of the candidate micro-applications based on an application selection strategy.
综上所述,本申请实施例中,在运行由若干服务构成的微应用时,通过获取微应用的微应用脚本,并基于触发事件触发微应用脚本中对应的触发器,进而通过执行该触发器对应的控制逻辑,调用相应的服务以实现微应用的微应用功能。由于微应用的运行基于低代码量的微应用脚本,因此相较于传统应用所需占用的存储空间更小;并且,将服务组装成微应用,并利用微应用脚本管理服务之间的调用关系,实现了微应用的组件化,提高了微应用间服务的复用性,有助于降低微应用的开发难度。To sum up, in the embodiment of this application, when running a micro-application composed of several services, 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 trigger The corresponding control logic of the controller is used to call the corresponding service to realize the micro-application function of the micro-application. Since the operation of micro-applications is based on micro-application scripts with low code volume, it requires less storage space than traditional applications; moreover, assemble services into micro-applications, and use micro-application scripts to manage the calling relationship between services , realizing the componentization of micro-applications, improving the reusability of services between micro-applications, and helping to reduce the difficulty of developing micro-applications.
请参考图17,其示出了本申请一个示例性实施例提供的计算机设备的结构方框图。该计算机设备1700可以实现成为上述各个实施例中的源端设备或目的端设备。计算机设备1700可以包括一个或多个如下部件:处理器1710和存储器1720。Please refer to FIG. 17 , which shows a structural block diagram of a computer device provided by an exemplary embodiment of the present application. The
处理器1710可以包括一个或者多个处理核心。处理器1710利用各种接口和线路连接整个计算机设备1700内的各个部分,通过运行或执行存储在存储器1720内的指令、程序、代码集或指令集,以及调用存储在存储器1720内的数据,执行计算机设备1700的各种功能和处理数据。可选的,处理器1710可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器1710可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)、神经网络处理器(Neural-network Processing Unit,NPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责触摸显示屏所需要显示的内容的渲染和绘制;NPU用于实现人工智能(Artificial Intelligence,AI)功能;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器1710中,单独通过一块芯片进行实现。
存储器1720可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory,ROM)。可选的,该存储器1720包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器1720可用于存储指令、程序、代码、代码集或指令集。存储器1720可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等;存储数据区可存储根据计算机设备1700的使用所创建的数据(比如音频数据、电话本)等。The
除此之外,本领域技术人员可以理解,上述附图所示出的计算机设备1700的结构并不构成对计算机设备的限定,计算机设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。比如,计算机设备1700中还包括显示屏、摄像组件、麦克风、扬声器、射频电路、输入单元、传感器(比如加速度传感器、角速度传感器、光线传感器等等)、音频电路、无线保真(Wireless Fidelity,WiFi)模块、电源、蓝牙模块等部件,在此不再赘述。In addition, those skilled in the art can understand that the structure of the
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质存储有至少一段程序,所述至少一段程序由处理器加载并执行以实现如上各个实施例所述的微应用的运行方法。The embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores at least one program, and the at least one program is loaded and executed by a processor to realize the micro-application described in each embodiment above. run method.
本申请实施例提供了一种计算机程序产品,该计算机程序产品包括计算机指令,该计算机指令存储在计算机可读存储介质中;计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述方面的各种可选实现方式中提供的微应用的运行方法。An embodiment of the present application provides a computer program product, the computer program product includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and processes The computer executes the computer instructions, so that the computer device executes the micro-application running method provided in various optional implementation manners of the above aspects.
应当理解的是,在本文中提及的“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,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)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111434742.1 | 2021-11-29 | ||
| CN202111434742.1A CN114125028B (en) | 2021-11-29 | 2021-11-29 | Method, apparatus, device, storage medium and program product for operating micro-application |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2023093429A1 true WO2023093429A1 (en) | 2023-06-01 |
Family
ID=80371877
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2022/127460 Ceased WO2023093429A1 (en) | 2021-11-29 | 2022-10-25 | Micro-application running method and apparatus, and device, storage medium and program product |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN114125028B (en) |
| WO (1) | WO2023093429A1 (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2025035400A1 (en) * | 2023-08-15 | 2025-02-20 | Oppo广东移动通信有限公司 | Method and apparatus for calling service, device, and storage medium |
Families Citing this family (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114125028B (en) * | 2021-11-29 | 2024-05-14 | Oppo广东移动通信有限公司 | Method, apparatus, device, storage medium and program product for operating micro-application |
| CN114595010B (en) * | 2022-03-11 | 2024-11-29 | Oppo广东移动通信有限公司 | Service calling system, method, equipment and storage medium |
| CN115150507A (en) * | 2022-05-07 | 2022-10-04 | Oppo广东移动通信有限公司 | Service scheduling method and system, electronic device and computer readable storage medium |
| CN115150378B (en) * | 2022-05-07 | 2024-08-23 | Oppo广东移动通信有限公司 | Travel service method and device, electronic equipment and computer readable storage medium |
| CN114968406B (en) * | 2022-05-27 | 2023-10-13 | 北京青云科技股份有限公司 | Plug-in management method and device, electronic equipment and storage medium |
| CN115296949A (en) * | 2022-06-28 | 2022-11-04 | 青岛海尔科技有限公司 | Remote control method, device and system for intelligent household electrical appliance |
| CN117056173B (en) * | 2023-10-12 | 2024-01-30 | 麒麟软件有限公司 | Method for monitoring android application life cycle on Web operating system |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1500328A (en) * | 2001-02-23 | 2004-05-26 | ��˹��ŵ�� | Method and system for providing network services using business scripts |
| US20170187785A1 (en) * | 2015-12-23 | 2017-06-29 | Hewlett Packard Enterprise Development Lp | Microservice with decoupled user interface |
| US20190065177A1 (en) * | 2017-08-24 | 2019-02-28 | General Electric Company | Cross application behavior customization |
| US20190197148A1 (en) * | 2017-12-21 | 2019-06-27 | Adobe Inc. | Reducing frontend complexity for multiple microservices with consistent updates |
| CN114125028A (en) * | 2021-11-29 | 2022-03-01 | Oppo广东移动通信有限公司 | Micro-application operating method, device, device, storage medium and program product |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110908658B (en) * | 2019-11-15 | 2024-04-12 | 国网电子商务有限公司 | Micro-service and micro-application system, data processing method and device |
| US11553053B2 (en) * | 2020-04-16 | 2023-01-10 | Citrix Systems, Inc. | Tracking application usage for microapp recommendation |
-
2021
- 2021-11-29 CN CN202111434742.1A patent/CN114125028B/en active Active
-
2022
- 2022-10-25 WO PCT/CN2022/127460 patent/WO2023093429A1/en not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1500328A (en) * | 2001-02-23 | 2004-05-26 | ��˹��ŵ�� | Method and system for providing network services using business scripts |
| US20170187785A1 (en) * | 2015-12-23 | 2017-06-29 | Hewlett Packard Enterprise Development Lp | Microservice with decoupled user interface |
| US20190065177A1 (en) * | 2017-08-24 | 2019-02-28 | General Electric Company | Cross application behavior customization |
| US20190197148A1 (en) * | 2017-12-21 | 2019-06-27 | Adobe Inc. | Reducing frontend complexity for multiple microservices with consistent updates |
| CN114125028A (en) * | 2021-11-29 | 2022-03-01 | Oppo广东移动通信有限公司 | Micro-application operating method, device, device, storage medium and program product |
Non-Patent Citations (1)
| Title |
|---|
| LIU DAN; ZHU HONGBIN; WANG YUFEI; WU JIASHENG; LUO HUAYONG: "A Best Practice for a Micro-Service Architecture", 2017 POWER INDUSTRY INFORMATIZATION ANNUAL CONFERENCE; NANNING, GUANGXI, CHINA; 2017-11-24, 24 November 2017 (2017-11-24), CN, pages 359 - 363, XP009546858 * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2025035400A1 (en) * | 2023-08-15 | 2025-02-20 | Oppo广东移动通信有限公司 | Method and apparatus for calling service, device, and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN114125028A (en) | 2022-03-01 |
| CN114125028B (en) | 2024-05-14 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN114125028B (en) | Method, apparatus, device, storage medium and program product for operating micro-application | |
| WO2023093414A1 (en) | Micro-application development method and apparatus, and device, storage medium and program product | |
| CN108989384A (en) | A data processing method, multi-cloud management system and related equipment | |
| CN102550003A (en) | A method and arrangement for managing persistent rich internet applications | |
| EP2959381A1 (en) | Systems and methods for integrated recommendations | |
| CN110990075A (en) | Quick application startup method, device, device and storage medium | |
| WO2023185166A1 (en) | Service call method and apparatus, device and storage medium | |
| WO2023093452A1 (en) | Resource interaction method and apparatus, and terminal and storage medium | |
| CN112764746B (en) | Data processing method, device, electronic equipment and storage medium | |
| CN114168335B (en) | Distributed computing method, device, computer equipment and storage medium | |
| CN114172957B (en) | Subscription system, method, electronic device, server, storage medium and product | |
| CN117270942A (en) | Application program generation method, system, device, electronic equipment and storage medium | |
| US12353411B2 (en) | Database systems and client-side query transformation methods | |
| CN114222003B (en) | Service calling method, system, device, equipment and storage medium | |
| CN113050962A (en) | Mobile service upgrading method, device and terminal | |
| WO2024251107A1 (en) | Container orchestration method, data access method, and electronic device and storage medium | |
| WO2023124657A1 (en) | Micro-application running method and apparatus, device, storage medium, and program product | |
| CN116567133B (en) | Resource playing method and device, computer equipment, storage medium and program product | |
| KR20110122996A (en) | Application execution device, method and computer-readable recording medium having recorded thereon | |
| JP7721673B2 (en) | Information interaction method, device and electronic device | |
| US20240070149A1 (en) | Database systems and client-side data synchronization methods | |
| CN114116111B (en) | Method, device, equipment and medium for configuring flow node and data processing | |
| Fjellheim | Over-the-air deployment of applications in multi-platform environments | |
| WO2022100261A1 (en) | Mobile terminal, server, display device, and control method for remote timed shutdown | |
| US12099491B2 (en) | Database systems and methods for client-side initiation of server-side actions |
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: 22897512 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22897512 Country of ref document: EP Kind code of ref document: A1 |