A seat selection method, ticket selling method, device and system

Through the consistent hashing algorithm and queue management mechanism, multiple ballot and ticket source management servers are used to share ticket purchase requests, which solves the problem of balancing efficiency, effectiveness and fairness in automatic seat selection for online ticket sales, and achieves efficient and fair seat allocation.

CN113919897BActive Publication Date: 2025-09-16ALIBABA GROUP HOLDING LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202010657076.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-09
Publication Date
2025-09-16
Estimated Expiration
2040-07-09

AI Technical Summary

Technical Problem

Existing technologies make it difficult to simultaneously ensure efficiency, effectiveness, and fairness in the process of automatic seat selection for online ticket sales. This is especially true when multiple threads compete for resources, which can easily lead to seats being occupied by users who place orders first or seats for popular sessions being sold out.

Method used

By adopting the consistent hashing algorithm and queue management mechanism, ticket purchase requests are shared by multiple voting servers and ticket source management servers, and the hash structure is used to evenly distribute the ticket source management servers to achieve fairness and efficiency in seat allocation.

Benefits of technology

It achieves high efficiency, effectiveness and fairness in online automatic seat selection, ensures that users are reasonably allocated seats according to order and priority, and avoids users' failure to reserve seats and waste of seats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113919897B_ABST
    Figure CN113919897B_ABST
Patent Text Reader

Abstract

The present invention discloses a seat selection method, ticket sales method, device, and system. The seat selection method includes: responding to an assigned ticket request, adding the ticket request to a ticket request queue based on the viewing area specified in the ticket request; allocating a seat from pre-allocated seat resources to the currently processed ticket request in the ticket request queue; and, if the number of matching seats in the seat resources is less than the number of seats specified in the ticket request, requesting a seat matching the viewing area specified in the currently processed ticket request from a ticket source management server. This method enables efficient and reasonable online automatic seat selection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of e-commerce, and in particular to a seat selection method, a ticket selling method, a device and a system. Background Art

[0002] Automatic seat selection is a crucial feature during online ticketing. However, venue seat distribution is complex. Different venues have different ticket blocks, and even the same venue often has multiple blocks. Seats within the same block offer different viewing angles. Users placing an order expect multiple seats within the same block to be adjacent and offer a good viewing angle. Therefore, automatic seat selection must implement at least the following fair and effective features:

[0003] (1) The earlier the user places an order, the better the viewing angle they will get.

[0004] (2) The seats of the same order are continuous or as continuous as possible in the physical scene.

[0005] (3) Avoid the situation where multiple users compete for resources and fail to reserve a seat, resulting in a vacant seat or no seat for the user who placed the order first.

[0006] Some existing technologies use a single-thread + queue approach to solve the fairness and effectiveness issues of automatic seat selection in online ticket sales, but the efficiency of single-thread voting becomes the biggest problem; in order to solve the efficiency problem, the existing technology also uses multiple threads to compete for resources at the same time, but this is easy to cause competition failure, resulting in users who place orders first to lose good seats due to continuous failure to reserve seats, or the seats of popular sessions are taken away. Figure 1 As shown, user 1 and user 2 come in at the same time, and user 3 comes in later. As a result, user 1 and user 2 compete for the same seat resource at the same time, and user 2 fails to get the ticket.

[0007] Therefore, how to ensure efficiency while achieving effectiveness and fairness in the automatic seat selection process is a technical problem that urgently needs to be solved. Summary of the Invention

[0008] In view of the above problems, the present invention is proposed to provide a seat selection method, ticket selling method, device and system that overcome the above problems or at least partially solve the above problems.

[0009] In a first aspect, an embodiment of the present invention provides a seat selection method, comprising:

[0010] In response to the allocated ticket purchase request, adding the ticket purchase request to a ticket purchase request queue according to the viewing area in the ticket purchase request;

[0011] Allocate seats for the ticket purchase requests currently being processed in the ticket purchase request queue from pre-allocated seat resources;

[0012] If the number of matching seats in the seat resource is less than the number of seats in the ticket purchase request, a request is made to the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request.

[0013] In some optional embodiments, requesting the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request specifically includes:

[0014] According to the identification of the viewing area in the currently processed ticket purchase request, determine the virtual node corresponding to the identification on the pre-established hash structure through a consistent hashing algorithm;

[0015] According to the address of the ticket source management server corresponding to the virtual node, a request is made to the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request.

[0016] In some optional embodiments, determining the virtual node corresponding to the identifier on the pre-established hash structure by using a consistent hashing algorithm specifically includes:

[0017] Determine a hash point of the identifier on a hash structure using a consistent hashing algorithm, wherein the hash structure is a ring structure pre-established by the consistent hashing algorithm based on an address list of a ticket source management server, and an address in the address list corresponds to multiple virtual nodes in the hash structure;

[0018] In the hash structure, along a preset direction, a virtual node closest to the hash point is determined as the virtual node corresponding to the identifier.

[0019] In some optional embodiments, after establishing the hash structure, the method further includes:

[0020] If it is determined that a new address of the ticket source management server is added to the address list, a new hash structure is established using the consistent hashing algorithm according to the current address list;

[0021] If it is determined that the address of the ticket source management server is reduced in the address list, the virtual node corresponding to the reduced address is deleted in the current hash structure.

[0022] In some optional embodiments, requesting the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request specifically includes:

[0023] Based on the identifier of the viewing area in the currently processed ticket purchase request and the mapping relationship between the viewing area identifier and the address of the ticket source management server, the address of the ticket source management server is determined, and a request is made to the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request.

[0024] In some optional embodiments, when the mapping relationship does not contain the identifier of the viewing area in the currently processed ticket purchase request, the method further includes:

[0025] According to the identification of the viewing area in the currently processed ticket purchase request, determine the virtual node corresponding to the identification on the pre-established hash structure through a consistent hashing algorithm;

[0026] According to the address of the ticket source management server corresponding to the virtual node, request the ticket source management server for a seat that matches the viewing area in the currently processed ticket purchase request;

[0027] Fill the identification and the determined address into the mapping relationship.

[0028] In some optional embodiments, determining the virtual node corresponding to the identifier on the pre-established hash structure by using a consistent hashing algorithm specifically includes:

[0029] Determine a hash point of the identifier on a hash structure using a consistent hashing algorithm, wherein the hash structure is a ring structure pre-established by the consistent hashing algorithm based on an address list of a ticket source management server, and an address in the address list corresponds to multiple virtual nodes in the hash structure;

[0030] In the hash structure, along a preset direction, a virtual node closest to the hash point is determined as the virtual node corresponding to the identifier.

[0031] In some optional embodiments, after establishing the hash structure, the method further includes:

[0032] If it is determined that a new address of the ticket source management server is added to the address list, a new hash structure is established according to the current address list using the consistent hashing algorithm, and the current mapping relationship is cleared;

[0033] If it is determined that the address of the ticket source management server has been reduced in the address list, the virtual node corresponding to the reduced address is deleted in the current hash structure. When it is determined that the address of the ticket source management server has been reduced in the current mapping relationship, the address and the corresponding viewing area identifier are deleted.

[0034] In some optional embodiments, requesting the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request specifically includes:

[0035] According to the preset multiple and the number of ticket purchase requests in the currently processed ticket purchase request queue, the number of seats to be requested is determined, and the ticket source management server is requested to provide the seats of the number that match the viewing area in the currently processed ticket purchase request.

[0036] In some optional embodiments, the above method further includes:

[0037] For the seat resources matching each viewing area among the pre-allocated seat resources, the seat resources matching the viewing area are updated according to a preset time interval.

[0038] In some optional embodiments, updating the seat resources matching the viewing area at a preset time interval specifically includes:

[0039] Determine whether there is an unprocessed ticket purchase request queue matching the viewing area at a preset time interval;

[0040] If so, request seats matching the viewing area from the ticket source management server that manages the seat resources matching the viewing area, and replace the current seat resources according to the request result;

[0041] If not, remove the seats matching the viewing area from the current seat resources.

[0042] In some optional embodiments, adding the ticket purchase request to a ticket purchase request queue according to the viewing area in the ticket purchase request specifically includes:

[0043] Determining whether there is a ticket purchase request queue that matches the viewing area in the ticket purchase request;

[0044] If so, add the ticket purchase request to the end of the ticket purchase request queue that matches the viewing area;

[0045] If not, create a ticket purchase request queue that matches the viewing area, and add the ticket purchase request to the created ticket purchase request queue.

[0046] In some optional embodiments, allocating a seat from pre-allocated seat resources to the currently processed ticket purchase request specifically includes:

[0047] Based on the number of seats and viewing area of ​​the currently processed ticket purchase request, the seat with the highest priority that matches the viewing area is obtained from the pre-allocated seat resources and allocated to the currently processed ticket purchase request.

[0048] In a second aspect, an embodiment of the present invention provides a seat selection method, comprising:

[0049] In response to a received seat request, adding the seat request to a seat request queue according to a viewing area in the seat request;

