Method, device, computer device and readable storage medium for preventing repeated clicking

By listening to and recording the timestamps of click signals, and using the click stack and trigger stack to determine the click time difference, duplicate click signals can be identified and intercepted. This solves the problem of server blocking and crashes caused by multiple clicks by users, ensuring the reliability of click events and the stability of the server.

CN112306805BActive Publication Date: 2026-01-23PING AN PAY ELECTRONIC PAYMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011192983.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-30
Publication Date
2026-01-23
Estimated Expiration
2040-10-30

AI Technical Summary

Technical Problem

Multiple button clicks by users can cause the server's click event queue and threads to become blocked, delayed, or even crash.

Method used

By listening to click signals on web pages from the user's client, recording click timestamps, and using click stacks and trigger stacks to determine the click time difference, duplicate click signals can be identified, and click events that have not exceeded their duration can be intercepted.

Benefits of technology

This avoids server congestion and crashes caused by repeated click events within a short period of time, ensuring the reliability of click events and the stability of the server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112306805B_ABST
    Figure CN112306805B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of software monitoring, and discloses a method and device for preventing repeated clicking, computer equipment and a readable storage medium, which comprise the following steps: recording a clicking timestamp for generating a clicking signal time; obtaining a clicking event corresponding to the clicking signal and a clicking stack corresponding to the clicking event; extracting a historical clicking timestamp located at the top of the clicking stack, calculating a clicking time difference between the clicking timestamp and the historical clicking timestamp; judging whether the clicking time difference exceeds a preset clicking duration; if the clicking duration is exceeded, executing the clicking event; and if the clicking duration is not exceeded, intercepting the clicking event. The application avoids the situation that the queue and thread for executing the clicking event are blocked, delayed or even cause the server to crash due to the repeated execution of the clicking event in a short time. The application also relates to the field of blockchains, and a key event set obtained by traversing the keys and clicking events of a webpage can be uploaded into a blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software monitoring technology, and in particular to a method, apparatus, computer device, and readable storage medium for preventing duplicate clicks. Background Technology

[0002] Web pages are the basic elements that make up a website and serve as a platform for various website applications. Web page designs typically use buttons to navigate to other pages or provide users with relevant information.

[0003] However, the inventors discovered that when a user triggers a click event corresponding to a button by clicking the button, the click event may fail to redirect the page or provide the user with the corresponding information due to the limitations of the server's computing power. In this case, the user will click the button multiple times to repeatedly trigger the click event, which will further burden the server, which is already under heavy computing load, causing the queue and threads for executing click events on the server to be blocked, delayed, or even cause the server to crash. Summary of the Invention

[0004] The purpose of this invention is to provide a method, apparatus, computer device, and readable storage medium for preventing repeated clicks, in order to solve the problem in the prior art where multiple clicks by users cause the queue and threads of the server to be blocked or delayed, or even cause the server to crash.

[0005] To achieve the above objectives, the present invention provides a method for preventing duplicate clicks, comprising:

[0006] A pre-configured click processing module monitors click signals generated by users clicking buttons on web pages and records the click timestamp of the time the click signal is generated; wherein, the click signal reflects the encoding of the click button and the click timestamp that reflects the time the button is clicked;

[0007] The click processing module is invoked to obtain the click event corresponding to the click signal, and the click stack corresponding to the click event is obtained.

[0008] Determine if the click stack is empty; if the click stack is empty, determine if the click signal is an execution signal, execute the click event, and save the click timestamp as a historical click timestamp to the click stack; if the click stack is not empty, extract the historical click timestamp at the top of the click stack, and calculate the click time difference between the click timestamp and the historical click timestamp.

[0009] Determine whether the click time difference exceeds a preset click duration; if it exceeds the click duration, determine that the click signal is an execution signal and execute the click event, and set the click timestamp as a historical click timestamp and save it to the click stack; if it does not exceed the click duration, determine that the click signal is a repeat signal and intercept the click event.

[0010] In the above scheme, before the step of listening to the click signal generated by the user clicking a button on the web page through a preset click processing module, the method further includes:

[0011] The page loading signal generated when the web page is loaded is triggered, and the key events are obtained by traversing the keys and click events of the web page.

[0012] The system creates a click processing module for the web page based on the set of key events, and constructs a click stack and a trigger stack corresponding to each click event in the set of key events. The click processing module monitors and records the click timestamp when a key is clicked and a click signal is generated, identifies the click event corresponding to the key and forwards the click signal to the click event, and monitors and records the trigger timestamp of the time when the click event is executed based on the click signal. The click stack stores the click timestamp of the click signal received by the click event, and the trigger stack stores the trigger timestamp generated when the corresponding click event is executed.

[0013] In the above scheme, after obtaining the key event set by traversing the keys and click events of the web page, the method further includes:

[0014] Delete the repeatedly clickable keys and their click events from the set of key events;

[0015] After deleting the repeatedly clickable keys and their click events from the key event set, the method further includes:

[0016] The set of key events is uploaded to the blockchain.

[0017] In the above scheme, the step of deleting repeatedly clickable keys and their click events from the key event set includes:

[0018] The inheritance keywords of each click event in the key event set are identified using the developer debugging tool, and click events with inheritance keywords are set as events to be identified.

[0019] Determine whether the class inherited by the event to be identified belongs to a preset set of repeatable base classes, wherein the set of repeatable base classes contains at least one class;

[0020] If so, the event to be identified is determined to be a repeatable event, and the repeatable event is removed from the key event set;

[0021] If not, the event to be identified is restored to a click event and stored in the key event set.

[0022] In the above scheme, after recording the click timestamp of the time when the click signal is generated, the method further includes:

[0023] The click processing module is invoked to obtain the click event corresponding to the click signal and to obtain the trigger timestamp corresponding to the click event. The trigger timestamp is a timestamp reflecting the time when the click event is executed according to the click signal.

