Pre-set action execution method and device, computer device and storage medium

By defining trigger scenarios and nesting sub-conditions for separate judgment in the application, the strong coupling problem of traditional preset action execution logic is solved, the decoupling of conditions and actions is achieved, and the scalability and ease of maintenance of the processing logic are improved.

CN114816588BActive Publication Date: 2026-08-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110129588.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-29
Publication Date
2026-08-25
Estimated Expiration
2041-01-29

AI Technical Summary

Technical Problem

Traditional preset action execution logic is strongly coupled, difficult to maintain, and prone to errors when conditions are judged or action results change.

Method used

By defining trigger scenarios in the application and nesting sub-conditions for separate judgment, the action execution conditions and action execution are separated, and the decorator pattern is used to decouple the conditions and actions.

Benefits of technology

It reduces the coupling between conditions and actions, increases the scalability of processing logic, and facilitates the maintenance and adjustment of action execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114816588B_ABST
    Figure CN114816588B_ABST
Patent Text Reader

Abstract

The application relates to a preset action execution method and device, computer equipment and a storage medium. The method comprises the following steps: in response to a trigger event of an application program, determining a scene corresponding to the trigger event; if the scene is a trigger scene for executing a preset action, determining a first sub-condition associated with the trigger scene; if the scene satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition, acquiring data corresponding to a data interface according to the second sub-condition; if the data satisfies the second sub-condition and a nested object of the second sub-condition is an execution method of the preset action, calling the execution method to execute the preset action. Through the preset action execution method, the separation of action execution conditions and real action execution is realized, the coupling degree between various conditions and actions is reduced, the expansibility of processing logic is increased, and the processing logic of subsequent action execution is facilitated to be maintained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, computer device, and storage medium for executing preset actions. Background Technology

[0002] With the development of information technology, various terminals are implementing more and more functions. For example, the same function can be implemented in different scenarios. Taking applications that require privacy protection as an example, in order to avoid information leakage and verify the identity of the operator, the current interface can be locked under certain conditions. This requires the user to perform a specific unlocking operation, such as entering a password, a specific key combination, or using the device's touchscreen for gesture recognition, in order to unlock the screen and achieve access control, thus ensuring information security. There are many scenarios that require screen locking, such as login operations, balance viewing operations, and fund transfer operations in financial applications. Different scenarios correspond to different combinations of screen locking conditions, and screen locking is the execution of a preset action.

[0003] In traditional technologies, the processing logic for executing preset actions centralizes all conditional checks and the execution of an action. This logic, encompassing both conditional checks and the actions being performed, exhibits strong coupling, is complex, and difficult to maintain. If the result style corresponding to any one of the conditional checks or actions changes, the entire processing logic needs to be modified, easily leading to errors. Maintaining the action execution processing logic is extremely difficult. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, computer device, and storage medium for performing preset actions to address the aforementioned technical problems.

[0005] A method for executing a preset action, the method comprising:

[0006] Respond to application trigger events and determine the scenario corresponding to the trigger event;

[0007] If the scenario is a trigger scenario for executing a preset action, then determine the first sub-condition associated with the trigger scenario;

[0008] If the scenario satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition, then obtain the data corresponding to the data interface according to the data interface corresponding to the second sub-condition.

[0009] If the data satisfies the second sub-condition and the nested object of the second sub-condition is the execution method of the preset action, then the execution method is called to execute the preset action.

[0010] A preset action execution device, the device comprising:

[0011] The operation response module is used to respond to application trigger events and determine the scenario corresponding to the trigger event;

[0012] The first sub-condition determination module is used to determine the first sub-condition associated with the triggering scenario if the scenario is a triggering scenario for executing a preset action.

[0013] The data acquisition module is used to acquire the data corresponding to the data interface based on the data interface corresponding to the second sub-condition if the scenario satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition.

[0014] The action execution module is used to execute the preset action by calling the execution method if the data satisfies the second sub-condition and the nested object of the second sub-condition is the execution method of the preset action.

[0015] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0016] Respond to application trigger events and determine the scenario corresponding to the trigger event;

[0017] If the scenario is a trigger scenario for executing a preset action, then determine the first sub-condition associated with the trigger scenario;

[0018] If the scenario satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition, then obtain the data corresponding to the data interface according to the data interface corresponding to the second sub-condition.

[0019] If the data satisfies the second sub-condition and the nested object of the second sub-condition is the execution method of the preset action, then the execution method is called to execute the preset action.

[0020] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the following steps:

[0021] Respond to application trigger events and determine the scenario corresponding to the trigger event;

[0022] If the scenario is a trigger scenario for executing a preset action, then determine the first sub-condition associated with the trigger scenario;

[0023] If the scenario satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition, then obtain the data corresponding to the data interface according to the data interface corresponding to the second sub-condition.

[0024] If the data satisfies the second sub-condition and the nested object of the second sub-condition is the execution method of the preset action, then the execution method is called to execute the preset action.