[0050] For the seat request in the currently processed seat request queue, a seat is allocated for the currently processed seat request from the pre-allocated seat resources, so that the ticket server that sends the seat request allocates the allocated seat to the ticket purchase request corresponding to the seat request.

[0051] In some optional embodiments, allocating a seat from pre-allocated seat resources to the currently processed seat request specifically includes:

[0052] Determine the number of seats to be allocated based on the preset multiple and the number of ticket purchase requests currently being processed;

[0053] According to the viewing area in the currently processed seat request and the number of seats to be allocated, seats with matching viewing areas are allocated to the currently processed seat request from pre-allocated seat resources.

[0054] In some optional embodiments, allocating a seat matching the viewing area to the currently processed seat request from pre-allocated seat resources specifically includes:

[0055] From the pre-allocated seat resources, the seat that matches the highest priority viewing area is assigned to the currently processed seat request.

[0056] In some optional embodiments, allocating seats from pre-allocated seat resources to the currently processed seat request further includes:

[0057] If there is no seat matching the viewing area of ​​the currently processed seat request in the pre-allocated seat resources, a seat matching the viewing area is obtained from the database.

[0058] In some optional embodiments, the method further includes:

[0059] According to the viewing areas of the seats in the pre-allocated seat resources, seats with matching viewing areas are obtained from the database at preset time intervals;

[0060] The pre-allocated seat resources are updated using the acquisition result.

[0061] In some optional embodiments, adding the seat request to a seat request queue according to the viewing area in the seat request specifically includes:

[0062] Determining whether there is a seat request queue that matches the viewing area in the seat request;

[0063] If so, add the seat request to the end of the queue of seat requests that match the viewing area;

[0064] If not, create a seat request queue that matches the viewing area, and add the seat request to the created seat request queue.

[0065] In a third aspect, an embodiment of the present invention provides a ticket selling method, including:

[0066] The distribution server distributes the received ticket purchase request to the voting server, and obtains the seat allocated by the voting server to the ticket purchase request using the method described in the first aspect above;

[0067] When the seat is successfully deducted from the database, an order is generated and sent to the terminal that sent the ticket purchase request, and the order includes the ticket purchase request and the seat.

[0068] In some optional embodiments, the method further includes:

[0069] When the deduction of the seat from the database fails, a message of ticket purchase failure is sent to the terminal that sent the ticket purchase request.

[0070] In some optional embodiments, before the distribution server distributes the received ticket purchase request to the vote server, the process further includes:

[0071] The distribution server sends information on whether to change the viewing area to the terminal that sent the ticket purchase request in response to the received ticket purchase request;

[0072] If selection information for changing the viewing area is received, at least one new viewing area is pushed to the user according to the selection information, and the viewing area in the ticket purchase request is updated according to the new viewing area selected by the user. The information sent to the terminal regarding whether to change the viewing area includes at least one of the following:

[0073] Whether to choose a cheaper viewing area, whether to choose a better viewing area, whether to choose a viewing area with less queues.

[0074] In some optional embodiments, after generating and sending the order to the terminal that sent the ticket purchase request, the method further includes:

[0075] After receiving the order confirmation information sent by the terminal within a preset time, the payment server generates payment information for the order, and after confirming that the terminal has successfully paid according to the payment information, notifies the database to mark the seat as sold;

[0076] If the payment server does not receive the confirmation information of the order sent by the terminal within a preset time, or after confirming that the terminal fails to pay according to the payment information, it notifies the database to mark the seat as unallocated.

[0077] In a fourth aspect, an embodiment of the present invention provides a cargo distribution method, comprising:

[0078] In response to the allocated purchase request, adding the purchase request to a purchase request queue according to the attributes of the goods in the purchase request;

[0079] Allocate goods for the purchase request currently being processed from the pre-allocated goods resources for the purchase request currently being processed in the purchase request queue;

[0080] If the quantity of matching goods in the goods resource is less than the purchase quantity in the purchase request, a request is made to the goods management server for goods that match the attributes of the goods in the currently processed purchase request.

[0081] In a fifth aspect, an embodiment of the present invention provides a cargo distribution method, comprising:

[0082] In response to the received cargo request, adding the cargo request to a cargo request queue according to cargo attributes in the cargo request;

[0083] For the goods request in the currently processed goods request queue, goods are allocated to the currently processed goods request from the pre-allocated goods resources, so that the goods selection server that sends the goods request allocates the allocated goods to the purchase request corresponding to the goods request.

[0084] In a sixth aspect, an embodiment of the present invention provides a red envelope distribution method, comprising:

[0085] In response to the allocated red envelope request, adding the red envelope request to a red envelope request queue according to the applicable scope in the red envelope request;

[0086] For the red envelope request in the currently processed red envelope request queue, allocate a red envelope to the currently processed red envelope request from the pre-allocated red envelope resources;

[0087] If the number of matching red envelopes in the red envelope resource is less than the number of requests in the red envelope request, a red envelope matching the applicable scope in the currently processed red envelope request is requested from the red envelope management server.

[0088] In a seventh aspect, an embodiment of the present invention provides a red envelope distribution method, comprising:

[0089] In response to the received red envelope resource request, adding the red envelope resource request to a red envelope resource request queue according to an applicable scope in the red envelope resource request;

[0090] For the red envelope resource request in the currently processed red envelope resource request queue, a red envelope is allocated to the currently processed red envelope resource request from the pre-allocated resources, so that the red envelope allocation server that sends the red envelope resource request allocates the allocated red envelope to the red envelope request corresponding to the red envelope resource request.

[0091] In an eighth aspect, an embodiment of the present invention provides a game queuing method, comprising:

[0092] In response to the allocated game request, adding the game request to a game request queue according to the type of the game request;

[0093] Allocate a quota for the game request currently being processed from the pre-allocated quota resources in the game request queue;

[0094] If there is no matching quota in the quota resource, a request is made to the quota management server for a game quota that matches the type in the currently processed game request.

[0095] In a ninth aspect, an embodiment of the present invention provides a game queuing method, comprising:

[0096] In response to the received quota request, adding the quota request to a quota request queue according to the type of the quota request;

[0097] For the quota request in the currently processed quota request queue, a quota is allocated to the currently processed quota request from the pre-allocated quota resources, so that the game quota allocation server that sends the quota request allocates the allocated quota to the game request corresponding to the quota request.

[0098] In a tenth aspect, an embodiment of the present invention provides a seat selection device, comprising:

[0099] a queue management module, configured to respond to assigned ticket purchase requests and add the ticket purchase requests to a ticket purchase request queue according to the viewing area in the ticket purchase requests;

[0100] The seat selection module is used to allocate seats to the ticket purchase requests currently being processed from the pre-allocated seat resources for the ticket purchase requests in the ticket purchase request queue currently being processed;

[0101] A seat request module is used to request a seat matching the viewing area in the currently processed ticket purchase request from the ticket source management server if the seat selection module determines that the number of matching seats in the seat resource is less than the number of seats in the ticket purchase request.

[0102] In an eleventh aspect, an embodiment of the present invention provides a seat selection device, comprising:

[0103] a queue management module, configured to, in response to a received seat request, add the seat request to a seat request queue according to a viewing area in the seat request;

[0104] The seat allocation module is used to allocate seats to the seat requests currently being processed from the pre-allocated seat resources for the seat requests in the seat request queue currently being processed, so that the ticket server that sends the seat request allocates the allocated seats to the ticket purchase request corresponding to the seat request.

[0105] In a twelfth aspect, an embodiment of the present invention provides a seat selection system, including:

[0106] Multiple ballot servers, multiple ticket source management servers, and a load scheduler, wherein the ballot servers are provided with the seat selection device described in the eighth aspect, and the ticket source management servers are provided with the seat selection device described in the ninth aspect;

[0107] The load dispatcher is used to send the received ticket purchase request to one of the voting servers according to the principle of load balancing.

[0108] In a thirteenth aspect, an embodiment of the present invention provides a ticketing system, including:

[0109] at least one distribution server, a plurality of ballot servers, and a plurality of ticket source management servers, wherein the ticket source management servers are provided with the seat selection device described in the ninth aspect;

[0110] The distribution server is provided with a load dispatcher, and the load dispatcher is used to send the received ticket purchase request to one of the voting servers according to the principle of load balancing;

[0111] The ticket server is configured to allocate a seat to the ticket purchase request using the seat selection method described in the first aspect, and send the ticket purchase request and the seat to the distribution server;

[0112] The distribution server is configured to generate and send an order including the ticket purchase request and the seat to the terminal that sent the ticket purchase request when the seat is successfully deducted from the database.

[0113] In a fourteenth aspect, an embodiment of the present invention provides a ticketing system, including:

[0114] at least one distribution server, multiple ballot servers, multiple ticket source management servers, and a payment server, wherein the ticket source management server is provided with the seat selection device described in the ninth aspect;

[0115] The distribution server is provided with a load dispatcher, and the load dispatcher is used to send the received ticket purchase request to one of the voting servers according to the principle of load balancing;