[0024] In the above scheme, after obtaining the trigger timestamp corresponding to the click event, the method further includes:

[0025] Determine whether the trigger stack is empty;

[0026] If so, the click signal is determined to be an execution signal and the click event is executed. The time of execution of the click event is monitored by the click processing module and set as the trigger timestamp. The trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack.

[0027] If not, extract the top-ranked historical trigger timestamp from the trigger stack and calculate the trigger time difference between the click timestamp of the click signal and the top-ranked historical trigger timestamp.

[0028] In the above scheme, after calculating the trigger time difference between the click timestamp of the click signal and the pinned historical trigger timestamp, the method further includes:

[0029] Determine whether the trigger time difference exceeds the preset trigger duration;

[0030] If the trigger duration is exceeded, the click signal is determined to be an execution signal and the click event is executed. The time of executing the click event is monitored by the click processing module and set as the trigger timestamp. The trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack.

[0031] If the trigger duration has not been exceeded, the click event is intercepted and terminated to avoid repeated execution of the click event.

[0032] To achieve the above objectives, the present invention also provides a device for preventing repeated clicks, comprising:

[0033] The monitoring and recording module is used to monitor the click signals generated by the user clicking a button on a web page through a preset click processing module, and record the click timestamp of the time when the click signal is generated; wherein, the click signal reflects the encoding of the click button and the click timestamp reflecting the time when the button is clicked;

[0034] The click matching module is used to call the click processing module to obtain the click event corresponding to the click signal, and to obtain the click stack corresponding to the click event;

[0035] The click stack management module is used to determine whether the click stack is empty; if the click stack is empty, the click signal is determined to be an execution signal, and the click event is executed and the click timestamp is set as a historical click timestamp and saved to the click stack; if the click stack is not empty, the historical click timestamp located at the top of the click stack is extracted, and the click time difference between the click timestamp and the historical click timestamp is calculated.

[0036] The click determination module is used to determine whether the click time difference exceeds a preset click duration; if it exceeds the click duration, the click signal is determined to be an execution signal and the click event is executed, and the click timestamp is set as a historical click timestamp and saved to the click stack; if it does not exceed the click duration, the click signal is determined to be a repeat signal and the click event is intercepted.

[0037] To achieve the above objectives, the present invention also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor of the computer device executes the computer program, it implements the steps of the above-described method for preventing duplicate clicks.

[0038] To achieve the above objectives, the present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program stored in the storage medium, when executed by a processor, implements the steps of the above-described method for preventing duplicate clicks.

[0039] The present invention provides a method, apparatus, computer device, and readable storage medium for preventing repeated clicks. This involves monitoring click signals generated by a user clicking a button on a webpage, recording the timestamp of the click signal generation, and obtaining the click event corresponding to the encoding. By determining whether the click time difference exceeds the click duration, it identifies whether the user's click operation is due to a prolonged period without page navigation or feedback, ensuring the reliability of page click event execution. If the click duration is not exceeded, the click event is intercepted to prevent the server from experiencing blockage, delay, or even server crash due to repeated click events within a short period. Attached Figure Description

[0040] Figure 1 This is a flowchart of a first embodiment of the method for preventing duplicate clicks according to the present invention;

[0041] Figure 2 This is a schematic diagram illustrating the environmental application of the method for preventing duplicate clicks in Embodiment 2 of the present invention;

[0042] Figure 3 This is a flowchart illustrating the specific method for preventing duplicate clicks in Embodiment 2 of the present invention.

[0043] Figure 4 This is a schematic diagram of the program modules of Embodiment 3 of the device for preventing repeated clicks of the present invention;

[0044] Figure 5 This is a schematic diagram of the hardware structure of the computer device in Embodiment 4 of the present invention. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.

[0046] This invention provides a method, apparatus, computer device, and readable storage medium for preventing duplicate clicks, applicable to the field of software monitoring technology. It provides a method for preventing duplicate clicks based on a listening and recording module, a click matching module, a click stack management module, and a click judgment module. This invention uses a pre-set click processing module to listen for click signals generated by users clicking buttons on a webpage and records the click timestamp of the generated click signal. It then calls the click processing module to obtain the click event corresponding to the click signal and the click stack corresponding to the click event. It determines whether the click stack is empty. If the click stack is not empty, it extracts the historical click timestamp at the top of the stack and calculates the click time difference between the original click timestamp and the historical click timestamp. It determines whether the click time difference exceeds a pre-set click duration. If it exceeds the click duration, it determines the click signal as an execution signal and executes the click event, and sets the click timestamp as a historical click timestamp and saves it to the click stack. If it does not exceed the click duration, it determines the click signal as a duplicate signal and intercepts the click event.

[0047] Example 1:

[0048] Please see Figure 1 One method for preventing duplicate clicks in this embodiment includes:

[0049] S103: The preset click processing module listens for click signals generated by the user clicking a button on the web page, and records the click timestamp of the time the click signal is generated; wherein, the click signal reflects the encoding of the click button and the click timestamp used to reflect the time the button is clicked;

[0050] S104: Call the click processing module to obtain the click event corresponding to the click signal, and obtain the click stack corresponding to the click event;

[0051] S106: Determine whether the click stack is empty; if the click stack is empty, determine that the click signal is an execution signal, execute the click event, and save the click timestamp as a historical click timestamp to the click stack; if the click stack is not empty, extract the historical click timestamp located at the top of the click stack, and calculate the click time difference between the click timestamp and the historical click timestamp.

[0052] S107: Determine whether the click time difference exceeds a preset click duration; if it exceeds the click duration, determine that the click signal is an execution signal and execute the click event, and set the click timestamp as a historical click timestamp and save it to the click stack; if it does not exceed the click duration, determine that the click signal is a repeat signal and intercept the click event.