[0025] The aforementioned preset action execution method, device, computer equipment, and storage medium, through predefined trigger scenarios for executing preset actions, determine individual data separately through nested sub-conditions when the user operation corresponds to the trigger scenario. The first sub-condition determines whether the scenario meets the requirements, and the second sub-condition determines whether the data of the specified data interface meets the requirements. This achieves decompositional judgment of execution conditions. Furthermore, when the nested object of the second sub-condition is the execution method of the preset action, the preset action is executed, achieving separation of action execution conditions and actual action execution. This reduces the coupling between various conditions and actions, increases the extensibility of processing logic, and facilitates subsequent maintenance of the action execution processing logic. Attached Figure Description

[0026] Figure 1 This is an application environment diagram of a preset action execution method in one embodiment;

[0027] Figure 2 This is a flowchart illustrating a preset action execution method in one embodiment;

[0028] Figure 3 This is a flowchart illustrating the preset action execution method in another embodiment;

[0029] Figure 4 This is a flowchart illustrating the preset action execution method in another embodiment;

[0030] Figure 5 This is a flowchart illustrating the construction process of a nested conditional class in one embodiment;

[0031] Figure 6 This is a flowchart illustrating the preset action execution method in another embodiment;

[0032] Figure 7 This is a schematic diagram illustrating the relationship between abstract classes of preset action execution methods in one embodiment;

[0033] Figure 8 This is a schematic diagram of a lock screen style interface for a preset action execution method in one embodiment;

[0034] Figure 9 This is a timing diagram of a preset action execution method in one embodiment;

[0035] Figure 10 This is a structural block diagram of a preset action execution device in one embodiment;

[0036] Figure 11 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0037] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0038] The preset action execution method provided in this application can specifically be the execution of screen lock actions in financial applications with payment functions. Because such applications have high information security requirements, security is ensured through both screen lock applications in specific scenarios and cloud security. Cloud security refers to the collective term for security software, hardware, users, organizations, and secure cloud platforms based on cloud computing business models. Cloud security integrates emerging technologies and concepts such as parallel processing, grid computing, and unknown virus behavior detection. It uses a large network of clients to monitor abnormal software behavior on the network, obtains the latest information on Trojans and malware on the Internet, sends it to the server for automatic analysis and processing, and then distributes solutions for viruses and Trojans to each client.

[0039] Cloud security research primarily focuses on cloud computing security, specifically how to ensure the security of the cloud itself and various applications running on it. In this embodiment, the application can be either a cloud-based application or an application installed on a terminal.

[0040] The preset action execution method provided in this application can be published by server 104 in the form of a computer program to applications on various terminals 102, where it can be applied. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Terminal 102 can be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these. Terminal 102 and server 104 can be directly or indirectly connected via wired or wireless communication, which is not limited herein.

[0041] The preset action execution method provided in this application can be applied to, for example... Figure 1In the application environment shown, terminal 102 responds to the application's trigger event, determines the scenario corresponding to the trigger event, and if the scenario is a trigger scenario for executing a preset action, it determines the first sub-condition associated with the trigger scenario. If the scenario satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition, it obtains the data corresponding to the data interface according to the data interface corresponding to the second sub-condition. If the data satisfies the second sub-condition and the nested object of the second sub-condition is the execution method of the preset action, it calls the execution method to execute the preset action.

[0042] In one embodiment, such as Figure 2 As shown, a preset action execution method is provided, which can be applied to... Figure 1 The following steps are used as an example of the terminal in the example, including steps 202 to 208.

[0043] Step 202: Respond to the application's trigger event and determine the scenario corresponding to the trigger event.

[0044] An application is a program that needs to be installed on a terminal and can perform corresponding actions in response to user operations. An application's triggering event refers to any user action that triggers the application, which can include clicking the application icon, switching running states (foreground or background), clicking a button in the application's menu bar, logging in, switching accounts, viewing account resource data, and transferring account resource data.

[0045] Applications on a terminal are typically displayed on the terminal's desktop as application icons. Users launch applications by clicking on the application icons on the desktop and enter the corresponding display page. When the display page is shown in the foreground, it indicates that the application is running in the foreground. When the user switches to another application's foreground display, that application enters the background running state.

[0046] Different triggering events correspond to different scenarios. For example, clicking the application icon corresponds to the application starting or restarting, and switching the running state corresponds to entering the foreground running state or the background running state.

[0047] Step 204: If the scenario is a trigger scenario for executing a preset action, then determine the first sub-condition associated with the trigger scenario.

[0048] The preset action can be to display the application's lock screen, jump to a specified page of the application, or pop up a pop-up window containing preset prompts.

[0049] The trigger scenario for executing a preset action refers to a pre-configured scenario corresponding to the trigger conditions for executing the preset action. For each application's trigger event, the terminal checks whether the trigger event is a trigger scenario for executing a preset action. If it is, the terminal further determines the first sub-condition associated with the trigger scenario; otherwise, the detection ends and no further processing is performed.

[0050] The number of trigger operations corresponding to the triggering scenario of the preset action can be one or at least two. This can be set according to actual business requirements.

[0051] The conditions for triggering operations corresponding to triggering scenarios can also be nested. For example, a user's actual operation could be switching from a background running state back to a foreground running state, and then clicking to enter the transfer page. Switching from a background running state back to a foreground running state can be considered as a triggering scenario, as can entering the transfer page. In other embodiments, a triggering scenario can also be defined based on actual business needs, where both of the above operations are satisfied simultaneously.