[0116] The ticket server is configured to allocate a seat to the ticket purchase request using the seat selection method described in the first aspect, and send the ticket purchase request and the seat to the distribution server;

[0117] The distribution server is configured to generate and send an order including the ticket purchase request and the seat to the terminal that sent the ticket purchase request when the seat is successfully deducted from the database;

[0118] The payment server is configured to generate payment information for the order after receiving confirmation information of the order sent by the terminal within a preset time, and notify the database to mark the seat as sold after confirming that the terminal has successfully paid according to the payment information; if the payment server does not receive confirmation information of the order sent by the terminal within the preset time, or after confirming that the terminal has failed to pay according to the payment information, the payment server notifies the database to mark the seat as unallocated.

[0119] In a fifteenth aspect, an embodiment of the present invention provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implements the above-mentioned seat selection method or the above-mentioned ticket selling method.

[0120] In the seat selection method provided by an embodiment of the present invention, a voting server responds to an assigned ticket request and adds the ticket request to a ticket request queue based on the viewing area specified in the ticket request. For the ticket request currently being processed in the ticket request queue, a seat is allocated from pre-allocated seat resources. If the number of matching seats in the seat resources is less than the number of seats specified in the ticket request, a request is made to the ticket source management server for a seat matching the viewing area specified in the currently processed ticket request. Ticket requests are shared by multiple voting servers, each of which manages seats for one or more viewing areas. The voting server allocates seats to ticket requests, and the ticket source management server allocates seats to the ticket request queue, ensuring efficient and effective seat selection. Allocating seats in a queue ensures fairness in voting. Therefore, the seat selection method provided by an embodiment of the present invention achieves efficiency, effectiveness, and fairness in seat selection.

[0121] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purposes and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.

[0122] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0123] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0124] Figure 1 This is a diagram of an applicable scenario of an embodiment of the present invention;

[0125] Figure 2 This is a flow chart of the seat selection method in Example 1 of the present invention;

[0126] Figure 3 This is a flowchart for requesting a seat from a ticket source management server in the first embodiment of the present invention;

[0127] Figure 4 This is an example diagram of a hash structure in the first embodiment of the present invention;

[0128] Figure 5 This is another flowchart for requesting a seat from a ticket source management server in the first embodiment of the present invention;

[0129] Figure 6 Flowchart of the second seat selection method implemented in the present invention;

[0130] Figure 7 This is a specific implementation flow chart of the seat selection method in the implementation of the present invention;

[0131] Figure 8 Schematic diagram of the structure of the seat selection device in an embodiment of the present invention;

[0132] Figure 9 Schematic diagram of the structure of another seat selection device in an embodiment of the present invention;

[0133] Figure 10 A structural diagram of a seat selection system according to an embodiment of the present invention

[0134] Figure 11 This is a schematic diagram of the structure of a ticketing system in an embodiment of the present invention;

[0135] Figure 12 Schematic diagram of the structure of another ticketing system in an embodiment of the present invention. DETAILED DESCRIPTION

[0136] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0137] In order to solve the problem in the prior art that efficiency, effectiveness and fairness cannot be taken into account in the automatic seat selection process, the embodiments of the present invention provide a seat selection method, a ticket selling method, an apparatus and a system, which can realize online automatic seat selection efficiently and reasonably.

[0138] Reference Figure 1 As shown, the embodiments of the present invention may be applicable to the following scenarios:

[0139] 1. The user sends a ticket purchase request through terminal 1.

[0140] Specifically, the ticket purchase request sent includes the viewing area and the number of seats requested, and the terminal 1 can be a mobile terminal or a PC terminal.

[0141] 2. After receiving the ticket purchase request sent by the user, the distribution server 2 sends the ticket purchase request to a voting server 3 in the voting server group through the load scheduler according to the load balancing principle.

[0142] Specifically, the distribution server 2 can be a single server or a server group.

[0143] 3. The ticket server 3 adds the allocated ticket purchase requests to the matching ticket purchase request queue according to the viewing area, and allocates seats to each ticket purchase request in each ticket purchase request queue in order.

[0144] Specifically, the seats allocated by the ballot server 3 for the ticket purchase request are stored locally after being requested from the corresponding ticket source management server 4 in the ticket source management server group. When there are not enough local seats, the corresponding ticket source management server 4 is requested in real time.

[0145] 4. The ticket source management server 4 adds the received seat requests to the matching seat request queue according to the viewing area, and allocates seats to each seat request in each seat request queue in order.

[0146] Specifically, different ballot servers 4 fixedly manage seats in at least one viewing area. The seats allocated by the ticket source management server 4 to the ballot server 3 are obtained in advance from the database 5. For one viewing area, all seats that can be allocated in the viewing area are obtained from the database at one time. After all the seats in the viewing area are released at preset intervals, they are again obtained from the database, and the seat resources are updated at preset intervals.

[0147] 5. The ticket server 3 sends the seats allocated for the ticket purchase request to the distribution server 2. After successfully deducting the corresponding seats from the database 5, the distribution server 2 generates and sends an order including the ticket purchase request and seats to the corresponding terminal 1.

[0148] 6. After terminal 1 receives and confirms the order, payment server 6 generates payment information and sends it to terminal 1 through distribution server 2.

[0149] 7. After the payment server 6 determines that the terminal 1 has successfully paid, it notifies the database 5 to modify the status of the corresponding seat.

[0150] Example 1

[0151] The first embodiment of the present invention provides a seat selection method, which is mainly executed by a ballot server. The process is as follows: Figure 2 As shown, the following steps are included:

[0152] Step S21: In response to the allocated ticket purchase request, the ticket purchase request is added to the ticket purchase request queue according to the viewing area in the ticket purchase request.

[0153] In one embodiment, it may include determining whether there is a ticket purchase request queue that matches the viewing area in the ticket purchase request; if so, adding the ticket purchase request to the end of the ticket purchase request queue that matches the viewing area; if not, creating a ticket purchase request queue that matches the viewing area, and adding the ticket purchase request to the created ticket purchase request queue.

[0154] That is, ticket purchase requests for the same viewing area are placed in a single ticket purchase request queue, with earlier requests placed at the front and later requests placed at the back. Sorting ticket purchase requests for the same viewing area by request time ensures fairness in voting, with first-come, first-served voting.

[0155] Each time the ticket server receives an assigned ticket purchase request, it executes the above step S21.

[0156] For each ticket purchase request queue, the ticket server processes the ticket purchase requests in the ticket purchase request queue in sequence according to the following steps S22 and S23.

[0157] Specifically, ticket request queues can be processed in parallel. Alternatively, the queues corresponding to VIP user requests can be processed first, followed by the queues corresponding to non-VIP user requests. This means that ticket requests are added to matching queues based on the viewing area in the request, while also considering whether the request is from a VIP user. Requests with both consistent VIP user and viewing area are placed in the same queue. Alternatively, each ticket request queue can be processed according to other sequential rules.

[0158] Specifically, the aforementioned viewing areas can be a collective term for seats of the same price within the same venue; or they can be further divided based on other criteria within the same venue and price range, such as children's tickets, adult tickets, or barrier-free tickets for people with disabilities. The specific division of viewing areas can be determined based on the specific seating conditions within the venue.

[0159] Step S22: for the ticket purchase request in the currently processed ticket purchase request queue, a seat is allocated for the currently processed ticket purchase request from pre-allocated seat resources.

[0160] Specifically, according to the number of seats and the viewing area of ​​the currently processed ticket purchase request, the seat with the highest priority matching the viewing area among the pre-allocated seat resources is allocated to the currently processed ticket purchase request.

[0161] When the number of seats in the ticket purchase request is greater than 1, the highest-priority and adjacent seats that match the viewing area in the ticket purchase request may be allocated to the currently processed ticket purchase request; optionally, seats may be allocated to the currently processed ticket purchase request according to other rules, as long as the allocated seats are in the corresponding viewing area and the number is the same as the number of seats in the ticket purchase request.

[0162] The seats with the highest priority that match the viewing area are assigned to the currently processed ticket purchase request, which further ensures the fairness of seat selection. The seats are assigned on a first-come, first-served basis, and the seats assigned to those who arrive first have higher priority.

[0163] Specifically, the priorities may be pre-assessed based on the viewing angles of the seats; alternatively, they may be assessed based on other factors.

[0164] When it is determined that the number of matching seats in the seat resources is less than the number of seats in the ticket purchase request, step S23 is executed.

[0165] Step S23: Request the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request.

[0166] In one embodiment, it may include determining the number of seats to be requested based on a preset multiple and the number of ticket purchase requests in the currently processed ticket purchase request queue, and requesting the ticket source management server for the number of seats that match the viewing area in the currently processed ticket purchase request.

[0167] Specifically, the preset multiple may be an average value of the number of seats in ticket purchase requests obtained within a set time and calculated in advance.