[0053] In this embodiment, the click processing module listens to the click signals generated by the user clicking a button on the web page and records the click timestamp of the time the click signal is generated, so as to ensure that the time of the click signal generation can be obtained in a timely manner.

[0054] By calling the click processing module and obtaining the code of the clicked button in the click signal, the click event corresponding to the code is obtained. At the same time, the click stack corresponding to the click event is also obtained to determine whether the click signal is generated by repeated clicks in a short period of time from the dimension of the frequency of user button clicks, so as to ensure that the click signal can accurately trigger the corresponding click event.

[0055] The click signal is identified by determining whether the click stack is empty. If the click stack is empty, the click signal is determined to be generated by the user's first click on the button, and thus it is identified as an execution signal. If the click stack is not empty, the click signal is determined to be generated by the user repeatedly clicking the button. Then, the historical click timestamp at the top of the click stack is extracted, and the click time difference between the click timestamp and the historical click timestamp is calculated to identify whether the click signal is generated by the user's first click on the button.

[0056] The identification is performed by judging whether the click time difference exceeds the click duration. If it exceeds the click duration, the click signal is determined not to be a repeated click by the user in a short period of time, but a click operation performed by the user again to execute the click event because the page has not redirected or provided feedback for a long time, thus ensuring the reliability of the page's click event execution. If it does not exceed the click duration, the click signal is determined to be a repeated click by the user in a short period of time, and the click event is intercepted to avoid the server from being blocked or delayed due to repeated execution of the click event in a short period of time, or even causing the server to crash.

[0057] Example 2:

[0058] This embodiment is a specific application scenario of the above embodiment one. Through this embodiment, the method provided by the present invention can be explained more clearly and specifically.

[0059] The following example illustrates the method provided in this embodiment by calculating the click time difference between a click timestamp and a historical click timestamp in a server running a method to prevent duplicate clicks, determining whether the click time difference exceeds a preset click duration, and then executing or intercepting the click event. It should be noted that this embodiment is merely exemplary and does not limit the scope of protection of this invention.

[0060] Figure 2 The illustration shows an environmental application diagram of the method for preventing duplicate clicks according to Embodiment 2 of this application.

[0061] In an exemplary embodiment, the server 2, where the anti-duplicate-click method is located, is connected to the user terminal 4 via network 3. The server 2 can provide services through one or more networks 3, which may include various network devices such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or more. Network 3 may include physical links, such as coaxial cable links, twisted-pair cable links, fiber optic links, combinations thereof, and / or the like. Network 3 may include wireless links, such as cellular links, satellite links, Wi-Fi links, and / or the like. The user terminal 4 may be a smartphone, tablet, laptop, desktop computer, or other computer device.

[0062] Figure 3 This is a flowchart of a method for preventing duplicate clicks according to an embodiment of the present invention. The method specifically includes steps S200 to S210.

[0063] S200: A page loading signal generated when loading a web page is triggered. The key events are obtained by traversing the keys and click events of the web page.

[0064] To centrally control the buttons on a webpage and avoid code redundancy caused by setting a separate anti-repeated-click code for each button, this step, upon monitoring or receiving a page loading signal generated by the server loading the webpage, retrieves the page code from the webpage based on the page loading signal, and then uses developer debugging tools to traverse the button attributes and their click events within the page code. The page code is a computer program that defines and executes the webpage; the button attributes are attribute codes in the page code used to define the buttons on the webpage; and the click events are event codes in the code page corresponding to the button attributes, triggered by click signals generated based on the button attributes.

[0065] In this embodiment, the page code can be HTML code, Java code, Android code, or JavaScript code. The developer debugging tool iterates through the character codes containing the character "button" in the page code and sets these character codes as button attributes. The developer debugging tool then identifies the `event.keyCode` and `event.which` events corresponding to the button attributes to obtain the click events corresponding to the button attributes.

[0066] It should be noted that the developer debugging tools mentioned are computer tools used for developing and managing web pages, such as ADB, TraceView, Logcat, and Dev Tools. Since developer debugging tools are existing technology, and the technical problem addressed in this step is how to identify buttons and their click events on a web page, the usage and operating principles of developer debugging tools will not be elaborated upon here.

[0067] S201: Delete the repeatedly clickable keys and their click events from the set of key events.

[0068] To prevent unnecessary repeated clicks from being blocked on a webpage, thus preventing multiple click events from being executed, this step identifies repeatedly clickable buttons and their corresponding click events in the button event set and deletes them. This ensures that buttons with high precision requirements can repeatedly trigger their corresponding click events when clicked, thereby satisfying the diversity of button management on webpages.

[0069] In a preferred embodiment, the step of deleting repeatedly clickable keys and their click events from the key event set includes:

[0070] S11: Identify the inheritance keywords of each click event in the key event set using the developer debugging tool, and set the click events with inheritance keywords as events to be identified.

[0071] In this step, the inheritance keyword is "extends". Additionally, by adding a "to be identified" tag to the click event, the click event containing the keyword can be designated as a "to be identified" event.

[0072] S12: Determine whether the class inherited by the event to be identified belongs to a preset set of repeatable base classes, wherein the set of repeatable base classes contains at least one class.

[0073] S13: If so, the event to be identified is determined to be a repeatable event, and the repeatable event is deleted from the key event set.

[0074] In this step, the technical effect of determining the event to be identified as a repeatable event can be achieved by changing the "to be identified" label in the event to be identified to the "repeatable" label.

[0075] S14: If not, restore the event to be identified as a click event and save it in the key event set.

[0076] In this step, the technical effect of restoring the event to be identified to the click time can be achieved by deleting the "to be identified" tag from the event to be identified.

[0077] For example, suppose the collection of repeatable base classes contains a Cleanser class, and the code for the click event is:

[0078] public class Detergent extends Cleanser{

[0079] }

[0080] Therefore, since the code contains the "extends" inheritance keyword, the click event is set as the event to be recognized;