[0052] The first sub-condition triggering a scenario association refers to the standard used to detect whether the corresponding data in that scenario meets the requirements. This first sub-condition can be either an action-based condition or a state-based condition. An action-based condition means that the condition is met upon detecting the corresponding action, such as switching accounts or logging out and then logging back in. A state-based condition refers to a state triggered by an action, or the duration of a state. For example, an application switching to background operation and running in the background for more than n (n > 0) minutes.

[0053] In one embodiment, a sub-condition is a single condition that can determine whether a certain piece of data meets the requirements. That is, a sub-condition is used only once for data judgment in a single processing step.

[0054] It should be noted that the first sub-condition associated with the triggering scenario of the preset action is only one of the prerequisites for executing the preset action. The preset action will only be executed if all the pre-configured sub-conditions are met.

[0055] Step 206: If the scenario satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition, then obtain the data corresponding to the data interface according to the data interface corresponding to the second sub-condition.

[0056] If the scenario satisfies the first sub-condition and the nested object of the first sub-condition is the execution method of the preset action, then the preset action is executed directly.

[0057] Nested conditions refer to using a previous condition as a prerequisite or post-condition for the next condition. By using nested sub-conditions, and by organizing all the conditions that trigger a preset action, conditions are decomposed into sub-conditions, allowing for independent decomposition and nesting of sub-conditions, thereby reducing the coupling between the various sub-conditions.

[0058] The data interface corresponding to the second sub-condition is used to record relevant data indicating whether the current data of the application meets the second sub-condition. The corresponding data can be obtained through the data interface. For example, if the second sub-condition is that the user is logged in, then the data interface corresponding to the second sub-condition will record the login status data. If the login status record data shows that the user is logged in, then the data indicates that the second sub-condition is met; if the login status record data shows that the user is not logged in, then the data indicates that the second sub-condition is not met.

[0059] Step 208: If the data satisfies the second sub-condition and the nested object of the second sub-condition is the execution method of the preset action, then the execution method is called to execute the preset action.

[0060] In one embodiment, whether a subcondition is nested can be determined by the input parameter of the constructor. If the input parameter is a method of the class, it indicates that the nested object is the execution method of the preset action. If the input parameter is an object containing other input parameters, it indicates that the nested object is a subcondition.

[0061] For the second sub-condition of a nested object that is an execution method of a preset action, the nested content is the execution method of the class. By calling the execution method of the class, the preset action can be executed.

[0062] It is understood that in other embodiments, if the data satisfies the second sub-condition and the nested object of the second sub-condition is the third sub-condition, then the data corresponding to the data interface corresponding to the third sub-condition is obtained. If the data satisfies the third sub-condition, then further processing is performed based on the nested object nested within the third sub-condition. The processing procedure for the nested object of the third sub-condition being a sub-condition or an execution method of a preset action is the same as the processing procedure for the nested object of the second sub-condition described above, and will not be repeated here.

[0063] The aforementioned preset action execution method, through predefined trigger scenarios for executing preset actions, determines individual data based on nested sub-conditions when the user's operation corresponds to the trigger scenario. The first sub-condition determines whether the scenario meets the requirements, and the second sub-condition determines whether the data of the specified data interface meets the requirements. This achieves decompositional judgment of execution conditions. Furthermore, when the nested object of the second sub-condition is the preset action execution method, the preset action is executed, achieving separation between action execution conditions and actual action execution. By adopting the aforementioned preset action execution method, the coupling between conditions and actions is reduced, the extensibility of processing logic is increased, and subsequent maintenance of the action execution processing logic is facilitated.

[0064] In one embodiment, such as Figure 3 As shown, the method also includes steps 302 to 304.

[0065] Step 302: Response condition configuration operation, determine the triggering scenario corresponding to the condition configuration operation and the sub-conditions for executing the preset action.

[0066] Step 304: The sub-conditions are nested to obtain the nested sub-condition result. The outermost sub-condition in the nested sub-condition result is the first sub-condition that triggers the scene association.

[0067] Condition configuration refers to the operation of setting corresponding conditions for a specific triggering scenario. In one embodiment, users can configure conditions through a preset condition configuration interface or by uploading a configuration file containing configuration data.

[0068] The conditional configuration operation includes the actual triggering scenario and the various sub-conditions that need to be met to execute the preset action. These sub-conditions include not only those corresponding to the triggering scenario but also conditions that various application settings must meet. For example, login status records must show the user is logged in, and user account registration status records must show the user is registered.

[0069] Nested arrangement refers to using the execution result corresponding to the fulfillment of the outer sub-condition as the trigger condition for the inner sub-condition. By using nested arrangement, when one sub-condition is not met, the preset action will not be executed, and there is no need to further execute checks on whether other sub-conditions are met, thus simplifying the data processing process.

[0070] By using the first sub-condition associated with the triggering scenario as the outermost sub-condition in the nested sub-condition result, the nested sub-conditions can be quickly found and the preset action can be determined when entering the triggering scenario, thus achieving a fast response to the triggering event.

