Subway ride code checking method and device, electronic equipment and storage medium

By parsing and verifying the QR code for boarding at the subway gate, the problem of slow gate response caused by network dependence in the existing technology has been solved, and fast and reliable boarding code verification and passage have been achieved.

CN120725046BActive Publication Date: 2025-11-25深圳市深圳通有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511204236.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-27
Publication Date
2025-11-25
Estimated Expiration
2045-08-27

AI Technical Summary

Technical Problem

The existing subway ride code verification method relies on network communication, which leads to slow gate response during periods of poor network signal or peak passenger flow, affecting passage efficiency and user experience.

Method used

The system parses the QR code for boarding at the subway turnstile, obtains encrypted travel data, and performs local verification. Upon successful verification, it generates entry and exit registration information and updates the travel status before uploading the data to the cloud for synchronization.

Benefits of technology

Local verification improves the speed of QR code verification, shortens the waiting time for users to pass through the gate, and ensures data consistency and a fast passage experience for users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120725046B_ABST
    Figure CN120725046B_ABST
Patent Text Reader

Abstract

The application provides a subway ride code verification method and device, electronic equipment and storage medium, and belongs to the field of rail transit. Applied to a subway gate, the method comprises the following steps: obtaining a target ride two-dimensional code; analyzing the target ride two-dimensional code to obtain encrypted travel data; wherein the encrypted travel data comprises a data verification code and travel state information; performing local verification on the travel state information through the data verification code; in response to successful local verification, generating entry and exit registration information based on the travel state information, and controlling the subway gate to open; updating the travel state information based on the entry and exit registration information, and uploading the updated travel state information to a cloud backend server for data synchronization. The application can improve the verification speed of the subway gate for the ride code, and shorten the waiting time of the user when passing through the gate.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of rail transit, and in particular to a metro ride code verification method and device, electronic equipment and a storage medium. BACKGROUND

[0002] Currently, a two-dimensional code has become an electronic ticketing voucher widely used in urban rail transit. A passenger generates a ride code through a mobile phone application, and interacts with a metro gate machine when entering or leaving a station to complete ticket checking and fee deduction.

[0003] In related technologies, when the network signal is poor or during a peak passenger flow period, the verification process of the existing ride code often causes the gate machine to respond slowly, and the user needs to wait for a long time in front of the gate machine, which not only affects the passing efficiency, but also reduces the user's ride experience. The root cause lies in that the traditional verification method relies on real-time network communication between the gate machine and the cloud backend server. Each time the code is scanned, data needs to be transmitted back and forth through the network to verify the validity of the two-dimensional code and obtain the trip state. The delay or jitter of the network increases the waiting time of the user. SUMMARY

[0004] The main purpose of the embodiments of the present application is to provide a metro ride code verification method and device, electronic equipment and a storage medium, which can improve the verification speed of the metro gate machine for the ride code and shorten the waiting time of the user when passing through the gate.

[0005] To achieve the above purpose, a first aspect of the embodiments of the present application provides a metro ride code verification method applied to a metro gate machine, and the method comprises:

[0006] obtaining a target ride two-dimensional code;

[0007] analyzing the target ride two-dimensional code to obtain encrypted trip data; wherein the encrypted trip data comprises a data check code and trip state information;

[0008] locally verifying the trip state information through the data check code;

[0009] in response to the local verification being successful, generating entry and exit registration information based on the trip state information, and controlling the metro gate machine to be opened;

[0010] updating the trip state information based on the entry and exit registration information, and uploading the updated trip state information to a cloud backend server for data synchronization.

[0011] In some embodiments, if the local verification fails, the method further comprises:

[0012] sending the target ride QR code to the cloud background server to initiate a real-time online verification request; so that the cloud background server verifies the target ride QR code according to the locally stored user account data, historical journey records and two-dimensional code anti-replay data, and generates an online verification result;

[0013] receiving the online verification result returned by the cloud background server, and when the online verification result is verified, generating entry and exit registration information based on the online verification result, and controlling the subway gate to be opened.

[0014] In some embodiments, the journey status information includes entry and exit identification, last station number, last transaction terminal number, last transaction time and journey identification, and the local verification of the journey status information by the data verification code includes:

[0015] generating a local verification code based on the journey status information and a preset encryption key;

[0016] comparing the local verification code with the data verification code to obtain an integrity verification result;

