CN112306465A - Counting method and device - Google Patents

Counting method and device Download PDF

Info

Publication number
CN112306465A
CN112306465A CN202011193482.9A CN202011193482A CN112306465A CN 112306465 A CN112306465 A CN 112306465A CN 202011193482 A CN202011193482 A CN 202011193482A CN 112306465 A CN112306465 A CN 112306465A
Authority
CN
China
Prior art keywords
time
counting
target
trigger
trigger time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011193482.9A
Other languages
Chinese (zh)
Other versions
CN112306465B (en
Inventor
李振宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202011193482.9A priority Critical patent/CN112306465B/en
Publication of CN112306465A publication Critical patent/CN112306465A/en
Application granted granted Critical
Publication of CN112306465B publication Critical patent/CN112306465B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/22Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The method can determine a first trigger time of a target event based on a time unit corresponding to a counting task, determine a second trigger time which is closest to the first trigger time in a target counting set corresponding to the counting task in a target time period under the condition that the first trigger time does not exist, update the target counting set according to the first trigger time and the second trigger time, further update a counting result of the counting task in the target time period, count the counting tasks in various time periods, reduce workload in developing counting rules in different time periods, and facilitate the need of business development based on various counting rules.

Description

Counting method and device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a counting method and apparatus.
Background
Counting is the simplest basic operation, can be realized in a computer through a counter, and has wide application in various scenes. For example, various operations performed by the user when using the application program, such as login times, number of completed tasks, accumulated login days, etc., can be recorded through the counter. In counting, the counting rule usually involves some restrictions strongly related to time, such as the number of logins in a year, the number of comments made in a week, the number of pages visited in a day, the time of continuous login, and the like.
Generally, business personnel need to write the counting logic of the counter according to different counting rules, the counting logic cannot be generated quickly, if the counter of each rule is coded and developed, high workload is obviously brought, and the development efficiency is low.
Disclosure of Invention
The embodiment of the disclosure at least provides a counting method and a device.
In a first aspect, an embodiment of the present disclosure provides a counting method, including:
when the triggering of a target event is detected, determining first triggering time of the target event based on a time unit corresponding to a counting task;
if the first trigger time does not exist in a target counting set corresponding to the counting task in a target time period, determining a second trigger time which is closest to the first trigger time in the target counting set;
updating the target count set based on the first trigger time and the second trigger time; and the number of the trigger time in the target counting set is the counting result of the counting task in the target time period.
In an optional embodiment, after determining the first trigger time of the target event, the method further comprises:
and determining a target time period and a target counting set corresponding to the target time period based on the first trigger time and the time periods corresponding to the target counting sets of the counting task.
In an optional embodiment, the updating the target count set based on the first trigger time and the second trigger time includes:
determining a time difference between the first trigger time and the second trigger time;
comparing the time difference with a preset time interval;
updating the target count set based on the comparison result.
In an optional embodiment, the updating the target count set based on the comparison result includes:
if the time difference is consistent with the preset time interval, adding the first trigger time to the target counting set;
if the time difference is inconsistent with the preset time interval, clearing the trigger time in the target counting set, and adding the first trigger time to the target counting set.
In an alternative embodiment, the time unit includes at least one of:
day, week, month, year.
In an optional embodiment, the determining the first trigger time of the target event based on the time unit corresponding to the counting task includes:
and performing rounding processing on the time triggered by the detected target event based on the time unit corresponding to the counting task to obtain the first triggering time.
In a second aspect, an embodiment of the present disclosure further provides a counting apparatus, including:
the first determining module is used for determining first trigger time of a target event based on a time unit corresponding to a counting task when the target event trigger is detected;
a second determining module, configured to determine, if the first trigger time does not exist in a target count set corresponding to the counting task in a target time period, a second trigger time closest to the first trigger time in the target count set;
an update module configured to update the target count set based on the first trigger time and the second trigger time; and the number of the trigger time in the target counting set is the counting result of the counting task in the target time period.
In an optional implementation, the first determining module is further configured to:
and determining a target time period and a target counting set corresponding to the target time period based on the first trigger time and the time periods corresponding to the target counting sets of the counting task.
In an optional implementation manner, the update module is specifically configured to:
determining a time difference between the first trigger time and the second trigger time;
comparing the time difference with a preset time interval;
updating the target count set based on the comparison result.
In an optional implementation manner, when the update module updates the target count set based on the comparison result, the update module is specifically configured to:
if the time difference is consistent with the preset time interval, adding the first trigger time to the target counting set;
if the time difference is inconsistent with the preset time interval, clearing the trigger time in the target counting set, and adding the first trigger time to the target counting set.
In an alternative embodiment, the time unit includes at least one of:
day, week, month, year.
In an optional implementation manner, the first determining module is specifically configured to:
and performing rounding processing on the time triggered by the detected target event based on the time unit corresponding to the counting task to obtain the first triggering time.
In a third aspect, an embodiment of the present disclosure further provides a computer device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect described above, or any possible implementation of the first aspect.
In a fourth aspect, this disclosed embodiment also provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps in the first aspect or any one of the possible implementation manners of the first aspect.
For the effect description of the counting device, the computer device, and the computer-readable storage medium, reference is made to the description of the counting method, and details are not repeated here.
The counting method and device provided by the embodiment of the disclosure can determine the first trigger time of the target event based on the time unit corresponding to the counting task, determine the second trigger time closest to the first trigger time in the target counting set when the first trigger time does not exist in the target counting set corresponding to the counting task in the target time period, and update the target counting set according to the first trigger time and the second trigger time, thereby realizing updating of the counting result of the counting task in the target time period, realizing counting of the counting tasks in various time periods, reducing the workload in developing the counting rules in different time periods, and facilitating the need of business development based on various counting rules.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
Fig. 1 shows a flow chart of a counting method provided by an embodiment of the present disclosure;
FIG. 2 shows a flow chart of another counting method provided by the embodiments of the present disclosure;
FIG. 3 is a schematic diagram of a counting apparatus provided by an embodiment of the present disclosure;
fig. 4 shows a schematic diagram of a computer device provided by an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure, presented in the figures, is not intended to limit the scope of the claimed disclosure, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making creative efforts, shall fall within the protection scope of the disclosure.
According to researches, corresponding counting rules need to be set in the counting process, and some time-strongly-related limitations are often involved in the counting rules, for example, the counting rules can limit the time period between two times of counting, such as the number of logins in a year, the number of comments made in a week, the number of pages visited in a day, the time of continuous login, and the like. When the counting logic is written, the counting logic with different time periods needs to be written according to different counting rules because the time periods of the counting rules are usually different, the universality of the counting logic with different time periods is poor, the code reuse rate is low, the counting logic needs to be written frequently, and the development efficiency is low.
Based on the above research, the embodiment of the present disclosure provides a counting method, which may determine a first trigger time of a target event based on a time unit corresponding to a counting task, determine a second trigger time closest to the first trigger time in a target counting set corresponding to the counting task in a target time period when the first trigger time does not exist in the target counting set, and update the target counting set according to the first trigger time and the second trigger time, thereby updating a counting result of the counting task in the target time period, enabling counting of the counting tasks in multiple time periods, reducing workload in developing counting rules in different time periods, and achieving high efficiency.
The above-mentioned drawbacks are the results of the inventor after practical and careful study, and therefore, the discovery process of the above-mentioned problems and the solutions proposed by the present disclosure to the above-mentioned problems should be the contribution of the inventor in the process of the present disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
To facilitate understanding of the present embodiment, first, a counting method disclosed in the embodiments of the present disclosure is described in detail, where an execution subject of the counting method provided in the embodiments of the present disclosure is generally a computer device with certain computing capability, and the computer device includes, for example: a terminal device, which may be a User Equipment (UE), a mobile device, a User terminal, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle mounted device, a wearable device, or a server or other processing device. In some possible implementations, the counting method may be implemented by a processor calling computer readable instructions stored in a memory.
The following describes a counting method provided by the embodiment of the present disclosure by taking an execution subject as a terminal device.
Referring to fig. 1, a flowchart of a counting method provided in the embodiment of the present disclosure is shown, where the method includes steps S101 to S103, where:
s101: when the target event trigger is detected, determining a first trigger time of the target event based on a time unit corresponding to the counting task.
In this step, because different time units may be used for counting in the counting rules of different counting tasks, the time when the target event is detected to be triggered needs to be converted into the first trigger time of the target event, and the time unit of the first trigger time may be set according to the time unit corresponding to the counting task.
Here, the time unit may include: day, week, month, year.
Specifically, the rounding processing may be performed on the time triggered by the detected target event based on the time unit corresponding to the counting task, so as to obtain the first trigger time.
For example, when the trigger time of the target event is detected to be 6/8/2020/6, if the time unit of the counting task is day, the first trigger time may be 2020-06-08; if the time unit of the counting task is week, the first trigger time can be 2020-week-24 (6/8/2020 is the 24 th week of 2020); if the time unit of the counting task is month, the first trigger time can be 2020-06; if the time unit of the counting task is year, the first trigger time may be 2020.
Further, after determining the first trigger time of the target event, the method may further include:
and determining a target time period and a target counting set corresponding to the target time period based on the first trigger time and the time periods corresponding to the target counting sets of the counting task.
In this step, in some counting rules, a restriction on a time period may be further included, for example, in a case that the counting rule is "courses accumulated and completed within 1 natural month", and the restriction on the time period is one natural month, a target time period and a target counting set corresponding to the target time period may be determined from a plurality of time periods of the counting task according to the time period to which the first trigger time belongs.
For example, when the trigger time of the target event is detected to be 6/8/2020, and the plurality of time periods of the counting task is each natural month in 2020, the target time period may be 06/2020, and the target count set corresponding to the time period of 06/2020 is determined to be the target count set.
The counting task processing method includes that a plurality of trigger times can be recorded in a target counting set, in the counting process, a first trigger time of a target event needing to be counted can be added into the target counting set, and the total number of the trigger times in the target counting set is a counting result of the counting task in the time period.
S102: and if the first trigger time does not exist in a target counting set corresponding to the counting task in a target time period, determining a second trigger time which is closest to the first trigger time in the target counting set.
In this step, if the first trigger time does not exist in the target count set, it indicates that the first trigger time has not been counted, and a second trigger time closest to the first trigger time in the target count set may be determined.
For example, if the target count set corresponding to the target time period includes 2020-06 and 2020-07 trigger times, when the first trigger time is 2020-08, 2020-07 can be determined as the second trigger time.
S103: updating the target count set based on the first trigger time and the second trigger time; and the number of the trigger time in the target counting set is the counting result of the counting task in the target time period.
In this step, the counting rule may further include a restriction on time continuity. For example, when the counting rule is "the course is completed cumulatively within 1 natural month", the limitation on the time continuity may be cumulative counting, and in this case, the first trigger time may be directly added to the target counting set without judging the time continuity; when the counting rule is "complete the course continuously in 1 natural month", the limitation on the time continuity may be continuous counting, at this time, the time continuity needs to be judged, and whether to count the target event may be determined according to the time difference between the first trigger time and the second trigger time.
Specifically, a time difference between the first trigger time and the second trigger time may be determined first; comparing the time difference with a preset time interval; and finally updating the target counting set based on the comparison result.
Specifically, if the time difference is consistent with the preset time interval, adding the first trigger time to the target counting set;
if the time difference is inconsistent with the preset time interval, clearing the trigger time in the target counting set, and adding the first trigger time to the target counting set.
If the time difference between the first trigger time and the second trigger time is inconsistent with the preset time interval, the continuity of time which does not meet the requirements in the counting rule between the target event and the event corresponding to the second trigger time can be determined, the trigger time in the target counting set can be cleared, and then the first trigger time is added; if the time difference between the first trigger time and the second trigger time is consistent with the preset time interval, the continuity of time meeting the requirements in the counting rule between the target event and the event corresponding to the second trigger time can be determined, and the first trigger time is directly added into the target counting set.
For example, if the first trigger time is 2020-08-05, the second trigger time is 2020-08-01, and the time difference between the first trigger time and the second trigger time is 4 days, and if the preset time interval is 1 day, it may be determined that the event corresponding to the target event and the second trigger time does not meet the continuity of the time required in the counting rule, at this time, the target counting set may be cleared, and 2020-08-05 may be added to the cleared target counting set; if the first trigger time is 2020-08-05, the second trigger time is 2020-08-04, the time difference between the first trigger time and the second trigger time is 1 day, and the time difference is consistent with the preset time interval of 1 day, the continuity of time when the target event and the event corresponding to the second trigger time meet the requirement in the counting rule can be determined, and 2020-08-05 is directly added to the target counting set.
Therefore, whether the target event meets the requirement on time continuity in the counting rule or not can be determined, the workload in developing the counting rule with different continuity requirements can be reduced, and the development efficiency is high.
Referring to fig. 2, a flow chart of another counting method provided by the embodiment of the disclosure is shown. In the counting method, after a target event is detected to be triggered, current (first trigger time) triggered by the target event can be analyzed and detected according to a time dimension (time unit) corresponding to a counting task, whether the current is contained in an ordered set (target counting set) of the counting task is determined, if yes, counting is finished directly, if not, the maximum timestamp max (second trigger time) in the ordered set is obtained, whether the value of the current-max is consistent with the configured time unit (preset time interval) is determined, if yes, the current is written into the ordered set, accumulation of a counter is finished, and if not, the current is written into the ordered set after the ordered set is cleared.
Illustratively, if current is 2020-06, max is 2020-01, and the value of current-max is 5 months, if the configured time unit is one month, the ordered set is cleared, and 2020-6 is written into the ordered set, at this time, the counting result is 1; if the configured time unit is 1 year, 2020-6 can be directly written into the ordered set, at which time the count result is incremented by 1.
According to the counting method provided by the embodiment of the disclosure, the first trigger time of the target event can be determined based on the time unit corresponding to the counting task, when the counting task is in the target counting set corresponding to the target time period, and the first trigger time does not exist, the second trigger time closest to the first trigger time in the target counting set is determined, and the target counting set is updated according to the first trigger time and the second trigger time, so that the counting result of the counting task in the target time period is updated, counting of the counting task in any time period can be realized, workload in developing counting rules of different time periods is reduced, and development efficiency is high.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same inventive concept, a counting device corresponding to the counting method is also provided in the embodiments of the present disclosure, and as the principle of solving the problem of the device in the embodiments of the present disclosure is similar to the counting method in the embodiments of the present disclosure, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
Referring to fig. 3, which is a schematic diagram of an architecture of a counting apparatus according to an embodiment of the present disclosure, the counting apparatus 300 includes: a first determination module 310, a second determination module 320, an update module 330; wherein the content of the first and second substances,
a first determining module 310, configured to determine, when a target event trigger is detected, a first trigger time of the target event based on a time unit corresponding to a counting task;
a second determining module 320, configured to determine, if the first trigger time does not exist in a target counting set corresponding to the counting task in a target time period, a second trigger time closest to the first trigger time in the target counting set;
an update module 330, configured to update the target count set based on the first trigger time and the second trigger time; and the number of the trigger time in the target counting set is the counting result of the counting task in the target time period.
The counting device provided by the embodiment of the disclosure can determine the first trigger time of the target event based on the time unit corresponding to the counting task, and when the counting task does not have the first trigger time in the target counting set corresponding to the target time period, determine the second trigger time closest to the first trigger time in the target counting set, and update the target counting set according to the first trigger time and the second trigger time, thereby realizing updating of the counting result of the counting task in the target time period, being capable of realizing counting of the counting task in any time period, reducing workload in developing counting rules in different time periods, and having higher efficiency.
In an optional implementation manner, the update module 330 is specifically configured to:
determining a time difference between the first trigger time and the second trigger time;
comparing the time difference with a preset time interval;
updating the target count set based on the comparison result.
In an optional implementation manner, when the update module 330 updates the target count set based on the comparison result, specifically configured to:
if the time difference is consistent with the preset time interval, adding the first trigger time to the target counting set;
if the time difference is inconsistent with the preset time interval, clearing the trigger time in the target counting set, and adding the first trigger time to the target counting set.
In an alternative embodiment, the time unit includes at least one of:
day, week, month, year.
In an optional implementation manner, the first determining module 310 is specifically configured to:
and performing rounding processing on the time triggered by the detected target event based on the time unit corresponding to the counting task to obtain the first triggering time.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
Based on the same technical concept, the embodiment of the disclosure also provides computer equipment. Referring to fig. 4, a schematic structural diagram of a computer device 400 provided in the embodiment of the present disclosure includes a processor 401, a memory 402, and a bus 403. The memory 402 is used for storing execution instructions and includes a memory 4021 and an external memory 4022; the memory 4021 is also referred to as an internal memory, and is configured to temporarily store operation data in the processor 401 and data exchanged with an external memory 4022 such as a hard disk, the processor 401 exchanges data with the external memory 4022 through the memory 4021, and when the computer device 400 operates, the processor 401 communicates with the memory 402 through the bus 403, so that the processor 401 executes the following instructions:
in one possible implementation, the processor 401 is further configured to perform:
and determining a target time period and a target counting set corresponding to the target time period based on the first trigger time and the time periods corresponding to the target counting sets of the counting task.
In a possible implementation, the updating the target count set based on the first trigger time and the second trigger time in the instructions executed by the processor 401 includes:
determining a time difference between the first trigger time and the second trigger time;
comparing the time difference with a preset time interval;
updating the target count set based on the comparison result.
In a possible implementation, the updating the target count set based on the comparison result in the instruction executed by the processor 401 includes:
if the time difference is consistent with the preset time interval, adding the first trigger time to the target counting set;
if the time difference is inconsistent with the preset time interval, clearing the trigger time in the target counting set, and adding the first trigger time to the target counting set.
In one possible implementation, the processor 401 executes instructions in which the time unit includes at least one of:
day, week, month, year.
In a possible implementation manner, in the instructions executed by the processor 401, the determining the first trigger time of the target event based on the time unit corresponding to the counting task includes:
and performing rounding processing on the time triggered by the detected target event based on the time unit corresponding to the counting task to obtain the first triggering time.
The embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the steps of the counting method described in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute the steps of the counting method in the foregoing method embodiments, which may be referred to specifically for the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (10)

1. A counting method, comprising:
when the triggering of a target event is detected, determining first triggering time of the target event based on a time unit corresponding to a counting task;
if the first trigger time does not exist in a target counting set corresponding to the counting task in a target time period, determining a second trigger time which is closest to the first trigger time in the target counting set;
updating the target count set based on the first trigger time and the second trigger time; and the number of the trigger time in the target counting set is the counting result of the counting task in the target time period.
2. The method of claim 1, wherein after determining the first trigger time for the target event, the method further comprises:
and determining a target time period and a target counting set corresponding to the target time period based on the first trigger time and the time periods corresponding to the target counting sets of the counting task.
3. The method of claim 1, wherein updating the target set of counts based on the first trigger time and the second trigger time comprises:
determining a time difference between the first trigger time and the second trigger time;
comparing the time difference with a preset time interval;
updating the target count set based on the comparison result.
4. The method of claim 3, wherein updating the target count set based on the comparison comprises:
if the time difference is consistent with the preset time interval, adding the first trigger time to the target counting set;
if the time difference is inconsistent with the preset time interval, clearing the trigger time in the target counting set, and adding the first trigger time to the target counting set.
5. The method of claim 1, wherein the time unit comprises at least one of:
day, week, month, year.
6. The method of claim 1, wherein determining the first trigger time of the target event based on the time unit corresponding to the counting task comprises:
and performing rounding processing on the time triggered by the detected target event based on the time unit corresponding to the counting task to obtain the first triggering time.
7. A counting device, comprising:
the first determining module is used for determining first trigger time of a target event based on a time unit corresponding to a counting task when the target event trigger is detected;
a second determining module, configured to determine, if the first trigger time does not exist in a target count set corresponding to the counting task in a target time period, a second trigger time closest to the first trigger time in the target count set;
an update module configured to update the target count set based on the first trigger time and the second trigger time; and the number of the trigger time in the target counting set is the counting result of the counting task in the target time period.
8. The apparatus of claim 7, wherein the update module is specifically configured to:
determining a time difference between the first trigger time and the second trigger time;
comparing the time difference with a preset time interval;
updating the target count set based on the comparison result.
9. A computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when a computer device is running, the machine-readable instructions when executed by the processor performing the steps of the counting method of any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, performs the steps of the counting method according to any one of claims 1 to 6.
CN202011193482.9A 2020-10-30 2020-10-30 Counting method and device Active CN112306465B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011193482.9A CN112306465B (en) 2020-10-30 2020-10-30 Counting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011193482.9A CN112306465B (en) 2020-10-30 2020-10-30 Counting method and device

Publications (2)

Publication Number Publication Date
CN112306465A true CN112306465A (en) 2021-02-02
CN112306465B CN112306465B (en) 2024-05-24

Family

ID=74333160

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011193482.9A Active CN112306465B (en) 2020-10-30 2020-10-30 Counting method and device

Country Status (1)

Country Link
CN (1) CN112306465B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775965A (en) * 2016-11-17 2017-05-31 腾讯科技(深圳)有限公司 A kind of processing method and processing device of timed task
CN108540396A (en) * 2018-07-11 2018-09-14 尚通(北京)科技发展有限公司 A kind of Internet of Things flow control methods, system, terminal and storage medium
CN109587793A (en) * 2017-09-29 2019-04-05 维沃移动通信有限公司 TCI state updating method, base station and terminal
CN109739880A (en) * 2018-12-20 2019-05-10 中国联合网络通信集团有限公司 Method for computing data and device
CN110928717A (en) * 2019-11-14 2020-03-27 北京神州绿盟信息安全科技股份有限公司 Complex time sequence event detection method and device
CN111260465A (en) * 2020-01-20 2020-06-09 深圳乐信软件技术有限公司 Business processing method, device, server and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775965A (en) * 2016-11-17 2017-05-31 腾讯科技(深圳)有限公司 A kind of processing method and processing device of timed task
CN109587793A (en) * 2017-09-29 2019-04-05 维沃移动通信有限公司 TCI state updating method, base station and terminal
CN108540396A (en) * 2018-07-11 2018-09-14 尚通(北京)科技发展有限公司 A kind of Internet of Things flow control methods, system, terminal and storage medium
CN109739880A (en) * 2018-12-20 2019-05-10 中国联合网络通信集团有限公司 Method for computing data and device
CN110928717A (en) * 2019-11-14 2020-03-27 北京神州绿盟信息安全科技股份有限公司 Complex time sequence event detection method and device
CN111260465A (en) * 2020-01-20 2020-06-09 深圳乐信软件技术有限公司 Business processing method, device, server and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
孙晓川;梁晓蕾;洪晓光;: "时态数据库中非数值型属性周期规律的研究", 山东师范大学学报(自然科学版), no. 03, pages 50 - 55 *

Also Published As

Publication number Publication date
CN112306465B (en) 2024-05-24

Similar Documents

Publication Publication Date Title
JP7450649B2 (en) Message processing method and device
CN108415952B (en) User data storage method, label calculation method and calculation equipment
CN108616654B (en) Message reminding method, device, terminal and computer readable storage medium
CN106469413B (en) Data processing method and device for virtual resources
CN112947830A (en) Popup window display method and device, computer equipment and storage medium
CN111478963B (en) Message pushing method and device, electronic equipment and computer readable storage medium
CN111524609B (en) Method and system for generating screening model and screening infectious disease high-risk infected people
CN111026570A (en) Method and device for determining abnormal reason of business system
CN107179930B (en) Application uninstalling recommendation method and device
CN111159329A (en) Sensitive word detection method and device, terminal equipment and computer-readable storage medium
CN111159183B (en) Report generation method, electronic device and computer readable storage medium
CN111339158A (en) Method and device for processing information, electronic equipment and storage medium
CN109325015B (en) Method and device for extracting characteristic field of domain model
CN114296682A (en) Floating point number processing device, floating point number processing method, electronic equipment, storage medium and chip
CN112306465A (en) Counting method and device
CN109213476A (en) A kind of generation method of installation kit, computer readable storage medium and terminal device
CN112579861A (en) Counting method and device
CN111459987A (en) Cache updating method and device
CN112527803A (en) Data processing method and device and computer equipment
CN115202755A (en) Plug-in loading method and device, computer equipment and storage medium
CN111951114B (en) Task execution method and device, electronic equipment and readable storage medium
CN112685360A (en) Memory data persistence method and device, storage medium and computer equipment
CN110324845B (en) Resource allocation method and device
CN108920676B (en) Method and system for processing graph data
CN109189827B (en) Time sequence processing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant