Prize drawing method, device, storage medium and electronic device

By generating and shuffling the prize list, and combining it with atomic operations to indicate the lottery order, the problem of users not being able to win on a first-come, first-served basis in existing lottery methods is solved, achieving a first-come, first-served effect and randomness for users to win prizes.

CN115018546BActive Publication Date: 2026-03-13QINGDAO HAIER TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-16
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing random number-based lottery methods are not affected by the order of drawing, which prevents users from achieving a first-come, first-served lottery effect and affects users' enthusiasm for participating in lotteries.

Method used

Generate an initial prize list, shuffle the order of the prize identifiers to form a target prize list, and save it to the cache. Upon receiving a user request, generate an atomic operation carrying a lottery order identifier, draw prizes sequentially according to the order of the prize identifiers, and return the results.

Benefits of technology

This achieves a first-come, first-served lottery effect while maintaining the randomness of the lottery results, thus increasing users' enthusiasm for participating in the lottery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115018546B_ABST
    Figure CN115018546B_ABST
Patent Text Reader

Abstract

This application discloses a prize drawing method, apparatus, storage medium, and electronic device, relating to the field of smart home / smart home technology. The method includes: shuffling the order of prize identifiers in an initial prize list to obtain a target prize list; saving the target prize list to a cache to obtain a target prize pool; generating at least one atomic operation carrying a drawing order identifier upon receiving a drawing request triggered by at least one user; and sequentially drawing the target prize identifiers from the target prize pool according to the order of the prize identifiers in the target prize list based on the drawing order identifiers of each atomic operation. Since this application draws prizes sequentially according to the order of the prize identifiers and the drawing order of the atomic operations, it achieves a first-come, first-served draw effect for users. Furthermore, the randomness of the order of the prize identifiers in the target prize pool ensures the randomness of the user's drawing results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart home / intelligent home technology, and more specifically, to a prize drawing method, apparatus, storage medium, and electronic device. Background Technology

[0002] Most lottery systems on the market currently operate on the principle of assigning random numbers to users to create uncertainty in the lottery results. For example, when a user participates in a lottery, the system generates a random number based on the probability of each prize. If the random number is less than the set winning value, the user wins; if the random number is greater than the set winning value, the user does not win.

[0003] In the existing scheme, since the random number is not affected by the order of the lottery draw, some users who have obtained the lottery draw opportunity and participated in the lottery may not be able to win a prize in some pre-sale of goods and other marketing activities that use lottery draws, thus affecting users' enthusiasm for lottery draws. Summary of the Invention

[0004] This application provides a prize drawing method, apparatus, storage medium, and electronic device to solve the technical problem that existing random number-based lottery methods are not affected by the order of drawing and cannot achieve the first-come, first-served lottery effect.

[0005] This application provides a method for drawing prizes, including:

[0006] Generate an initial prize list, shuffle the order of the prize identifiers in the initial prize list to obtain a target prize list, and save the target prize list to a cache to obtain the target prize pool;

[0007] Upon receiving a lottery request triggered by at least one user, generate at least one atomic operation carrying a lottery order identifier;

[0008] Based on the lottery order identifier of each atomic operation, the target prize identifier corresponding to each atomic operation is extracted sequentially from the target prize pool according to the arrangement order of the prize identifiers in the target prize list, and the corresponding prize result is fed back to each lottery request based on the target prize identifier.

[0009] According to the prize drawing method provided in this application, the step of shuffling the order of prize identifiers in the initial prize list to obtain the target prize list includes:

[0010] The order of prize identifiers in the initial prize list is shuffled using the list random number shuffling function to obtain the target prize list.

[0011] According to the prize drawing method provided in this application, generating the initial prize list includes:

[0012] Determine the primary key ID of each type of prize and the number of prizes associated with each primary key ID;

[0013] Generate at least one prize identifier associated with the primary key ID of each type of prize based on the quantity of prizes;

[0014] The at least one prize identifier is assembled to generate an initial prize list.

[0015] According to the prize drawing method provided in this application, the step of shuffling the order of prize identifiers in the initial prize list to obtain the target prize list includes:

[0016] Determine the preset winning probability and the total number of prize identifiers in the initial prize list;