[0017] in response to the integrity verification result indicating that the verification is passed, performing a business logic verification, and the business logic verification includes:

[0018] when the subway gate is an entry gate, judging the entry and exit identification in the journey status information to perform entry verification on the current entry behavior to obtain an entry verification result;

[0019] when the subway gate is an exit gate, performing exit verification on the current exit behavior according to the journey identification, the last station number, the last transaction terminal number and the last transaction time to obtain an exit verification result;

[0020] when the business logic verification is passed, determining that the local verification is successful.

[0021] In some embodiments, the encrypted journey data further includes a key index; and the generation of the local verification code based on the journey status information and a preset encryption key specifically includes:

[0022] determining a target key used for this verification from a plurality of encryption keys locally stored in the subway gate according to the key index;

[0023] calculating the journey status information by using the target key to generate the local verification code.

[0024] In some embodiments, the out-bound checking of the current out-bound behavior according to the trip identifier, the last station number, the last transaction terminal number and the last transaction time, to obtain an out-bound checking result, comprises:

[0025] determining whether the trip identifier is a current valid trip identifier;

[0026] obtaining a station number of a current out-bound gate, and determining whether the station number of the current out-bound gate is different from the last station number;

[0027] calculating a trip duration based on the last transaction time and a current time, and determining whether the trip duration is within a preset valid duration interval;

[0028] when the trip identifier is valid, the station number of the current out-bound gate is different from the last station number, and the trip duration is within the valid duration interval, determining that the out-bound checking result is passed.

[0029] In some embodiments, before the target ride QR code is obtained, the cloud server performs the following steps:

[0030] obtaining real-time geographic location information and historical ride time period data of the user;

[0031] comparing the real-time geographic location information with a preset subway station geographic fence to determine whether the user enters the subway station range;

[0032] comparing the current time with the historical ride time period data to determine whether the current time conforms to the user's travel regularity;

[0033] when it is determined that the user enters the subway station range or the current time conforms to the travel regularity, generating trip data containing the latest trip state information, and generating a target ride QR code according to the trip data;

[0034] pushing and caching the target ride QR code to the terminal device of the user.

[0035] In some embodiments, after the trip state information is updated based on the entry and exit registration information, and the updated trip state information is uploaded to the cloud server for data synchronization, the cloud server further performs the following steps:

[0036] the cloud server determines a completed trip interval and a trip duration according to the updated trip state information;

[0037] generating a ticket amount to be deducted according to the trip interval and the trip duration, and based on a preset billing rule;

[0038] initiating a deduction request to a payment channel corresponding to the user to deduct the ticket fare amount.

[0039] To achieve the above object, a second aspect of the embodiment of the present application provides a subway ride code verification device, comprising:

[0040] a real-time acquisition module, which acquires device running data and historical user behavior data of the earphone charging box in real time;

[0041] a parameter prediction module, which inputs the device running data and the user historical behavior data into a pre-constructed charging parameter prediction model, so that the charging parameter prediction model determines a target charging scene according to the user historical behavior data and determines a target charging parameter according to the target charging scene and the device running data;

[0042] a charging module, which adjusts charging parameters of a charging circuit in the earphone charging box based on the target charging scene and the target charging parameter to charge the earphone charging box.

[0043] To achieve the above object, a third aspect of the embodiment of the present application provides an electronic device, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the method of the first aspect embodiment when executing the computer program.

[0044] To achieve the above object, a fourth aspect of the embodiment of the present application provides a storage medium, which is a computer readable storage medium, the storage medium stores a computer program, and the computer program is executed by a processor to implement the method of the first aspect embodiment.

[0045] The subway ride code verification method and device, electronic equipment and storage medium provided by the application have the following beneficial effects: first, the method obtains and analyzes the target ride two-dimensional code, directly obtains encrypted travel data containing data verification code and travel state information at the subway gate end, provides complete data basis for subsequent local verification, and avoids the delay of requesting verification data from a remote server through a network in the prior art; second, the travel state information is verified locally using the data verification code, the core verification work is completed locally, and the entire verification process is accelerated; after responding to the local verification success, registration information is generated based on the reliable travel state information, and the gate is opened, since the time-consuming network interaction is skipped, the response time of the gate opening action is greatly shortened; finally, after completing the gate opening action, the travel state information is updated based on the current entry and exit registration information, and is uploaded to the cloud server for data synchronization, ensuring the consistency of the data while not affecting the user's fast passage experience. In summary, the application prepositions the core verification logic to the local subway gate, replaces the original remote online verification with local verification, can improve the verification speed of the subway gate for the ride code, and shorten the user's waiting time for passing through the gate. BRIEF DESCRIPTION OF DRAWINGS