[0071] In one embodiment, such as Figure 4As shown, nesting the sub-conditions to obtain the nested sub-condition result includes steps 402 to 404.

[0072] Step 402: Based on the triggering scenario and preset condition classification, determine the triggering condition and prerequisite condition in the sub-condition.

[0073] Step 404: Nest the triggering condition as the outer condition and the precondition as the inner condition to obtain the nested subcondition result.

[0074] Triggering conditions refer to the conditions associated with the actual triggering scenario. Different triggering scenarios may have different triggering conditions. Preconditions refer to the conditions associated with the user's state, including user login status and account registration status. In this embodiment, preconditions can be mandatory conditions for different triggering scenarios. By dividing conditions into triggering conditions and preconditions, efficient selection can be made when configuring conditions, and the calling order can be determined by classification, avoiding resource waste.

[0075] In this embodiment, the triggering condition is used as the outer condition and the precondition as the inner condition, which clarifies the order in which the conditions are called. It should be noted that outer and inner conditions are relative concepts; the number of triggering conditions can be greater than one, and the number of preconditions can also be greater than one. Multiple triggering conditions and multiple preconditions can be nested first, and then the nested triggering conditions and preconditions can be treated as a whole and nested again to obtain a nested arrangement with the triggering condition as the outer condition and the precondition as the inner condition.

[0076] In one embodiment, the preset action is to display a preset lock screen page. Triggering conditions include at least one of the following: the application running in the background for more than a preset runtime, the application being idle in the foreground for more than a preset idle time, restarting the application, re-login to the account, and account data operations. Preconditions include at least one of the following: the user is logged in and the user has a registered account identifier.

[0077] The lock screen is the page displayed after the screen is locked, and it's a user interface used in various operating systems. The lock screen allows users to perform specific actions to achieve access control. These actions include entering a password, using specific key combinations, or using the device's touchscreen for gesture recognition.

[0078] In one embodiment, when the application is in an abnormal state, if the current user login state is logged in, the corresponding status data is modified to "not logged in". The abnormal state can be due to network outages, server failures, data tampering, etc. In one embodiment, for abnormal application states, checking the user state is a necessary step to trigger screen locking. Once screen locking is triggered, status record data from the interface containing account status data will be retrieved. If any application exception occurs, the user's login state will be removed. In this case, if the condition is not met (i.e., the check function returns false), the preset action execution method will not be called, and the preset action, such as triggering a real screen lock, will not be executed.

[0079] In one embodiment, the preconditions include: 1. User login; 2. User account opening; the triggering conditions include: 3. The application runs in the background for more than n minutes; 4. The application is idle in the foreground for more than m minutes; 5. After clicking the application icon to re-enter the application; 6. After switching accounts or logging out and then logging back in.

[0080] Scenarios where sub-condition combinations trigger screen locking can include: 1+2+3, 1+2+4, 1+2+5, and 1+2+6. In other embodiments, different triggering conditions such as 7, 8, and 9 can be added based on the actual situation of the product; for example, before performing a money transfer operation.

[0081] In one embodiment, nested sub-conditions allow for permutations and combinations, facilitating the expansion of various lock screen scenarios. If a scenario needs to be added later, such as a logged-in and account-opened user who has been idle for more than ten minutes in the application foreground and chooses to check their balance, only one condition needs to be added: 7. Perform the balance check operation. This can be achieved using nested sub-conditions consisting of 1+2+4+7 to implement the lock screen in this scenario.

[0082] In one embodiment, such as Figure 5 As shown, the nested sub-condition result includes a nested condition class. The nested sub-condition result is obtained by arranging the triggering condition as the outer condition and the precondition as the inner condition. That is, the construction process of the nested condition class includes steps 502 to 504.

[0083] Step 502: Construct the condition class corresponding to the sub-condition, wherein the condition class corresponding to the sub-condition inherits from the same parent class, the object held by the parent class is an abstract class used to represent the preset action, and the method corresponding to the subclass of the abstract class is the execution method of the preset action.

[0084] Step 504: Take the condition class corresponding to the triggering condition as the outer condition class, the condition class corresponding to the precondition as the inner condition class, take the object of the inner condition class as the constructor parameter of the object of the outer condition class, and take the execution method of the preset action as the method corresponding to the innermost condition class to obtain the nested condition class.

[0085] A condition class is an abstract class in computer languages ​​used to represent sub-conditions. Passing an object of the inner condition class as a parameter to the constructor of an object of the outer condition class, and passing the method for executing a pre-defined action as the method corresponding to the innermost condition class, is a concrete implementation of the decorator pattern. The decorator pattern is a design pattern in object-oriented programming that dynamically adds new behaviors to a class. Functionally, passing an object of the inner condition class as a parameter to the constructor of an object of the outer condition class, and passing the method for executing a pre-defined action as the method corresponding to the innermost condition class, makes the decorator pattern more flexible than subclassing. This allows adding functionality to a specific object rather than the entire class, extending the functionality of a class at runtime, and facilitating on-demand expansion of sub-conditions. The implementation principle of the decorator pattern is: add a decorator class to wrap the original class by passing the original object as a parameter to the decorator class's constructor. The decorator class implements new functionality, but where the new functionality is not needed, it can directly call methods in the original class. The decorator class must have the same interface as the original class.

[0086] In one embodiment, taking screen lock as an example, the common characteristics of each sub-condition can first be determined: 1. Actually execute the screen lock action (doLock); 2. Check whether the screen lock condition is met (check); 3. Use an appropriate screen lock style to lock (Lock(Sceen)).

[0087] Each screen lock condition inherits from the Lock interface, and all conditions accept a Lock object as an input parameter. The upper-level condition executes its own behavior before the condition itself. For example, if a FrontLock object is created with a LoggedIn object as an input parameter, then when the FrontLock's check function is executed, the LoggedIn's check function will be executed first. FrontLock checks whether the application page has been visible on the front end for more than the specified time interval (m minutes). LoggedIn checks whether the user is already logged in.

[0088] For example, the parent class `Lock` of all conditional classes holds a `screen` object and calls the `doLock` method of `screen` to actually lock the screen. This way, each subclass of the screen-locking condition doesn't need to worry about the screen-locking behavior; it only needs to focus on implementing its own condition judgment. The conditional classes corresponding to screen-locking conditions all inherit from the `Lock` parent class and need to be constructed by passing in a `Lock` object. The behavior of the parent class is executed before its own behavior. For example, the usage of `FrontLock` is as follows:

[0089] FrontLock frontLock=new FrontLock(new OpenAccount(new LoggedIn(UserLockScreen.getInstance())));

[0090] frontLock.doLock();

[0091] The above-described use of FrontLock first generates a FrontLock object, which takes an OpenAccount object as the input parameter to its constructor. When the FrontLock's check function is executed, if the execution result meets the conditions, the doLock function of the OpenAccount object will be called. This doLock function will then call OpenAccount's own check function. If the execution result meets the conditions, the LoggedIn's check function will be called. If the execution result also meets the conditions, the actual screen subclass UserLockScreen will be called to execute the screen locking function.

[0092] In one embodiment, the method further includes: responding to a user's style configuration operation for a preset action, determining the style to be configured and the data interface corresponding to the style to be configured; and updating the data interface corresponding to the execution method of the preset action to the data interface corresponding to the style to be configured.

[0093] Specifically, the execution method of the preset action is also implemented based on abstraction. By modifying the data interface corresponding to the execution method of the preset action, the style configuration of the preset action can be realized, enabling convenient adjustment of the action style.

[0094] Taking the screen lock action as an example, you can implement the doLock method of the abstract class to create a screen lock page. If you need different screen lock styles, you only need to extend the new class to implement the interface without modifying the existing code. For example, the full-screen screen lock style (UserLockScreen) here achieves the separation of screen lock conditions and the actual screen lock, reducing coupling and increasing extensibility.

[0095] In one embodiment, the method further includes: if the scenario is a trigger scenario for executing a preset action, then determining a target nested condition class with the condition class corresponding to the trigger scenario as the outermost condition class. Each condition class in the target nested condition class is called sequentially. When the data of the interfaces corresponding to each condition class in the nested condition class all satisfy the conditions corresponding to the condition classes, the execution method of the preset action is called to execute the preset action.

[0096] By constructing nested condition classes corresponding to different triggering scenarios based on the decorator pattern, when a triggering event in the application corresponds to a specific triggering scenario, the system can sequentially call the condition classes based on the target nested condition classes corresponding to that triggering scenario. Based on the input parameters of the condition class constructor and the execution function of the condition class (such as the check function), the system determines whether to proceed to the next nested level based on the result of the execution function. When the execution functions of each condition class in the nested condition classes detect that the data of the corresponding interface meets the conditions of the condition class, the preset action is executed. When the execution functions of each condition class in the nested condition classes detect that the data of any condition class's corresponding interface does not meet the corresponding conditions, the process ends.

[0097] In one embodiment, such as Figure 6 As shown, a method for executing a preset action is provided, which includes the following steps:

[0098] Step 602: Response condition configuration operation, determine the triggering scenario corresponding to the condition configuration operation and the sub-conditions for executing the preset action.

[0099] Step 604: Based on the triggering scenario and preset condition classification, determine the triggering condition and prerequisite condition in the sub-condition.

[0100] Step 606: Construct the condition class corresponding to the sub-condition, wherein the condition class corresponding to the sub-condition inherits from the same parent class, the object held by the parent class is an abstract class used to represent the preset action, and the method corresponding to the subclass of the abstract class is the execution method of the preset action.

[0101] Step 608: Take the condition class corresponding to the triggering condition as the outer condition class, the condition class corresponding to the precondition as the inner condition class, take the object of the inner condition class as the constructor parameter of the object of the outer condition class, and take the execution method of the preset action as the method corresponding to the innermost condition class to obtain the nested condition class.

[0102] Step 610: The nested condition class is used as the result of the nested sub-conditions, and the outermost sub-condition in the nested sub-conditions is the first sub-condition that triggers the scene association.

[0103] Step 612: Respond to the application's trigger event and determine the scenario corresponding to the trigger event.

