CN110766854A - Voting data processing method and device - Google Patents

Voting data processing method and device Download PDF

Info

Publication number
CN110766854A
CN110766854A CN201911046377.XA CN201911046377A CN110766854A CN 110766854 A CN110766854 A CN 110766854A CN 201911046377 A CN201911046377 A CN 201911046377A CN 110766854 A CN110766854 A CN 110766854A
Authority
CN
China
Prior art keywords
voting
options
option
counting
data
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.)
Pending
Application number
CN201911046377.XA
Other languages
Chinese (zh)
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.)
Koubei Shanghai Information Technology Co Ltd
Original Assignee
Koubei Shanghai Information 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 Koubei Shanghai Information Technology Co Ltd filed Critical Koubei Shanghai Information Technology Co Ltd
Priority to CN201911046377.XA priority Critical patent/CN110766854A/en
Publication of CN110766854A publication Critical patent/CN110766854A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C13/00Voting apparatus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a voting data processing method and a device, wherein the method comprises the following steps: receiving a voting request carrying voting options; randomly calculating a voting counting record to be updated corresponding to the voting option; each voting option corresponds to at least two voting counting records; inquiring and locking the vote count record to be updated, and updating the vote count record to be updated; and summarizing at least two voting counting records corresponding to the voting options to obtain voting data of the voting options. By the method, the pressure of voting option counting can be shared, so that a high-concurrency scene can be supported, and the performance of voting activities is improved.

Description

Voting data processing method and device
Technical Field
The invention relates to the technical field of data processing, in particular to a voting data processing method and device.
Background
Electronic voting based on computing devices has become increasingly popular today. In electronic voting, users input voting options through a computing device, voting option data of each user are transmitted to a background to statistically generate voting results, and high concurrence problems exist when the users participate in the voting to form hot point data.
The existing voting processing mode comprises the following steps: based on the voting of the pessimistic lock, the data is operated in an exclusive mode, the locked voting data can only be modified by the current request, and other requests fail to modify. Based on the voting of the optimistic lock, data is operated in a fair mode, the version number is introduced, whether the current data version meets the condition is judged by comparing the current data version with the request version, the request meeting the condition can be modified, and otherwise, the modification fails.
However, in the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art: the existing voting processing mode is poor in performance, cannot support application of a high concurrency scene, and causes failure in voting in the high concurrency scene.
Disclosure of Invention
In view of the above, embodiments of the present invention are proposed to provide a method and apparatus for processing voting data that overcome or at least partially solve the above problems.
According to an aspect of the embodiments of the present invention, there is provided a method for processing voting data, the method including:
receiving a voting request carrying voting options;
randomly calculating a voting counting record to be updated corresponding to the voting option; each voting option corresponds to at least two voting counting records;
inquiring and locking the vote count record to be updated, and updating the vote count record to be updated;
and summarizing at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
Optionally, summarizing at least two vote count records corresponding to the voting options to obtain voting data of the voting options further includes:
starting a timing task;
and when the timing time of the timing task is up, performing accumulation calculation on at least two voting count records corresponding to the voting options to obtain voting data of the voting options.
Optionally, summarizing at least two vote count records corresponding to the voting options to obtain voting data of the voting options further includes:
receiving a voting data query request;
and responding to the polling request of the voting data, and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain the voting data of the voting options.
Optionally, the performing an accumulation calculation on at least two vote count records corresponding to the voting options to obtain voting data of the voting options further includes:
inquiring voting options;
traversing at least two voting counting records corresponding to the voting options;
and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
Optionally, before receiving the voting request carrying the voting option, the method further includes:
receiving a voting activity creating request, wherein the voting activity creating request carries voting activity information and voting option information;
storing the voting event information and the voting option information in a database in a ground mode;
and aiming at least one voting option, splitting to obtain at least two voting count records corresponding to the voting option, and storing the at least two voting count records corresponding to the at least one voting option in a database.
Optionally, after receiving the voting request carrying the voting option, the method further comprises: inquiring whether the corresponding voting activities are effective or not according to the voting requests;
the randomly calculating the vote count record to be updated corresponding to the voting options specifically comprises: and if the voting activity is judged to be effective, randomly calculating a voting counting record to be updated corresponding to the voting option.
According to another aspect of the embodiments of the present invention, there is provided a voting data processing apparatus, including:
the first receiving module is suitable for receiving a voting request carrying voting options;
the random calculation module is suitable for randomly calculating the voting counting record to be updated corresponding to the voting options; each voting option corresponds to at least two voting counting records;
the updating module is suitable for inquiring and locking the vote count record to be updated and updating the vote count record to be updated;
and the summarizing module is suitable for summarizing at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
Optionally, the aggregation module is further adapted to:
starting a timing task;
and when the timing time of the timing task is up, performing accumulation calculation on at least two voting count records corresponding to the voting options to obtain voting data of the voting options.
Optionally, the aggregation module is further adapted to:
receiving a voting data query request;
and responding to the polling request of the voting data, and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain the voting data of the voting options.
Optionally, the aggregation module is further adapted to:
inquiring voting options;
traversing at least two voting counting records corresponding to the voting options;
and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
Optionally, the apparatus further comprises:
the second receiving module is suitable for receiving a voting activity creating request, and the voting activity creating request carries voting activity information and voting option information;
the splitting module is suitable for storing the voting activity information and the voting option information in a database in a ground mode; and aiming at least one voting option, splitting to obtain at least two voting count records corresponding to the voting option, and storing the at least two voting count records corresponding to the at least one voting option in a database.
Optionally, the apparatus further comprises:
the query module is suitable for querying whether the corresponding voting activities are effective or not according to the voting requests;
the random calculation module is further adapted to: and if the voting activity is judged to be effective, randomly calculating a voting counting record to be updated corresponding to the voting option.
According to still another aspect of an embodiment of the present invention, there is provided a computing device including: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the processing method of the voting data.
According to a further aspect of the embodiments of the present invention, there is provided a computer storage medium, in which at least one executable instruction is stored, and the executable instruction causes a processor to execute operations corresponding to the processing method of voting data.
According to the voting data processing method and device provided by the embodiment of the invention, a voting request carrying voting options is received; randomly calculating a voting counting record to be updated corresponding to the voting option; each voting option corresponds to at least two voting counting records; inquiring and locking the vote count record to be updated, and updating the vote count record to be updated; and summarizing at least two voting counting records corresponding to the voting options to obtain voting data of the voting options. By the method, the pressure of voting option counting can be shared, so that a high-concurrency scene can be supported, and the performance of voting activities is improved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and the embodiments of the present invention can be implemented according to the content of the description in order to make the technical means of the embodiments of the present invention more clearly understood, and the detailed description of the embodiments of the present invention is provided below in order to make the foregoing and other objects, features, and advantages of the embodiments of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the embodiments of the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating a method for processing voting data according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a voting data processing method according to another embodiment of the present invention;
FIG. 3 illustrates an interaction diagram for creating a voting campaign according to another embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating an interaction of user voting provided by another embodiment of the present invention;
FIG. 5 is an interaction diagram illustrating the summary voting data of the timed task according to another embodiment of the present invention;
fig. 6 is a schematic structural diagram of a voting data processing device according to another embodiment of the present invention;
fig. 7 is a schematic structural diagram of a computing device provided by an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
Fig. 1 is a flowchart illustrating a voting data processing method according to an embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
step S101, receiving a voting request carrying voting options.
Receiving a voting request carrying voting options sent by a user side, for example, a user performs a voting operation on the voting options at the user side, and the user side initiates the voting request according to the detected voting operation on the voting options.
Step S102, randomly calculating a vote count record to be updated corresponding to the voting options, where each voting option corresponds to at least two vote count records.
When the voting campaign is created in advance, at least two voting count records are created for the voting options respectively, wherein the voting count records are used for recording the number of votes for the voting options. And responding to the voting request, and randomly calculating a voting counting record to be updated corresponding to the voting option.
And step S103, inquiring and locking the vote count record to be updated, and updating the vote count record to be updated.
And inquiring and locking the randomly calculated vote count record to be updated, and operating the vote count record to be updated, namely updating the vote number corresponding to the vote count record to be updated based on the vote request so as to record the vote of the voting option in the vote count record.
And step S104, summarizing at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
As can be seen from the above, each voting request is randomly recorded in one voting count record for one voting choice, so that the number of votes for the voting choice is scattered in the corresponding voting count records. And summarizing the voting counting records corresponding to the voting options respectively to obtain the total voting number of the voting options.
According to the voting data processing method provided by the embodiment, at least two voting count records are created for the voting options, and when a user votes, one voting count record is randomly determined to be operated to record the voting, so that the voting number of the voting options is scattered in each corresponding voting count record, and each voting count record corresponding to the voting options is summarized, so that the voting number of the voting options can be obtained.
Fig. 2 is a flowchart of a voting data processing method according to another embodiment of the present invention, where the voting data processing method is applied to a voting system, and as shown in fig. 2, the method includes the following steps:
step S201, receiving a voting event creating request, where the voting event creating request carries voting event information and voting option information.
The voting system receives a voting event creation request sent by a user side, for example, a user performs a voting event creation operation at the user side, including an operation of inputting voting event information and voting option information, and the user side detects the voting event creation operation and sends the voting event creation request carrying the voting event information and the voting option information to the voting system.
Step S202, the voting event information and the voting option information are stored in the database.
The voting system stores the voting event information and the voting option information in a database in a correlated manner.
Step S203, for at least any one voting option, splitting to obtain at least two voting count records corresponding to the voting option, and storing the at least two voting count records corresponding to the at least any one voting option in a database.
At least two voting count records are created for the voting options aiming at least any one voting option, and the at least any one voting option and the corresponding at least two voting count records are stored in a database in a correlation mode.
In an optional implementation manner of the embodiment of the present invention, the voting system scores the popularity of each voting option, determines a target voting option according to the popularity score of each voting option, and splits the target voting option to obtain at least two voting count records corresponding to the target voting option; optionally, the target voting options are voting options with a heat score higher than a preset score threshold. In the method, the popularity of the voting options of the voting campaign is estimated, at least two corresponding voting count records are obtained by splitting the voting options with higher popularity, that is, the voting options with higher popularity are estimated to have high concurrency, at least two voting count records are split for the voting options, and further, the voting count records split by the voting options with higher popularity are more, so that the voting count records are more, and by adopting the method, on one hand, the situation of high concurrency of the voting requests can be effectively responded to for the voting options with higher popularity; on the other hand, for the voting options with lower popularity, the resources occupied by the subsequent random calculation can be saved as excessive voting counting records are not split for the voting options.
Steps S201 to S203 correspond to the steps of creating a voting campaign in the embodiment of the present invention.
Step S204, receiving a voting request carrying voting options, and inquiring whether the corresponding voting activities are effective or not according to the voting request.
The voting system receives a voting request carrying voting options sent by a user side, for example, a user performs a voting operation on the voting options at the user side, and the user side initiates the voting request according to the detected voting operation on the voting options.
The voting system inquires whether the corresponding voting event is valid according to the voting request, such as whether the valid period of the voting event is exceeded, whether the voting event is normally operated, and the like. Optionally, the voting request further carries voting event information, and the voting system queries whether the voting event is valid according to the voting event information.
In step S205, if the voting activity is determined to be valid, the voting count record to be updated corresponding to the voting option is randomly calculated.
In an optional implementation manner of the embodiment of the present invention, if the voting system determines that the voting campaign is valid, a voting count record of the voting options is calculated according to a preset random routing algorithm, so as to operate on the randomly calculated voting count record. Wherein each voting option corresponds to at least two vote count records.
Step S206, querying and locking the vote count record to be updated in the database, and updating the vote count record to be updated in the database.
And the voting system inquires and locks the vote count record to be updated in the database, and updates the inquired vote count record to be updated. For example, if the calculated vote count record to be updated is the 1 st vote count record of "option one" and the vote count record is queried to be 2, the vote count record is updated from 2 to 3.
Step S207, starting the timing task, and when the timing time of the timing task is reached, performing cumulative calculation on at least two voting count records corresponding to the voting options to obtain voting data of the voting options.
In this embodiment, the voting numbers of the voting options are collected at regular time by using a timed task, where the timed task refers to a task executed at preset intervals. Specifically, when the timing time of the timing task is reached, the voting option corresponding to each voting count record is accumulated, so that the total voting amount of the voting options is obtained.
Optionally, after obtaining the voting data of the voting choice, the voting data of the voting choice is stored in the database.
The following describes the method of this embodiment by taking a specific example, first creating a voting campaign, where the voting campaign has 4 voting options, and splitting each voting option to obtain 10 voting count records.
The user A selects 'option one' at the user end to vote, the user end sends a voting request containing 'option one' to the voting system according to the voting operation of the user A, the voting system randomly finds out 5 according to a random algorithm, the 5 th counting record of 'option one' is taken out from the database, the voting number of the 5 th counting record corresponding to 'option one' is updated from 0 to 1, and the voting is successful.
The user B selects the option two at the user side for voting, the client side sends a voting request containing the option two to the voting system according to the voting operation of the user B, the voting system randomly takes out 7 according to a random algorithm, the 7 th counting record of the option two is taken out from the database, the voting number of the 5 th counting record of the option two is updated from 0 to 1, and the voting is successful.
The user C selects 'option one' at the user end to vote, the user end sends a voting request containing 'option one' to the voting system according to the voting operation of the user C, the voting system randomly finds out 1 according to a random algorithm, the 1 st counting record of 'option one' is taken out from the database, the 1 st counting record of 'option one' is updated from 0 to 1, and the voting is successful.
Summarizing 10 counting records corresponding to the four options every 1 minute, wherein the current summarizing result is as follows: option one: 2 tickets, namely the number of tickets recorded by the 5 th counting record plus the number of tickets recorded by the 1 st counting record; and (5) option two: 1, ticket; and (4) selecting a third option: 0 ticket; and 4, selecting a fourth option: and 0 ticket.
In an optional implementation manner of the embodiment of the present invention, a voting data query request is received; and responding to the polling request of the voting data, and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain the voting data of the voting options. In this approach, the count records of the voting options are aggregated in response to the voting data query request.
Optionally, in a case that the query request for voting data is sent by the user terminal, after obtaining the voting data of the voting options, the voting data of the voting options are issued to the user terminal.
In an optional implementation manner of the embodiment of the present invention, the voting data summarization is implemented by the following steps: inquiring voting options stored in a database; traversing at least two voting counting records corresponding to the voting options; and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain voting data of the voting options. And inquiring the voting options stored in the database, traversing each voting count record corresponding to the voting options, and accumulating each voting count record corresponding to the voting options to obtain the voting number of the voting options.
According to the voting data processing method provided by the embodiment of the invention, at least two voting count records are created for the voting options, and when a user votes, one voting count record is randomly determined to be operated to record the voting, so that the voting number of the voting options is scattered in each corresponding voting count record, and each voting count record corresponding to the voting options is summarized, and the voting number of the voting options can be obtained. In addition, the voting counting records of the voting options are summarized at regular time through the timing task, so that the effect of counting the voting number of the voting options at regular time is realized; or, summarizing the voting counting records of the voting options in response to the voting data query request, so as to realize the effect of counting the voting number of the voting options according to the request.
Fig. 3 is a schematic diagram illustrating an interaction for creating a voting campaign according to another embodiment of the present invention, as shown in fig. 3, including:
step S301, a user side initiates a voting activity to a voting system;
step S302, the voting system carries out floor voting on the database to obtain basic information of the activity;
step S303, the voting system votes the option information to the database;
step S304, the voting system divides each voting option into a plurality of counting records;
step S305, the voting system votes to the database to count and record;
step S306, the voting system returns a response to the user terminal. Such as returning a response that the voting campaign created successfully.
Fig. 4 is a schematic diagram illustrating an interaction of user voting according to another embodiment of the present invention, as shown in fig. 4, including:
step S401, a user side initiates a voting request aiming at voting options to a voting system;
step S402, the voting system inquires voting activity from a database;
step S403, the voting system judges whether the inquired voting event is available;
step S404, the voting system randomly routes. The voting counting record to be updated corresponding to the voting option is obtained by random calculation;
step S405, the voting system inquires a voting counting record from the database and locks the voting counting record;
step S406, the voting system updates the voting count record;
step S407, the voting system stores the updated count record into a database;
in step S408, the voting system returns a voting success response to the user terminal.
Fig. 5 is an interaction diagram illustrating a summary voting data of a timed task according to another embodiment of the present invention, and as shown in fig. 5, the interaction diagram includes:
step S501, the timing task requests the voting system to start summarizing and voting;
step S502, the voting system inquires the voting activity in progress from the database;
step S503, the voting system inquires voting options from the database;
step S504, the voting system traverses all voting counting records according to the voting options;
step S505, the voting system inquires a voting count record from a database;
step S506, the voting system collects the voting number;
in step S507, the voting system updates the voting number of the voting options to the database.
Fig. 6 is a schematic structural diagram of a voting data processing apparatus according to another embodiment of the present invention, and as shown in fig. 6, the apparatus includes:
a first receiving module 61, adapted to receive a voting request carrying voting options;
a random calculation module 62, adapted to randomly calculate a vote count record to be updated corresponding to the voting options; each voting option corresponds to at least two voting counting records;
the updating module 63 is adapted to query and lock the vote count record to be updated, and update the vote count record to be updated;
the summarizing module 64 is adapted to summarize at least two voting count records corresponding to the voting options to obtain voting data of the voting options.
In an alternative approach, the aggregation module 64 is further adapted to:
starting a timing task;
and when the timing time of the timing task is up, performing accumulation calculation on at least two voting count records corresponding to the voting options to obtain voting data of the voting options.
In an alternative approach, the aggregation module 64 is further adapted to:
receiving a voting data query request;
and responding to the polling request of the voting data, and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain the voting data of the voting options.
In an alternative approach, the aggregation module 64 is further adapted to:
inquiring voting options;
traversing at least two voting counting records corresponding to the voting options;
and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
In an optional manner, the apparatus further comprises:
the second receiving module is suitable for receiving a voting activity creating request, and the voting activity creating request carries voting activity information and voting option information;
the splitting module is suitable for storing the voting activity information and the voting option information in a database in a ground mode; and aiming at least one voting option, splitting to obtain at least two voting count records corresponding to the voting option, and storing the at least two voting count records corresponding to the at least one voting option in a database.
In an optional manner, the apparatus further comprises:
the query module is suitable for querying whether the corresponding voting activities are effective or not according to the voting requests;
the random calculation module is further adapted to: and if the voting activity is judged to be effective, randomly calculating a voting counting record to be updated corresponding to the voting option.
According to the processing device for voting data provided by the embodiment, at least two voting count records are created for the voting options, and when a user votes, one voting count record is randomly determined to be operated to record the current voting, so that the voting number of the voting options is scattered in each corresponding voting count record, and each voting count record corresponding to the voting options is summarized, and the voting number of the voting options can be obtained. In addition, the voting counting records of the voting options are summarized at regular time through the timing task, so that the effect of counting the voting number of the voting options at regular time is realized; or, summarizing the voting counting records of the voting options in response to the voting data query request, so as to realize the effect of counting the voting number of the voting options according to the request.
An embodiment of the present invention provides a non-volatile computer storage medium, where the computer storage medium stores at least one executable instruction, and the computer executable instruction may execute the method for processing voting data in any method embodiment described above.
The executable instructions may be specifically configured to cause the processor to:
receiving a voting request carrying voting options;
randomly calculating a voting counting record to be updated corresponding to the voting option; each voting option corresponds to at least two voting counting records;
inquiring and locking the vote count record to be updated, and updating the vote count record to be updated;
and summarizing at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
In an alternative, the executable instructions cause the processor to:
starting a timing task;
and when the timing time of the timing task is up, performing accumulation calculation on at least two voting count records corresponding to the voting options to obtain voting data of the voting options.
In an alternative, the executable instructions cause the processor to:
receiving a voting data query request;
and responding to the polling request of the voting data, and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain the voting data of the voting options.
In an alternative, the executable instructions cause the processor to:
inquiring voting options;
traversing at least two voting counting records corresponding to the voting options;
and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
In an alternative, the executable instructions cause the processor to:
receiving a voting activity creating request, wherein the voting activity creating request carries voting activity information and voting option information;
storing the voting event information and the voting option information in a database in a ground mode;
and aiming at least one voting option, splitting to obtain at least two voting count records corresponding to the voting option, and storing the at least two voting count records corresponding to the at least one voting option in a database.
In an alternative, the executable instructions cause the processor to:
inquiring whether the corresponding voting activities are effective or not according to the voting requests;
and if the voting activity is judged to be effective, randomly calculating a voting counting record to be updated corresponding to the voting option.
The method can share the pressure of voting option counting, thereby supporting high concurrency scenes, improving the performance of voting activities, and ensuring that voting data are not lost due to the fact that the database is adopted to store the voting counting records. In addition, the voting counting records of the voting options are summarized at regular time through the timing task, so that the effect of counting the voting number of the voting options at regular time is realized; or, summarizing the voting counting records of the voting options in response to the voting data query request, so as to realize the effect of counting the voting number of the voting options according to the request.
Fig. 7 is a schematic structural diagram of a computing device according to an embodiment of the present invention, and a specific embodiment of the present invention does not limit a specific implementation of the computing device.
As shown in fig. 7, the computing device may include: a processor (processor)702, a Communications Interface 704, a memory 706, and a communication bus 708.
Wherein: the processor 702, communication interface 704, and memory 706 communicate with each other via a communication bus 708. A communication interface 704 for communicating with network elements of other devices, such as clients or other servers. The processor 702 is configured to execute the program 710, and may specifically execute relevant steps in the above embodiment of the voting data processing method for a computing device.
In particular, the program 710 may include program code that includes computer operating instructions.
The processor 702 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement an embodiment of the invention. The computing device includes one or more processors, which may be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
The memory 706 stores a program 710. The memory 706 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 710 may specifically be used to cause the processor 702 to perform the following operations:
receiving a voting request carrying voting options;
randomly calculating a voting counting record to be updated corresponding to the voting option; each voting option corresponds to at least two voting counting records;
inquiring and locking the vote count record to be updated, and updating the vote count record to be updated;
and summarizing at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
In an alternative, the program 710 causes the processor 702 to:
starting a timing task;
and when the timing time of the timing task is up, performing accumulation calculation on at least two voting count records corresponding to the voting options to obtain voting data of the voting options.
In an alternative, the program 710 causes the processor 702 to: receiving a voting data query request;
and responding to the polling request of the voting data, and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain the voting data of the voting options.
In an alternative, the program 710 causes the processor 702 to: inquiring voting options;
traversing at least two voting counting records corresponding to the voting options;
and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
In an alternative, the program 710 causes the processor 702 to: receiving a voting activity creating request, wherein the voting activity creating request carries voting activity information and voting option information;
storing the voting event information and the voting option information in a database in a ground mode;
and aiming at least one voting option, splitting to obtain at least two voting count records corresponding to the voting option, and storing the at least two voting count records corresponding to the at least one voting option in a database.
In an alternative, the program 710 causes the processor 702 to:
inquiring whether the corresponding voting activities are effective or not according to the voting requests;
and if the voting activity is judged to be effective, randomly calculating a voting counting record to be updated corresponding to the voting option.
The method can share the pressure of voting option counting, thereby supporting high concurrency scenes, improving the performance of voting activities, and ensuring that voting data are not lost due to the fact that the database is adopted to store the voting counting records. In addition, the voting counting records of the voting options are summarized at regular time through the timing task, so that the effect of counting the voting number of the voting options at regular time is realized; or, summarizing the voting counting records of the voting options in response to the voting data query request, so as to realize the effect of counting the voting number of the voting options according to the request.
The algorithms or displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. In addition, embodiments of the present invention are not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of embodiments of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best modes of embodiments of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the embodiments of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that is, the claimed embodiments of the invention require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components according to embodiments of the present invention. Embodiments of the invention may also be implemented as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing embodiments of the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. Embodiments of the invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names. The steps in the above embodiments should not be construed as limiting the order of execution unless specified otherwise.

Claims (10)

1. A method of processing voting data, the method comprising:
receiving a voting request carrying voting options;
randomly calculating a voting counting record to be updated corresponding to the voting option; each voting option corresponds to at least two voting counting records;
inquiring and locking the vote count record to be updated, and updating the vote count record to be updated;
and summarizing at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
2. The method of claim 1, wherein the aggregating at least two vote count records corresponding to the voting choices to obtain voting data of the voting choices further comprises:
starting a timing task;
and when the timing time of the timing task is up, performing accumulation calculation on at least two voting count records corresponding to the voting options to obtain voting data of the voting options.
3. The method of claim 1, wherein the aggregating at least two vote count records corresponding to the voting choices to obtain voting data of the voting choices further comprises:
receiving a voting data query request;
and responding to the voting data query request, and performing accumulation calculation on at least two voting count records corresponding to the voting options to obtain the voting data of the voting options.
4. The method of claim 2 or 3, wherein the accumulating the at least two vote count records corresponding to the voting choices to obtain the voting data of the voting choices further comprises:
querying the voting options;
traversing at least two voting counting records corresponding to the voting options;
and performing accumulation calculation on at least two voting counting records corresponding to the voting options to obtain voting data of the voting options.
5. The method of any of claims 1-4, wherein prior to said receiving a voting request carrying voting options, the method further comprises:
receiving a voting activity creating request, wherein the voting activity creating request carries voting activity information and voting option information;
storing the voting event information and the voting option information in a database in a ground mode;
and aiming at least one voting option, splitting to obtain at least two voting counting records corresponding to the voting option, and storing the at least two voting counting records corresponding to the at least one voting option in a database.
6. The method of claim 1, wherein after the receiving a voting request carrying voting options, the method further comprises: inquiring whether the corresponding voting activities are effective or not according to the voting requests;
the randomly calculating the vote count record to be updated corresponding to the voting options specifically comprises: and if the voting activity is judged to be effective, randomly calculating a voting counting record to be updated corresponding to the voting option.
7. An apparatus for processing voting data, the apparatus comprising:
the first receiving module is suitable for receiving a voting request carrying voting options;
the random calculation module is suitable for calculating the voting counting record to be updated corresponding to the voting option at random; each voting option corresponds to at least two voting counting records;
the updating module is suitable for inquiring and locking the vote count record to be updated and updating the vote count record to be updated;
and the summarizing module is suitable for summarizing at least two voting counting records corresponding to the voting options to obtain the voting data of the voting options.
8. The apparatus of claim 7, wherein the aggregation module is further adapted to:
starting a timing task;
and when the timing time of the timing task is up, performing accumulation calculation on at least two voting count records corresponding to the voting options to obtain voting data of the voting options.
9. A computing device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the processing method of the voting data according to any one of claims 1-6.
10. A computer storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to the processing method of voting data according to any one of claims 1 to 6.
CN201911046377.XA 2019-10-30 2019-10-30 Voting data processing method and device Pending CN110766854A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911046377.XA CN110766854A (en) 2019-10-30 2019-10-30 Voting data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911046377.XA CN110766854A (en) 2019-10-30 2019-10-30 Voting data processing method and device

Publications (1)

Publication Number Publication Date
CN110766854A true CN110766854A (en) 2020-02-07

Family

ID=69333233

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911046377.XA Pending CN110766854A (en) 2019-10-30 2019-10-30 Voting data processing method and device

Country Status (1)

Country Link
CN (1) CN110766854A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106682134A (en) * 2016-12-16 2017-05-17 郑州云海信息技术有限公司 Method, device and system for writing data pairs in LevelDB databases
CN107315761A (en) * 2017-04-17 2017-11-03 阿里巴巴集团控股有限公司 A kind of data-updating method, data query method and device
CN107818114A (en) * 2016-09-14 2018-03-20 ***通信有限公司研究院 A kind of data processing method, device and database
CN108255827A (en) * 2016-12-28 2018-07-06 卓望数码技术(深圳)有限公司 The processing method and system of a kind of hot spot data
CN109542894A (en) * 2018-10-22 2019-03-29 平安科技(深圳)有限公司 User data concentrates storage method, device, medium and computer equipment
CN109830029A (en) * 2019-01-18 2019-05-31 深圳智链物联科技有限公司 Voting method, device, system and server, computer readable storage medium
CN110231977A (en) * 2018-03-05 2019-09-13 中兴通讯股份有限公司 Processing method, device, storage medium and the electronic device of database

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107818114A (en) * 2016-09-14 2018-03-20 ***通信有限公司研究院 A kind of data processing method, device and database
CN106682134A (en) * 2016-12-16 2017-05-17 郑州云海信息技术有限公司 Method, device and system for writing data pairs in LevelDB databases
CN108255827A (en) * 2016-12-28 2018-07-06 卓望数码技术(深圳)有限公司 The processing method and system of a kind of hot spot data
CN107315761A (en) * 2017-04-17 2017-11-03 阿里巴巴集团控股有限公司 A kind of data-updating method, data query method and device
CN110231977A (en) * 2018-03-05 2019-09-13 中兴通讯股份有限公司 Processing method, device, storage medium and the electronic device of database
CN109542894A (en) * 2018-10-22 2019-03-29 平安科技(深圳)有限公司 User data concentrates storage method, device, medium and computer equipment
CN109830029A (en) * 2019-01-18 2019-05-31 深圳智链物联科技有限公司 Voting method, device, system and server, computer readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
EDAGARLI: "实现高性能高并发的计数器功能", 《CSDN博客》 *
鲍鹏: "《计算机基础》", 30 June 2018 *

Similar Documents

Publication Publication Date Title
CN106933854B (en) Short link processing method and device and server
CN109614377B (en) File deletion method, device, equipment and storage medium of distributed file system
US20210150519A1 (en) Blockchain-based transaction processing method and apparatus and electronic device
CN105512320B (en) User ranking obtaining method and device and server
JP2019503537A (en) Method and apparatus for processing short link and short link server
CN107451013B (en) Data recovery method, device and system based on distributed system
EP3816912B1 (en) Blockchain-based transaction processing method and apparatus, and electronic device
CN104133825A (en) Method and device for matching client user
CN110738479B (en) Order management method and system based on multi-person ordering
JP6870466B2 (en) Control programs, control methods, controls, and database servers
CN106776785B (en) Data writing method and device and data processing system
US8694471B2 (en) System and method for updating a cache using a gating mechanism and events
CN106161519B (en) A kind of information acquisition method and device
CN108769157B (en) Message popup display method and device, computing equipment and computer storage medium
CN110597879B (en) Method and device for processing time series data
CN113760976A (en) Service processing method, device, equipment and storage medium
CN111143053A (en) Scheduling method of timing task, server and storage device
CN110233843B (en) User request processing method and device
CN110766854A (en) Voting data processing method and device
CN108769244B (en) Storage task information acquisition method and related device
CN115907949A (en) Bank transaction data processing method and device
CN111147568B (en) Identity data synchronization method and device
CN105791350B (en) Project data processing method and system
Sun et al. Adaptive trade‐off between consistency and performance in data replication
CN113467896A (en) Cluster service current limiting method and device, computing equipment and storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200207

RJ01 Rejection of invention patent application after publication