[0046] Figure 1 is a flowchart of the subway ride code verification method provided by the embodiment of the application;

[0047] Figure 2 is another flowchart of the subway ride code verification method provided by the embodiment of the application;

[0048] Figure 3 is another flowchart of the subway ride code verification method provided by the embodiment of the application;

[0049] Figure 4 is another flowchart of the subway ride code verification method provided by the embodiment of the application;

[0050] Figure 5 is another flowchart of the subway ride code verification method provided by the embodiment of the application;

[0051] Figure 6 is another flowchart of the subway ride code verification method provided by the embodiment of the application;

[0052] Figure 7 is a schematic diagram of the subway ride code verification device provided by the embodiment of the application;

[0053] Figure 8 is a hardware structure schematic diagram of the electronic equipment provided by the embodiment of the application. DETAILED DESCRIPTION

[0054] In order to make the purposes, technical solutions and advantages of the present application clearer, further detailed description will be given below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application and not intended to limit the present application.

[0055] It should be noted that although the functional modules are divided in the device schematic diagram, and the logical sequence is shown in the flowchart, in some cases, the steps shown or described can be performed in a manner different from the module division in the device or the sequence in the flowchart.

[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0057] Currently, the two-dimensional code has become an electronic ticketing voucher widely used in urban rail transit. Passengers generate a ride code through a mobile phone application, and interact with the subway gate when entering and leaving the station to complete ticket checking and fee deduction.

[0058] In the related art, when the network signal is poor or during the peak passenger flow period, the existing ride code verification process often causes the gate to respond slowly, and the user needs to wait for a long time in front of the gate, which not only affects the passing efficiency, but also reduces the user's ride experience. The root cause is that the traditional verification method relies on real-time network communication between the gate and the cloud server. Each time the code is scanned, data needs to be transmitted back and forth through the network to verify the validity of the two-dimensional code and obtain the journey status. The delay or jitter of the network increases the user's waiting time.

[0059] Based on this, the present application provides a subway ride code verification method and device, electronic equipment and storage medium, which can improve the verification speed of the subway gate for the ride code and shorten the waiting time of the user passing through the gate.

[0060] The subway ride code verification method and device, electronic equipment and storage medium provided by the present application are specifically described through the following examples. First, the subway ride code verification method in the present application is described.

[0061] The subway ride code verification method in the present application can be described through the following examples.

[0062] It should be noted that in various specific embodiments of the present application, when relevant processing needs to be performed according to user information, user behavior data, user historical data, and user location information, etc. related to the identity or characteristics of the user, the user's permission or consent will be obtained first, for example, when accessing the user's stored data and the user's cache data access request, the user's permission or consent will be obtained first. Moreover, the collection, use and processing of these data will comply with relevant laws, regulations and standards of relevant countries and regions. In addition, when the embodiments of the present application need to obtain sensitive personal information of the user, the separate permission or separate consent of the user will be obtained through a pop-up window or by jumping to a confirmation page, and after obtaining the separate permission or separate consent of the user, the necessary user-related data for the normal operation of the embodiments of the present application will be obtained.

[0063] Figure 1 is an optional flowchart of the subway ride code verification method provided by the embodiments of the present application, Figure 1 The method in the above can include but not limited to steps 101-105. It can be understood that the order of steps 101-105 in the embodiments is not limited, and the order of steps can be adjusted or some steps can be reduced or added according to actual needs. Figure 1 The order of steps 101-105 in the embodiments is not limited, and the order of steps can be adjusted or some steps can be reduced or added according to actual needs.

[0064] Step 101, obtaining a target ride two-dimensional code.

[0065] Step 102, analyzing the target ride two-dimensional code to obtain encrypted trip data.

[0066] Step 103, locally verifying the trip state information by the data verification code.

[0067] Step 104, in response to the local verification being successful, generating entry and exit registration information based on the trip state information, and controlling the subway gate to be opened.

[0068] Step 105, updating the trip state information based on the entry and exit registration information, and uploading the updated trip state information to a cloud backend server for data synchronization.