[0081] Furthermore, since "Detergent extends Cleanser" indicates that Detergent inherits from the Cleanser class, and the Cleanser class belongs to the set of repeatable base classes, the time to be identified is set as a repeatable event.

[0082] Optionally, after deleting the repeatedly clickable keys and their click events from the key event set, the method further includes:

[0083] The set of key events is uploaded to the blockchain.

[0084] It should be noted that the digest information is obtained based on the set of key events. Specifically, the digest information is obtained by hashing the set of key events, such as using the SHA256 algorithm. Uploading the digest information to the blockchain ensures its security and fairness and transparency to users. User devices can download the digest information from the blockchain to verify whether the set of key events has been tampered with. The blockchain referred to in this example is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. A blockchain is essentially a decentralized database, a chain of data blocks linked using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer.

[0085] S202: Create a click processing module for the web page based on the set of key events, and construct a click stack and a trigger stack corresponding to each click event in the set of key events; wherein, the click processing module is used to monitor and record the click timestamp when a key is clicked and a click signal is generated, identify the click event corresponding to the key and forward the click signal to the click event, and monitor and record the trigger timestamp of the time when the click event is executed according to the click signal; the click stack is used to store the click timestamp of the click signal received by the click event, and the trigger stack is used to store the trigger timestamp generated when the corresponding click event is executed.

[0086] To avoid setting up a separate anti-repeated click code for each button, which would lead to code redundancy, and to enable the determination of whether the current user's click behavior on the button is intended to execute a click event or is a repeated click behavior caused by anxiety or accidental operation based on the click timestamp and trigger timestamp.

[0087] This step constructs a click processing module through a set of key events to monitor and record click timestamps and trigger timestamps, and to configure the association between keys and click events. It integrates the relationship between keys and click events in the web page by traversing the set of key events generated by the page code, managing the click timestamps of each click event when it receives a click signal, and managing the trigger timestamps generated when each click event is executed.

[0088] Therefore, only one click processing module is needed to manage the duplicate click prevention of buttons and their click events on the web page, without having to set up a set of duplicate click prevention code for each button. This not only reduces code redundancy, but also effectively utilizes the click stack and trigger stack to judge the behavior used to click the button.

[0089] Optionally, after the step of creating the click processing module for the web page based on the set of key events, the method further includes:

[0090] Construct click variables and trigger variables corresponding to each click event in the set of key events; wherein, the click variables are used to store the click timestamp of the click signal received by the click event, and the trigger variables are used to store the trigger timestamp generated when the corresponding click event is executed.

[0091] In this step, a register module is created in the server running the method to prevent duplicate clicks, which serves as the carrier for setting the click variables and trigger variables.

[0092] S203: The preset click processing module listens for click signals generated by the user clicking a button on the web page, records the click timestamp of the time the click signal is generated, and then executes step S204 or step S205; wherein, the click signal reflects the encoding of the click button and the click timestamp used to reflect the time the button is clicked.

[0093] To ensure timely acquisition of the click signal generation time, this step uses the click processing module to monitor the click signals generated by the user clicking buttons on the web page and records the click timestamp of the time the click signal was generated.

[0094] In this embodiment, the click processing module uses the onclick event to listen for the user's click behavior on the button.

[0095] S204: Call the click processing module to obtain the click event corresponding to the click signal and obtain the click stack corresponding to the click event, and then execute step S206.

[0096] To ensure that the click signal accurately triggers the corresponding click event, this step calls the click processing module and obtains the click event corresponding to the keystroke encoding in the click signal. Simultaneously, it obtains the click stack corresponding to this click event to determine whether the click signal was generated by repeated clicks within a short period, based on the frequency of user keystrokes. The data operations in the click stack are last-in, first-out (LIFO).

[0097] In this embodiment, the click timestamp is set as a local variable so that the value of the click timestamp changes as the user clicks the button.

[0098] Optionally, after calling the click processing module to obtain the click event corresponding to the click signal, it can also be:

[0099] Obtain the click variable corresponding to the click event.

[0100] S205: Call the click processing module to obtain the click event corresponding to the click signal, and obtain the trigger timestamp corresponding to the click event. The trigger timestamp reflects the time when the click event is executed according to the click signal. Then execute step S208.

[0101] To ensure that the click signal accurately triggers the corresponding click event, this step calls the click processing module and obtains the click time corresponding to the code of the clicked button in the click signal. Simultaneously, it obtains the trigger stack corresponding to the click event to determine whether the click signal triggered the click event multiple times within a short period, based on the frequency of click event execution. The data operations in the trigger stack are performed in a last-in, first-out (LIFO) manner.

[0102] In this embodiment, the trigger timestamp is set as a local variable so that the value of the trigger timestamp changes as the user clicks the button.

[0103] S206: Determine whether the click stack is empty;

[0104] If the click stack is empty, the click signal is determined to be an execution signal, and the click event is executed and the click timestamp is set as a historical click timestamp and saved to the click stack;

[0105] If the click stack is not empty, extract the historical click timestamp at the top of the click stack, calculate the click time difference between the click timestamp and the historical click timestamp, and then execute step S207.

[0106] To identify whether a click signal was generated by the user's first click on the button, this step identifies the click signal by determining whether the click stack is empty. If the click stack is empty, the click signal is determined to be generated by the user's first click on the button, and is thus identified as an execution signal. If the click stack is not empty, the click signal is determined to be generated by the user repeatedly clicking the button, and the historical click timestamp at the top of the click stack is extracted, and the click time difference between the click timestamp and the historical click timestamp is calculated.

[0107] The click time difference reflects the time difference between when a user clicks a button. The length of this time difference helps to reflect whether the user's behavior is repeated clicking due to anxiety or repeated clicking due to the page not redirecting or providing feedback for a long time. This indicates that the click signal failed to successfully trigger the click event, and further suggests that there was a blockage or error in the process of triggering the corresponding click event based on the click signal.

[0108] Optionally, after obtaining the click variable corresponding to the click event, the method further includes:

[0109] Determine whether the value of the clicked variable is empty;

[0110] If the value of the click variable is empty, then the click signal is determined to be an execution signal, and the click event is executed and the click variable is replaced with the click timestamp;

[0111] If the value of the click variable is not empty, then calculate the click time difference between the click timestamp and the click variable.

[0112] In this embodiment, S206 is in Figure 3 The following labels will be used for display:

[0113] S61: Determine whether the click stack is empty;

[0114] S62: If the click stack is empty, then determine that the click signal is an execution signal, execute the click event, and save the click timestamp as a historical click timestamp to the click stack;

[0115] S63: If the click stack is not empty, extract the historical click timestamp located at the top of the click stack, calculate the click time difference between the click timestamp and the historical click timestamp, and then execute step S207.

[0116] S207: Determine whether the click time difference exceeds the preset click duration;

[0117] If the click duration is exceeded, the click signal is determined to be an execution signal and the click event is executed, and the click timestamp is set as a historical click timestamp and saved to the click stack;

[0118] If the click duration is not exceeded, the click signal is determined to be a repeated signal and the click event is blocked.

[0119] To prevent repeated clicks by users within a short period from causing the server to repeatedly execute click events, which could lead to server congestion, delays, or even crashes, this step identifies the click by determining whether the click time difference exceeds the click duration. If it does, the click signal is determined to be not a repeated click by the user within a short period, but rather a click operation performed by the user to re-execute the click event because the page has not redirected or provided feedback for an extended period, thus ensuring the reliability of the page's click event execution.

[0120] If the click duration is not exceeded, the click signal is determined to be a repeated click by the user within a short period of time, and the click event is intercepted to avoid the server from being blocked or delayed due to repeated execution of the click event in a short period of time, which could lead to the queue and thread of the click event being blocked, delayed, or even the server crashing.

[0121] In this embodiment, the click duration is used as a global variable to ensure that the click processing module determines the click signal based on a fixed click duration. At the same time, the historical click timestamps in the click stack are used as global variables to fix the time when the button is clicked, which helps to compare the time difference between the current time of the button click and the time of the most recent click.

[0122] Furthermore, this embodiment employs an event dispatch mechanism to execute click events and an event interception mechanism to intercept the click events.

[0123] It should be noted that the event distribution mechanism employs the following method:

[0124] public booleandispatchTouchEvent(MotionEventev).

[0125] The event interception mechanism employs the following method:

[0126] public booleanonInterceptTouchEvent(MotionEventev).

[0127] Optionally, after calculating the click time difference between the click timestamp and the historical click timestamp, the method further includes:

[0128] Determine whether the click time difference exceeds the preset click duration;

[0129] If the click duration is exceeded, the click signal is determined to be an execution signal and the click event is executed, and the value of the click variable is replaced with the click timestamp;

[0130] If the click duration is not exceeded, the click signal is determined to be a repeated signal and the click event is blocked.

[0131] In this embodiment, S207 is in Figure 3 The following labels are used to display the information:

[0132] S71: Determine whether the click time difference exceeds the preset click duration;

[0133] S72: If the click duration is exceeded, the click signal is determined to be an execution signal and the click event is executed, and the click timestamp is set as a historical click timestamp and saved to the click stack;

[0134] S73: If the click duration has not been exceeded, the click signal is determined to be a repeat signal and the click event is intercepted.

[0135] S208: Determine whether the trigger stack is empty;

[0136] If so, the click signal is determined to be an execution signal and the click event is executed. The time of execution of the click event is monitored by the click processing module and set as the trigger timestamp. The trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack.

[0137] If not, extract the top-ranked historical trigger timestamp from the trigger stack, calculate the trigger time difference between the click timestamp of the click signal and the top-ranked historical trigger timestamp, and then execute step S209.

[0138] To identify whether a click signal is the first trigger of a click event, this step identifies the click signal by checking if the trigger stack is empty. If the trigger stack is empty, the click signal is determined to be generated by the user's first click on the button, and is thus identified as an execution signal. The click processing module monitors the execution time of the click event and sets this time as a trigger timestamp; the trigger timestamp is then set as a historical trigger timestamp and saved to the trigger stack. If the trigger stack is not empty, the click signal is determined to be generated by the user repeatedly clicking the button, and the historical trigger timestamp at the top of the trigger stack is extracted, and the trigger time difference between the historical trigger timestamp and the click timestamp is calculated.

[0139] Optionally, determine whether the value of the trigger variable is null;

[0140] If so, the click signal is determined to be an execution signal and the click event is executed. The time of execution of the click event is monitored by the click processing module and set as the trigger timestamp. The value of the trigger variable is replaced with the trigger timestamp.

[0141] If not, calculate the trigger time difference between the click timestamp of the click signal and the trigger variable.

[0142] In this embodiment, S208 is in Figure 3 The following labels are used to display the information:

[0143] S81: Determine whether the trigger stack is empty;

[0144] S82: If so, determine that the click signal is an execution signal and execute the click event, and monitor the time of executing the click event through the click processing module and set the time as a trigger timestamp; save the trigger timestamp as a historical trigger timestamp to the trigger stack;

[0145] S83: If not, extract the top historical trigger timestamp in the trigger stack, calculate the trigger time difference between the click timestamp of the click signal and the top historical trigger timestamp, and then execute step S209.

[0146] S209: Determine whether the trigger time difference exceeds the preset trigger duration;

[0147] If the trigger duration is exceeded, the click signal is determined to be an execution signal and the click event is executed. The time of executing the click event is monitored by the click processing module and set as the trigger timestamp. The trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack.

[0148] If the trigger duration has not been exceeded, the click event is intercepted and terminated to avoid repeated execution of the click event.