[0168] The ticket server manages each ticket purchase request queue. When a new ticket purchase request is added or seats are allocated for the ticket purchase requests, the queue length, that is, the number of currently unprocessed ticket purchase requests, is updated. When it is determined that the local ticket supply is insufficient, seats in the corresponding viewing area are requested from the ticket source management server. The number of seats requested is not the number of seats for the currently processed ticket purchase requests, but the number of seats to be requested determined based on the current number of ticket purchase requests and a preset multiple. This reduces the number of seat requests made to the ticket source management server, thereby improving the speed of seat allocation. At the same time, the number of seats requested is not accurately determined based on the number of seats for each ticket purchase request in the queue. This reduces the amount of calculation before each seat request, improves the request speed, and thus improves the seat allocation speed.

[0169] Optionally, the number of seats requested from the ticket source management server that matches the viewing area in the currently processed ticket purchase request can be a preset fixed number. This further reduces the computational effort required to maintain the ticket purchase request queue length. However, rather than estimating the number of requests on demand, requesting too many seats wastes storage resources and may impact seat requests for the same viewing area from other ticket servers within the corresponding time period. If requesting too few seats, they may be quickly allocated, necessitating new requests, increasing the number of requests and thus impacting seat allocation efficiency. Therefore, the rationality of setting the fixed number will affect the efficiency of seat allocation.

[0170] Optionally, the number of seats requested from the ticket source management server each time may be determined by other methods, which may be determined based on actual needs.

[0171] Specifically, how to determine which ticket source management server to request a seat from will be described in detail later.

[0172] After the ballot server obtains the seats matching the viewing area assigned to it by the ticket source management server for the ticket purchase request sent by it, it first updates the local seat resources according to the request result, and allocates seats for the currently processed ticket purchase request from the updated seat resources.

[0173] In one embodiment, for the seat resources matching each viewing area among the pre-allocated seat resources, the seat resources matching the viewing area are updated according to a preset time interval.

[0174] After the ballot server obtains the seats of the corresponding viewing area assigned to it by the ticket source management server in response to the ticket purchase request sent by it, it determines whether there is an unprocessed ticket purchase request queue matching the viewing area at a preset time interval; if so, it requests the seats matching the viewing area from the ticket source management server that manages the seat resources matching the viewing area, and replaces the current seat resources with the request result; if not, it deletes the seats matching the viewing area from the current seat resources.

[0175] The voting server updates the seats for each local viewing area at preset intervals, ensuring timely release of over-requested seats and the validity of locally stored seat resources. The voting server stores pre-allocated seats locally, so the local seat resources are identical to the pre-allocated seat resources and are continuously updated with seat allocations and new requests.

[0176] In the seat selection method provided by the first embodiment of the present invention, a ballot server responds to an assigned ticket request and adds the ticket request to a ticket request queue based on the viewing area specified in the ticket request. For the ticket request currently being processed in the ticket request queue, a seat is allocated from pre-allocated seat resources. If the number of matching seats in the seat resources is less than the number of seats specified in the ticket request, a request is made to the ticket source management server for a seat matching the viewing area specified in the currently being processed ticket request. Ticket requests are shared by multiple ballot servers, each of which manages seats in one or more viewing areas. The ballot server allocates seats to the ticket request, and the ticket source management server allocates seats to the ticket request queue, ensuring efficient and effective seat selection. Allocating seats in a queue ensures fairness in ballot selection. Therefore, the seat selection method provided by the embodiment of the present invention simultaneously achieves efficiency, effectiveness, and fairness in seat selection.

[0177] In the above step S23, the specific ticket source management server to be requested for seats matching the viewing area in the currently processed ticket purchase request can be determined in the following two ways.

[0178] Method 1: Use the hash structure and the viewing area in the currently processed ticket purchase request to determine the ticket source management server.

[0179] Reference Figure 3 As shown, the specific steps are as follows:

[0180] Step S31: According to the identifier of the viewing area in the currently processed ticket purchase request, a hash point of the identifier on a pre-established hash structure is determined by a consistent hashing algorithm.

[0181] Specifically, the above hash structure is a ring structure containing multiple virtual nodes established through a consistent hashing algorithm based on the address list of the ticket source management server, and one address in the address list corresponds to multiple virtual nodes on the ring structure.

[0182] There is no specific limit on the number of virtual nodes, as long as the location distribution of the virtual nodes on the hash structure can reach a preset uniformity.

[0183] In one embodiment, if it is determined that a new ticket source management server address is added to the address list, a new ring hash structure containing multiple virtual nodes is established based on the current address list through a consistent hashing algorithm; if it is determined that the ticket source management server address is reduced in the address list, the virtual node corresponding to the reduced address is deleted from the current hash structure.

[0184] Reference Figure 4 As shown, the ticket source management server is recorded as a Worker, and the established hash structure contains four virtual nodes corresponding to the Workers.

[0185] Step S32: Determine the virtual node on the hash structure that is closest to the hash point along a preset direction as the virtual node corresponding to the identifier.

[0186] The above preset direction can be Figure 4 The direction is clockwise, and optionally counterclockwise.

[0187] Step S33: According to the address of the ticket source management server corresponding to the virtual node, determine the ticket source management server that manages the seats matching the viewing area in the currently processed ticket purchase request.

[0188] Reference Figure 4 As shown, according to the identifier of the viewing area in the currently processed ticket purchase request, the consistent hashing algorithm is used to determine that the hash point identified on the pre-established hash structure is hash point 1, and the nearest virtual node of hash point 1 in the clockwise direction is the virtual node corresponding to Worker1. The address of the ticket source management server is determined according to the address of the virtual node corresponding to Worker1.

[0189] When Worker3 is found to be down, the virtual node corresponding to Worker3 can be deleted. In this way, the virtual node corresponding to the identifier determined according to the above method is the next virtual node in the clockwise direction of the original virtual node corresponding to Worker3, that is, the Worker corresponding to the determined identifier is no longer Worker3.

[0190] Method 2: Use the mapping relationship between the viewing area and the ticket source management server address to determine the ticket source management server.

[0191] Reference Figure 5 As shown, the specific steps are as follows:

[0192] Step S51: Determine whether the pre-established mapping relationship between viewing area identifiers and ticket source management server addresses contains the identifier of the viewing area in the currently processed ticket purchase request.

[0193] If yes, go to step S52; if no, go to step S53.

[0194] Step S52: Determine the address of the ticket source management server based on the identifier of the viewing area in the currently processed ticket purchase request and the mapping relationship between the viewing area identifier and the address of the ticket source management server.

[0195] Step S53: According to the identifier of the viewing area, a hash point of the identifier on a pre-established hash structure is determined by a consistent hashing algorithm.

[0196] The above hash structure is a ring structure containing multiple virtual nodes established through a consistent hashing algorithm based on the address list of the ticket source management server. One address in the list corresponds to multiple virtual nodes.

[0197] In one embodiment, if it is determined that a new ticket source management server address is added to the address list, a new ring hash structure containing multiple virtual nodes is established according to the current address list through a consistent hashing algorithm, and the current mapping relationship is cleared; if it is determined that the ticket source management server address is reduced in the address list, the virtual node corresponding to the reduced address is deleted in the current hash structure, and when it is determined that the address of the ticket source management server is reduced in the current mapping relationship, the address and the corresponding viewing area identifier are deleted.

[0198] Step S54: Determine the virtual node on the hash structure that is closest to the hash point along a preset direction as the virtual node corresponding to the identifier.

[0199] Step S55: Determine the address of the ticket source management server according to the address corresponding to the virtual node.

[0200] Step S56: Fill the identifier of the viewing area and the address corresponding to the virtual node into the mapping relationship.

[0201] There is no order between step S55 and step S56. Either step can be executed first, or they can be executed simultaneously.

[0202] Both of the above methods use a hash consistency algorithm to establish a hash structure based on the address list of the ticket source management server, so that each address corresponds to multiple virtual nodes on the hash structure, and the distribution of virtual nodes is uniform to the preset requirements; at the same time, the address list is monitored, and when the address list changes, the hash structure is updated accordingly. The difference is that in method 1, the virtual node corresponding to the viewing area identifier on the hash structure is determined by the hash consistency algorithm each time; method 2 maintains the mapping relationship between the viewing area identifier and the ticket source management server address. Each time the viewing area identifier is not included in the mapping relationship, the hash value is calculated using the hash consistency algorithm to determine the hash point on the hash structure, and then the corresponding virtual node is determined. At the same time, the newly determined viewing area identifier and the ticket source management server address are added to the mapping relationship. Method 1 calculates the hash value and determines the hash point each time, and then determines the corresponding virtual node; method 2 requires maintaining the mapping relationship, so both have their advantages. The specific method to be used can be determined according to the specific situation.

[0203] The hash consistency algorithm is used to maintain the identification of the viewing area and the corresponding relationship with the ticket source management server in real time, so that the management of the ticket source management server can be automatically updated. Regardless of whether the ticket source management server is down or a new management server is added, there is no need to manually adjust the correspondence between the ticket source management server and the managed viewing area seats, which realizes the flexibility of the ticket source management server in managing the seats in each viewing area and saves labor costs.

