A method, system, device and storage medium for judging the consistency of ticket purchase discount times
Through database replication, sharding, table sharding and trigger technology, data consistency of online and offline ticketing channels is achieved, solving the data consistency challenge of the railway ticketing system under a distributed architecture, and improving the reliability and availability of the system.
Patent Information
- Application Number
- CN202111145824.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-28
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-09-28
AI Technical Summary
The railway ticketing system under a distributed architecture has data consistency challenges between online and offline ticketing channels. Especially in the case of high concurrency and decentralized system architecture, it is difficult for traditional transaction control to ensure the consistency of operations.
Database replication, database sharding, table sharding and trigger technology are used to separate data reading and writing in online and offline ticket sales channels. Through online independent judgment and offline unified judgment, the consistency of the number of ticket purchase discounts is ensured.
It effectively ensures the data consistency of online and offline ticketing channels, improves the reliability and availability of the system, and solves the problem of high online concurrency and difficulty in ensuring the integrity of offline transactions.
Smart Images

Figure CN113918649B
Abstract
Description
Technical Field
[0001] The present application relates to the field of distributed architecture data consistency, and in particular to a method, system, computer device and computer-readable storage medium for determining consistency of ticket purchase discount times. Background Art
[0002] At present, with the continuous development of Internet technology, distributed systems have been more and more widely used, with the advantages of high availability, high reliability, high scalability, etc., but at the same time, the data consistency problem of distributed architecture has extremely high requirements for data consistency, which brings great challenges to the application of distributed systems.
[0003] Given the distributed architecture of the railway passenger ticket system and the large differences in system services faced by online and offline ticket sales channels, online ticket sales channels are mainly faced with high concurrency and robot ticket grabbing behavior control, while offline ticket sales channels are mainly faced with decentralized system architecture and difficulty in ensuring transaction integrity.
[0004] The traditional method uses database transaction control to ensure transaction consistency. This method is more suitable for simple processing, but it is difficult to adapt to complex operations in a distributed environment. In a distributed environment, a complete operation often includes multiple remote calls and multiple database operations, including remote calls to external systems, remote calls to internal systems, operations on a single database table, and operations on multiple database tables. During the operation process, errors may occur in any step. How to ensure the consistency of the entire operation has brought great challenges to the designers and developers of distributed systems.
[0005] The present invention provides a solution for how to ensure the consistency of the number of ticket purchase discounts when tickets are sold through different channels at the same time. The present invention aims to solve the differences between online and offline ticket sales channels, and realize data reading and writing separation through database replication, sub-library, sub-table and trigger technology, so as to realize the method of realizing the consistency of data reading through online and offline ticket sales channels. Summary of the invention
[0006] The embodiment of the present application provides a method for achieving data read and write separation and data consistency in online and offline ticketing channels through database replication, database sharding, table sharding and trigger technology in view of the differences between online and offline ticketing channels.
[0007] In a first aspect, an embodiment of the present application provides a method for determining consistency of the number of ticket purchase discounts, including:
[0008] Online independent judgment step: When passengers purchase tickets at various online ticketing nodes, each online ticketing node independently completes the judgment of discount ticket purchase qualifications based on data sub-databases and sub-tables, generates a temporary ticket purchase record, and synchronizes the temporary ticket purchase record to the offline discount qualification centralized judgment node through the intermediate table. The trigger technology is used to trigger the corresponding update of the target data stored in the source table, and the updated target data is copied to each online ticketing node for data synchronization;
[0009] Offline unified judgment steps: When passengers purchase tickets at various offline ticketing nodes, the offline preferential qualification centralized judgment node uniformly determines the discount ticket purchase eligibility, completes the corresponding update of the target data in the source table, and uses database replication technology to achieve data consistency in online and offline ticketing channels.
[0010] Preferably, the above-mentioned method for determining consistency of the number of ticket purchase discounts further includes:
[0011] Steps for establishing sub-databases and sub-tables: Establish multiple independent data sub-databases at each online ticketing node, and establish multiple data tables in each data sub-database to achieve data read and write separation;
[0012] Intermediate table creation steps: For each online ticketing node, a corresponding intermediate table is pre-established to store temporary ticket purchase records.
[0013] Preferably, the above-mentioned online independent judgment step includes:
[0014] Online verification steps: Verify the preferential qualification information and determine the eligibility to purchase preferential tickets when passengers purchase tickets at the online ticketing node;
[0015] Temporary record generation step: When the discount ticket purchase qualification is met, a temporary ticket purchase record is generated at the online ticketing node and stored in the intermediate table. The temporary ticket purchase record also marks the connection relationship between the ticket purchase segments and whether the discount times have been deducted.
[0016] Offline data synchronization step: The data stored in the intermediate table of the online ticketing node is copied to the source table of the offline ticketing channel centralized decision node;
[0017] Trigger data update step: set a trigger in each intermediate table. The trigger modifies the target discount qualification and ticket purchase record in the source table according to the ticket purchase record connection and discount number deduction mark;
[0018] Online data synchronization steps: The target discount qualifications and ticket purchase records in the source table are copied to each online ticketing node through database replication technology.
[0019] Preferably, the above offline unified judgment step includes:
[0020] Offline verification steps: Verify the discount qualification information of passengers who purchase tickets offline and determine their eligibility to purchase discount tickets;
[0021] Eligibility determination step: The offline ticket purchase node connects to the offline discount qualification centralized determination node to determine the eligibility for purchasing discount tickets;
[0022] Target data update step: If the discount ticket purchase qualification is met, the target discount qualification and ticket purchase record data stored in the source table are updated at the offline discount qualification centralized determination node;
[0023] Online data synchronization steps: The data updates of target discount qualifications and ticket purchase records in the updated source table are copied to each online ticketing node through database replication technology.
[0024] Preferably, the above-mentioned online verification steps include:
[0025] Online qualification verification steps: Verify the qualification of passengers based on the preferential qualification information filled in by passengers;
[0026] Steps for judging online discount eligibility: Based on the passenger's ticket purchase information, calculate the connection relationship between this ticket purchase and the ticket purchase record, the relationship between the mileage and the mileage in the discount qualification interval, and whether the discount times need to be deducted for this ticket purchase to judge the passenger's discount eligibility.
[0027] In a second aspect, an embodiment of the present application provides a system for determining the consistency of the number of discount tickets, using the method for determining the consistency of the number of discount tickets as described above, including:
[0028] Online independent judgment module: When passengers purchase tickets at various online ticketing nodes, each online ticketing node independently completes the judgment of the discount ticket purchase qualification based on the data sub-database and sub-table, generates a temporary ticket purchase record, and synchronizes the temporary ticket purchase record to the offline discount qualification centralized judgment node through the intermediate table. The trigger technology is used to trigger the corresponding update of the target data stored in the source table, and the updated target data is copied to each online ticketing node for data synchronization;
[0029] Offline unified judgment module: When passengers purchase tickets at various offline ticket sales nodes, the offline preferential qualification centralized judgment node uniformly determines the discount ticket purchase eligibility, completes the corresponding update of the target data in the source table, and uses database replication technology to achieve data consistency in online and offline ticket sales channels.
[0030] Preferably, the above-mentioned ticket purchase discount number consistency judgment system further includes:
[0031] Sub-database and sub-table establishment module: multiple independent data sub-databases are established at each online ticketing node, and multiple data tables are established in each data sub-database to achieve data read and write separation;
[0032] Intermediate table establishment module: For each online ticketing node, a corresponding intermediate table is pre-established to store temporary ticket purchase records.
[0033] Preferably, the above-mentioned online independent judgment module includes:
[0034] Online verification module: Verify the preferential qualification information and determine the eligibility to purchase preferential tickets when passengers purchase tickets at the online ticketing node;
[0035] Temporary record generation module: When the discount ticket purchase qualification is met, a temporary ticket purchase record is generated at the online ticketing node, stored in the intermediate table, and the connection relationship between the ticket purchase segments and whether the discount times are deducted are marked in the temporary ticket purchase record;
[0036] Offline data synchronization module: The data stored in the intermediate table of the online ticketing node is copied to the source table of the centralized decision node of the offline ticketing channel;
[0037] Trigger data update module: set a trigger in each intermediate table. The trigger modifies the target discount qualification and ticket purchase record in the source table according to the ticket purchase record connection and discount number deduction mark;
[0038] Online data synchronization module: The target discount qualifications and ticket purchase records in the source table are copied to each online ticketing node through database replication technology.
[0039] Preferably, the offline unified judgment module includes:
[0040] Offline verification module: Verify the discount qualification information of passengers who purchase tickets offline and determine their eligibility to purchase discount tickets;
[0041] Qualification judgment module: The offline ticket purchase node is connected to the offline discount qualification centralized judgment node to judge the qualification for purchasing discount tickets;
[0042] Target data update module: If the discount ticket purchase qualification is met, the target discount qualification and ticket purchase record data stored in the source table will be updated on the offline discount qualification centralized determination node;
[0043] Online data synchronization module: The data updates of target discount qualifications and ticket purchase records in the updated source table are copied to each online ticketing node through database replication technology.
[0044] Preferably, the above-mentioned online verification module includes:
[0045] Online qualification verification module: Verify the qualification of passengers based on the preferential qualification information filled in by passengers;
[0046] Online discount qualification judgment module: Based on the passenger's ticket purchase information, calculate the connection relationship between this ticket purchase and the ticket purchase record, the relationship between the mileage and the discount qualification interval mileage, and whether the discount times need to be deducted for this ticket purchase, to judge the passenger's discount qualification.
[0047] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for consistency of the number of ticket purchase discounts as described in the first aspect above is implemented.
[0048] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for consistency of the number of ticket purchase discounts as described in the first aspect above.
[0049] Compared with the related prior art, it has the following outstanding beneficial effects:
[0050] (1) In view of the differences between online and offline ticket sales channels, the online ticket sales channel uses each node to independently determine the eligibility for student ticket discounts. Through database replication, sub-database, sub-table and trigger technology, data reading and writing are separated, and data consistency is guaranteed by the business.
[0051] (2) Offline ticket sales channels adopt the method of adding centralized nodes to uniformly judge the eligibility of student ticket discounts, and achieve data consistency in reading between online and offline ticket sales channels through database replication technology.
[0052] (3) The database partitioning technology of the present invention realizes the establishment of multiple independent databases at each node of the online ticket sales channel, which are used to store different data for determining the student's preferential eligibility;
[0053] (4) The sub-table of the present invention is to establish multiple data tables in each sub-library to achieve data reading and writing separation;
[0054] (5) The present invention uses an intermediate table to store temporary ticket purchase records to ensure business assurance data consistency. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0056] Figure 1 It is a flow chart of the method for judging consistency of the number of ticket purchase discounts of the present invention;
[0057] Figure 2 This is a data change flow chart of an embodiment of the present invention;
[0058] Figure 3 Schematic diagram of the ticket purchase discount times consistency judgment system of the present invention;
[0059] Figure 4 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present application.
[0060] In the above picture:
[0061] 100 Ticket Purchase Discount Times Consistency Judgment System
[0062] 10Online independent judgment module 20Offline unified judgment module
[0063] 81. Processor; 82. Memory; 83. Communication interface; 80. Bus. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0065] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0066] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent.
[0067] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0068] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0069] The present invention aims to provide a method for the difference between online and offline ticket sales channels. The online ticket sales channel uses each node to independently judge the qualification of student ticket discounts, and realizes data reading and writing separation through database replication, sub-library, sub-table and trigger technology, and ensures data consistency by business. The offline ticket sales channel adopts the method of adding centralized nodes to uniformly judge the qualification of student ticket discounts, and realizes the consistency of data read by online and offline ticket sales channels through database replication technology.
[0070] Figure 1 It is a schematic flow chart of the method of the present invention, as shown in Figure 1 As shown, a method for determining the consistency of the number of ticket purchase discounts includes:
[0071] Online independent judgment step S10: When passengers purchase tickets at various online ticketing nodes, each online ticketing node independently completes the judgment of the discount ticket purchase qualification based on the data sub-database and sub-table, generates a temporary ticket purchase record, and synchronizes the temporary ticket purchase record to the offline discount qualification centralized judgment node through the intermediate table, uses trigger technology to trigger the corresponding update of the target data stored in the source table, and copies the updated target data to each online ticketing node for data synchronization;
[0072] Offline unified judgment step S20: When passengers purchase tickets at various offline ticketing nodes, after the offline preferential qualification centralized judgment node uniformly determines the discount ticket purchase qualification, the corresponding update of the target data in the source table is completed, and the database replication technology is used to achieve data consistency in online and offline ticketing channels.
[0073] Preferably, the above-mentioned method for determining consistency of the number of ticket purchase discounts further includes:
[0074] Steps for establishing sub-databases and sub-tables: Establish multiple independent data sub-databases at each online ticketing node, and establish multiple data tables in each data sub-database to achieve data read and write separation;
[0075] Intermediate table creation steps: For each online ticketing node, a corresponding intermediate table is pre-established to store temporary ticket purchase records.
[0076] The above-mentioned online independent judgment step S10 includes:
[0077] Online verification steps: Verify the preferential qualification information and determine the eligibility to purchase preferential tickets when passengers purchase tickets at the online ticketing node;
[0078] Temporary record generation step: When the discount ticket purchase qualification is met, a temporary ticket purchase record is generated at the online ticketing node and stored in the intermediate table. The temporary ticket purchase record also marks the connection relationship between the ticket purchase segments and whether the discount times have been deducted.
[0079] Offline data synchronization step: The data stored in the intermediate table of the online ticketing node is copied to the source table of the offline ticketing channel centralized decision node;
[0080] Trigger data update step: set a trigger in each intermediate table. The trigger modifies the target discount qualification and ticket purchase record in the source table according to the ticket purchase record connection and discount number deduction mark;
[0081] Online data synchronization steps: The target discount qualifications and ticket purchase records in the source table are copied to each online ticketing node through database replication technology.
[0082] Furthermore, the above online verification steps include:
[0083] Online qualification verification steps: Verify the qualification of passengers based on the preferential qualification information filled in by passengers;
[0084] Steps for judging online discount eligibility: Based on the passenger's ticket purchase information, calculate the connection relationship between this ticket purchase and the ticket purchase record, the relationship between the mileage and the mileage in the discount qualification interval, and whether the discount times need to be deducted for this ticket purchase to judge the passenger's discount eligibility.
[0085] The offline unified judgment step S20 includes:
[0086] Offline verification steps: Verify the discount qualification information of passengers who purchase tickets offline and determine their eligibility to purchase discount tickets;
[0087] Eligibility determination step: The offline ticket purchase node connects to the offline discount qualification centralized determination node to determine the eligibility for purchasing discount tickets;
[0088] Target data update step: If the discount ticket purchase qualification is met, the target discount qualification and ticket purchase record data stored in the source table are updated at the offline discount qualification centralized determination node;
[0089] Online data synchronization steps: The data updates of target discount qualifications and ticket purchase records in the updated source table are copied to each online ticketing node through database replication technology.
[0090] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings:
[0091] The "Railway Passenger Transport Regulations" stipulate that students can use the discount voucher to purchase four one-way student tickets between home and school each year, and they can transfer for one-way trips. Students can purchase student discount tickets through the 12306 website, 12306 mobile app, station windows, sales outlets, automatic ticket machines and other channels. When purchasing tickets, the system will determine the ticket connection, interval mileage and discount number based on the student discount qualification information collected in advance. Student discount qualifications include student identity information, school information, home address, school address, and the number of tickets that can be purchased.
[0092] The railway passenger ticket system adopts a distributed architecture to achieve high system availability. The 12306 website and 12306 mobile app (referred to as online ticket sales channels) use the head office to centrally deploy multiple nodes, and users are evenly distributed across all nodes. Station windows, sales outlets, and automatic ticket machines (referred to as offline ticket sales channels) use a three-level system architecture of stations, railway bureaus, and head offices to sell tickets. How to ensure the consistency of student discount times when different channels sell student tickets at the same time requires research on feasibility plans.
[0093] The core issue of the sale of railway student discount tickets is to solve the problem of determining the connection relationship between the travel section of the purchased ticket and the purchased student ticket based on the student's discount qualifications. The relationship between the mileage of the connecting ticket section and the mileage of the discount section and the number of discounts should not exceed 4 times. In view of the distributed architecture of the railway passenger ticket system and the large differences in system services faced by online and offline ticket sales channels, the online ticket sales channel is mainly faced with high concurrency and robot ticket grabbing behavior control, while the offline ticket sales channel is mainly faced with decentralized system architecture and difficulty in ensuring transaction integrity.
[0094] In view of the differences between online and offline ticket sales channels, the online ticket sales channel uses each node to independently determine the eligibility for student ticket discounts, and realizes data read and write separation through database replication, sub-database, sub-table and trigger technology, and ensures data consistency by the business. The offline ticket sales channel adopts the method of adding centralized nodes to uniformly determine the eligibility for student ticket discounts, and realizes the consistency of data read by online and offline ticket sales channels through database replication technology.
[0095] Figure 2 It is a data flow chart of a specific embodiment of the present invention, such as Figure 2 As shown, before purchasing student discount tickets through online ticketing channels, passengers need to fill in the student discount qualification information. After the discount qualification information is verified, the connection relationship between the current ticket purchase and the ticket purchase record is calculated based on the ticket purchase date, departure station, and arrival station, and the relationship between the connection mileage and the discount qualification interval mileage, as well as whether the current ticket purchase needs to deduct the discount times. When a student is eligible to purchase a discounted ticket, a temporary student ticket purchase record tmp_stu_info is generated at the ticketing node A1. The student ticket purchase record marks the connection relationship between the ticket purchase sections and whether the discount times have been deducted. The temporary student ticket purchase record uses database replication technology to copy the data from the ticketing node to the offline ticketing channel centralized determination node X1, the intermediate table tmp_stu_info_N (each ticketing node corresponds to a temporary table), and a trigger stu_tr_N is added to each online ticketing student record intermediate table. The trigger completes the modification of the target student's discount qualifications and ticket purchase records based on the ticket purchase record connection and discount times deduction mark. The target student's discount qualifications stu_ctf and ticket purchase record stu_info are stored in the source table and copied to each online ticketing node through database replication technology.
[0096] Before passengers purchase student discount tickets through offline ticketing channels, they need to collect student discount qualification information first. After the discount qualification information is verified, when buying a ticket, the X1 node is connected to calculate the connection relationship between this ticket purchase and the purchased ticket record based on the ticket purchase date, departure station, and arrival station, and the relationship between the mileage and the discount qualification interval mileage, as well as whether the discount number needs to be deducted for this ticket purchase. When the student discount ticket purchase qualification is met, the target student discount qualification stu_ctf and ticket purchase record stu_info data in the storage source table are updated on X1, and the data is copied to each online ticketing node through database replication technology.
[0097] Figure 3 It is a schematic diagram of the system of the present invention, as shown in Figure 3 As shown, the embodiment of the present invention further provides a system for determining the consistency of the number of preferential ticket purchases, which adopts the method for determining the consistency of the number of preferential ticket purchases as described above, and includes:
[0098] Online independent judgment module 10: When passengers purchase tickets at various online ticketing nodes, each online ticketing node independently completes the judgment of the discount ticket purchase qualification based on the data sub-database and sub-table, generates a temporary ticket purchase record, and synchronizes the temporary ticket purchase record to the offline discount qualification centralized judgment node through the intermediate table, uses trigger technology to trigger the corresponding update of the target data stored in the source table, and copies the updated target data to each online ticketing node for data synchronization;
[0099] Offline unified judgment module 20: When passengers purchase tickets at various offline ticketing nodes, after the offline preferential qualification centralized judgment node uniformly determines the discount ticket purchase qualification, the corresponding update of the target data in the source table is completed, and the database replication technology is used to achieve the consistency of data reading from online and offline ticketing channels.
[0100] Preferably, the above-mentioned ticket purchase discount number consistency judgment system further includes:
[0101] Sub-database and sub-table establishment module: multiple independent data sub-databases are established at each online ticketing node, and multiple data tables are established in each data sub-database to achieve data read and write separation;
[0102] Intermediate table establishment module: For each online ticketing node, a corresponding intermediate table is pre-established to store temporary ticket purchase records.
[0103] The above-mentioned online independent judgment module 10 includes:
[0104] Online verification module: Verify the preferential qualification information and determine the eligibility to purchase preferential tickets when passengers purchase tickets at the online ticketing node;
[0105] Temporary record generation module: When the discount ticket purchase qualification is met, a temporary ticket purchase record is generated at the online ticketing node, stored in the intermediate table, and the connection relationship between the ticket purchase segments and whether the discount times are deducted are marked in the temporary ticket purchase record;
[0106] Offline data synchronization module: The data stored in the intermediate table of the online ticketing node is copied to the source table of the centralized decision node of the offline ticketing channel;
[0107] Trigger data update module: set a trigger in each intermediate table. The trigger modifies the target discount qualification and ticket purchase record in the source table according to the ticket purchase record connection and discount number deduction mark;
[0108] Online data synchronization module: The target discount qualifications and ticket purchase records in the source table are copied to each online ticketing node through database replication technology.
[0109] Furthermore, the online verification module includes:
[0110] Online qualification verification module: Verify the qualification of passengers based on the preferential qualification information filled in by passengers;
[0111] Online discount qualification judgment module: Based on the passenger's ticket purchase information, calculate the connection relationship between this ticket purchase and the ticket purchase record, the relationship between the mileage and the discount qualification interval mileage, and whether the discount times need to be deducted for this ticket purchase, to judge the passenger's discount qualification.
[0112] Among them, the above-mentioned offline unified judgment module includes:
[0113] Offline verification module: Verify the discount qualification information of passengers who purchase tickets offline and determine their eligibility to purchase discount tickets;
[0114] Qualification judgment module: The offline ticket purchase node is connected to the offline discount qualification centralized judgment node to judge the qualification for purchasing discount tickets;
[0115] Target data update module: If the discount ticket purchase qualification is met, the target discount qualification and ticket purchase record data stored in the source table will be updated on the offline discount qualification centralized determination node;
[0116] Online data synchronization module: The data updates of target discount qualifications and ticket purchase records in the updated source table are copied to each online ticketing node through database replication technology.
[0117] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for determining the consistency of the number of ticket purchase discounts as described in the first aspect above is implemented.
[0118] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for determining the consistency of the number of ticket purchase discounts as described in the first aspect above.
[0119] In addition, combined Figure 1 The method for determining the consistency of the number of ticket purchase discounts in the embodiment of the present application described can be implemented by a computer device. Figure 4 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present application.
[0120] The computer device may include a processor 81 and a memory 82 storing computer program instructions.
[0121] Specifically, the processor 81 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0122] Among them, the memory 82 may include a large-capacity memory for data or instructions. By way of example and not limitation, the memory 82 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 82 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 82 may be inside or outside the data processing device. In a specific embodiment, the memory 82 is a non-volatile memory. In a specific embodiment, the memory 82 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, PROM for short), an erasable PROM (Erasable ProgrammableRead-Only Memory, EPROM for short), an electrically erasable PROM (Electrically Erasable ProgrammableRead-Only Memory, EEPROM for short), an electrically alterable ROM (Electrically Alterable Read-Only Memory, EAROM for short) or a flash memory (FLASH) or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0123] The memory 82 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 81 .
[0124] The processor 81 implements any one of the risky user identification methods in the above embodiments by reading and executing computer program instructions stored in the memory 82 .
[0125] In some of these embodiments, the computer device may further include a communication interface 83 and a bus 80. Figure 4 As shown, the processor 81, the memory 82, and the communication interface 83 are connected via a bus 80 and communicate with each other.
[0126] The communication interface 83 is used to implement communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication port 83 can also implement data communication with other components such as: external devices, image / data acquisition equipment, databases, external storage, and image / data processing workstations.
[0127] The bus 80 includes hardware, software or both, and couples the components of the computer device to each other. The bus 80 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 80 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 80 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
[0128] The computer device can be based on the ticket purchase qualification judgment, thereby realizing the combination Figure 1 The method for determining the consistency of the number of ticket discounts described.
[0129] Compared with the prior art, the present invention mainly realizes the difference between online and offline ticketing channels. The online ticketing channel uses each node to independently judge the qualification of student ticket discounts, and realizes data read and write separation through database replication, sub-library, sub-table and trigger technology, and data consistency is guaranteed by business; the offline ticketing channel uses the addition of centralized nodes to uniformly judge the qualification of student ticket discounts, and realizes the consistency of data read by online and offline ticketing channels through database replication technology. The sub-library technology adopted by the present invention realizes the establishment of multiple independent databases at each node of the online ticketing channel, which are used to store different data for judging the qualification of student discounts; the sub-table adopted by the present invention is to realize the establishment of multiple data tables in each sub-library, realizing the separation of data read and write; the present invention adopts an intermediate table to store temporary ticket purchase records to ensure the consistency of data guaranteed by business.
[0130] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0131] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for determining the consistency of the number of ticket purchase discounts, characterized in that: include: Online independent judgment step: When passengers purchase tickets at various online ticketing nodes, each online ticketing node independently completes the judgment of the discount ticket purchase qualification based on the data sub-database and sub-table, generates a temporary ticket purchase record, and synchronizes the temporary ticket purchase record to the offline discount qualification centralized judgment node through the intermediate table, uses trigger technology to trigger the corresponding update of the target data stored in the source table, and copies the updated target data to each online ticketing node for data synchronization; Offline unified judgment step: when the passenger purchases a ticket at each offline ticketing node, after the offline discount qualification centralized judgment node uniformly determines the discount ticket purchase qualification, the corresponding update of the target data in the source table is completed, and the consistency of the data read by the online and offline ticketing channels is achieved through database replication technology; The online independent judgment step includes: Online verification steps: Verify the preferential qualification information and determine the eligibility to purchase preferential tickets when passengers purchase tickets at the online ticketing node; Temporary record generation step: when the discount ticket purchase qualification is met, the temporary ticket purchase record is generated at the online ticketing node, stored in the intermediate table, and the connection relationship of the ticket purchase segment and whether the discount number is deducted are marked in the temporary ticket purchase record; Offline data synchronization step: the data stored in the intermediate table of the online ticketing node is copied to the source table of the offline ticketing channel centralized decision node; Triggering data update step: setting a trigger in each intermediate table, and the trigger completes the modification of the target discount qualification and ticket purchase record in the source table according to the ticket purchase record connection and discount number deduction mark; Online data synchronization step: the target preferential qualifications and ticket purchase records in the source table are copied to each online ticketing node through database replication technology; The offline unified judgment step includes: Offline verification step: verify the passenger's offline ticket purchase qualification information and determine the passenger's eligibility to purchase discount tickets; Qualification judgment step: the offline ticket purchase node is connected to the offline discount qualification centralized judgment node to judge the qualification for purchasing discount tickets; Target data updating step: if the preferential ticket purchase qualification is met, the target preferential qualification and ticket purchase record data stored in the source table are updated at the offline preferential qualification centralized determination node; Online data synchronization step: The data of the target preferential qualifications and ticket purchase records in the updated source table are updated and copied to each of the online ticketing nodes through database replication technology.
2. The method for determining consistency of the number of ticket purchase discounts according to claim 1, characterized in that: The method further comprises: Sub-database and sub-table establishment step: establish multiple independent data sub-databases at each of the online ticketing nodes, and establish multiple data tables in each of the data sub-databases to achieve data read and write separation; Intermediate table establishment step: For each of the online ticketing nodes, a corresponding intermediate table is pre-established to store temporary ticket purchase records.
3. The method for determining consistency of ticket purchase discount times according to claim 2, characterized in that: The online verification steps include: Online qualification verification step: based on the preferential qualification information filled in by the passenger, the passenger's qualification is verified; Online discount qualification judgment step: Based on the passenger's ticket purchase information, calculate the connection relationship between this ticket purchase and the ticket purchase record, the relationship between the mileage and the discount qualification interval mileage, and whether the discount times need to be deducted for this ticket purchase, and judge the passenger's discount qualification.
4. A system for judging the consistency of the number of preferential ticket purchases, using the method for judging the consistency of the number of preferential ticket purchases as claimed in any one of claims 1 to 3, characterized in that: include: Online independent judgment module: When passengers purchase tickets at various online ticketing nodes, each online ticketing node independently completes the judgment of the discount ticket purchase qualification based on the data sub-database and sub-table, generates a temporary ticket purchase record, and synchronizes the temporary ticket purchase record to the offline discount qualification centralized judgment node through the intermediate table, uses trigger technology to trigger the corresponding update of the target data stored in the source table, and copies the updated target data to each online ticketing node for data synchronization; Offline unified judgment module: when the passenger purchases tickets at each offline ticketing node, after the offline preferential qualification centralized judgment node uniformly determines the preferential ticket purchase qualification, the corresponding update of the target data in the source table is completed, and the consistency of the data read by the online and offline ticketing channels is achieved through database replication technology; The online independent judgment module includes: Online verification module: Verify the preferential qualification information and determine the eligibility to purchase preferential tickets when passengers purchase tickets at the online ticketing node; Temporary record generation module: when the discount ticket purchase qualification is met, the temporary ticket purchase record is generated at the online ticketing node, stored in the intermediate table, and the connection relationship of the ticket purchase segment and whether the discount number is deducted are marked in the temporary ticket purchase record; Offline data synchronization module: the data stored in the intermediate table of the online ticketing node is copied to the source table of the offline ticketing channel centralized decision node; Trigger data update module: set a trigger in each intermediate table, and the trigger completes the modification of the target discount qualification and ticket purchase record in the source table according to the ticket purchase record connection and discount number deduction mark; Online data synchronization module: The target preferential qualifications and ticket purchase records in the source table are copied to each online ticketing node through database replication technology; The offline unified judgment module includes: Offline verification module: verify the passenger's qualification information for offline ticket purchase and determine the eligibility for purchasing discount tickets; Qualification judgment module: the offline ticket purchase node is connected to the offline discount qualification centralized judgment node to judge the qualification for purchasing discount tickets; Target data update module: if the preferential ticket purchase qualification is met, the target preferential qualification and ticket purchase record data stored in the source table are updated on the offline preferential qualification centralized determination node; Online data synchronization module: The data of target preferential qualifications and ticket purchase records in the updated source table are updated and copied to each of the online ticketing nodes through database replication technology.
5. The ticket purchase discount frequency consistency judgment system according to claim 4 is characterized in that: The system further comprises: Sub-database and sub-table establishment module: establish multiple independent data sub-databases at each online ticketing node, and establish multiple data tables in each data sub-database to achieve data reading and writing separation; Intermediate table establishment module: for each of the online ticketing nodes, a corresponding intermediate table is pre-established to store temporary ticket purchase records.
6. The ticket purchase discount frequency consistency judgment system according to claim 5, characterized in that: The online verification module includes: Online qualification verification module: based on the preferential qualification information filled in by the passenger, the qualification of the passenger is verified; Online discount qualification judgment module: Based on the passenger's ticket purchase information, the connection relationship between the current ticket purchase and the ticket purchase record is calculated, the relationship between the mileage and the mileage of the discount qualification interval is calculated, and whether the current ticket purchase needs to deduct the number of discounts, so as to judge the passenger's discount qualification.
7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for determining the consistency of the number of ticket purchase discounts as described in any one of claims 1 to 3 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a method for determining the consistency of the number of ticket purchase discounts as described in any one of claims 1 to 3 is implemented.