[0104] Step 614: If the scenario is a trigger scenario for executing a preset action, then determine the nested result of the target sub-conditions corresponding to the trigger scenario, and obtain the first sub-condition of the outermost layer in the nested result of the target sub-conditions.

[0105] Step 616: If the scenario satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition, then obtain the data corresponding to the data interface according to the data interface corresponding to the second sub-condition.

[0106] Step 618: If the data satisfies the second sub-condition and the nested object of the second sub-condition is the execution method of the preset action, then the execution method is called to execute the preset action.

[0107] This application also provides an application scenario for screen lock action execution in a financial application. By triggering screen lock under a set scenario, the user's information security and account asset security can be ensured. This application scenario applies the aforementioned preset action execution method. Specifically, the application of the preset action execution method in this application scenario is as follows:

[0108] First, the conditions for triggering screen lock are abstracted, extracted, and organized. Each condition is broken down into an independent sub-condition to decouple each condition into an independent condition class. An independent sub-condition means that it can be determined as yes or no based on a condition. The condition class can hold other scenario classes.

[0109] In one embodiment, the independent sub-conditions can be specifically divided into preconditions and triggering conditions. Condition classification can differentiate the invocation order and avoid resource waste. Specifically, in different screen lock conditions, preconditions are mandatory, while special conditions are optional, enabling the configuration of screen lock conditions for different triggering scenarios.

[0110] For example, the preconditions include: 1. User login; 2. User account opening; the triggering conditions include: 3. The application runs in the background for more than n minutes; 4. The application is idle in the foreground for more than m minutes; 5. After clicking the application icon to re-enter the application; 6. After switching accounts or logging out and then logging back in.

[0111] like Figure 7As shown, the abstract classes are first constructed, including ActivityLifecycle (the app's lifecycle), FrontLock, BackLock, LoggedIn, OpenAccount, RestartLock, Lock, Screen, and UserLockScreen. Each abstract class defines its attributes and executable operations. These attributes and operations include private information (represented by the "-" symbol in the diagram) and non-private information (represented by the "+" symbol in the diagram).

[0112] Among them, FrontLock and BackLock have a dependency relationship with ActivityLifecycle. The abstract classes FrontLock, BackLock, LoggedIn, OpenAccount, and RestartLock inherit from the parent class Lock to implement various lock screen styles. The lock screen action is mainly accomplished by implementing the Screen class. The parent class Lock holds the abstract class Screen, which has only one abstract method, doLock. UserLockScreen is a subclass of the abstract class Screen, and the actual lock screen behavior is implemented by the doLock function in UserLockScreen.

[0113] like Figure 8 As shown, UserLockScreen is a full-screen lock screen style, one type of lock screen style. Lock screen styles also support extensions, allowing for unlimited expansion based on product needs and actual business scenarios. The lock screen class itself is implemented based on abstraction; by implementing the doLock method of the abstract class, it can be used as a lock screen page. If different lock screen styles are needed, only a new class needs to be extended to implement the interface; no changes to existing code are required, such as the full-screen lock screen style (UserLockScreen) here. This achieves separation of the lock screen condition and the actual lock screen, reducing coupling and increasing extensibility.

[0114] Taking the triggering scenario corresponding to FrontLock as an example, the specific process implementation sequence diagram is as follows: Figure 9As shown. During application runtime, when entering the foreground, the ActivityLifecycle class calls the doLock function of the FrontLock parameter in its constructor. The doLock function calls the check function of the FrontLock to check the duration of the foreground running state. When the duration reaches the preset duration (m minutes), the check function's result is that the condition is met. The FrontLock then calls the doLock function of the OpenAccount parameter in its constructor. The doLock function calls the check function of the OpenAccount to check if the user has an account. When the check function's result is that the user has an account, the OpenAccount calls the doLock function of the LoggedIn parameter in its constructor. The doLock function calls the check function of the LoggedIn parameter to check if the user is logged in. When the check function's result is that the user is logged in, the LoggedIn parameter calls the doLock function of the UserLockScreen parameter in its constructor. The UserLockScreen then executes doLock, locking the screen in full-screen mode.

[0115] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0116] In one embodiment, such as Figure 10 As shown, a preset action execution device 1000 is provided. This device can be a software module, a hardware module, or a combination of both as part of a computer device. Specifically, the device includes: a trigger event response module 1002, a first sub-condition determination module 1004, a data acquisition module 1006, and an action execution module 1008, wherein:

[0117] The trigger event response module 1002 is used to respond to the application's trigger events and determine the scenario corresponding to the trigger event.

[0118] The first sub-condition determination module 1004 is used to determine the first sub-condition associated with the triggering scenario if the scenario is a triggering scenario for executing a preset action.

[0119] The data acquisition module 1006 is used to acquire the data corresponding to the data interface according to the data interface corresponding to the second sub-condition if the scenario satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition.

[0120] The action execution module 1008 is used to execute the preset action by calling the execution method if the data satisfies the second sub-condition and the nested object of the second sub-condition is the execution method of the preset action.

[0121] In one embodiment, the preset action execution device further includes a condition configuration module, which is used to respond to a condition configuration operation, determine the triggering scenario corresponding to the condition configuration operation and the sub-conditions for executing the preset action; and arrange the sub-conditions in a nested manner to obtain a sub-condition nesting result, wherein the outermost sub-condition in the sub-condition nesting result is the first sub-condition associated with the triggering scenario.

[0122] In one embodiment, the condition configuration module is further configured to determine the triggering condition and the precondition in the subcondition according to the triggering scenario and the preset condition classification; and to arrange the triggering condition as the outer condition and the precondition as the inner condition in a nested arrangement to obtain the nested subcondition result.

[0123] In one embodiment, the preset action is to display a preset lock screen page; the triggering conditions include at least one of the following: the application running in the background for more than a preset runtime, the application being idle in the foreground for more than a preset idle time, restarting the application, logging in to the account again, and performing account data operations; the preconditions include at least one of the following: the user is logged in and the user has a registered account identifier.

[0124] In one embodiment, the nested sub-condition result includes a nested condition class. The condition configuration module is also used to construct the condition class corresponding to the sub-condition. Based on the decorator pattern, the outermost condition class is the condition class corresponding to the triggering scenario, and the inner condition class is the object of the outer condition class as the constructor parameter of the outer condition class object. The execution method of the preset action is the method corresponding to the innermost condition class, thus obtaining the nested condition class.

[0125] In one embodiment, the condition class corresponding to the sub-condition inherits from the same parent class, the object held by the parent class is an abstract class used to represent the preset action, and the execution method of the preset action is the method corresponding to the subclass of the abstract class.

[0126] In one embodiment, the preset action execution device further includes an action style configuration module, which is used to respond to the user's style configuration operation for the preset action, determine the style to be configured and the data interface corresponding to the style to be configured, and update the data interface corresponding to the execution method of the preset action to the data interface corresponding to the style to be configured.

[0127] In one embodiment, the preset action execution device is further configured to, if the scenario is a trigger scenario for executing a preset action, determine a target nested condition class with the condition class corresponding to the trigger scenario as the outermost condition class; sequentially call each condition class in the target nested condition class; and when the data of the interfaces corresponding to each condition class in the nested condition class all meet the conditions corresponding to the condition class, call the execution method of the preset action to execute the preset action.

[0128] The aforementioned preset action execution device, through predefined trigger scenarios for executing preset actions, determines individual data based on nested sub-conditions when the user's operation corresponds to the trigger scenario. The first sub-condition checks if the scenario meets the requirements, and the second sub-condition checks if the data from the specified data interface meets the requirements. This achieves decomposed judgment of execution conditions. Furthermore, when the nested object of the second sub-condition is the execution method of the preset action, the preset action is executed, achieving separation between the action execution conditions and the actual action execution. Using this preset action execution method reduces the coupling between conditions and actions, increases the extensibility of the processing logic, and facilitates subsequent maintenance of the action execution processing logic.

[0129] For specific limitations regarding the preset action execution device, please refer to the limitations on the preset action execution method above, which will not be repeated here. Each module in the aforementioned preset action execution device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0130] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 11As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a preset action execution method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0131] Those skilled in the art will understand that Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0132] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0133] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0134] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.

[0135] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0136] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0137] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for executing a preset action, characterized in that, The method includes: Responding to the application's triggering event, determine the scenario corresponding to the triggering event; If the scenario is a trigger scenario for executing a preset action, then the first sub-condition associated with the trigger scenario is determined; the first sub-condition is the outermost sub-condition in the nested sub-condition result, which is obtained by nesting the trigger condition as the outer condition and the precondition as the inner condition; wherein, the nested arrangement means that the execution result corresponding to the outer sub-condition is used as the trigger condition of the inner sub-condition. Through the nested arrangement, when one of the sub-conditions is not satisfied, the preset action will not be executed, and there is no need to further execute the detection of whether other sub-conditions are satisfied; If the scenario satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition, then the data corresponding to the data interface is obtained according to the data interface corresponding to the second sub-condition; If the data satisfies the second sub-condition and the nested object of the second sub-condition is the execution method of the preset action, then the execution method is called to execute the preset action; When the preset action is to display a preset lock screen page and the prerequisite condition includes the user being logged in, if the application is in an abnormal state and the current user login status is logged in, the status data corresponding to the login status will be modified to not logged in.

2. The method according to claim 1, characterized in that, The method further includes: The response condition configuration operation determines the triggering scenario corresponding to the condition configuration operation and the sub-conditions for executing the preset action; The sub-conditions are nested to obtain the nested sub-condition result.

3. The method according to claim 2, characterized in that, The nesting arrangement of the sub-conditions to obtain the nested sub-condition result includes: Based on the triggering scenario and the preset condition classification, determine the triggering condition and the prerequisite condition in the sub-condition; By nesting the triggering condition as the outer condition and the precondition as the inner condition, a nested subcondition result is obtained.

4. The method according to claim 3, characterized in that, When the preset action is to display a preset lock screen page, the triggering conditions include at least one of the following: the application running in the background for more than a preset running time, the application being idle in the foreground for more than a preset idle time, restarting the application, logging in to the account again, and performing account data operations; the prerequisite conditions also include that the user has a registered account identifier.