[0204] Example 2

[0205] The second embodiment of the present invention provides a seat selection method, which is mainly executed by the ticket source management server. The process is as follows: Figure 6 As shown, the following steps are included:

[0206] Step S61: In response to the received seat request, the seat request is added to a seat request queue according to the viewing area in the seat request.

[0207] In one embodiment, the method may include determining whether there is a local seat request queue that matches the viewing area in the seat request; if so, adding the seat request to the end of the seat request queue that matches the viewing area; if not, creating a seat request queue that matches the viewing area and adding the seat request to the created seat request queue.

[0208] Seat requests for the same viewing area are placed in a single seat request queue, with earlier requests placed first and later requests placed later. Sorting seat requests for the same viewing area by request time ensures fair seat allocation, assigning seats to those who requested first. This allows the corresponding ticket server to allocate seats to the corresponding ticket purchase requests first, ultimately achieving fair seat selection.

[0209] The ticket source management server executes the above step S61 every time it receives a seat request.

[0210] For each seat request queue, the ticket source management server processes the seat requests in the seat request queue in sequence according to the following step S62.

[0211] Specifically, the seat request queues may be processed in parallel; alternatively, the seat request queues corresponding to VIP users may be processed first, and then the seat request queues corresponding to non-VIP users; optionally, each seat request queue may be processed according to other sequential rules.

[0212] Step S62: for the seat request in the currently processed seat request queue, allocate a seat to the currently processed seat request from the pre-allocated seat resources, so that the ticket server that sends the seat request allocates the allocated seat to the ticket purchase request corresponding to the seat request.

[0213] In one embodiment, allocating seats for the currently processed seat request may specifically include: determining the number of seats to be allocated based on a preset multiple and the number of ticket purchase requests in the currently processed seat request; and allocating seats with matching viewing areas for the currently processed seat request from pre-allocated seat resources based on the viewing areas in the currently processed seat request and the number of seats to be allocated.

[0214] Specifically, the preset multiple may be a pre-calculated average number of tickets purchased in the ticket purchase requests obtained by the ballot server within a set time.

[0215] The ticket source management server determines the number of seats to be allocated based on the preset multiple and the number of ticket purchase requests in the seat request, reducing the number of times seats are allocated to the ballot server, and further reducing the number of times the ballot server requests seats from the ticket source management server, thereby improving the speed of seat allocation.

[0216] Optionally, the number of seats to be allocated may be a preset fixed number, which further reduces the amount of calculation. However, the number of seats to be allocated is not determined on demand. If too many seats are allocated for seat requests, the storage resources of the ballot server will be wasted, and it may also affect the requests of other ballot servers for seats in the same ballot area within the corresponding time period. If too few seats are allocated for seat requests, the ballot server may quickly allocate all the allocated seats and need to request again from the ballot source management server, which increases the number of requests from the ballot server and affects the efficiency of seat allocation.

[0217] Optionally, the number of seats to be allocated may be determined by other methods, depending on actual needs.

[0218] In one embodiment, allocating seats to seat requests may include allocating, from pre-allocated seat resources, a seat that matches the viewing area with the highest priority for the seat request currently being processed; or may include allocating, from pre-allocated seat resources, a seat that matches the viewing area with the highest priority and is adjacent for the seat request currently being processed.

[0219] The seats with the highest priority that match the viewing area in the seat resources are assigned to the currently processed seat request, which further ensures the fairness of seat selection. The seats are assigned on a first-come, first-served basis, and the seats assigned to those who arrive first have higher priority.

[0220] The second embodiment of the present invention provides a seat selection method: when the ticket source management server receives a seat request sent by the ballot server, it adds the seat request to a matching seat request queue based on the viewing area in the seat request; for each seat request queue, the seat requests in the seat request queue are processed in sequence, and seats are allocated to the seat requests from pre-allocated seat resources, so that the ballot server allocates the allocated seats to the ticket purchase requests corresponding to the seat requests. The ticket purchase requests are shared by the ballot server, the ballot server allocates seats to the ticket purchase requests, and the ticket source management server allocates seats to the ticket purchase request queue, ensuring that seat selection is effectively implemented while taking into account efficiency; allocating seats in the form of queues achieves fairness in ballot selection. Therefore, the seat selection method provided in the second embodiment of the present invention simultaneously achieves efficiency, effectiveness, and fairness in seat selection.

[0221] In one embodiment, if there are no seats matching the viewing area of ​​the currently processed seat request in the pre-allocated seat resources, seats matching the viewing area are obtained from the database, and local seat resources are updated based on the acquisition result to allocate seats for the currently processed seat request.

[0222] Specifically, obtaining seats matching the viewing area from the database may include obtaining all allocatable seats matching the viewing area from the database. For example, when a seat assigned by the ticket server for a ticket purchase request is successfully deducted, the database marks the corresponding seat as deducted; when payment for the ticket purchase request is successfully made, the database marks the corresponding seat as sold. Except for the sold and deducted seats, all other seats are allocatable.

[0223] After the ticket source management server obtains the seats allocated to it from the database, it updates the local seat resources according to the acquisition results and allocates seats from the seat resources for the currently processed seat request.

[0224] In one embodiment, according to the viewing areas of the seats in the pre-allocated seat resources, seats with matching viewing areas are acquired from the database at preset time intervals; and the pre-allocated seat resources are updated using the acquisition results.

[0225] The ticket source management server updates the seats in each viewing area in the local seat resources at preset intervals, ensuring the validity of the locally stored seat resources.

[0226] Example 3

[0227] The third embodiment of the present invention provides a specific implementation of a seat selection method, referring to Figure 7 As shown in the figure: First, the user's ticket purchase request is assigned to a ticket source management server Agent Server through the load balancer according to the principle of traffic balancing. The tasks performed by each Agent Server include: adding the ticket purchase request to the matching ticket purchase request queue according to the viewing area in the ticket purchase request; maintaining the length of each ticket purchase request queue (the number of ticket purchase requests); using the consistent hashing algorithm Consistent hashing algorithm based on the address list of the ticket source management server Worker obtained. Hash determines a circular hash structure containing multiple virtual nodes, and a Worker address in the address list corresponds to multiple virtual nodes on the hash structure; when the address list is monitored for changes, the hash structure is updated; each ticket purchase request queue is processed in parallel, and for the ticket purchase request in the ticket purchase request queue, seats are allocated to the currently processed ticket purchase request from the pre-allocated seat resources; when there are insufficient seats matching the viewing area in the seat resources, the hash consistency algorithm is used to determine the corresponding point on the hash structure according to the identifier of the viewing area in the ticket purchase request, and the address of the Worker corresponding to the virtual node closest to the corresponding point in the clockwise direction is obtained. A seat request is sent to the corresponding Worker according to the obtained address. The seat request includes the viewing area and the queue length (the number of ticket purchase requests in the corresponding ticket purchase request queue). After obtaining the seat allocated by the Worker, the local seat resources are updated and a seat is allocated for the ticket purchase request.

[0228] The Agent Server determines which Worker to request a seat from based on the viewing zone identifier. Therefore, seat requests for the same viewing zone are sent to the same Worker. Accordingly, each Worker performs the following tasks:

[0229] Upon receiving a seat request from the ticket server, the seat request is added to a matching seat request queue based on the viewing area in the seat request. Each seat request queue is processed in parallel, and for each seat request in the seat request queue, a seat is allocated from pre-allocated seat resources to the currently processed seat request, allowing the ticket server to assign the allocated seat to the corresponding ticket purchase request. If a seat matching the viewing area of ​​the currently processed seat request does not exist in the pre-allocated seat resources, a seat matching the viewing area is retrieved from the database, and the local seat resources are updated based on the retrieval result, and a seat is allocated to the seat request. Simultaneously, after the ticket source management server obtains the seats for the corresponding viewing area from the database, it re-retrieves the seats for the corresponding viewing area from the database at preset intervals and updates the seat resources based on the retrieval result.

[0230] Based on the inventive concept of the present invention, an embodiment of the present invention also provides a ticket selling method, including: the distribution server distributes the received ticket purchase request to the voting server, and obtains the seat assigned to the ticket purchase request by the voting server using the above-mentioned seat selection method; when the seat is successfully deducted from the database, an order including the ticket purchase request and the seat is generated and sent to the terminal that sent the ticket purchase request.

[0231] The seats assigned by the voting server for ticket purchase requests may be allocated repeatedly, that is, the same seat is assigned to different ticket purchase requests by the same voting server or different voting servers. Therefore, after the distribution server receives the seats assigned by the voting server for the ticket purchase request, it needs to deduct the seats from the database. The same seat can only be deducted successfully once, so the situation of selling one ticket multiple times is avoided.

[0232] In one embodiment, in response to a received ticket purchase request, the distribution server sends information to the terminal that sent the ticket purchase request, indicating whether to change the viewing area in the ticket purchase request. If selection information for changing the viewing area is received, at least one new viewing area is pushed to the user based on the selection information, and the viewing area in the ticket purchase request is updated based on the new viewing area selected by the user. The information sent to the terminal regarding whether to change the viewing area in the ticket purchase request includes at least one of the following:

[0233] Whether to choose a cheaper viewing area, whether to choose a better viewing area, whether to choose a viewing area with less queues.

[0234] This strengthens the human-computer interaction in the seat allocation process, and ultimately allows users to be assigned more satisfactory seats.

[0235] In one embodiment, if the distribution server fails to deduct seats from the database, it sends a message indicating the purchase failure to the terminal that submitted the ticket purchase request. The distribution server can then generate and display a dialog box to the terminal, asking whether a new ticket purchase is required. If a yes message is received, the distribution server displays the original user-submitted ticket purchase request information to the user. Upon receiving the user's confirmation or revised information, a new ticket purchase request is generated, and seats are reassigned and deducted for the new request.

[0236] In one embodiment, after generating and sending an order including the ticket purchase request and the corresponding seat to the terminal that sent the ticket purchase request, the process further includes:

[0237] After the payment server receives the order confirmation information sent by the terminal within the preset time, it generates the payment information of the order. After confirming that the terminal has successfully paid according to the payment information, it notifies the database to mark the corresponding seat as sold; if the payment server does not receive the order confirmation information sent by the terminal within the preset time, or after confirming that the terminal has failed to pay according to the payment information, it notifies the database to mark the corresponding seat as unallocated.

[0238] After the terminal pays successfully, the database is notified to mark the corresponding seat as sold, making the corresponding seat unallocated, avoiding multiple sales of one ticket; if the terminal does not pay within the preset time period, or the payment fails, the database is notified to mark the corresponding seat as unallocated, which can release the corresponding seat resources in time and make the corresponding seat available for reallocation or deduction.

[0239] Specifically, the above-mentioned seat selection method and ticket sales method are not only applicable to the above-mentioned scenarios. Based on the above-mentioned inventive concept, they can also be applied to various other scenarios, as long as one type of server is used to connect with user requests and allocate resources to users, and the allocated resources are pre-obtained and stored from another type of management server; the management server is used to manage one or more types of resources, and allocates corresponding resources to the server in response to resource requests from the first type of server, and the allocated resources are pre-obtained from the database. For example, the following scenarios can be applied:

[0240] 1. Distribution of goods.

[0241] The goods selection server responds to the assigned purchase request and adds the purchase request to the purchase request queue according to the goods attributes in the purchase request; for the purchase request in the currently processed purchase request queue, the server allocates goods for the currently processed purchase request from the pre-allocated goods resources; if the number of matching goods in the goods resources is less than the purchase quantity in the purchase request, the server requests goods matching the goods attributes in the currently processed purchase request from the goods management server.

[0242] The cargo management server responds to the received cargo request and adds the cargo request to the cargo request queue according to the cargo attributes in the cargo request; for the cargo request in the currently processed cargo request queue, the cargo management server allocates cargo to the currently processed cargo request from the pre-allocated cargo resources, so that the cargo selection server that sends the cargo request allocates the allocated cargo to the purchase request corresponding to the cargo request.

[0243] Specifically, the above-mentioned product selection can be selecting products for users during online shopping, or it can be selecting products through live streaming.

[0244] The goods attributes may be one or more of the type, size, color and style of the goods.

[0245] 2. Red envelope distribution.

[0246] The red envelope allocation server responds to the allocated red envelope request and adds the red envelope request to the red envelope request queue according to the applicable scope in the red envelope request; for the red envelope request in the currently processed red envelope request queue, a red envelope is allocated to the currently processed red envelope request from the pre-allocated red envelope resources; if the number of matching red envelopes in the red envelope resources is less than the number of requests in the red envelope request, a red envelope matching the applicable scope in the currently processed red envelope request is requested from the red envelope management server.

[0247] The red envelope management server responds to the received red envelope resource request and adds the red envelope resource request to the red envelope resource request queue according to the applicable scope in the red envelope resource request; for the red envelope resource request in the currently processed red envelope resource request queue, the server allocates red envelopes to the currently processed red envelope resource request from the pre-allocated resources, so that the red envelope allocation server that sends the red envelope resource request allocates the allocated red envelope to the red envelope request corresponding to the red envelope resource request.

[0248] Specifically, the above-mentioned red envelope can be a voucher applicable to one or some commodities, or a discount voucher applicable to one or some commodities, etc.

[0249] 3. Game queue.

[0250] The quota allocation server responds to the allocated game request and adds the game request to the game request queue according to the type in the game request; for the game request in the currently processed game request queue, the quota is allocated to the currently processed game request from the pre-allocated quota resources; if there is no matching quota in the quota resources, the quota management server is requested for a game quota that matches the type in the currently processed game request.

[0251] The quota management server responds to the received quota request and adds the quota request to the quota request queue according to the type in the quota request; for the quota request in the currently processed quota request queue, the quota is allocated to the currently processed quota request from the pre-allocated quota resources, so that the game quota allocation server that sent the quota request allocates the allocated quota to the game request corresponding to the quota request.

[0252] Based on the inventive concept of the present invention, the embodiment of the present invention further provides a seat selection device, the structure of which is as follows: Figure 8 As shown, including:

[0253] a queue management module 81 for responding to assigned ticket purchase requests and adding the ticket purchase requests to a ticket purchase request queue according to the viewing area in the ticket purchase request;

[0254] The seat selection module 82 is used to allocate a seat to the ticket purchase request currently being processed from the pre-allocated seat resources for the ticket purchase request currently being processed in the ticket purchase request queue;

[0255] The seat request module 83 is used to request seats that match the viewing area in the currently processed ticket purchase request from the ticket source management server if the seat selection module 82 determines that the number of matching seats in the seat resources is less than the number of seats in the ticket purchase request.

[0256] In one embodiment, the seat request module 83 requests the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request, specifically for:

[0257] According to the identifier of the viewing area in the currently processed ticket purchase request, the virtual node corresponding to the identifier on the pre-established hash structure is determined by the consistent hashing algorithm; according to the address of the ticket source management server corresponding to the virtual node, the ticket source management server is requested to find seats that match the viewing area in the currently processed ticket purchase request.

[0258] In one embodiment, the seat request module 83 determines the virtual node corresponding to the identifier on the pre-established hash structure using a consistent hashing algorithm, specifically for:

[0259] The hash point of the identifier on the hash structure is determined by a consistent hashing algorithm. The hash structure is a ring structure pre-established by the consistent hashing algorithm based on the address list of the ticket source management server. An address in the address list corresponds to multiple virtual nodes in the hash structure. In the hash structure, the virtual node closest to the hash point is determined along a preset direction as the virtual node corresponding to the identifier.

[0260] In one embodiment, after establishing the hash structure, the seat request module 83 is further configured to:

[0261] If it is determined that the address of a new ticket source management server is added to the address list, a new hash structure is established based on the current address list using the consistent hashing algorithm; if it is determined that the address of a ticket source management server is reduced in the address list, the virtual node corresponding to the reduced address is deleted from the current hash structure.

[0262] In one embodiment, the seat request module 83 requests the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request, specifically for:

[0263] Based on the identifier of the viewing area in the currently processed ticket purchase request and the mapping relationship between the viewing area identifier and the address of the ticket source management server, the address of the ticket source management server is determined, and a request is made to the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request.

[0264] In one embodiment, when the mapping relationship does not contain the identifier of the viewing area in the currently processed ticket purchase request, the seat request module 83 is further configured to:

[0265] According to the identifier of the viewing area in the currently processed ticket purchase request, the virtual node corresponding to the identifier on the pre-established hash structure is determined by a consistent hashing algorithm; according to the address of the ticket source management server corresponding to the virtual node, a request is made to the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request; the identifier and the determined address are filled into the mapping relationship.

[0266] In one embodiment, the seat request module 83 determines the virtual node corresponding to the identifier on the pre-established hash structure using a consistent hashing algorithm, specifically for:

[0267] The hash point of the identifier on the hash structure is determined by a consistent hashing algorithm. The hash structure is a ring structure pre-established by the consistent hashing algorithm based on the address list of the ticket source management server. An address in the address list corresponds to multiple virtual nodes in the hash structure. In the hash structure, the virtual node closest to the hash point is determined along a preset direction as the virtual node corresponding to the identifier.

[0268] In one embodiment, after establishing the hash structure, the seat request module 83 is further configured to:

[0269] If it is determined that a new ticket source management server address is added to the address list, a new hash structure is established based on the current address list using the consistent hashing algorithm, and the current mapping relationship is cleared; if it is determined that the ticket source management server address is reduced in the address list, the virtual node corresponding to the reduced address is deleted in the current hash structure, and when it is determined that the address of the ticket source management server is reduced in the current mapping relationship, the address and the corresponding viewing area identifier are deleted.

[0270] In one embodiment, the seat request module 83 requests the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request, specifically for:

[0271] According to the preset multiple and the number of ticket purchase requests in the currently processed ticket purchase request queue, the number of seats to be requested is determined, and the ticket source management server is requested to provide the seats of the number that match the viewing area in the currently processed ticket purchase request.

[0272] In one embodiment, the seat request module 83 is further configured to:

[0273] For the seat resources matching each viewing area among the pre-allocated seat resources, the seat resources matching the viewing area are updated according to a preset time interval.

[0274] In one embodiment, the seat request module 83 updates the seat resources matching the viewing area according to a preset time interval, specifically for:

[0275] Determine whether there is an unprocessed ticket purchase request queue matching the viewing area at a preset time interval;

[0276] If so, request seats matching the viewing area from the ticket source management server that manages the seat resources matching the viewing area, and replace the current seat resources according to the request result; if not, delete the seats matching the viewing area from the current seat resources.

[0277] In one embodiment, the queue management module 81 adds the ticket purchase request to the ticket purchase request queue according to the viewing area in the ticket purchase request, specifically for:

[0278] Determine whether there is a ticket purchase request queue that matches the viewing area in the ticket purchase request; if so, add the ticket purchase request to the end of the ticket purchase request queue that matches the viewing area; if not, create a ticket purchase request queue that matches the viewing area, and add the ticket purchase request to the created ticket purchase request queue.

[0279] In one embodiment, the seat selection module 82 allocates a seat from pre-allocated seat resources for the currently processed ticket purchase request, specifically for:

[0280] Based on the number of seats and viewing area of ​​the currently processed ticket purchase request, the seat with the highest priority that matches the viewing area is obtained from the pre-allocated seat resources and allocated to the currently processed ticket purchase request.

[0281] Based on the inventive concept of the present invention, the embodiment of the present invention also provides another seat selection device, whose structure is as follows: Figure 9 As shown, including:

[0282] a queue management module 91 for responding to a received seat request and adding the seat request to a seat request queue according to the viewing area in the seat request;

[0283] The seat allocation module 92 is used to allocate seats to the seat requests currently being processed from the pre-allocated seat resources for the seat requests in the seat request queue currently being processed, so that the ticket server that sends the seat request allocates the allocated seats to the ticket purchase request corresponding to the seat request.

[0284] In one embodiment, the seat allocation module 92 allocates seats for the currently processed seat request from pre-allocated seat resources, specifically for:

[0285] The number of seats to be allocated is determined based on a preset multiple and the number of ticket purchase requests in the currently processed seat requests; and seats that match the viewing area in the currently processed seat requests are allocated from the pre-allocated seat resources based on the viewing area in the currently processed seat requests and the number of seats to be allocated.

[0286] In one embodiment, the seat allocation module 92 allocates a seat matching the viewing area to the currently processed seat request from pre-allocated seat resources, specifically for:

[0287] Assign the highest priority seat to the currently processed seat request from the pre-allocated seat resources.

[0288] In one embodiment, the seat allocation module 92 allocates seats for the currently processed seat request from pre-allocated seat resources and is further configured to:

[0289] If there is no seat matching the viewing area of ​​the currently processed seat request in the pre-allocated seat resources, a seat matching the viewing area is obtained from the database.

[0290] In one embodiment, the seat assignment module 92 is further configured to:

[0291] According to the viewing areas of the seats in the pre-allocated seat resources, seats with matching viewing areas are acquired from the database at preset time intervals; and the pre-allocated seat resources are updated using the acquisition results.

[0292] In one embodiment, the queue management module 91 adds the seat request to the seat request queue according to the viewing area in the seat request, specifically for:

[0293] Determine whether there is a seat request queue that matches the viewing area in the seat request; if so, add the seat request to the end of the seat request queue that matches the viewing area; if not, create a seat request queue that matches the viewing area and add the seat request to the created seat request queue.

[0294] Based on the inventive concept of the present invention, the embodiment of the present invention further provides a seat selection system, the structure of which is as follows: Figure 10 As shown, it includes multiple ballot servers 101, multiple ballot source management servers 102 and load dispatcher 103. The ballot server 101 is provided with Figure 8 The intelligent seat selection device shown in FIG, the ticket source management server 102 is provided with Figure 9 The intelligent seat selection device shown;

[0295] The load dispatcher 103 is used to send the received ticket purchase request to a voting server 101 according to the principle of load balancing.

[0296] Based on the inventive concept of the present invention, the embodiment of the present invention further provides a ticketing system, the structure of which is as follows: Figure 11 As shown, it includes at least one distribution server 111, multiple ballot servers 112 and multiple ticket source management servers 113. The ticket source management server 113 is provided with Figure 9 The intelligent seat selection device shown in ;

[0297] The distribution server 111 is provided with a load dispatcher, which is used to send the received ticket purchase request to a voting server 112 according to the principle of load balancing;

[0298] The ticket server 112 is configured to allocate a seat to the ticket purchase request using the intelligent seat selection method in the first embodiment, and send the ticket purchase request and the seat to the distribution server 111;

[0299] The distribution server 111 is configured to generate and send an order including the ticket purchase request and the seat to the terminal that sent the ticket purchase request when the seat is successfully deducted from the database.

[0300] Based on the inventive concept of the present invention, the embodiment of the present invention also provides another ticketing system, whose structure is as follows: Figure 12 As shown, it includes at least one distribution server 121, multiple ballot servers 122, multiple ticket source management servers 123 and payment servers 124. The ticket source management server 123 is provided with Figure 9 The intelligent seat selection device shown in;

[0301] The distribution server 121 is provided with a load dispatcher, which is used to send the received ticket purchase request to a voting server 122 according to the principle of load balancing;

[0302] The ticket server 122 is configured to allocate a seat to the ticket purchase request using the intelligent seat selection method in the first embodiment, and send the ticket purchase request and the seat to the distribution server 121;

[0303] The distribution server 121 is configured to generate and send an order including the ticket purchase request and the seat to the terminal that sent the ticket purchase request when the seat is successfully deducted from the database;

[0304] The payment server 124 is configured to generate payment information for the order after receiving confirmation information of the order sent by the terminal within a preset time, and notify the database to mark the seat as sold after confirming that the terminal has successfully paid according to the payment information; if the payment server 124 does not receive confirmation information of the order sent by the terminal within the preset time, or after confirming that the terminal has failed to pay according to the payment information, it notifies the database to mark the seat as unallocated.

[0305] Regarding the apparatus and system in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiment of the method and will not be elaborated here.

[0306] Based on the inventive concept of the present invention, an embodiment of the present invention further provides a computer-readable storage medium having computer instructions stored thereon, which implement the above-mentioned seat selection method or the above-mentioned ticket selling method when the instructions are executed by a processor.

[0307] Unless otherwise specifically stated, terms such as process, calculate, compute, determine, display, and the like may refer to the actions and / or processes of one or more processing or computing systems, or similar devices, that manipulate and convert data represented as physical (e.g., electronic) quantities within registers or memories of a processing system into other data similarly represented as physical quantities within the memories, registers, or other such information storage, transmission, or display devices of the processing system. Information and signals may be represented using any of a variety of different techniques and methods. For example, data, instructions, commands, information, signals, bits, symbols, and chips referred to throughout the above description may be represented by voltages, currents, electromagnetic waves, magnetic fields or particles, light fields or particles, or any combination thereof.

[0308] It should be understood that the specific order or hierarchy of steps in the disclosed processes is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of the present disclosure. The accompanying method claims present elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.

[0309] In the foregoing detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that embodiments of the claimed subject matter require more features than are expressly recited in each claim. On the contrary, as reflected in the appended claims, the invention comprises less than all the features of any individual disclosed embodiment. The appended claims are therefore hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.

[0310] Those skilled in the art will also appreciate that the various illustrative logic blocks, modules, circuits, and algorithmic steps described in conjunction with the embodiments herein may be implemented as electronic hardware, computer software, or a combination thereof. In order to clearly illustrate the interchangeability between hardware and software, the various illustrative components, blocks, modules, circuits, and steps described above are generally described around their functions. Whether such functions are implemented as hardware or software depends on the specific application and the design constraints imposed on the entire system. A skilled person may implement the described functions in an adaptable manner for each specific application, but such implementation decisions should not be interpreted as departing from the scope of protection of this disclosure.

[0311] The steps of the methods or algorithms described in conjunction with the embodiments herein may be directly embodied as hardware, software modules executed by a processor, or a combination thereof. The software module may be located in a RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, register, hard disk, removable disk, CD-ROM, or any other form of storage medium well known in the art. An exemplary storage medium is connected to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and storage medium may be located in an ASIC. The ASIC may be located in a user terminal. Of course, the processor and storage medium may also be present in a user terminal as discrete components.

[0312] For software implementation, the techniques described in this application can be implemented using modules (e.g., procedures, functions, etc.) that perform the functions described in this application. These software codes can be stored in a memory unit and executed by a processor. The memory unit can be implemented within the processor or external to the processor. In the latter case, it is communicatively coupled to the processor via various means, which are well known in the art.

[0313] The above description includes examples of one or more embodiments. Of course, it is not possible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but it will be appreciated by those skilled in the art that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to encompass all such changes, modifications and variations that fall within the scope of protection of the appended claims. Furthermore, with respect to the term "comprising" used in the specification or claims, the word is encompassed in a manner similar to the term "including," as explained in terms of "including," used as a transitional word in the claims. Furthermore, any term "or" used in the specification of the claims is intended to mean "non-exclusive or." The terms "first," "second," and "third" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance.

Claims

1. A seat selection method, comprising: The ticket server, in response to the assigned ticket purchase request, adds the ticket purchase request to a ticket purchase request queue according to the viewing area in the ticket purchase request, the ticket server being one of the ticket server groups, and the ticket purchase request being sent by the distribution server to the ticket server; The voting server allocates seats to the ticket purchase requests currently being processed from the pre-allocated seat resources for the ticket purchase requests in the ticket purchase request queue currently being processed; If the number of matching seats in the seat resource is less than the number of seats in the ticket purchase request, determine, based on the identifier of the viewing area in the currently processed ticket purchase request, a hash point of the identifier on a pre-established hash structure using a consistent hashing algorithm, wherein the hash structure is a ring structure pre-established by the consistent hashing algorithm based on the address list of the ticket source management server, wherein each address in the address list corresponds to multiple virtual nodes in the hash structure; Determine, in the hash structure, along a preset direction, a virtual node closest to the hash point as the virtual node corresponding to the identifier; According to the address of the ticket source management server corresponding to the virtual node, request the ticket source management server for a seat that matches the viewing area in the currently processed ticket purchase request; The ticket source management server responds to the received seat request and adds the seat request to a seat request queue according to the viewing area in the seat request; allocating seats from pre-allocated seat resources for the seat requests currently being processed in the seat request queue, so that the ballot server that sent the seat request allocates the allocated seats to the ticket purchase request corresponding to the seat request; The ticket source management server obtains seat resources in advance in the following manner: according to the viewing areas of the seats in the pre-allocated seat resources, seats matching the viewing areas are obtained from the database at preset time intervals; and the pre-allocated seat resources are updated using the obtained results.

2. The method according to claim 1, after establishing the hash structure, further comprising: If it is determined that a new address of the ticket source management server is added to the address list, a new hash structure is established using the consistent hashing algorithm according to the current address list; If it is determined that the address of the ticket source management server is reduced in the address list, the virtual node corresponding to the reduced address is deleted in the current hash structure.

3. The method according to claim 1, wherein the requesting the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request specifically comprises: Based on the identifier of the viewing area in the currently processed ticket purchase request and the mapping relationship between the viewing area identifier and the address of the ticket source management server, the address of the ticket source management server is determined, and a request is made to the ticket source management server for seats that match the viewing area in the currently processed ticket purchase request.

4. The method according to claim 3, further comprising: According to the identification of the viewing area in the currently processed ticket purchase request, determine the virtual node corresponding to the identification on the pre-established hash structure through a consistent hashing algorithm; According to the address of the ticket source management server corresponding to the virtual node, request the ticket source management server for a seat that matches the viewing area in the currently processed ticket purchase request; Fill the identification and the determined address into the mapping relationship.

5. The method according to claim 4, wherein determining the virtual node corresponding to the identifier on the pre-established hash structure by using a consistent hashing algorithm specifically comprises: Determine a hash point of the identifier on a hash structure using a consistent hashing algorithm, wherein the hash structure is a ring structure pre-established by the consistent hashing algorithm based on an address list of a ticket source management server, and an address in the address list corresponds to multiple virtual nodes in the hash structure; In the hash structure, along a preset direction, a virtual node closest to the hash point is determined as the virtual node corresponding to the identifier.

6. The method according to claim 5, after establishing the hash structure, further comprising: If it is determined that a new address of the ticket source management server is added to the address list, a new hash structure is established according to the current address list using the consistent hashing algorithm, and the current mapping relationship is cleared; If it is determined that the address of the ticket source management server has been reduced in the address list, the virtual node corresponding to the reduced address is deleted in the current hash structure. When it is determined that the address of the ticket source management server has been reduced in the current mapping relationship, the address and the corresponding viewing area identifier are deleted.

7. The method according to claim 1, wherein the requesting the ticket source management server for seats matching the viewing area in the currently processed ticket purchase request specifically comprises: According to the preset multiple and the number of ticket purchase requests in the currently processed ticket purchase request queue, the number of seats to be requested is determined, and the ticket source management server is requested to provide the seats of the number that match the viewing area in the currently processed ticket purchase request.

8. The method of claim 1 , further comprising: For the seat resources matching each viewing area among the pre-allocated seat resources, the seat resources matching the viewing area are updated according to a preset time interval.

9. The method according to claim 8, wherein updating the seat resources matching the viewing area at a preset time interval specifically comprises: Determine whether there is an unprocessed ticket purchase request queue matching the viewing area at a preset time interval; If so, request seats matching the viewing area from the ticket source management server that manages the seat resources matching the viewing area, and replace the current seat resources according to the request result; If not, remove the seats matching the viewing area from the current seat resources.

10. The method according to any one of claims 1 to 9, wherein adding the ticket purchase request to a ticket purchase request queue according to the viewing area in the ticket purchase request specifically comprises: Determining whether there is a ticket purchase request queue that matches the viewing area in the ticket purchase request; If so, add the ticket purchase request to the end of the ticket purchase request queue that matches the viewing area; If not, create a ticket purchase request queue that matches the viewing area, and add the ticket purchase request to the created ticket purchase request queue.

11. The method according to any one of claims 1 to 9, wherein allocating a seat from pre-allocated seat resources to the currently processed ticket purchase request specifically comprises: Based on the number of seats and viewing area of ​​the currently processed ticket purchase request, the seat with the highest priority that matches the viewing area is obtained from the pre-allocated seat resources and allocated to the currently processed ticket purchase request.

12. The method of claim 1, wherein allocating seats from pre-allocated seat resources to the currently processed seat request specifically comprises: Determine the number of seats to be allocated based on the preset multiple and the number of ticket purchase requests currently being processed; According to the viewing area in the currently processed seat request and the number of seats to be allocated, seats with matching viewing areas are allocated to the currently processed seat request from pre-allocated seat resources.

13. The method according to claim 12, wherein allocating a seat matching the viewing area to the currently processed seat request from pre-allocated seat resources specifically comprises: From the pre-allocated seat resources, the seat that matches the highest priority viewing area is assigned to the currently processed seat request.

14. The method of claim 1, wherein allocating seats to the currently processed seat request from pre-allocated seat resources further comprises: If there is no seat matching the viewing area of ​​the currently processed seat request in the pre-allocated seat resources, a seat matching the viewing area is obtained from the database.

15. The method according to any one of claims 12 to 14, wherein the step of adding the seat request to a seat request queue according to the viewing area in the seat request comprises: Determining whether there is a seat request queue that matches the viewing area in the seat request; If so, add the seat request to the end of the queue of seat requests that match the viewing area; If not, create a seat request queue that matches the viewing area, and add the seat request to the created seat request queue.

16. A ticket selling method comprising: The distribution server distributes the received ticket purchase request to the voting server, and obtains the seat allocated by the voting server to the ticket purchase request using the method according to any one of claims 1 to 15; When the seat is successfully deducted from the database, an order is generated and sent to the terminal that sent the ticket purchase request, and the order includes the ticket purchase request and the seat.

17. The method of claim 16, further comprising: When the deduction of the seat from the database fails, a message of ticket purchase failure is sent to the terminal that sent the ticket purchase request.

18. The method of claim 16, before the distribution server distributes the received ticket purchase request to the vote server, further comprising: The distribution server sends information on whether to change the viewing area to the terminal that sent the ticket purchase request in response to the received ticket purchase request; If selection information for changing the viewing area is received, at least one new viewing area is pushed to the user according to the selection information, and the viewing area in the ticket purchase request is updated according to the new viewing area selected by the user. The information sent to the terminal regarding whether to change the viewing area includes at least one of the following: Whether to choose a cheaper viewing area, whether to choose a better viewing area, whether to choose a viewing area with less queues.

19. The method according to claim 16, after generating and sending the order to the terminal that sent the ticket purchase request, further comprising: After receiving the order confirmation information sent by the terminal within a preset time, the payment server generates payment information for the order, and after confirming that the terminal has successfully paid according to the payment information, notifies the database to mark the seat as sold; If the payment server does not receive the confirmation information of the order sent by the terminal within a preset time, or after confirming that the terminal fails to pay according to the payment information, it notifies the database to mark the seat as unallocated.

20. A computer-readable storage medium having computer instructions stored thereon, which implement the method of claims 1-19 when the instructions are executed by a processor.

Citation Information

Patent Citations

  • Distributed resource obtaining method and device

    CN103944994A

  • File issuing method and device for file storage system

    CN109150927A

  • A ticket booking method and system

    CN109902841A

  • Method, device and system for virtual resource distribution based on resource pre-distribution, and medium

    CN111178958A