[0069] In step 101 of some embodiments, obtaining a target ride two-dimensional code is the starting point of the entire verification process. The target ride two-dimensional code refers to the dynamic graphic code displayed on the screen of the user's terminal device (such as a smart phone) for this ride transaction. The acquisition action can be performed by an optical scanning module integrated on the subway gate, which captures and converts the image information of the two-dimensional code into raw digital signals for subsequent processing through shooting or scanning.

[0070] Please refer to Figure 2In some embodiments, before step 101, the execution steps of the cloud backend server can further include, but are not limited to, steps 201 to 205.

[0071] Step 201, obtaining real-time geographic location information of the user and historical ride time period data.

[0072] Step 202, comparing the real-time geographic location information with the preset subway station geographic fence to determine whether the user has entered the subway station range.

[0073] Step 203, comparing the current time with the historical ride time period data to determine whether the current time conforms to the user's travel regularity.

[0074] Step 204, when it is determined that the user has entered the subway station range or the current time conforms to the travel regularity, generating travel data containing the latest travel state information, and generating a target ride two-dimensional code according to the travel data.

[0075] Step 205, pushing and caching the target ride two-dimensional code to the user's terminal device.

[0076] In step 201 of some embodiments, the cloud backend server obtains real-time geographic location information of the user and historical ride time period data. The real-time geographic location information is usually provided by the positioning module of the user's terminal device and can accurately reflect the user's current geographic coordinates. The historical ride time period data is statistical data generated by the cloud backend server by analyzing the user's long-term ride records, which can represent the user's ride time regularity in a specific period (such as weekdays or weekends).

[0077] In step 202 of some embodiments, the cloud backend server compares the real-time geographic location information obtained in the previous step with the preset subway station geographic fence. The subway station geographic fence is a virtual geographic boundary that is predefined based on the center coordinates of the subway station. For example, the geographic fence of a subway station can be set as a circular area with a radius of 500 meters around the station. Through this comparison action, the server can accurately determine whether the user has entered or is approaching the effective range of a subway station.

[0078] In step 203 of some embodiments, the cloud backend server compares the current time with the user's historical ride time period data, which aims to predict the user's travel intention from the time dimension. For example, if the historical ride time period data of a user shows that he usually takes the subway between 8:00 and 9:00 am on weekdays, and the current time is 8:30 am on Wednesday, the server can determine that the current time point conforms to the user's travel regularity and infer that he has a high probability of taking the subway.

[0079] In some embodiments, step 204 is a preprocessing action performed based on prior judgments. When the geographical location judgment result in step 202 is true and the time pattern judgment result in step 203 is true, the cloud backend server will actively trigger a QR code generation process. This process will obtain the user's latest travel status information, package it to generate a complete travel data containing a data verification code, and finally generate an immediately usable target travel QR code based on this travel data.

[0080] In step 205 of some embodiments, the cloud-based backend server pushes the target transit QR code, pre-generated in the previous step, to the user's terminal device via a network message. Upon receiving this QR code, the application on the user's terminal device securely caches it in local storage. This way, when the user actually needs to use the transit code later, the application can directly read and display it from the local cache at high speed, without initiating another real-time network request.

[0081] Through steps 201 to 205 described above, this embodiment of the application transforms the timing of QR code generation from a passive user request to an active prediction. By comprehensively analyzing the user's geographical location and historical travel patterns, the QR code can be generated and distributed in advance, before the user actually needs it. This mechanism optimizes the user experience and effectively avoids loading delays or failures caused by real-time QR code requests in situations with poor network signal (such as underground station environments) or network congestion, ensuring that users can always instantly obtain a valid boarding pass when needed.

[0082] In step 102 of some embodiments, this step processes and decodes the raw digital signal obtained in the previous step. Parsing refers to converting the image format of the QR code into the string or data stream it carries. The encrypted trip data obtained after parsing is a secure data packet processed by an encryption algorithm. It contains a data verification code, which is a cryptographic credential used to verify whether the data has maintained its integrity and authenticity and has not been tampered with during the generation and transmission process, such as a Message Authentication Code (MAC); it also contains trip status information, which is a series of key data representing the user's current trip status, such as the user's previous transaction record.

[0083] In step 103 of some embodiments, local verification means that the entire verification process is completed within the processor of the subway gate itself, without the need for real-time network communication with the cloud backend server. Specifically, the gate system uses the data verification code obtained in the previous step to perform a cryptographic verification on the same obtained travel status information. For example, the gate can recalculate the verification code for the travel status information based on a preset key and algorithm, and compare it with the data verification code embedded in the QR code. If they match, it proves that the travel status information is reliable.