5. The method according to claim 3, characterized in that, The nested sub-condition result includes nested condition classes; The nested arrangement of the triggering condition as the outer condition and the precondition as the inner condition to obtain the nested sub-condition result includes: Construct a condition class corresponding to the sub-condition, wherein the condition class corresponding to the sub-condition inherits from the same parent class, the object held by the parent class is an abstract class used to represent the preset action, and the method corresponding to the subclass of the abstract class is the execution method of the preset action; The outer condition class is defined as the condition class corresponding to the triggering condition, and the inner condition class is defined as the condition class corresponding to the precondition. The object of the inner condition class is used as the constructor parameter of the object of the outer condition class, and the execution method of the preset action is used as the method corresponding to the innermost condition class, thus obtaining a nested condition class.

6. The method according to claim 5, characterized in that, The method further includes: Responding to the user's style configuration operation for the preset action, determine the style to be configured and the data interface corresponding to the style to be configured; Update the data interface corresponding to the execution method of the preset action to the data interface corresponding to the style to be configured.

7. The method according to claim 5, characterized in that, The method further includes: If the scenario is a trigger scenario for executing a preset action, then the target nested condition class with the condition class corresponding to the trigger scenario as the outermost condition class is determined; Call each condition class in the target nested condition class in sequence; If the data of each interface corresponding to a condition class in the nested condition class satisfies the condition corresponding to the condition class, then the execution method of the preset action is called to execute the preset action.

8. A preset action execution device, characterized in that, The device includes: An operation response module is used to respond to triggering events from the application and determine the scenario corresponding to the triggering event; The first sub-condition determination module is used to determine the first sub-condition associated with the triggering scenario if the scenario is a triggering scenario for executing a preset action. The first sub-condition is the outermost sub-condition in the nested sub-condition result, which is obtained by nesting the triggering condition as the outer condition and the precondition as the inner condition. The nested arrangement means that the execution result corresponding to the outer sub-condition is used as the triggering condition of the inner sub-condition. By nesting, when one of the sub-conditions is not satisfied, the preset action will not be executed, and there is no need to further check whether other sub-conditions are satisfied. The data acquisition module is used to acquire data corresponding to the data interface according to the data interface corresponding to the second sub-condition if the scenario satisfies the first sub-condition and the first sub-condition is nested with a second sub-condition; An action execution module is used to call the execution method to execute the preset action if the data satisfies the second sub-condition and the nested object of the second sub-condition is an execution method of a preset action; The preset action execution device is further configured to, when the application is in an abnormal state, modify the status data corresponding to the login status to not logged in if the current user login status is already logged in, provided that the preset action is to display a preset lock screen page and the prerequisite condition includes the user being logged in.

9. The apparatus according to claim 8, characterized in that, The preset action execution device also includes a condition configuration module, which is used to respond to the condition configuration operation, determine the triggering scenario corresponding to the condition configuration operation and the sub-conditions for executing the preset action; and arrange the sub-conditions in a nested manner to obtain a sub-condition nesting result, wherein the outermost sub-condition in the sub-condition nesting result is the first sub-condition associated with the triggering scenario.

10. The apparatus according to claim 9, characterized in that, The condition configuration module is also used to determine the triggering condition and the precondition in the subcondition according to the triggering scenario and the preset condition classification; and to arrange the triggering condition as the outer condition and the precondition as the inner condition in a nested arrangement to obtain the nested subcondition result.

11. The apparatus according to claim 10, characterized in that, When the preset action is to display a preset lock screen page, the triggering conditions include at least one of the following: the application running in the background for more than a preset running time, the application being idle in the foreground for more than a preset idle time, restarting the application, logging in to the account again, and performing account data operations; the prerequisite conditions also include that the user has a registered account identifier.

12. The apparatus according to claim 10, characterized in that, The nested sub-condition result includes a nested condition class. The condition configuration module is also used to construct the condition class corresponding to the sub-condition. Based on the decorator pattern, the outermost condition class is the condition class corresponding to the triggering scenario, and the inner condition class is the object of the outer condition class as the constructor parameter of the outer condition class object. The execution method of the preset action is the method corresponding to the innermost condition class, thus obtaining the nested condition class.

13. The apparatus according to claim 12, characterized in that, The condition classes corresponding to the sub-conditions inherit from the same parent class. The parent class holds an object that represents an abstract class for a preset action. The execution method of the preset action is the method corresponding to the subclass of the abstract class.

14. The apparatus according to claim 13, characterized in that, The preset action execution device also includes an action style configuration module, which is used to respond to the user's style configuration operation for the preset action, determine the style to be configured and the data interface corresponding to the style to be configured, and update the data interface corresponding to the execution method of the preset action to the data interface corresponding to the style to be configured.

15. The apparatus according to claim 13, characterized in that, The preset action execution device is further configured to, if the scenario is a trigger scenario for executing a preset action, determine a target nested condition class with the condition class corresponding to the trigger scenario as the outermost condition class; sequentially call each condition class in the target nested condition class; and when the data of the interfaces corresponding to each condition class in the nested condition class all meet the conditions corresponding to the condition class, call the execution method of the preset action to execute the preset action.

16. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

17. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

18. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Event linkage processing method, device and system, electronic equipment and storage medium

    CN111177214A