[0149] To identify whether a blockage or error occurred during the execution of a click event, it is determined whether the trigger time difference exceeds the trigger duration. The trigger time difference, from the perspective of triggering the corresponding click event after the user clicks a button, reflects the time difference between the click timestamp of the user clicking the button and the trigger timestamp of the most recent click event. Since the trigger timestamp reflects the time node when the click event was successfully triggered, if the click timestamp and the top historical trigger timestamp in the trigger stack exceed the trigger duration, it indicates that even if the click event was successfully triggered upon receiving the click signal, the page did not redirect or provide corresponding information. This reflects that the click event was not successfully completed, suggesting that a blockage or error may have occurred during the execution of the click event.

[0150] In this embodiment, the trigger duration is used as a global variable to ensure that the trigger processing module determines the trigger signal based on the fixed trigger duration. At the same time, the historical trigger timestamps in the trigger stack are used as global variables to fix the time when the button is triggered, which helps to compare the time difference between the current time the button is clicked and the time when the corresponding click event was most recently triggered.

[0151] In a preferred embodiment, after setting the trigger timestamp as a historical trigger timestamp and saving it to the trigger stack, the method further includes:

[0152] The click event is sent to the control terminal.

[0153] Since click events may encounter blocking or errors during execution, they are sent to the control panel so that developers can handle erroneous click events in a timely manner.

[0154] Furthermore, this embodiment employs an event dispatch mechanism to execute click events and an event interception mechanism to intercept the click events.

[0155] It should be noted that the event distribution mechanism employs the following method:

[0156] public booleandispatchTouchEvent(MotionEventev).

[0157] The event interception mechanism employs the following method:

[0158] public booleanonInterceptTouchEvent(MotionEventev).

[0159] Optionally, after calculating the trigger time difference between the click timestamp of the click signal and the trigger variable, the method further includes:

[0160] Determine whether the trigger time difference exceeds the preset trigger duration;

[0161] If the trigger duration is exceeded, the click signal is determined to be an execution signal and the click event is executed. The time of execution of the click event is monitored by the click processing module and set as the trigger timestamp. The value of the trigger variable is replaced with the trigger timestamp.

[0162] If the trigger duration has not been exceeded, the click event is intercepted and terminated to avoid repeated execution of the click event.

[0163] In this embodiment, S209 is in Figure 3 The following labels are used to display the information:

[0164] S91: Determine whether the trigger time difference exceeds the preset trigger duration;

[0165] S92: If the trigger duration is exceeded, the click signal is determined to be an execution signal and the click event is executed. The time of executing the click event is monitored by the click processing module and the time is set as the trigger timestamp. The trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack.

[0166] S93: If the trigger duration has not been exceeded, the click event is intercepted and terminated to avoid repeated execution of the click event.

[0167] S210: Traverse each click stack and trigger stack in the click processing module;

[0168] Identify click stacks where the number of historical click timestamps exceeds a preset click threshold, and send the click events corresponding to the click stacks to the control terminal.

[0169] The system identifies trigger stacks where the number of historical trigger timestamps exceeds a preset trigger threshold and sends the click time corresponding to the trigger stack to the control terminal.

[0170] In this step, for click stacks where the number of historical click timestamps exceeds the click threshold, it indicates that the click event corresponding to that click stack is being clicked frequently, which means that the click signal may not be able to trigger the click event execution. Therefore, the click event is sent to the control end so that the developers can fix the click event.

[0171] For a trigger stack where the number of historical trigger timestamps exceeds the trigger threshold, it indicates that the click event corresponding to the trigger stack is being triggered frequently. This means that even if the click event is executed frequently, it still cannot jump or provide timely feedback. Therefore, the click event is sent to the control end so that the developers can fix it.

[0172] Example 3:

[0173] Please see Figure 4 The device 1 for preventing repeated clicks in this embodiment includes:

[0174] The listening and recording module 13 is used to listen to the click signals generated by the user on the web page by clicking a button through a preset click processing module, and record the click timestamp of the time when the click signal is generated; wherein, the click signal reflects the encoding of the click button and the click timestamp used to reflect the time when the button is clicked;

[0175] Click matching module 14 is used to call the click processing module to obtain the click event corresponding to the click signal, and to obtain the click stack corresponding to the click event;

[0176] The click stack management module 16 is used to determine whether the click stack is empty; if the click stack is empty, the click signal is determined to be an execution signal, and the click event is executed and the click timestamp is set as a historical click timestamp and saved to the click stack; if the click stack is not empty, the historical click timestamp located at the top of the click stack is extracted, and the click time difference between the click timestamp and the historical click timestamp is calculated.

[0177] The click judgment module 17 is used to determine whether the click time difference exceeds a preset click duration; if it exceeds the click duration, the click signal is determined to be an execution signal and the click event is executed, and the click timestamp is set as a historical click timestamp and saved to the click stack; if it does not exceed the click duration, the click signal is determined to be a repeat signal and the click event is intercepted.

[0178] Optionally, the anti-repeated-click device 1 further includes:

[0179] The trigger traversal module 10 is used to trigger the page loading signal generated when loading a network page, and traverse the buttons and their click events on the network page to obtain a set of button events.

[0180] Optionally, the anti-repeated-click device 1 further includes:

[0181] The deletion module 11 is used to delete repeatedly clickable buttons and their click events from the set of button events.

[0182] Optionally, the anti-repeated-click device 1 further includes:

[0183] The stack creation module 12 is used to create a click processing module for the web page based on the set of key events, and to construct a click stack and a trigger stack corresponding to each click event in the set of key events; wherein, the click processing module is used to monitor and record the click timestamp when a key is clicked and a click signal is generated, identify the click event corresponding to the key and forward the click signal to the click event, and monitor and record the trigger timestamp of the time when the click event is executed based on the click signal; the click stack is used to store the click timestamp of the click signal received by the click event, and the trigger stack is used to store the trigger timestamp generated when the corresponding click event is executed.