[0084] Please see Figure 3 In some embodiments, the trip status information includes entry / exit station identifier, last station number, last transaction terminal number, last transaction time and trip identifier. Step 103 may include, but is not limited to, steps 301 to 304.

[0085] Step 301: Generate a local verification code based on the trip status information and the preset encryption key;

[0086] Step 302: Compare the local check code with the data check code to obtain the integrity verification result;

[0087] Step 303: In response to the integrity verification result indicating that the verification has passed, perform business logic verification. The business logic verification includes: when the subway gate is an entry gate, determine the entry / exit identifier in the travel status information to perform entry verification on the current entry behavior and obtain the entry verification result; when the subway gate is an exit gate, perform exit verification on the current exit behavior based on the travel identifier, the previous station number, the previous transaction terminal number, and the previous transaction time and obtain the exit verification result.

[0088] Step 304: When the business logic verification passes, the local verification is confirmed to be successful.

[0089] In step 301 of some embodiments, after obtaining the parsed travel status information, the subway turnstile begins the first stage of local verification, namely cryptographic verification. The turnstile processing unit calls a preset encryption key, which is securely stored locally on the turnstile and corresponds to the key held by the cloud backend server. By using this preset encryption key, a message authentication code calculation is performed on the received travel status information as a whole, thereby generating a local verification code for comparison in real time.

[0090] Please see Figure 4 In some embodiments, the encrypted trip data also includes a key index, and step 301 may include, but is not limited to, steps 401 to 402.

[0091] Step 401: Based on the key index, determine the target key used for this verification from multiple encryption keys stored locally on the subway turnstile.

[0092] Step 402: Calculate the trip status information using the target key to generate a local checksum.

[0093] In step 401 of some embodiments, the key index included in the encrypted travel data is a non-confidential number or string used to identify the key version. The subway turnstile stores multiple sets of encryption keys pre-allocated and managed by a cloud-based backend server in its local secure storage area. Upon receiving encrypted travel data containing a key index, it first parses the key index and, based on this index value, searches and matches it among the multiple locally stored encryption keys to accurately determine the unique target key required for this verification.

[0094] In step 402 of some embodiments, the parsed trip status information is used as input data, and the determined target key is used as the operation key. A new string uniquely corresponding to the input data and the key is generated through a preset message authentication code algorithm. This string is the local verification code. This local verification code is then used to compare with the data verification code built into the encrypted trip data to complete the final integrity verification.

[0095] Through steps 401 to 402 described above, this embodiment of the application introduces a key index, changing the traditional method's reliance on a single, fixed key for verification. This allows for the simultaneous management of multiple key versions. This not only significantly enhances system security, enabling regular and seamless key rotation and upgrades, but also effectively isolates security risks associated with QR codes from different periods or batches. When a key update is required, the backend system only needs to issue a new key and activate a new key index for a smooth transition, without requiring a forced synchronous update for all terminals.

[0096] In step 302 of some embodiments, the local verification code generated in the previous step is compared with the original data verification code parsed from the QR code data. This comparison process aims to confirm whether the two verification codes are completely identical. If they are completely identical, it proves that the trip status information has not been tampered with or damaged since it was generated from the cloud backend server, and the integrity and authenticity of the data have been confirmed. The output of this step is a clear integrity verification result, namely "verification passed" or "verification failed".

[0097] In some embodiments, step 303 is triggered only if the previous integrity check result is "verification passed," to perform the second phase of local verification, namely business logic verification. The business logic verification executes different judgment branches based on the gate's own attributes (entry or exit).

[0098] For example, in a station entry scenario, when the subway turnstile is used as an entry gate, the business logic verifies whether the user is qualified to initiate a new journey. The turnstile reads the entry / exit identifier from the journey status information and determines whether this identifier is a preset non-journeying state. A non-journeying state can be a specific data marker indicating that the user is not currently in any incomplete journey. If an entry / exit identifier meets this requirement, for example, if it is marked as "journey completed," the turnstile considers the current entry behavior logically valid and accordingly determines a "pass" entry verification result.

[0099] For example, in an exit scenario, when the subway turnstile is the exit gate, its business logic verification is a multi-dimensional verification process to ensure the validity of the travel loop. First, it checks if the travel identifier in the travel data is a currently valid travel identifier to confirm the travel identity. Second, it obtains the current exit gate's own station number and checks if this current station number differs from the previous station number recorded in the travel data to verify the reasonableness of the travel spatial location. Third, based on the previous transaction time and the current system time recorded in the travel data, it calculates the total travel duration and checks if this duration falls within a preset valid duration range to verify the reasonableness of the travel time span. Finally, only when the travel identifier is valid, the current exit gate's station number differs from the previous station number, and the travel duration is within the valid duration range, is the exit verification result determined to be "passed," thus ensuring that every step of the exit behavior complies with operational rules.

[0100] In step 304 of some embodiments, the final conclusion of successful local verification must simultaneously meet two preconditions: first, the integrity verification result in step 302 must be "verification passed"; second, the business logic verification in step 303 (whether it is inbound verification or outbound verification) must also pass. Only when both cryptographic security and business logic rationality are confirmed will the overall result of this local verification be considered successful, thereby authorizing subsequent gate opening operations.

[0101] Through steps 301 to 304 described above, this embodiment of the application first ensures the authenticity and integrity of the transaction data by generating and comparing verification codes, providing a reliable data foundation for subsequent processing. Then, based on this reliable data, a layer of business logic rationality judgment is added to ensure that the transaction behavior conforms to actual operational rules. This enables the subway turnstile to independently, quickly, and reliably complete a full transaction verification without relying on the network, thus providing a solid technical guarantee for bypassing online verification and achieving rapid passage.

[0102] Please see Figure 5In some embodiments, if local verification fails, steps 501 to 502 may also be included, but are not limited to.

[0103] Step 501: Send the target ride QR code to the cloud backend server to initiate a real-time online verification request; so that the cloud backend server can verify the target ride QR code based on the locally stored user account data, historical trip records and QR code anti-replay data, and generate an online verification result.

[0104] Step 502: Receive the online verification result returned by the cloud backend server. When the online verification result is successful, generate entry and exit registration information based on the online verification result and control the subway gate to open.

[0105] In step 501 of some embodiments, when local verification fails, the subway gate, acting as the requesting end, sends the original data of the obtained target QR code to the cloud backend server via network communication, thereby initiating a real-time online verification request. Upon receiving the request, the cloud backend server performs a comprehensive verification process, which includes: retrieving the user's account data to confirm the account status; querying the user's historical travel records to determine if the current entry / exit behavior conforms to travel logic; and simultaneously retrieving QR code anti-replay data to verify whether the target QR code is being used for the first time. Based on the results of these multiple verifications, the cloud backend server ultimately generates an online verification result.

[0106] In step 502 of some embodiments, after receiving the online verification result returned by the cloud backend server, the subway gate will execute the final business action based on this result. First, it will determine whether the online verification result is "verification passed". If the result is "verification passed", it means that although the local verification failed, from the perspective of the cloud backend, the transaction is legal and valid. In this case, the subsequent process will continue, that is, based on this online verification result, local entry and exit registration information will be generated, and the subway gate will be opened to ensure the normal passage of users. Otherwise, the gate will not be opened.

[0107] Through steps 501 to 502 described above, this embodiment of the application, when local verification fails for any reason, will not directly reject the transaction, but can seamlessly switch to the traditional online verification mode, leaving the judgment to the cloud-based backend server with the most comprehensive data. This ensures that while pursuing speed, system stability and service reliability are not affected, avoiding misjudgments of legitimate users.

[0108] In some embodiments, step 104 is a direct business action following successful local verification. "Responding to successful local verification" means using the successful verification in the previous step as the trigger condition for executing this step. The entry / exit registration information is a formal, localized transaction record generated by the turnstile based on the verified travel status information and the turnstile's own physical information (such as the current station, device number, and current time). After generating this registration information, the turnstile's processing unit immediately sends an opening command to its physical gate control unit, thereby enabling passage.

[0109] In step 105 of some embodiments, after the user's travel experience is completed, a final step is performed to ensure the consistency of data throughout the system. "Update" refers to replacing the old status in the original travel status information with the new status (such as "entered the station") in the newly generated entry / exit registration information. Subsequently, this updated travel status information will be uploaded to the cloud backend server. This "data synchronization" process aims to ensure that the backend server has the latest and most accurate travel records for the user, so as to generate the correct boarding QR code for the user's next trip (such as exiting the station or transferring), thereby forming a complete data loop.

