CN111258768B - Concurrent processing method and device for preferential lottery drawing activities - Google Patents

Concurrent processing method and device for preferential lottery drawing activities Download PDF

Info

Publication number
CN111258768B
CN111258768B CN201811457761.4A CN201811457761A CN111258768B CN 111258768 B CN111258768 B CN 111258768B CN 201811457761 A CN201811457761 A CN 201811457761A CN 111258768 B CN111258768 B CN 111258768B
Authority
CN
China
Prior art keywords
activity
request
winning
lottery
prize
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.)
Active
Application number
CN201811457761.4A
Other languages
Chinese (zh)
Other versions
CN111258768A (en
Inventor
刘良锟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Group Henan Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Henan 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 China Mobile Communications Group Co Ltd, China Mobile Group Henan Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201811457761.4A priority Critical patent/CN111258768B/en
Publication of CN111258768A publication Critical patent/CN111258768A/en
Application granted granted Critical
Publication of CN111258768B publication Critical patent/CN111258768B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0207Discounts or incentives, e.g. coupons or rebates

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Development Economics (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Game Theory and Decision Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • General Business, Economics & Management (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention provides a concurrent processing method and device for preferential lottery activities, wherein the method comprises the following steps: receiving an activity request transmitted by an activity framework and sent by any user terminal; the active framework is constructed based on Spring WebFlux; generating activity feedback based on the activity request; the activity feedback is returned to the user terminal through the activity framework. The method and the device provided by the embodiment of the invention realize the execution of various functions in a synchronous environment in a parallel mode, avoid the generation of a large number of threads in a high concurrency state, reduce the blocking probability, avoid the situation of thread queuing waiting, so that a small number of fixed threads can be used for processing a large number of requests, the subsequent upgrading is convenient, the concurrency processing capacity of preferential lottery activities is greatly improved, and the user experience is optimized.

Description

Concurrent processing method and device for preferential lottery drawing activities
Technical Field
The embodiment of the invention relates to the technical field of Internet operation, in particular to a concurrent processing method and device for preferential lottery activities.
Background
In the mainstream Internet preferential lottery marketing promotion activities at present, 1000-2000 ten thousand accurate marketing user short messages are actively issued for promotion every day by short message accurate marketing promotion, and a great deal of concurrent participation activities exist in the activity promotion period of users.
The current conventional mobile internet preferential lottery activity framework is MVC (Model View Controller) model, and belongs to a synchronous request mode framework. HTTP (Hyper Text Transfer Protocol ) request sent by user through Browser of user terminal for participating in preferential lottery is called by synchronous mode, B/S (Browser/Server) mode in synchronous mode includes: submitting a request, waiting for processing by a server, and returning after the processing is finished. During which the user terminal browser cannot perform other operations. In a high concurrency situation, when the thread pool reaches the maximum thread number, all available threads are in a blocking state, the subsequent re-entering HTTP requests can only be queued, and the response time length starts to rise. If page response is to be improved, server expansion is required to support more concurrent requests.
Therefore, when a great deal of concurrent preferential lottery activities exist, the activities are easy to be blocked, the phenomena of slow refreshing of the white screen and the like occur in page loading, and the user experience is extremely poor.
Disclosure of Invention
The embodiment of the invention provides a concurrent processing method and device for preferential lottery activities, which are used for solving the problem that page blocking, white screen and other conditions affecting user experience are easy to occur when a large number of preferential lottery activities are concurrent in the prior art.
In a first aspect, an embodiment of the present invention provides a method for concurrence processing of a preferential lottery, including:
receiving an activity request transmitted by an activity framework and sent by any user terminal; the movable frame is constructed based on Spring WebFlux;
generating activity feedback based on the activity request;
and returning the activity feedback to the any user terminal through the activity framework.
In a second aspect, an embodiment of the present invention provides a concurrence processing device for preferential lottery activities, including:
the receiving module is used for receiving an activity request transmitted by the activity framework and sent by any user terminal; the movable frame is constructed based on Spring WebFlux;
a processing module for generating activity feedback based on the activity request;
and the feedback module is used for returning the activity feedback to the any user terminal through the activity framework.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a bus, where the processor, the communication interface, and the memory are in communication with each other through the bus, and the processor may invoke logic instructions in the memory to perform the steps of the method as provided in the first aspect.
In a fourth aspect, embodiments of the present invention provide a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method as provided by the first aspect.
According to the concurrency processing method and device for preferential lottery activities, provided by the embodiment of the invention, through the activity framework constructed based on Spring WebFlux, the activity requests are processed asynchronously, so that various functions under a synchronous environment are executed in a parallel mode, a large number of threads are prevented from being generated under a high concurrency state, the blocking probability is reduced, the situation of thread queuing waiting is avoided, a small number of fixed threads can be used for processing the large number of requests, the subsequent upgrading is facilitated, the concurrency processing capacity of preferential lottery activities is improved to a great extent, and the user experience is optimized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a concurrent processing method of a preferential lottery activity provided in an embodiment of the present invention;
FIG. 2 is a schematic diagram of a concurrent processing structure of a preferential lottery activity according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for concurrent processing of a preferential lottery activity according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of a concurrent processing device for preferential lottery activities according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Aiming at the problems that when a great amount of concurrent preferential lottery activities exist, the activities are easy to be blocked, the pages are loaded to cause the phenomena of slow refreshing of a white screen and the like, and the user experience is extremely bad, the embodiment of the invention provides a concurrent processing method of the preferential lottery activities. Fig. 1 is a flow chart of a method for concurrent processing of a preferential lottery, where, as shown in fig. 1, an execution body of the method is a processing unit with a function of processing the preferential lottery, and the method includes:
110, receiving an activity request transmitted by an activity framework and sent by any user terminal; the active framework is built based on Spring WebFlux.
Here, the user terminal is an intelligent terminal for the user to perform the preferential lottery, and the user terminal may be a smart phone, a tablet computer, a notebook computer, or the like. The activity request is an HTTP request transmitted by the user through the user terminal for performing the preferential lottery activity. The user sends the activity request to the activity framework via the user terminal and the activity request to the processing unit via the activity framework. Here, the activity framework is used to take over activity requests sent by the respective user terminals. The active framework is built based on Spring WebFlux, which is a responsive Web framework that can be used to build asynchronous, non-blocking, event-driven services. The active frame constructed based on Spring WebFlux may be disposed on the same server or a different server with the processing unit, which is not particularly limited in the embodiment of the present invention.
After the activity request is taken over by the activity framework, the activity framework communicates with the processing unit, and the activity request is transmitted to the processing unit for processing. Here, since the active framework applies the non-blocking HTTP technology of Spring WebFlux, compared with the current active framework based on MVC model, various functions in the synchronous environment can be executed in a parallel manner, thereby greatly improving the concurrence processing capability of preferential lottery activities.
At 120, activity feedback is generated based on the activity request.
Here, the activity feedback is feedback information given based on the activity request, and is used to instruct the user terminal to perform the next flow of the preferential lottery activity. And generating activity feedback corresponding to the activity request aiming at the activity request issued by the activity framework. For example, when the activity request is to verify the lottery qualification, the activity feedback is either the lottery qualification or the lottery qualification disqualification; for another example, when the activity request is to perform a lottery, the activity feedback is a winning or losing prize.
And 130, returning the activity feedback to the user terminal through the activity framework.
Specifically, after the processing unit generates the activity feedback, the processing unit transmits the activity feedback to the activity framework, and returns the activity feedback to the user terminal sending the activity request via the activity framework, so that the user terminal can execute the next flow of the preferential lottery according to the activity feedback. For example, when the activity feedback is that the lottery qualification is qualified, the user terminal displays the lottery qualification as qualified and jumps to a lottery interface to prompt the user to perform lottery operation; for another example, when the activity feedback is a losing prize, the user terminal displays the losing prize, prompts the user to draw the prize this time, or waits for the user to instruct to draw the prize again.
According to the method provided by the embodiment of the invention, the activity requests are asynchronously processed through the activity frame constructed based on Spring WebFlux, so that various functions under the synchronous environment are executed in a parallel mode, the generation of a large number of threads in a high concurrency state is avoided, the blocking probability is reduced, the situation of waiting in line of the threads is avoided, the processing of a large number of requests can be processed by a small number of fixed threads, the subsequent upgrading is facilitated, the concurrency processing capacity of preferential lottery activities is greatly improved, and the user experience is optimized.
Based on the above embodiment, after step 110, the method further includes: if no threads are available in the thread pool, the active request is set to a wait for ready state.
Specifically, after receiving an activity request, if no thread is available in the current thread pool, the activity request is set to a waiting ready state, and activity feedback is not generated based on the activity request. It should be noted that, when the active request in the waiting ready state does not occupy resources and there is an available thread in the waiting thread pool, the active request in the waiting ready state is set to be in a normal state, and an active feedback is generated based on the active request.
Based on any of the above embodiments, step 120 specifically includes: when the activity request is a lottery number inquiry request, extracting the used lottery number of the user corresponding to the lottery number inquiry request from a database; if the number of the used lottery is smaller than the preset lottery, generating lottery permission information as activity feedback; otherwise, the losing prize information is generated as an activity feedback.
Specifically, before conducting a lottery operation, it is necessary to verify the lottery qualification of the user. In the embodiment of the invention, the limited lottery number is set for each user, namely the preset lottery number, and the lottery number participated by each user cannot exceed the preset lottery number. The lottery drawing times of each user are stored in a database connected with the processing unit, and are updated in real time according to the lottery drawing participation condition of the user.
When the activity request is a lottery number inquiry request, after receiving the activity request, the processing unit extracts the used lottery number of the user currently transmitting the activity request from the database, and compares the used lottery number with a preset lottery number: if the number of used sweepstakes is equal to the preset number of sweepstakes, the number of sweepstakes of the user is used up, the user is no longer qualified for sweepstakes, and the generated activity is fed back as the unwinning information which is used for indicating that the user sweepstakes at the time. If the number of the used lottery is smaller than the preset lottery, the current user accords with the lottery condition, and the generated activity feedback is lottery permission information which is used for indicating that the user has the lottery condition and can participate in the lottery activity.
Based on any of the above embodiments, step 120 specifically includes: when the activity request is a lottery request, extracting the current prize amount from the database; if the current prize quantity is greater than 0 and the prize winning probability exists, extracting the prize winning probability from the database, and calculating the prize winning condition based on the prize winning probability; if the current prize quantity is larger than 0 and the prize winning probability is not set, setting the prize winning condition as a winning prize; if the winning situation is the winning, generating winning information as activity feedback; otherwise, the losing prize information is generated as an activity feedback.
Specifically, the lottery request is used to instruct the processing unit to perform a lottery operation and return a lottery result. In the embodiment of the invention, the total prize amount is preset for preferential lottery activities. The corresponding current prize amount is updated after each prize win. The current prize amount is stored in a database connected to the processing unit.
After receiving the lottery request, the processing unit extracts the current prize amount from the database, and judges whether the prize is available for lottery based on the current prize amount: if the number of the current prizes is more than 0, namely, the current time has prizes available for lottery drawing; if the current prize number is 0, no remaining prizes are available for the drawing, no specific winning conditions are specified, and the losing information is generated as activity feedback, where the losing information is used to indicate to the user that the drawing is not being performed.
Further, for the preferential lottery, a winning probability may be set in advance. The winning probability is used herein to indicate the winning probability of any user participating in the lottery. In the case where the current prize amount is greater than 0, it is determined whether a predetermined winning probability is stored in the database. If there is a winning probability, the processing unit extracts the winning probability from the database and calculates a winning situation based on the winning probability, where the winning situation is a winning or a losing prize. If there is no winning probability, the lottery is played by default and there is a prize available for lottery, and the winning situation is set directly as the winning.
Then, corresponding activity feedback is generated according to the winning situation. If the winning situation is a winning, the processing unit generates winning information as activity feedback, where the winning information is used to characterize the user's winning, the winning information may also contain a winning prize. If the winning situation is a losing prize, the processing unit generates losing prize information as activity feedback.
Based on any of the above embodiments, step 120 specifically includes: when the activity request is a redemption request, redemption information is generated as activity feedback.
After the lottery is completed, if the user wins, the user terminal transmits a redemption request to the processing unit through the movable frame, where the redemption request is used to instruct the processing unit to issue a specific prize for the user's winning. After receiving the request for exchanging the prize, the processing unit generates the information of exchanging the prize as activity feedback, wherein the information of exchanging the prize is used for indicating that the prize which is currently obtained is issued. In addition, the processing unit can issue the prize based on the prize exchanging request, for example, when the prize is a virtual commodity such as flow or an electronic ticket, the processing unit can issue the prize directly to the user account based on the prize exchanging information, and inform the user that the prize has been issued through the prize exchanging information.
Based on any of the above embodiments, the database is provided with a Redis distributed lock.
The Redis distributed lock stores lock information by setting up a Redis server, so that the distributed lock is used for controlling the access of a plurality of threads to resources, and the problems that the plurality of threads call information such as the number of used lottery drawings, the number of current lottery drawings and the like in a database at the same time, and the number of lottery drawings, the commodity negative inventory, the number of the lottery drawings of the same user and the like are caused by untimely updating are solved.
Correspondingly, when the activity request is a lottery request, the used lottery times of the user corresponding to the activity request in the database are correspondingly updated, so that the actual lottery times of the user are prevented from exceeding the preset lottery times.
In the lottery drawing process, if the winning situation is the winning, the current prize quantity in the database is correspondingly updated, and the number of prizes under the prize category of the winning in the current prize quantity is correspondingly reduced, so that the situation that the number of prizes is delayed to cause multiple prizes or commodity inventory is avoided.
Based on any of the above embodiments, fig. 2 is a schematic diagram of a concurrent processing structure of a preferential lottery provided by an embodiment of the present invention, and fig. 3 is a schematic flow chart of a concurrent processing method of a preferential lottery provided by another embodiment of the present invention, as shown in fig. 2 and 3. The concurrent processing method of the preferential lottery comprises the following steps:
after logging in through the user terminal, the user sends out an activity request for inquiring the lottery number before participating in the lottery. The lottery number inquiry request is transmitted to the processing unit through an activity frame constructed based on Spring WebFlux, after the processing unit receives the lottery number inquiry request, the used lottery number of the user is extracted from the database, if the used lottery number is equal to the preset lottery number, the lottery number of the user is used up, the user does not have lottery qualification any more, and the generated activity is fed back as the non-winning information. If the number of the used lottery is smaller than the preset lottery, the current user accords with the lottery condition, and the generated activity feedback is lottery permission information. The processing unit then transmits the activity feedback to the user terminal via the activity framework.
If the activity feedback received by the user terminal is lottery drawing permission information, the user terminal enters a preferential lottery drawing acquisition page, the user clicks a lottery drawing through the user terminal, and the user terminal sends an activity request which is a lottery drawing request. The lottery request is transmitted to the processing unit through the movable frame, and after the processing unit receives the lottery request, the processing unit extracts the current prize amount from the database, and judges whether the prize is available for lottery based on the current prize amount: if the number of the current prizes is more than 0, namely, the current time has prizes available for lottery drawing; if the current prize number is 0, no remaining prizes are available for drawing, no winning conditions are specified, and the losing prize information is generated as activity feedback.
If the current prize amount is greater than 0, the processing unit judges whether the preset prize winning probability is stored in the database. If there is a winning probability, the processing unit extracts the winning probability from the database and calculates a winning situation based on the winning probability, where the winning situation is a winning or a losing prize. If there is no winning probability, the lottery is played by default and there is a prize available for lottery, and the winning situation is set directly as the winning. Then, corresponding activity feedback is generated according to the winning situation. If the winning situation is a winning, the processing unit generates winning information as activity feedback, where the winning information is used to characterize the user's winning, the winning information may also contain a winning prize. If the winning situation is a losing prize, the processing unit generates losing prize information as activity feedback. The processing unit then transmits the activity feedback to the user terminal via the activity framework.
If the activity feedback received by the user terminal is the winning information, the user terminal enters a user winning page to prompt the user to win the prize. The user clicks the prize exchanging through the user terminal, and the user terminal sends out an activity request which is a prize exchanging request. The lottery request is transmitted to the processing unit through the movable frame, and after the processing unit receives the lottery request, the processing unit issues the prizes based on the lottery request, and generates lottery information as activity feedback to inform the user that the prizes are issued. The activity feedback is transmitted to the user terminal through the activity framework.
If the activity feedback received by the user terminal is the prize exchanging information, the user terminal enters a prize exchanging successful page to prompt the user that the prize is successfully exchanged.
If the activity feedback received by the user terminal is the prize-losing information, the user terminal enters a prize-losing page to prompt the user of prize losing.
According to the method provided by the embodiment of the invention, the activity requests are asynchronously processed through the activity frame constructed based on Spring WebFlux, so that various functions under the synchronous environment are executed in a parallel mode, the generation of a large number of threads in a high concurrency state is avoided, the blocking probability is reduced, the situation of waiting in line of the threads is avoided, the processing of a large number of requests can be processed by a small number of fixed threads, the subsequent upgrading is facilitated, the concurrency processing capacity of preferential lottery activities is greatly improved, and the user experience is optimized.
Based on any of the above embodiments, an active framework built based on Spring WebFlux supports asynchronous mode at the bottom layer processing, supports asynchronous containers such as Netty, un-window and the like and containers of Servlet3.1 standard.
Where Netty is an asynchronous, event-driven network application framework and tool that enables the development of high-performance, high-reliability network servers and client programs, and thus coincides with a responsive programming paradigm that is also asynchronous, event-driven. After Java 7 pushes out asynchronous I/O libraries and Serveret 3.1 increases support for asynchronous I/O, the Tomcat et al Servlet container then also starts supporting asynchronous I/O, then Spring WebMVC also increases support for the Reactor library on the Web container's choice, spring WebFlux supports both traditional containers like Tomcat, jetty, etc., and asynchronous containers like Netty, undertow. For the above container, the active framework built based on Spring webf lux will adapt its input and output streams to the format of Flux < DataBuffer > for unified processing.
In addition, in the method provided by the embodiment of the invention, based on Spring WebFlux as well, a responsive Http client API WebClient is also provided. The client can initiate Http requests and process responses asynchronously and non-blocking in a functional manner, with the underlying asynchronous support also provided by Netty.
Based on any one of the above embodiments, fig. 4 is a schematic structural diagram of a device for processing a preferential lottery, which is provided in an embodiment of the present invention, and as shown in fig. 4, the device for processing a preferential lottery includes a receiving module 410, a processing module 420, and a feedback module 430;
the receiving module 410 is configured to receive an activity request sent by any user terminal and transmitted through the activity framework; the movable frame is constructed based on Spring WebFlux;
the processing module 420 is configured to generate activity feedback based on the activity request;
the feedback module 430 is configured to return the activity feedback to the any user terminal through the activity framework.
According to the device provided by the embodiment of the invention, the activity requests are asynchronously processed through the activity frame constructed based on Spring WebFlux, so that various functions under a synchronous environment are executed in a parallel mode, a large number of threads are prevented from being generated under a high concurrency state, the blocking probability is reduced, the situation of waiting in line of the threads is avoided, the processing of a large number of requests can be processed by a small number of fixed threads, the subsequent upgrading is facilitated, the concurrency processing capacity of preferential lottery activities is greatly improved, and the user experience is optimized.
Based on any of the above embodiments, the apparatus further includes a cache unit;
the cache unit is configured to set the activity request to a wait ready state if no thread is available in the thread pool.
Based on any of the above embodiments, the processing module 420 is specifically configured to:
when the activity request is a lottery number inquiry request, extracting the used lottery number of the user corresponding to the lottery number inquiry request from a database;
if the number of the used lottery is smaller than the preset lottery, generating lottery permission information as the activity feedback; otherwise, generating the prize winning information as the activity feedback.
Based on any of the above embodiments, the processing module 420 is specifically configured to: when the activity request is a lottery request, extracting the current prize amount from a database;
if the current prize quantity is greater than 0 and the prize winning probability exists, extracting the prize winning probability from the database, and calculating a prize winning condition based on the prize winning probability;
if the current prize quantity is larger than 0 and the winning probability is not set, setting the winning situation as a winning;
generating winning information as the activity feedback if the winning situation is a winning;
otherwise, generating the prize winning information as the activity feedback.
Based on any of the above embodiments, the processing module 420 is specifically configured to: and generating the prize redemption information as the activity feedback when the activity request is the prize redemption request.
Based on any of the above embodiments, the database is provided with a Redis distributed lock; the processing module 420 is further configured to: and if the winning situation is the winning, correspondingly updating the current prize quantity in the database.
Fig. 5 is a schematic entity structure diagram of an electronic device according to an embodiment of the present invention, where, as shown in fig. 5, the electronic device may include: a processor (processor) 501, a communication interface (Communications Interface) 502, a memory (memory) 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other via the communication bus 504. The processor 501 may invoke a computer program stored in the memory 503 and executable on the processor 501 to perform the method of concurrent processing of the preferential lottery activity provided in the above embodiments, including, for example: receiving an activity request transmitted by an activity framework and sent by any user terminal; the movable frame is constructed based on Spring WebFlux; generating activity feedback based on the activity request; and returning the activity feedback to the any user terminal through the activity framework.
Further, the logic instructions in the memory 503 described above may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand alone product. Based on such understanding, the technical solution of the embodiments of the present invention may be embodied in essence or a part contributing to the prior art or a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The embodiments of the present invention also provide a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the concurrent processing method of the preferential lottery activity provided in the above embodiments, for example, including: receiving an activity request transmitted by an activity framework and sent by any user terminal; the movable frame is constructed based on Spring WebFlux; generating activity feedback based on the activity request; and returning the activity feedback to the any user terminal through the activity framework.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (6)

1. A method for concurrently processing preferential lottery activities, comprising:
receiving an activity request transmitted by an activity framework and sent by any user terminal; the movable frame is constructed based on Spring WebFlux;
generating activity feedback based on the activity request;
returning the activity feedback to the any user terminal through the activity framework;
the generating the activity feedback based on the activity request specifically includes:
when the activity request is a lottery number inquiry request, extracting the used lottery number of the user corresponding to the lottery number inquiry request from a database;
if the number of the used lottery is smaller than the preset lottery, generating lottery permission information as the activity feedback; otherwise, generating the losing prize information as the activity feedback;
the generating the activity feedback based on the activity request specifically includes:
when the activity request is a lottery request, extracting the current prize amount from a database;
if the current prize quantity is greater than 0 and the prize winning probability exists, extracting the prize winning probability from the database, and calculating a prize winning condition based on the prize winning probability;
if the current prize quantity is larger than 0 and the winning probability is not set, setting the winning situation as a winning;
generating winning information as the activity feedback if the winning situation is a winning;
otherwise, generating the losing prize information as the activity feedback;
the generating the activity feedback based on the activity request specifically includes:
when the activity request is a prize redemption request, generating prize redemption information as the activity feedback;
the database is provided with a Redis distributed lock;
and if the winning situation is a winning, generating winning information as the activity feedback, and further comprising:
and if the winning situation is the winning, correspondingly updating the current prize quantity in the database.
2. The method according to claim 1, wherein the receiving the activity request transmitted through the activity framework sent by any one of the user terminals further comprises:
if no threads are available in the thread pool, the active request is set to a wait for ready state.
3. A concurrence processing device for preferential lottery activities, comprising:
the receiving module is used for receiving an activity request transmitted by the activity framework and sent by any user terminal; the movable frame is constructed based on Spring WebFlux;
a processing module for generating activity feedback based on the activity request;
the feedback module is used for returning the activity feedback to the any user terminal through the activity framework;
the generating the activity feedback based on the activity request specifically includes:
when the activity request is a lottery number inquiry request, extracting the used lottery number of the user corresponding to the lottery number inquiry request from a database;
if the number of the used lottery is smaller than the preset lottery, generating lottery permission information as the activity feedback; otherwise, generating the losing prize information as the activity feedback;
the generating the activity feedback based on the activity request specifically includes:
when the activity request is a lottery request, extracting the current prize amount from a database;
if the current prize quantity is greater than 0 and the prize winning probability exists, extracting the prize winning probability from the database, and calculating a prize winning condition based on the prize winning probability;
if the current prize quantity is larger than 0 and the winning probability is not set, setting the winning situation as a winning;
generating winning information as the activity feedback if the winning situation is a winning;
otherwise, generating the losing prize information as the activity feedback;
the generating the activity feedback based on the activity request specifically includes:
when the activity request is a prize redemption request, generating prize redemption information as the activity feedback;
the database is provided with a Redis distributed lock;
and if the winning situation is a winning, generating winning information as the activity feedback, and further comprising:
and if the winning situation is the winning, correspondingly updating the current prize quantity in the database.
4. The apparatus of claim 3, further comprising a cache unit;
the cache unit is configured to set the activity request to a wait ready state if no thread is available in the thread pool.
5. An electronic device comprising a processor, a communication interface, a memory and a bus, wherein the processor, the communication interface, and the memory are in communication with each other via the bus, and wherein the processor is operable to invoke logic instructions in the memory to perform the method of any of claims 1-2.
6. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the method according to any one of claims 1 to 2.
CN201811457761.4A 2018-11-30 2018-11-30 Concurrent processing method and device for preferential lottery drawing activities Active CN111258768B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811457761.4A CN111258768B (en) 2018-11-30 2018-11-30 Concurrent processing method and device for preferential lottery drawing activities

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811457761.4A CN111258768B (en) 2018-11-30 2018-11-30 Concurrent processing method and device for preferential lottery drawing activities

Publications (2)

Publication Number Publication Date
CN111258768A CN111258768A (en) 2020-06-09
CN111258768B true CN111258768B (en) 2023-09-19

Family

ID=70953619

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811457761.4A Active CN111258768B (en) 2018-11-30 2018-11-30 Concurrent processing method and device for preferential lottery drawing activities

Country Status (1)

Country Link
CN (1) CN111258768B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113034207A (en) * 2021-04-20 2021-06-25 青岛冠成软件有限公司 Lottery information processing method, device, server and readable storage medium
CN114996031B (en) * 2022-08-03 2022-12-27 飞狐信息技术(天津)有限公司 Lottery drawing method and related device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101178818A (en) * 2006-08-11 2008-05-14 大连零点娱乐互动有限公司 Apparatus, method and system for real-time processing data
CN107220853A (en) * 2017-05-27 2017-09-29 北京奇虎科技有限公司 Prize drawing data processing method, device, server and computer-readable storage medium
WO2018032399A1 (en) * 2016-08-17 2018-02-22 Zte Corporation Server and method having high concurrency capability
CN108022126A (en) * 2017-11-29 2018-05-11 广东欧珀移动通信有限公司 Definite method, apparatus, server and the storage medium of prize drawing qualification
CN108881368A (en) * 2018-04-22 2018-11-23 平安科技(深圳)有限公司 High concurrent service request processing method, device, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8517811B2 (en) * 2009-05-26 2013-08-27 Pollard Banknote Limited Partnership Method of playing a lottery game including a group-based second chance game

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101178818A (en) * 2006-08-11 2008-05-14 大连零点娱乐互动有限公司 Apparatus, method and system for real-time processing data
WO2018032399A1 (en) * 2016-08-17 2018-02-22 Zte Corporation Server and method having high concurrency capability
CN107220853A (en) * 2017-05-27 2017-09-29 北京奇虎科技有限公司 Prize drawing data processing method, device, server and computer-readable storage medium
CN108022126A (en) * 2017-11-29 2018-05-11 广东欧珀移动通信有限公司 Definite method, apparatus, server and the storage medium of prize drawing qualification
CN108881368A (en) * 2018-04-22 2018-11-23 平安科技(深圳)有限公司 High concurrent service request processing method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN111258768A (en) 2020-06-09

Similar Documents

Publication Publication Date Title
US20200379779A1 (en) Program operating method and apparatus, computing device, and storage medium
US20090119302A1 (en) Asynchronous client to server updates
CN111258768B (en) Concurrent processing method and device for preferential lottery drawing activities
CN103685154A (en) Internet-based probability product data processing method and server
CN112559208A (en) Method for constructing micro-service MQ applied to government affair cloud platform
CN110362986A (en) A kind of wechat small routine automatic logging method and storage equipment
WO2024011899A1 (en) Widget loading method and apparatus, device, and storage medium
CN107317788A (en) Real time data method for pushing and device
CN113055348B (en) Cross-platform data request method and device and electronic equipment
CN112819638A (en) Transaction weight judging method, device, equipment and computer readable medium
CN106970872B (en) Information point burying method and device
EP2700023B1 (en) Reducing latency for served applications by anticipatory preprocessing
CN115270743A (en) Form data processing method and device
CN112612807B (en) Distributed transaction data consistency system design method
CN114356970A (en) Storage system resource caching method and device
CN112162988A (en) Distributed transaction processing method and device and electronic equipment
CN114237929A (en) Method for exporting big data by Web server
CN113190624A (en) Asynchronous-to-synchronous calling method and device based on distributed cross-container
CN113486032A (en) Date switching method and device, electronic equipment and computer readable medium
CN112422670A (en) Method for designing asynchronous push model based on intermediate message
CN108234481B (en) Method for controlling multi-machine distributed access to external system and distributed system
JP7143866B2 (en) Cache management program, server, cache management method, and information processing device
CN116643870B (en) Method, system and device for processing long-time task distribution and readable storage medium
CN114448715B (en) Authentication method, device, equipment and storage medium based on token
CN112561567A (en) Asynchronous processing method, system and equipment for electronic red packet getting request

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
GR01 Patent grant
GR01 Patent grant