[0184] Optionally, the anti-repeated-click device 1 further includes:

[0185] The trigger matching module 15 is used to call the click processing module to obtain the click event corresponding to the click signal and to obtain the trigger timestamp corresponding to the click event. The trigger timestamp reflects the time when the click event is executed according to the click signal. Then, the trigger stack management module 18 is called.

[0186] Optionally, the anti-repeated-click device 1 further includes:

[0187] Trigger stack management module 18 is used to determine whether the trigger stack is empty;

[0188] If so, the click signal is determined to be an execution signal and the click event is executed. The time of execution of the click event is monitored by the click processing module and set as the trigger timestamp. The trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack.

[0189] If not, extract the top historical trigger timestamp from the trigger stack, calculate the trigger time difference between the click timestamp of the click signal and the top historical trigger timestamp, and then call the trigger judgment module 19.

[0190] Optionally, the anti-repeated-click device 1 further includes:

[0191] The trigger judgment module 19 is used to determine whether the trigger time difference exceeds a preset trigger duration; if it exceeds the trigger duration, the click signal is determined to be an execution signal and the click event is executed, and the time of execution of the click event is monitored by the click processing module and set as the trigger timestamp; the trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack; if it does not exceed the trigger duration, the click event is intercepted and terminated to avoid repeated execution of the click event.

[0192] Optionally, the anti-repeated-click device 1 further includes:

[0193] The stack management module 20 is used to traverse each click stack and trigger stack in the click processing module; identify click stacks whose number of historical click timestamps exceeds a preset click threshold, and send the click events corresponding to the click stacks to the control terminal; identify trigger stacks whose number of historical trigger timestamps exceeds a preset trigger threshold, and send the click times corresponding to the trigger stacks to the control terminal.

[0194] This technical solution is applied in the field of software monitoring. It records the click timestamp of the time the click signal is generated; calls the click processing module to obtain the click event corresponding to the click signal and obtains the click stack corresponding to the click event; extracts the historical click timestamp at the top of the click stack and calculates the click time difference between the current click timestamp and the historical click timestamp; determines whether the click time difference exceeds a preset click duration; if it exceeds the click duration, the click event is executed; if it does not exceed the click duration, the click event is intercepted. By monitoring the server's system data (i.e., the click signal and its click timestamp), it avoids situations where the server's click event queue and threads are blocked, delayed, or even crash due to repeated execution of click events within a short period, thereby achieving server monitoring.

[0195] Example 4:

[0196] To achieve the above objectives, the present invention also provides a computer device 5. The components of the anti-repeated-click device 1 in Embodiment 3 can be distributed across different computer devices. The computer device 5 can be a smartphone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server, or cabinet server (including independent servers or server clusters composed of multiple application servers), etc. The computer device in this embodiment includes, but is not limited to, a memory 51 and a processor 52 that can communicate with each other via a system bus. Figure 5 As shown. It should be noted that, Figure 5 Only computer devices with components are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0197] In this embodiment, the memory 51 (i.e., the readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 51 can be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the memory 51 can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device. Of course, the memory 51 can also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the memory 51 is typically used to store the operating system and various application software installed on the computer device, such as the program code of the anti-repeated click device in Embodiment 3. In addition, the memory 51 can also be used to temporarily store various types of data that have been output or will be output.

[0198] In some embodiments, processor 52 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. This processor 52 is typically used to control the overall operation of a computer device. In this embodiment, processor 52 is used to run program code stored in memory 51 or process data, for example, to run a device for preventing duplicate clicks, to implement the methods for preventing duplicate clicks in Embodiments 1 and 2.

[0199] Example 5:

[0200] To achieve the above objectives, the present invention also provides a computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, server, App application store, etc., which stores a computer program, and the program performs corresponding functions when executed by processor 52. The computer-readable storage medium of this embodiment is used to store a device for preventing duplicate clicks, and when executed by processor 52, it implements the methods for preventing duplicate clicks in Embodiments 1 and 2.

[0201] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0202] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0203] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A method for preventing duplicate clicks, characterized in that, include: The page loading signal generated when the web page is loaded is triggered, and the key events are obtained by traversing the keys and click events of the web page. The step of traversing the buttons and their click events on the web page to obtain a set of button events includes: obtaining the page code in the web page according to the page loading signal, and traversing the button attributes and their click events in the page code using a developer debugging tool to obtain the button corresponding to the button attribute and the click event corresponding to the button attribute; the button attribute is the attribute code in the page code used to define the button in the web page, and the click event is the event code in the code page corresponding to the button attribute, used to trigger execution based on the click signal generated by the button attribute; wherein, the click event corresponding to the button attribute is obtained by identifying the event.keyCode and event.which events corresponding to the button attribute using the developer debugging tool; The system creates a click processing module for the webpage based on the set of key events, and constructs a click stack and a trigger stack corresponding to each click event in the set of key events. The click processing module monitors and records the click timestamp when a key is clicked and a click signal is generated, identifies the click event corresponding to the key and forwards the click signal to the click event, and monitors and records the trigger timestamp of the time when the click event is executed based on the click signal. The click stack stores the click timestamp of the click signal received by the click event, and the trigger stack stores the trigger timestamp generated when the corresponding click event is executed. A preset click processing module listens to click signals generated by the user clicking keys on the webpage and records the click timestamp of the time the click signal is generated. The click signal reflects the encoding of the clicked key and the click timestamp reflects the click event of clicking the key. The click processing module is invoked to obtain the click event corresponding to the click signal, and the click stack corresponding to the click event is obtained. Determine if the click stack is empty; if the click stack is empty, determine if the click signal is an execution signal, execute the click event, and save the click timestamp as a historical click timestamp to the click stack; if the click stack is not empty, extract the historical click timestamp at the top of the click stack, and calculate the click time difference between the click timestamp and the historical click timestamp. Determine whether the click time difference exceeds a preset click duration; if it exceeds the click duration, determine that the click signal is an execution signal and execute the click event, and save the click timestamp as a historical click timestamp to the click stack; if it does not exceed the click duration, determine that the click signal is a repeat signal and intercept the click event. The click processing module is invoked to obtain the click event corresponding to the click signal, and to obtain the trigger timestamp corresponding to the click event. The trigger timestamp is a trigger timestamp that reflects the time when the click event is executed according to the click signal. Determine whether the trigger stack is empty; If so, the click signal is determined to be an execution signal and the click event is executed. The time of execution of the click event is monitored by the click processing module and set as the trigger timestamp. The trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack. If not, extract the top-ranked historical trigger timestamp from the trigger stack and calculate the trigger time difference between the click timestamp of the click signal and the top-ranked historical trigger timestamp; Determine whether the trigger time difference exceeds the preset trigger duration; If the trigger duration is exceeded, the click signal is determined to be an execution signal and the click event is executed. The time of executing the click event is monitored by the click processing module and set as the trigger timestamp. The trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack. If the trigger duration has not been exceeded, the click event is intercepted and terminated to avoid repeated execution of the click event.