[0110] Please see Figure 6 In some embodiments, after step 105, the execution steps of the cloud backend server may also include, but are not limited to, steps 601 to 603.

[0111] Step 601: The cloud-based backend server determines the completed trip segments and trip durations based on the updated trip status information.

[0112] Step 602: Calculate and generate the ticket amount to be deducted based on the trip range and trip duration, and on the preset billing rules.

[0113] Step 603: Initiate a deduction request to the user's corresponding payment channel to deduct the ticket amount.

[0114] In step 601 of some embodiments, after receiving the data synchronization information uploaded by the gate, the cloud backend server will parse the received updated travel status information, and determine a completed travel interval by reading the entry station information and the exit station information of this transaction. At the same time, the server will calculate the total travel time based on the entry timestamp and the exit timestamp of this transaction.

[0115] In step 602 of some embodiments, the cloud backend server calls a preset billing rule library, which stores a complete subway network fare chart, the correspondence between mileage and price, and handling strategies for special cases such as overtime and discounts. The travel range and travel duration determined in the previous step are used as inputs to match and calculate the fare amount to be deducted for this trip in the billing rule library.

[0116] In step 603 of some embodiments, after the ticket amount is determined, the cloud backend server will find the user's pre-bound payment channel, such as a third-party payment platform or bank card, from the user's account data. Subsequently, the server will initiate a secure deduction request to the interface of this payment channel. The request includes the user's payment authorization information and the calculated ticket amount to complete the final fee deduction.

[0117] Through steps 601 to 603 described above, this embodiment of the application completely decouples the billing calculation and financial interaction with third-party payment channels from the front-end user's passage verification process at the gate. This design ensures that the user's gate-passing experience is not affected by any delays in the back-end billing and deduction processes, guaranteeing the efficiency of front-end passage.

[0118] Please see Figure 7 This application also provides a verification device for a subway transit code, which can implement the above-mentioned verification method for subway transit codes. The device includes:

[0119] The acquisition module is used to acquire the target boarding QR code;

[0120] The parsing module is used to parse the target boarding QR code to obtain encrypted trip data; the encrypted trip data includes a data verification code and trip status information.

[0121] The verification module is used to perform local verification of the trip status information using data verification codes;

[0122] The generation module is used to generate entry and exit registration information based on the travel status information in response to successful local verification, and to control the opening of the subway gates;

[0123] The update module is used to update the travel status information based on the entry and exit registration information, and upload the updated travel status information to the cloud backend server for data synchronization.

[0124] For example, the headphone case and Bluetooth headphones can communicate with smart home devices through smart home platforms such as Apple HomeKit and Google Assistant. Users can control the functions of smart devices in their homes, such as lighting and temperature adjustment, through specific physical actions, increasing the control flexibility and applicability of headphone accessories.

[0125] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned subway ride code verification method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0126] Please refer to the figure. Figure 8 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:

[0127] The processor 801 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0128] The memory 802 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 802 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 802 and is called and executed by the processor 801 to execute the subway ride code verification method of the embodiments of this application.

[0129] The 803 input / output interface is used to implement information input and output.

[0130] The communication interface 804 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0131] Bus 805 transmits information between various components of the device (e.g., processor 801, memory 802, input / output interface 803, and communication interface 804);

[0132] The processor 801, memory 802, input / output interface 803, and communication interface 804 are connected to each other within the device via bus 805.

[0133] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for verifying subway transit codes.

[0134] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0135] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0136] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0137] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0138] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

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

[0140] It should be understood that in this application, "at least one" and "several" refer to one or more, and "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0141] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. The couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0142] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0143] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0144] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0145] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A method for verifying a subway transit QR code, characterized in that, Applications in subway turnstiles include: Obtain the target ride QR code; The target QR code for boarding is parsed to obtain encrypted travel data; wherein, the encrypted travel data includes a data verification code and travel status information, the travel status information includes entry and exit station identifiers, last station number, last transaction terminal number, last transaction time and travel identifier, and the encrypted travel data also includes a key index; Local verification of the travel status information using the data verification code includes: determining the target key used for this verification from multiple encryption keys locally stored in the subway gate according to the key index; calculating the travel status information using the target key to generate the local verification code; comparing the local verification code with the data verification code to obtain an integrity verification result; and, in response to the integrity verification result indicating successful verification, executing business logic verification, which includes: when the subway gate is an entry gate, determining the entry / exit identifier in the travel status information to perform entry verification on the current entry behavior to obtain... The system checks the following: Entry verification result; When the subway gate is an exit gate, it determines whether the travel identifier is currently valid; it obtains the station number of the current exit gate and determines whether the station number is different from the previous station number; it calculates the travel duration based on the previous transaction time and the current time, and determines whether the travel duration is within a preset valid duration range; When the travel identifier is valid, the station number of the current exit gate is different from the previous station number, and the travel duration is within the valid duration range, the exit verification result is determined to be passed; When the business logic verification passes, the local verification is determined to be successful. In response to the successful local verification, entry and exit registration information is generated based on the travel status information, and the subway gate is opened. The travel status information is updated based on the entry and exit registration information, and the updated travel status information is uploaded to the cloud backend server for data synchronization.

2. The method for verifying subway transit codes according to claim 1, characterized in that, If the local verification fails, the method further includes: The target QR code for boarding is sent to the cloud-based backend server to initiate a real-time online verification request; so that the cloud-based backend server can verify the target QR code for boarding based on locally stored user account data, historical trip records, and QR code anti-replay data, and generate an online verification result. The system receives the online verification result returned by the cloud-based backend server. When the online verification result is successful, it generates entry and exit registration information based on the online verification result and controls the subway gate to open.

3. The method for verifying subway transit codes according to claim 1, characterized in that, Before obtaining the target ride QR code, the cloud-based backend server performs the following steps: Obtain the user's real-time location information and historical travel time data; The real-time geographic location information is compared with the preset subway station geofence to determine whether the user has entered the subway station area; The current time is compared with the historical travel time data to determine whether the current time matches the user's travel pattern; When it is determined that a user has entered the area of ​​the subway station or that the current time matches the travel pattern, travel data containing the latest travel status information is generated, and a target boarding QR code is generated based on the travel data; The target ride QR code is pushed and cached to the user's terminal device.

4. The method for verifying subway transit codes according to claim 3, characterized in that, After updating the travel status information based on the entry and exit registration information and uploading the updated travel status information to the cloud backend server for data synchronization, the execution steps of the cloud backend server further include: The cloud-based backend server determines the completed trip segments and trip durations based on the updated trip status information. Based on the trip range and trip duration, and according to the preset billing rules, the amount of ticket fare to be deducted is calculated and generated. A deduction request is initiated to the user's corresponding payment channel to deduct the ticket amount.

5. A verification device for subway ride codes, characterized in that, include: The acquisition module is used to acquire the target boarding QR code; The parsing module is used to parse the target QR code for boarding to obtain encrypted travel data; wherein, the encrypted travel data includes a data verification code and travel status information, the travel status information includes entry and exit station identifiers, last station number, last transaction terminal number, last transaction time and travel identifier, and the encrypted travel data also includes a key index; The verification module is used to perform local verification of the travel status information using the data verification code. This includes: determining the target key used for this verification from multiple encryption keys stored locally on the subway gate according to the key index; calculating the travel status information using the target key to generate the local verification code; comparing the local verification code with the data verification code to obtain an integrity verification result; and, in response to the integrity verification result indicating successful verification, performing business logic verification, which includes: when the subway gate is an entry gate, determining the entry / exit identifier in the travel status information to perform entry verification on the current entry behavior. The system obtains the entry verification result; when the subway gate is an exit gate, it determines whether the travel identifier is a currently valid travel identifier; it obtains the station number of the current exit gate and determines whether the station number of the current exit gate is different from the previous station number; it calculates the travel duration based on the previous transaction time and the current time, and determines whether the travel duration is within a preset valid duration range; when the travel identifier is valid, the station number of the current exit gate is different from the previous station number, and the travel duration is within the valid duration range, the exit verification result is determined to be passed; when the business logic verification passes, the local verification is determined to be successful. The generation module is used to generate entry and exit registration information based on the travel status information in response to the successful local verification, and to control the opening of the subway gate; The update module is used to update the travel status information based on the entry and exit registration information, and upload the updated travel status information to the cloud backend server for data synchronization.

6. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the verification method for the subway ride code as described in any one of claims 1 to 4.

7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for verifying the subway fare code as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Subway taking off-line processing system and method based on off-line two-dimensional code ticket-card

    CN108234517A

  • One-way ticket checking method and device and one-way ticket generating method

    CN119694010A