[0017] Based on the preset winning probability and the total number of prize identifiers, the total number of empty prize identifiers for empty prizes is calculated, and the total number of empty prize identifiers is generated.

[0018] The empty prize identifier is randomly inserted into the initial prize list to shuffle the order of the prize identifiers in the initial prize list, thus obtaining the target prize list.

[0019] According to the prize drawing method provided in this application, the step of generating at least one atomic operation carrying a drawing order identifier upon receiving a drawing request triggered by at least one user includes:

[0020] Upon receiving a lottery request triggered by at least one user, obtain the lottery access rights for each user.

[0021] If the user's lottery access is consistent with the preset lottery access, the lottery order identifier of the lottery request is determined according to the request trigger time of the lottery request, and at least one atomic operation carrying the lottery order identifier is generated.

[0022] According to the prize drawing method provided in this application, after extracting the target prize identifiers corresponding to each atomic operation sequentially from the target prize pool according to the order of prize identifiers in the target prize list based on the drawing order identifiers of each atomic operation, and feeding back the corresponding prize results to each drawing request based on the target prize identifiers, the method further includes:

[0023] Update the basic information of the target prize pool and the prizes corresponding to each target prize identifier.

[0024] According to the prize drawing method provided in this application, the basic prize information includes at least one of the following: prize name, prize type, and prize quantity.

[0025] This application provides a prize drawing device, including:

[0026] The first generation unit is used to generate an initial prize list, shuffle the order of the prize identifiers in the initial prize list to obtain a target prize list, and save the target prize list to a cache to obtain a target prize pool;

[0027] The second generation unit is used to generate at least one atomic operation carrying a lottery order identifier when receiving a lottery request triggered by at least one user.

[0028] The extraction unit is used to extract the target prize identifiers corresponding to each atomic operation from the target prize pool according to the order of the prize identifiers in the target prize list based on the lottery order identifiers of each atomic operation, and to feed back the corresponding prize results to each lottery request based on the target prize identifiers.

[0029] This application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the prize drawing method described above.

[0030] This application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the prize drawing method described above.

[0031] The prize drawing method, apparatus, storage medium, and electronic device provided in this application generate an initial prize list, shuffle the order of prize identifiers in the initial prize list to obtain a target prize list, and save the target prize list to a cache to obtain a target prize pool. Upon receiving a lottery request triggered by at least one user, at least one atomic operation carrying a lottery order identifier is generated. Based on the lottery order identifier of each atomic operation, the target prize identifier corresponding to each atomic operation is sequentially extracted from the target prize pool according to the order of the prize identifiers in the target prize list, and the corresponding prize result is fed back to each lottery request based on the target prize identifier. Since the prizes are drawn sequentially according to the order of the prize identifiers and the lottery order of the atomic operations after the user triggers the lottery request, a first-come, first-served lottery effect is achieved. Furthermore, the randomness of the order of the prize identifiers in the target prize pool in this application ensures the randomness of the user's lottery result. Attached Figure Description

[0032] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0033] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0034] Figure 1 A flowchart illustrating the prize drawing method provided in this application;

[0035] Figure 2 A schematic diagram of the prize drawing device provided in this application;

[0036] Figure 3 A schematic diagram of the hardware environment for the prize drawing method provided in this application;

[0037] Figure 4 A schematic diagram of the electronic device provided in this application.

[0038] Figure label:

[0039] 301: Terminal device; 302: Server. Detailed Implementation

[0040] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0041] It should be noted that the terms "first," "second," etc., used in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0042] Figure 1 A flowchart illustrating the prize drawing method provided in this application is shown below. Figure 1 As shown, the method includes steps 100, 200 and 300.

[0043] Step 100: Generate an initial prize list, shuffle the order of the prize identifiers in the initial prize list to obtain a target prize list, and save the target prize list to a cache to obtain the target prize pool;

[0044] Specifically, the prize drawing method provided in this application is applicable to any system or smart terminal with a prize drawing function. This application uses a system with a prize drawing function as the implementation subject for description.

[0045] First, before a lottery draw can be conducted, the system's lottery setup personnel need to enter basic prize information into the system, such as prize name, prize type, and the quantity of each prize type. After receiving this basic prize information, the system, to prevent errors such as incorrect, excessive, or insufficient prize distribution, calculates the quantity of each prize type based on this information when storing it in the system's database. Then, it assembles the prize identifiers of all prizes according to the quantity of each prize type into an initial prize list for the lottery draw.

[0046] Specifically, prize identifiers are generated based on the prize name or prize type in the basic prize information. For example, for prize A and prize B, to ensure correct prize distribution later, prize identifier A is set to 1, and prize identifier B is set to 2, thus distinguishing the two different prizes. Furthermore, it should be noted that since the quantity of each type of prize is not uniform, when assembling all prize identifiers according to the quantity of each type of prize into an initial prize list for the lottery, one prize identifier can be set in the initial prize list to represent all prizes associated with that type of prize, or a corresponding number of prize identifiers can be set in the initial prize list based on the quantity of all prizes associated with that type of prize; there is no restriction on this.

[0047] To facilitate understanding, this application provides an example. In a lottery, the prizes include 5 prizes A, 3 prizes B, 4 prizes C, and 2 prizes D. There are also 10 unclaimed prizes. The prize identifiers for prizes A, B, C, and D are 1, 2, 3, and 4, respectively. The identifier for the unclaimed prizes can be set to 0. Therefore, the initial prize list generated in this application can be {0, 1, 2, 3, 4}, or it can be {0...0, 1…1, 2…2, 4…4}. This initial prize list includes ten 0s, five 1s, three 2s, four 3s, and two 4s.

[0048] It should be noted that the order of the prize identifiers refers to the order in which each prize identifier is drawn. For example, for {0, 1, 2, 3, 4}, if the drawing direction is from beginning to end (from left to right), the first one drawn will be 0, followed by 1, and so on.

[0049] In order to achieve uncertainty in the lottery results, after obtaining the initial prize list, the order of the prize identifiers in the initial prize list is randomly shuffled to obtain a target prize list in which the order of the prize identifiers is uncertain. This ensures that the lottery result obtained each time a prize identifier is drawn from the target prize list is random.

[0050] Step 200: Upon receiving a lottery request triggered by at least one user, generate at least one atomic operation carrying a lottery order identifier.

[0051] Specifically, the lottery order identifier is used to characterize the order in which each atomic operation is drawn from the target prize pool, thereby realizing a first-come, first-served lottery mechanism based on the lottery order identifier.

[0052] It should be noted that the atomic operation in this application means that the current operation can only be executed after one operation thread has finished executing, and another operation thread can start executing the operation. In other words, multiple atomic operations in this application must be executed sequentially according to the lottery order identifier of each atomic operation, thereby ensuring the execution of the first-come-first-served lottery mechanism.

[0053] In addition, to avoid the draw speed being affected by the excessive processing time of subsequent operation threads due to the lag of one operation thread, this application sets a corresponding operation time limit to limit the operation time of each operation thread. Specifically, if the current operation thread does not return the corresponding draw result within the operation time limit, the operation of the current operation thread is determined to have failed and the operation thread is automatically interrupted so that the subsequent operation thread can continue to perform the corresponding draw operation.

[0054] Step 300: Based on the lottery order identifier of each atomic operation, the target prize identifier corresponding to each atomic operation is sequentially extracted from the target prize pool according to the arrangement order of the prize identifiers in the target prize list, and the corresponding prize result is fed back to each lottery request based on the target prize identifier.

[0055] In this step, the `lget` command in the Redis cache can be used to control the atomic operations to draw prizes sequentially according to the order of the lottery order identifier and the prize identifier. For example, the `lget` command in the Redis cache can draw the leftmost prize identifier from the list of the target prize pool from left to right, then draw the prize identifier one position to the right of the leftmost prize identifier, and so on. Due to the atomicity of the `lget` command, the atomicity of multiple atomic operations in the lottery is guaranteed, thereby ensuring the randomness of the lottery result due to the randomness of the arrangement of several prize identifiers in the target prize pool.

[0056] In order to speed up the prize drawing process, this application can execute several atomic operations in parallel during the big data burst phase, and draw prizes from the target prize pool in sequence according to the drawing order identifier.

[0057] To facilitate understanding, this application provides an example: In a lottery event, the prize identifiers in the target prize pool are arranged in the order {0, 1, 2, 3, 4}. Based on the user-triggered lottery request, three atomic operations are generated sequentially, with their lottery order identifiers being 1, 2, and 3, respectively. Here, 1 indicates that this atomic operation is executed first, and so on. When drawing from the target prize pool {0, 1, 2, 3, 4}, the atomic operation with lottery order identifier 1 (drawing 0) is executed simultaneously, the atomic operation with lottery order identifier 2 (drawing 1) and the atomic operation with lottery order identifier 3 (drawing 2) are executed simultaneously. After all three atomic operations are completed, 0, 1, and 2 are deleted from the target prize pool, resulting in {3, 4}.

[0058] In another embodiment, to avoid situations such as incorrect prize distribution, the target prize identifier can be immediately deleted from the target prize pool when the target prize identifier corresponding to each atomic operation is extracted. In addition, before each extraction, the pointer responsible for extracting the target prize identifier from the target prize pool is always stationed at the first prize identifier character to be extracted in the target prize list in the target prize pool, thereby speeding up the lottery process.

[0059] It should also be noted that the prize result refers to the prize name associated with the target prize identifier. In this application, in addition to saving the target prize identifier prize list to the cache to obtain the target prize pool, the basic information such as the prize name, prize type, and prize quantity associated with each prize in the target prize list will also be saved.

[0060] The prize drawing method provided in this application generates an initial prize list, shuffles the order of prize identifiers in the initial prize list to obtain a target prize list, and saves the target prize list to a cache to obtain a target prize pool. Upon receiving a lottery request triggered by at least one user, it generates at least one atomic operation carrying a lottery order identifier. Based on the lottery order identifier of each atomic operation, it sequentially extracts the target prize identifiers corresponding to each atomic operation from the target prize pool according to the order of the prize identifiers in the target prize list, and feeds back the corresponding prize result to each lottery request based on the target prize identifier. Since the prizes are drawn sequentially according to the order of the prize identifiers and the lottery order of the atomic operations after a user triggers a lottery request, a first-come, first-served lottery effect is achieved. Furthermore, the randomness of the order of prize identifiers in the target prize pool in this application ensures the randomness of the user's lottery result.

[0061] Based on the above embodiments, step 100 further includes:

[0062] The order of prize identifiers in the initial prize list is shuffled using a list random number shuffling function to obtain the target prize list.

[0063] Specifically, the function to shuffle the list's random numbers is `Collections.shuffle(prizeIds)`. This function randomly shuffles the order of the prize identifiers in the initial prize list, achieving a preliminary randomness in the lottery results. For example, given the initial prize list {0, 1, 2, 3, 4}, `Collections.shuffle(prizeIds)` might result in {1, 3, 4, 0, 2}, or other random sorting results. Thus, by handling the uncertainty of the result using `Collections.shuffle(prizeIds)`, the preliminary randomness of the lottery results is achieved.

[0064] Based on the above embodiments, step 100 further includes:

[0065] Determine the primary key ID of each type of prize and the number of prizes associated with each primary key ID;

[0066] Generate at least one prize identifier associated with the primary key ID of each type of prize based on the quantity of prizes;

[0067] The at least one prize identifier is assembled to generate an initial prize list.

[0068] Specifically, the primary key id refers to the identifier automatically generated when data related to each type of prize is stored in the database to identify the data related to each type of prize.

[0069] In practical applications, primary key IDs for several prize types are typically generated using natural number sorting. For example, for prize types a, b, and c, primary key IDs 1, 2, and 3 are generated sequentially based on the order in which the relevant data for each prize type is stored. This allows for the differentiation of prize-related information for each type through three distinct primary key IDs.

[0070] Furthermore, it should be noted that since there are more than one prize for each type of prize, in order to improve the randomness of the subsequent lottery results, this application generates a corresponding prize identifier for each prize associated with each primary key ID, thereby increasing the number of prize identifiers to be drawn in the target prize pool, and thus increasing the uncertainty of the lottery results by reducing the probability of the primary key ID of each type of prize being drawn.

[0071] Based on the above embodiments, step 100 further includes:

[0072] Determine the preset winning probability and the total number of prize identifiers in the initial prize list;

[0073] Based on the preset winning probability and the total number of prize identifiers, the total number of empty prize identifiers for empty prizes is calculated, and the total number of empty prize identifiers is generated.

[0074] The empty prize identifier is randomly inserted into the initial prize list to shuffle the order of the prize identifiers in the initial prize list, thus obtaining the target prize list.

[0075] Among them, the preset winning probability refers to the winning probability parameter set by the user in the lottery activity of this round in the system with lottery function, while the empty prize refers to the prompt message such as "Keep it up", "Thank you for your patronage" or "We're sorry" to indicate that the user did not win. It can also be virtual coins or other prizes in the system, and there are no restrictions on this.

[0076] Specifically, the prize identifiers in the initial prize list are the actual prize identifiers set in the system. In practical applications, since the preset winning probability and the set prizes are fixed, this application, after generating the initial prize list, counts the total number of prize identifiers in the initial prize list, calculates the total number of empty prize identifiers that still need to be generated in the system based on the preset winning probability and the total number of prize identifiers, and generates the total number of empty prize identifiers based on random numbers.

[0077] In the process of randomly generating empty prize identifiers based on random numbers, multiple empty prize identifiers can be the same or different. After generating the empty prize identifiers, the prize identifiers and empty prize identifiers are compared and iterated. If an empty prize identifier that is the same as the prize identifier is encountered, the identifier value corresponding to the empty prize identifier is increased or decreased until the empty prize identifier is different from the prize identifier. This avoids the mis-issuance, over-issuance, or under-issuance of prizes.

[0078] In addition, in this implementation, empty prize identifiers can be inserted into multiple prize identifiers at equal intervals, or they can be inserted to the left or right of multiple prize identifiers. Then, the list random number shuffling function, Collections.shuffle(prizeIds), is used to shuffle the order of multiple prize identifiers and multiple empty prize identifiers.

[0079] Furthermore, in this implementation, to achieve a first-come, first-served lottery effect, before randomly inserting empty prize identifiers into the prize list, the initial prize list is divided into at least two equal prize sublists. Based on the increasing trend of the number of empty prize identifiers, corresponding empty prize identifiers are inserted into each prize sublist. The order of multiple prize identifiers and multiple empty prize identifiers in each prize sublist is then shuffled using a list random number shuffling function. Finally, multiple prize sublists are merged sequentially according to the number of empty prize identifiers in ascending order. The resulting target prize list thus has an increasing number of empty prize identifiers from beginning to end, achieving a first-come, first-served lottery effect. Furthermore, the randomness of the order of multiple prize identifiers and multiple empty prize identifiers in each prize sublist further ensures the randomness of the order of multiple prize identifiers and multiple empty prize identifiers in the target prize list.

[0080] Based on the above embodiments, step 200 further includes:

[0081] Upon receiving a lottery request triggered by at least one user, obtain the lottery access rights for each user.

[0082] If the user's lottery access is consistent with the preset lottery access, the lottery order identifier of the lottery request is determined according to the request trigger time of the lottery request, and at least one atomic operation carrying the lottery order identifier is generated.

[0083] Specifically, lottery access can be based on consumption parameters associated with a user's account in the system, such as the money spent on items purchased by the user before participating in the lottery, or the points associated with the user's account, used to verify whether the user meets the lottery eligibility criteria. In addition, lottery access can also be based on user account attributes, such as member user accounts, existing user accounts, and new user accounts, which are attribute parameters used to identify the user's identity.

[0084] Therefore, the prize drawing method provided in this embodiment checks the drawing permissions corresponding to the drawing requests triggered by each user before generating an atomic operation carrying a drawing order identifier. This avoids the system processing drawing requests without drawing permissions, thereby reducing the system load pressure by intercepting them at the source, and thus improving the efficiency of the drawing.

[0085] Based on the above embodiments, step 300: after extracting the target prize identifiers corresponding to each atomic operation from the target prize pool according to the order of the prize identifiers in the target prize list based on the lottery order identifiers of each atomic operation, and feeding back the corresponding prize results to each lottery request based on the target prize identifiers, it further includes:

[0086] Update the basic information of the target prize pool and the prizes corresponding to each target prize identifier.

[0087] Specifically, when a prize identifier represents all prizes associated with a particular prize type, after extracting the target prize identifier corresponding to each atomic operation, the remaining prize quantity associated with that target prize identifier is updated in the target prize pool, and the remaining prize quantity in the basic prize information corresponding to that target prize identifier is updated accordingly. Furthermore, when the remaining prize quantity associated with that target prize identifier is zero, the target prize identifier can be directly deleted from the target prize pool, or it can be replaced with an empty prize identifier.

[0088] In another embodiment, when a prize identifier represents only one prize associated with that type of prize, after extracting the target prize identifier corresponding to each atomic operation, the remaining prize quantity in the basic prize information corresponding to the target prize identifier is updated. For the target prize pool, the target prize identifier can be directly deleted from the target prize pool, or it can be replaced with an empty prize identifier, thereby increasing the number of times the system allows users to participate in the lottery.

[0089] Furthermore, the lottery mechanism set in the system automatically closes the lottery entry when the user-defined lottery time is reached. In other words, the system has an unlimited number of lottery draws before the user-defined lottery time is reached. In this embodiment, after extracting the target prize identifiers corresponding to each atomic operation, the number of remaining prize identifiers in the target prize pool is counted. If the number of remaining prize identifiers reaches the minimum number set by the user, the total number of empty prize identifiers for empty prizes is calculated based on the number of remaining prize identifiers and the preset winning probability, and a total of empty prize identifiers are generated. The empty prize identifiers are then randomly inserted into the prize list to shuffle the order of the prize identifiers in the prize list, resulting in an updated target prize pool. This achieves an unlimited number of lottery draws before the user-defined lottery time is reached, while also achieving a first-come, first-served lottery effect.

[0090] Based on any of the above embodiments Figure 2 A schematic diagram of the prize drawing device provided in this application is shown below. Figure 2 As shown, the device includes:

[0091] The first generation unit 210 is used to generate an initial prize list, shuffle the order of the prize identifiers in the initial prize list to obtain a target prize list, and save the target prize list to a cache to obtain a target prize pool;

[0092] The second generation unit 220 is configured to generate at least one atomic operation carrying a lottery order identifier when receiving a lottery request triggered by at least one user.

[0093] The extraction unit 230 is used to extract the target prize identifiers corresponding to each atomic operation from the target prize pool in the order of the prize identifiers in the target prize list based on the lottery order identifiers of each atomic operation, and to feed back the corresponding prize results to each lottery request based on the target prize identifiers.

[0094] The prize drawing device provided in this application generates an initial prize list, shuffles the order of prize identifiers in the initial prize list to obtain a target prize list, and saves the target prize list to a cache to obtain a target prize pool. Upon receiving a lottery request triggered by at least one user, it generates at least one atomic operation carrying a lottery order identifier. Based on the lottery order identifier of each atomic operation, it sequentially extracts the target prize identifiers corresponding to each atomic operation from the target prize pool according to the order of the prize identifiers in the target prize list, and feeds back the corresponding prize result to each lottery request based on the target prize identifiers. Since the prizes are drawn sequentially according to the order of the prize identifiers and the lottery order of the atomic operations after the user triggers the lottery request, a first-come, first-served lottery effect is achieved. Furthermore, the randomness of the order of prize identifiers in the target prize pool in this application ensures the randomness of the user's lottery result.

[0095] Based on any of the above embodiments, according to the prize drawing device provided in this application, the first generating unit 210 is further configured to:

[0096] The order of prize identifiers in the initial prize list is shuffled using the list random number shuffling function to obtain the target prize list.

[0097] According to the prize drawing method provided in this application, generating the initial prize list includes:

[0098] Determine the primary key ID of each type of prize and the number of prizes associated with each primary key ID;

[0099] Generate at least one prize identifier associated with the primary key ID of each type of prize based on the quantity of prizes;

[0100] The at least one prize identifier is assembled to generate an initial prize list.

[0101] According to the prize drawing device provided in this application, the first generating unit 210 is further configured to:

[0102] Determine the preset winning probability and the total number of prize identifiers in the initial prize list;

[0103] Based on the preset winning probability and the total number of prize identifiers, the total number of empty prize identifiers for empty prizes is calculated, and the total number of empty prize identifiers is generated.

[0104] The empty prize identifier is randomly inserted into the initial prize list to shuffle the order of the prize identifiers in the initial prize list, thus obtaining the target prize list.

[0105] According to the prize drawing device provided in this application, the second generating unit 220 is further configured to:

[0106] Upon receiving a lottery request triggered by at least one user, obtain the lottery access rights for each user.

[0107] If the user's lottery access is consistent with the preset lottery access, the lottery order identifier of the lottery request is determined according to the request trigger time of the lottery request, and at least one atomic operation carrying the lottery order identifier is generated.

[0108] According to the prize drawing device provided in this application, the drawing 230 is also used for:

[0109] Update the basic information of the target prize pool and the prizes corresponding to each target prize identifier.

[0110] According to the prize drawing device provided in this application, the basic information of the prize includes at least one of the following: prize name, prize type, and prize quantity.

[0111] Based on any of the above embodiments, this application also provides a prize drawing method. This prize drawing method is widely used in whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligencehouse ecosystems. In this embodiment, Figure 3 This is a schematic diagram of the hardware environment for the prize drawing method provided in this application. The above-mentioned prize drawing method can be applied to, for example... Figure 3 The hardware environment shown consists of terminal device 301 and server 302. Server 302 is connected to terminal device 301 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. It can set up a database on the server or independently of the server to provide data storage services for server 302. It can also be configured with cloud computing and / or edge computing services on the server or independently of the server to provide data processing services for server 302.

[0112] The aforementioned networks may include, but are not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network (WAN), metropolitan area network (MAN), local area network (LAN). The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. Terminal device 301 may not be limited to PCs, mobile phones, tablets, smart air conditioners, smart range hoods, smart refrigerators, smart ovens, smart stoves, smart washing machines, smart water heaters, smart washing equipment, smart dishwashers, smart projectors, smart TVs, smart clothes racks, smart curtains, smart audio-visual equipment, smart sockets, smart speakers, smart speakers, smart fresh air systems, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaners, smart window cleaning robots, smart mopping robots, smart air purifiers, smart steam ovens, smart microwave ovens, smart water heaters, smart air purifiers, smart water dispensers, smart door locks, etc.

[0113] Based on any of the above embodiments, Figure 4 A schematic diagram of the structure of the electronic device provided in this application, such as Figure 4 As shown, the electronic device may include: a processor 410, a communications interface 420, a memory 430, and a communications bus 440, wherein the processor 410, the communications interface 420, and the memory 430 communicate with each other via the communications bus 440. The processor 410 can call logical commands stored in the memory 430 to execute the following methods:

[0114] An initial prize list is generated, and the order of the prize identifiers in the initial prize list is shuffled to obtain a target prize list. The target prize list is then saved to a cache to obtain a target prize pool. Upon receiving a lottery request triggered by at least one user, at least one atomic operation carrying a lottery order identifier is generated. Based on the lottery order identifier of each atomic operation, the target prize identifier corresponding to each atomic operation is sequentially extracted from the target prize pool according to the order of the prize identifiers in the target prize list. The corresponding prize result is then fed back to each lottery request based on the target prize identifier.

[0115] Furthermore, the logical commands in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several commands to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0116] The processor in the electronic device provided in this application embodiment can call logical instructions in the memory to implement the above method. Its specific implementation method is the same as the aforementioned method implementation method and can achieve the same beneficial effects, which will not be repeated here.

[0117] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the methods provided in the above embodiments.

[0118] The specific implementation method is the same as the aforementioned method implementation method and can achieve the same beneficial effects, so it will not be repeated here.

[0119] This application provides a computer program product, including a computer program that, when executed by a processor, implements the method described above.

[0120] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0121] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0122] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A prize draw method, characterized by, The method comprises the following steps: generating an initial prize list, shuffling the prize identifiers in the initial prize list by using Collections.shuffle(prizels) to obtain a target prize list, and saving the target prize list in a cache to obtain a target prize pool; in the case of receiving at least one user-triggered prize-drawing request, generating at least one atomic operation carrying a prize-drawing sequence identifier; wherein the prize-drawing sequence identifier is used to represent the prize-drawing order of each atomic operation in the target prize pool, so as to realize a prize-first-come-first-served mechanism according to the prize-drawing order; the atomic operation refers to the case that, after the current operation is executed in an operation thread, another operation thread starts to execute, and the atomic operation is realized by using the lget instruction of Redis; and setting an operation time limit for limiting the operation time of each operation thread, and interrupting the operation thread when the current operation thread does not feed back the drawing result within the operation time limit; based on the prize-drawing sequence identifiers of each atomic operation, sequentially drawing out the target prize identifiers corresponding to each atomic operation from the target prize pool according to the arrangement order of the prize identifiers in the target prize list, and feeding back the corresponding prize result to each prize-drawing request based on the target prize identifier; statistically counting the number of remaining prize identifiers in the target prize pool; if the number of remaining prize identifiers reaches a preset minimum number, generating a new empty prize identifier based on the number of remaining prize identifiers and a preset winning probability, and randomly inserting it to update the target prize pool.

2. The prize draw method according to claim 1, characterized in that, The method comprises the following steps: determining the primary keys id of each type of prize and the prize quantity associated with each primary key id; generating at least one prize identifier associated with the primary key id of each type of prize according to the prize quantity; assembling the at least one prize identifier to generate an initial prize list.

3. The prize draw method according to claim 2, characterized in that, The method comprises the following steps: determining a preset winning probability and the total number of prize identifiers in the initial prize list; based on the preset winning probability and the total number of prize identifiers, calculating the total number of empty prize identifiers of empty prizes, and generating the total number of empty prize identifiers; randomly inserting the empty prize identifiers into the initial prize list to shuffle the arrangement order of the prize identifiers in the initial prize list to obtain a target prize list.

4. The prize draw method according to claim 1, characterized by, The method comprises the following steps: in the case of receiving at least one user-triggered prize-drawing request, obtaining the prize-drawing permission of each user; in the case that the prize-drawing permission of the user is consistent with the preset prize-drawing permission, determining the prize-drawing sequence identifier of the prize-drawing request according to the request trigger time of the prize-drawing request, and generating at least one atomic operation carrying the prize-drawing sequence identifier.

5. The prize draw method according to any one of claims 1 to 4, characterized in that, The prize lottery method further comprises the following steps of: updating the prize basic information corresponding to each target prize identifier.

6. The prize draw method according to claim 5, wherein The prize basic information comprises at least one of a prize name, a prize type and a prize quantity.

7. A prize draw device, characterised in that The prize lottery method further comprises the following steps of: The first generating unit is configured to generate an initial prize list, to rearrange the prize identifiers in the initial prize list by using Collections.shuffle(prizels) to obtain a target prize list, and to save the target prize list in a cache to obtain a target prize pool. The second generating unit is configured to generate at least one atomic operation carrying a lottery order identifier in response to receiving at least one user-triggered lottery request, wherein the lottery order identifier is used to represent the lottery order of each atomic operation in the target prize pool, and the prize first-come-first-served mechanism is realized according to the lottery order. The atomic operation refers to the case that another operation thread starts to execute after the current operation thread is executed in one operation thread, and the atomic operation is realized by using the lget instruction of Redis. The operation time limit is used to limit the operation time of each operation thread, and the operation thread is interrupted when the current operation thread does not feed back the extracted result within the operation time limit. The extracting unit is configured to:

8. A computer-readable storage medium having stored thereon a computer program, characterized in that extract the target prize identifier corresponding to each atomic operation from the target prize pool according to the arrangement order of the prize identifiers in the target prize list based on the lottery order identifier of each atomic operation, and feed back the corresponding prize result to each lottery request based on the target prize identifier.

9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The prize lottery method further comprises the following steps of: The computer program is executed by the processor to realize the prize lottery method according to any one of claims 1 to 6. The processor executes the program to realize the prize lottery method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Lottery information determination method, device, apparatus, and storage medium

    CN109542395A

  • Lottery data processing method and device, storage medium, and server

    CN109615758A