2. The method for preventing duplicate clicks according to claim 1, characterized in that, After obtaining a set of key events by traversing the keys and click events of the web page, the method further includes: Delete the repeatedly clickable keys and their click events from the set of key events; After deleting the repeatedly clickable keys and their click events from the key event set, the method further includes: The set of key events is uploaded to the blockchain.

3. The method for preventing duplicate clicks according to claim 2, characterized in that, The step of deleting repeatedly clickable keys and their click events from the key event set includes: The inheritance keywords of each click event in the key event set are identified using the developer debugging tool, and click events with inheritance keywords are set as events to be identified. Determine whether the class inherited by the event to be identified belongs to a preset set of repeatable base classes, wherein the set of repeatable base classes contains at least one class; If so, the event to be identified is determined to be a repeatable event, and the repeatable event is removed from the key event set; If not, the event to be identified is restored to a click event and stored in the key event set.

4. A device for preventing repeated clicks, characterized in that, include: The trigger traversal module is used to trigger the page loading signal generated when loading a web page, and traverse the buttons and their click events on the web page to obtain a set of button events; The step of traversing the buttons and their click events on the web page to obtain a set of button events includes: obtaining the page code in the web page according to the page loading signal, and traversing the button attributes and their click events in the page code using a developer debugging tool to obtain the button corresponding to the button attribute and the click event corresponding to the button attribute; the button attribute is the attribute code in the page code used to define the button in the web page, and the click event is the event code in the code page corresponding to the button attribute, used to trigger execution based on the click signal generated by the button attribute; wherein, the click event corresponding to the button attribute is obtained by identifying the event.keyCode and event.which events corresponding to the button attribute using the developer debugging tool; A stack creation module is used to create a click processing module for the web page based on the set of key events, and to construct a click stack and a trigger stack corresponding to each click event in the set of key events; wherein, the click processing module is used to monitor and record the click timestamp when a key is clicked and a click signal is generated, identify the click event corresponding to the key and forward the click signal to the click event, and monitor and record the trigger timestamp of the time when the click event is executed based on the click signal; the click stack is used to store the click timestamp of the click signal received by the click event, and the trigger stack is used to store the trigger timestamp generated when the corresponding click event is executed; The monitoring and recording module is used to monitor the click signals generated by the user clicking a button on a web page through a preset click processing module, and record the click timestamp of the time when the click signal is generated; wherein, the click signal reflects the encoding of the click button and the click timestamp that reflects the event of clicking the button; The click matching module is used to call the click processing module to obtain the click event corresponding to the click signal, and to obtain the click stack corresponding to the click event; The click stack management module is used to determine whether the click stack is empty; if the click stack is empty, the click signal is determined to be an execution signal, and the click event is executed and the click timestamp is set as a historical click timestamp and saved to the click stack; if the click stack is not empty, the historical click timestamp located at the top of the click stack is extracted, and the click time difference between the click timestamp and the historical click timestamp is calculated. The click determination module is used to determine whether the click time difference exceeds a preset click duration; if it exceeds the click duration, the click signal is determined to be an execution signal and the click event is executed, and the click timestamp is set as a historical click timestamp and saved to the click stack; if it does not exceed the click duration, the click signal is determined to be a repeat signal and the click event is intercepted. The trigger matching module is used to call the click processing module to obtain the click event corresponding to the click signal, and to obtain the trigger timestamp corresponding to the click event. The trigger timestamp reflects the time when the click event is executed according to the click signal. Then, the trigger stack management module is called. The trigger stack management module is used to determine whether the trigger stack is empty; if so, it determines that the click signal is an execution signal and executes the click event, and monitors the execution time of the click event through the click processing module and sets the time as the trigger timestamp; the trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack; if not, it extracts the top historical trigger timestamp in the trigger stack, calculates the trigger time difference between the click timestamp of the click signal and the top historical trigger timestamp, and then calls the trigger judgment module. The trigger judgment module is used to determine whether the trigger time difference exceeds a preset trigger duration; if it exceeds the trigger duration, the click signal is determined to be an execution signal and the click event is executed, and the time of execution of the click event is monitored by the click processing module and set as the trigger timestamp; the trigger timestamp is set as a historical trigger timestamp and saved to the trigger stack; if it does not exceed the trigger duration, the click event is intercepted and terminated to avoid repeated execution of the click event.

5. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor of the computer device executes the computer program, it implements the steps of the method for preventing duplicate clicks as described in any one of claims 1 to 3.

6. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program stored on the readable storage medium is executed by a processor, it implements the steps of the method for preventing duplicate clicks as described in any one of claims 1 to 3.