Method and device for charging a vehicle
By querying the historical records when receiving the ride record, determining the latest record for the ride time and calculating the fees according to the discount strategy, the error billing problem caused by the out-of-order ride record is solved, and accurate ride cost calculation is achieved.
Patent Information
- Application Number
- CN201910562563.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-26
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2039-06-26
AI Technical Summary
In public transportation, asynchronous delivery of QR code ride records leads to out-of-order ride records and leads to incorrect billing. Especially under the transfer discount strategy, it is difficult to accurately calculate the ride costs.
When receiving the user's first ride record, the historical ride record is checked based on the ride time, and the record with the latest ride time is determined as the second ride record, if the left reference time is related to the first ride record If the time interval is less than or equal to the preferential time threshold, the ride fee information will be obtained according to the transfer discount strategy to ensure that the ride record is billed at the correct time interval.
Avoid miscalculation problems caused by out-of-order ride records, ensure that passengers calculate ride fees according to the correct transfer discount strategy, and improve the accuracy and fairness of billing.
Smart Images

Figure CN110264281B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of public transportation, and in particular to a method and device for charging a fare. Background Art
[0002] In the public transportation industry, more and more bus companies and rail transit companies are actively trying to provide QR code rides. While providing QR code rides, bus companies and rail transit companies hope to provide passengers with transfer discounts to reduce users' transfer costs. When providing transfer discounts, how to charge for rides has become an issue worthy of attention.
[0003] At present, when a user takes a vehicle, he or she points the QR code on the mobile phone to the card reader of the vehicle. The card reader recognizes the QR code through the camera and verifies whether the QR code is valid. After verification, the card reader records the user's riding information, including the vehicle number, line number and riding time (code scanning time), and prompts the user to get on the vehicle if the code scanning is successful. After the card reader prompts the user to get on the vehicle, it uploads the riding information as a riding record to the server. The server determines whether the riding time interval between the currently received riding record and the first received riding record is within the preferential time range (such as within 30 minutes). If it is within the preferential time range, the user will enjoy the transfer discount and calculate the fee after the transfer discount as the user's current ride fee. If it is not within the preferential time period, the user will not enjoy the transfer discount and the original fee will be used as the user's current ride fee.
[0004] When charging the currently received ride record, the above technology provides transfer discounts according to the time interval between the rides received for the first time. Since the upload of ride records is an asynchronous process and may go through multiple layers of transmission, each process may cause the user's ride record to be unable to be uploaded in the normal order of riding due to network problems or server or barcode scanner failures. In this way, the user's ride records received by the server are out of order. The first ride record has not been uploaded to the server, and the later ride record may have been uploaded to the server. If only the time interval between the first ride record and the first ride record is calculated, the transfer discount will be reduced. Billing based on the time interval of rides can easily lead to incorrect billing. For example, if the transfer discount is a discount type discount (such as a 50% discount within 30 minutes), the order of the user's four ride information is ABCD, the time interval between A, B and C is within 30 minutes, the time interval between B, C and D is within 30 minutes, and the time interval between A and D exceeds 30 minutes. The original fare is 1 yuan, then the billing should be 1 yuan, 0.5 yuan, 0.5 yuan and 1 yuan in the normal order, a total of 3 yuan, but if the order is abnormal, BCDA, the billing is 1 yuan, 0.5 yuan, 0.5 yuan and 0.5 yuan, a total of 2.5 yuan. Therefore, a ride billing method is urgently needed to avoid the problem of incorrect billing when the ride records are out of order. Summary of the invention
[0005] The embodiment of the present application provides a method and device for charging a ride, which can solve the problem of incorrect charging when the ride records are out of order in the related art. The technical solution is as follows:
[0006] In a first aspect, a method for charging a ride is provided, comprising:
[0007] If a first ride record of a user is received, a query is performed from the historical ride records of the user according to the ride time of the first ride record to obtain historical ride records within a first time interval, the end time of the first time interval is the ride time of the first ride record, and the time interval of the first time interval is equal to the time interval threshold indicated by the transfer discount policy;
[0008] Determine a second ride record with the latest ride time from the historical ride records within the first time interval;
[0009] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy;
[0010] Among them, the left reference time of the second ride record is the ride time of the earliest ride record within the billing interval to which the second ride record belongs, and the ride time interval between any two ride records in the same billing interval is less than or equal to the time interval threshold.
[0011] In a possible implementation, if the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy includes:
[0012] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of times the preferential usage of the billing interval to which the second ride record belongs;
[0013] If the number of preferential usages of the billing interval to which the second ride record belongs is less than or equal to the preferential number threshold indicated by the transfer preferential policy, a step of obtaining the fare information of the first ride record according to the transfer preferential policy is executed.
[0014] In a possible implementation, if the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy includes:
[0015] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record;
[0016] The fare information of the first riding record is obtained according to the discount information of the first riding record.
[0017] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0018] According to the time interval between the boarding time of the first boarding record and the left reference time of the second boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0019] According to the transfer time interval corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different transfer time intervals correspond to different discount information.
[0020] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0021] According to the number of ride records in the charging interval to which the second ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0022] According to the number of transfers corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different numbers of transfers correspond to different discount information.
[0023] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0024] According to the time interval between the boarding time of the first boarding record and the left reference time of the second boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0025] According to the number of ride records in the charging interval to which the second ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0026] Discount information corresponding to the first ride record is obtained according to the transfer time interval and the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer time intervals and the number of transfers.
[0027] In one possible implementation, the method further includes:
[0028] If no historical ride record within the first time interval is found from the historical ride record of the user, query the historical ride record of the user according to the ride time of the first ride record to obtain the historical ride record within the second time interval;
[0029] The start time of the second time interval is the riding time of the first riding record, and the time interval of the second time interval is equal to the time interval threshold.
[0030] In a possible implementation, after determining the second ride record with the latest ride time from the historical ride records within the first time interval, the method further includes:
[0031] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is greater than the time interval threshold, query the historical ride records of the user according to the ride time of the first ride record to obtain historical ride records within a second time interval, the start time of the second time interval is the ride time of the first ride record, and the time interval of the second time interval is equal to the time interval threshold;
[0032] Determine a third ride record with the earliest ride time from the historical ride records within the second time interval;
[0033] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, the fare information of the first ride record is obtained according to the transfer discount policy, and the right reference time of the third ride record is the ride time of the latest ride record within the billing interval to which the third ride record belongs.
[0034] In a possible implementation, if the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy includes:
[0035] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of times the preferential usage of the charging interval to which the third ride record belongs;
[0036] If the number of preferential usages of the billing interval to which the third ride record belongs is less than or equal to the preferential number threshold indicated by the transfer preferential policy, a step of obtaining the fare information of the first ride record according to the transfer preferential policy is executed.
[0037] In a possible implementation, if the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy includes:
[0038] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record;
[0039] The fare information of the first riding record is obtained according to the discount information of the first riding record.
[0040] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0041] According to the time interval between the boarding time of the first boarding record and the right reference time of the third boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0042] According to the transfer time interval corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different transfer time intervals correspond to different discount information.
[0043] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0044] According to the number of ride records in the charging interval to which the third ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0045] According to the number of transfers corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different numbers of transfers correspond to different discount information.
[0046] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0047] According to the time interval between the boarding time of the first boarding record and the right reference time of the third boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0048] According to the number of ride records in the charging interval to which the third ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0049] Discount information corresponding to the first riding record is obtained according to the transfer time interval and the number of transfers corresponding to the first riding record, and different discount information corresponds to different transfer time intervals and the number of transfers.
[0050] In a possible implementation, after determining the third ride record with the earliest ride time from the historical ride records within the second time interval, the method further includes:
[0051] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is greater than the time interval threshold, the original fare of the first ride record is acquired as the ride fare information of the first ride record.
[0052] In one possible implementation, the method further includes:
[0053] If no historical riding record within the second time interval is found in the historical riding record of the user, the original fare of the first riding record is obtained as the riding fare information of the first riding record.
[0054] In a possible implementation, after receiving the first ride record of the user, the method further includes:
[0055] Acquire configuration information, where the configuration information is used to indicate the vehicle operators that support the transfer discount policy and the ride times, ride routes or vehicles that the vehicle operators support the transfer discount policy;
[0056] If it is determined according to the configuration information that the first riding record supports the transfer discount policy, a step of querying from the historical riding records of the user is performed.
[0057] In a possible implementation, after receiving the first ride record of the user, the method further includes:
[0058] A distributed lock control method is used to execute the steps of querying the user's historical ride records and obtaining the fare information of the first ride record. The distributed lock control method is used to control the distributed system to charge a ride record of the same user at the same time.
[0059] In a second aspect, a ride fare accounting device is provided, comprising:
[0060] a query module configured to, if receiving a first ride record of a user, query the historical ride records of the user according to the ride time of the first ride record to obtain historical ride records within a first time interval, wherein the end time of the first time interval is the ride time of the first ride record, and the time interval of the first time interval is equal to the time interval threshold indicated by the transfer discount policy;
[0061] A determination module, configured to determine a second ride record with the latest ride time from the historical ride records within the first time interval;
[0062] an acquisition module, configured to acquire the fare information of the first ride record according to the transfer preferential policy if the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold;
[0063] Among them, the left reference time of the second ride record is the ride time of the earliest ride record within the billing interval to which the second ride record belongs, and the ride time interval between any two ride records in the same billing interval is less than or equal to the time interval threshold.
[0064] In a possible implementation, the acquisition module is used to:
[0065] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of times the preferential usage of the billing interval to which the second ride record belongs;
[0066] If the number of preferential usages of the billing interval to which the second ride record belongs is less than or equal to the preferential number threshold indicated by the transfer preferential policy, a step of obtaining the fare information of the first ride record according to the transfer preferential policy is executed.
[0067] In a possible implementation, the acquisition module is used to:
[0068] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record;
[0069] The fare information of the first riding record is obtained according to the discount information of the first riding record.
[0070] In a possible implementation, the acquisition module is used to:
[0071] According to the time interval between the boarding time of the first boarding record and the left reference time of the second boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0072] According to the transfer time interval corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different transfer time intervals correspond to different discount information.
[0073] In a possible implementation, the acquisition module is used to:
[0074] According to the number of ride records in the charging interval to which the second ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0075] According to the number of transfers corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different numbers of transfers correspond to different discount information.
[0076] In a possible implementation, the acquisition module is used to:
[0077] According to the time interval between the boarding time of the first boarding record and the left reference time of the second boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0078] According to the number of ride records in the charging interval to which the second ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0079] Discount information corresponding to the first ride record is obtained according to the transfer time interval and the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer time intervals and the number of transfers.
[0080] In a possible implementation, the query module is further configured to query the historical ride records of the user according to the ride time of the first ride record to obtain the historical ride records within the second time interval if no historical ride records within the first time interval are found from the historical ride records of the user;
[0081] The start time of the second time interval is the riding time of the first riding record, and the time interval of the second time interval is equal to the time interval threshold.
[0082] In a possible implementation, the query module is further configured to query the historical ride records of the user according to the ride time of the first ride record to obtain historical ride records within a second time interval if the time interval between the left reference time of the second ride record and the ride time of the first ride record is greater than the time interval threshold, wherein the start time of the second time interval is the ride time of the first ride record, and the time interval of the second time interval is equal to the time interval threshold;
[0083] The determining module is further used to determine a third riding record with the earliest riding time from the historical riding records within the second time interval;
[0084] The acquisition module is also used to obtain the fare information of the first ride record according to the transfer discount policy if the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, and the right reference time of the third ride record is the ride time of the latest ride record within the billing interval to which the third ride record belongs.
[0085] In a possible implementation, the acquisition module is used to:
[0086] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of times the preferential usage of the charging interval to which the third ride record belongs;
[0087] If the number of preferential usages of the billing interval to which the third ride record belongs is less than or equal to the preferential number threshold indicated by the transfer preferential policy, a step of obtaining the fare information of the first ride record according to the transfer preferential policy is executed.
[0088] In a possible implementation, the acquisition module is used to:
[0089] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record;
[0090] The fare information of the first riding record is obtained according to the discount information of the first riding record.
[0091] In a possible implementation, the acquisition module is used to:
[0092] According to the time interval between the boarding time of the first boarding record and the right reference time of the third boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0093] According to the transfer time interval corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different transfer time intervals correspond to different discount information.
[0094] In a possible implementation, the acquisition module is used to:
[0095] According to the number of ride records in the charging interval to which the third ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0096] According to the number of transfers corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different numbers of transfers correspond to different discount information.
[0097] In a possible implementation, the acquisition module is used to:
[0098] According to the time interval between the boarding time of the first boarding record and the right reference time of the third boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0099] According to the number of ride records in the charging interval to which the third ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0100] Discount information corresponding to the first ride record is obtained according to the transfer time interval and the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer time intervals and the number of transfers.
[0101] In one possible implementation, the acquisition module is also used to obtain the original fare of the first ride record as the fare information of the first ride record if the time interval between the right reference time of the third ride record and the ride time of the first ride record is greater than the time interval threshold.
[0102] In one possible implementation, the acquisition module is also used to obtain the original fare of the first ride record as the fare information of the first ride record if no historical ride record within the second time interval is found from the historical ride records of the user.
[0103] In a possible implementation, the acquisition module is further used to acquire configuration information, where the configuration information is used to indicate the vehicle operators that support the transfer discount policy and the ride times, ride routes or vehicles that the vehicle operators support the transfer discount policy;
[0104] The query module is also used to execute the step of querying from the historical ride records of the user if it is determined, based on the configuration information, that the first ride record supports a transfer discount policy.
[0105] In a possible implementation, the query module is further used to adopt a distributed lock control method to execute a step of querying from the user's historical riding records;
[0106] The acquisition module is also used to adopt a distributed lock control method to execute the step of acquiring the fare information of the first ride record. The distributed lock control method is used to control the distributed system to charge a ride record of the same user at the same time.
[0107] In a third aspect, a server is provided, comprising one or more processors and one or more memories; the one or more memories are used to store computer programs; the one or more processors are used to execute the computer programs stored in the one or more memories to implement the method steps described in any implementation method of the first aspect.
[0108] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps described in any implementation mode of the first aspect are implemented.
[0109] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0110] When receiving the first ride record of the user, according to the ride time of the first ride record, the historical ride records within the first time interval are queried from the user's historical ride records to obtain the historical ride records within the first time interval, the ride time of the historical ride records within the first time interval is earlier than the ride time of the first ride record, and the ride time interval with the first ride record is less than or equal to the time interval threshold indicated by the transfer discount policy, and then from the historical ride records within the first time interval, the ride record with the latest ride time is found as the second ride record, if the time interval between the left reference time of the second ride record and the ride time of the first ride record does not exceed the time interval threshold, it is determined that the first ride record can enjoy the transfer discount, and thus the fare information of the first ride record is obtained according to the transfer discount policy. By correctly calculating the transfer discount according to the ride record of the user according to the ride time, the problem of erroneous deduction can be avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0111] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0112] Figure 1 It is a schematic diagram of an implementation environment provided by an embodiment of the present application;
[0113] Figure 2 is a flow chart of a ride fare billing method provided in an embodiment of the present application;
[0114] Figure 3 is a flow chart of a ride fare billing method provided in an embodiment of the present application;
[0115] Figure 4is a flow chart of a ride fare billing method provided in an embodiment of the present application;
[0116] Figure 5 It is a structural schematic diagram of a ride fare accounting device provided in an embodiment of the present application;
[0117] Figure 6 It is a structural diagram of a server 600 provided in an embodiment of the present application. DETAILED DESCRIPTION
[0118] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0119] Figure 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application. Figure 1 , the implementation environment includes a mobile terminal 101, an electronic device 102 and a server 103.
[0120] The mobile terminal 101 may be a user device such as a mobile phone or a tablet computer. The user may operate on the mobile terminal 101 to trigger the mobile terminal 101 to display a QR code for riding. The electronic device 102 may be a barcode reader, a gate machine, etc. The electronic device 102 may recognize the QR code displayed by the mobile terminal 101 through a camera, and interact with the server 103 to upload the user's riding record to the server 103. The server is used to receive the riding record uploaded by the electronic device 102 and charge the riding record.
[0121] Figure 2 is a flow chart of a method for charging a ride provided by an embodiment of the present application. Figure 2 , the method comprising:
[0122] 201. If the user's first ride record is received, a query is performed from the user's historical ride records based on the ride time of the first ride record to obtain the historical ride records within a first time interval, the end time of the first time interval is the ride time of the first ride record, and the time interval of the first time interval is equal to the time interval threshold indicated by the transfer discount policy.
[0123] 202. Determine a second ride record with the latest ride time from the historical ride records within the first time interval.
[0124] 203. If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtain the fare information of the first ride record according to the transfer discount policy.
[0125] Among them, the left reference time of the second ride record is the ride time of the earliest ride record in the billing interval to which the second ride record belongs, and the ride time interval between any two ride records in the same billing interval is less than or equal to the time interval threshold.
[0126] The method provided by the embodiment of the present application is to query the historical ride records of the user according to the ride time of the first ride record when receiving the first ride record of the user, and obtain the historical ride records within the first time interval, the ride time of the historical ride records within the first time interval is earlier than the ride time of the first ride record, and the ride time interval with the first ride record is less than or equal to the time interval threshold indicated by the transfer preferential policy, and then find the ride record with the latest ride time from the historical ride records within the first time interval as the second ride record, if the time interval between the left reference time of the second ride record and the ride time of the first ride record does not exceed the time interval threshold, it is determined that the first ride record can enjoy the transfer preferential treatment, and thus the ride fare information of the first ride record is obtained according to the transfer preferential policy. By correctly calculating the transfer preferential treatment according to the ride record of the user according to the ride time, the problem of incorrect deduction of fees can be avoided.
[0127] In a possible implementation, if the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy includes:
[0128] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of times the preferential usage of the charging interval to which the second ride record belongs;
[0129] If the number of preferential usages of the billing interval to which the second ride record belongs is less than or equal to the preferential number threshold indicated by the transfer preferential policy, a step of obtaining the fare information of the first ride record according to the transfer preferential policy is executed.
[0130] In a possible implementation, if the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy includes:
[0131] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record;
[0132] According to the discount information of the first ride record, the ride fare information of the first ride record is obtained.
[0133] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0134] According to the time interval between the boarding time of the first boarding record and the left reference time of the second boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0135] According to the transfer time interval corresponding to the first ride record, the discount information corresponding to the first ride record is obtained, and different transfer time intervals correspond to different discount information.
[0136] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0137] According to the number of ride records in the charging interval to which the second ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0138] According to the number of transfers corresponding to the first ride record, the discount information corresponding to the first ride record is obtained, and different numbers of transfers correspond to different discount information.
[0139] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0140] According to the time interval between the boarding time of the first boarding record and the left reference time of the second boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0141] According to the number of ride records in the charging interval to which the second ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0142] Discount information corresponding to the first ride record is obtained according to the transfer time interval and the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer time intervals and the number of transfers.
[0143] In one possible implementation, the method further includes:
[0144] If no historical ride record within the first time interval is found from the historical ride record of the user, query the historical ride record of the user according to the ride time of the first ride record to obtain the historical ride record within the second time interval;
[0145] The start time of the second time interval is the riding time of the first riding record, and the time interval of the second time interval is equal to the time interval threshold.
[0146] In a possible implementation, after determining the second ride record with the latest ride time from the historical ride records within the first time interval, the method further includes:
[0147] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is greater than the time interval threshold, query the historical ride records of the user according to the ride time of the first ride record to obtain historical ride records within a second time interval, the start time of the second time interval is the ride time of the first ride record, and the time interval of the second time interval is equal to the time interval threshold;
[0148] Determine a third ride record with the earliest ride time from the historical ride records within the second time interval;
[0149] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, according to the transfer discount strategy, the fare information of the first ride record is obtained, and the right reference time of the third ride record is the ride time of the latest ride record within the billing interval to which the third ride record belongs.
[0150] In a possible implementation, if the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy includes:
[0151] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of times the preferential usage of the charging interval to which the third ride record belongs;
[0152] If the number of preferential usages of the billing interval to which the third ride record belongs is less than or equal to the preferential number threshold indicated by the transfer preferential policy, a step of obtaining the fare information of the first ride record according to the transfer preferential policy is executed.
[0153] In a possible implementation, if the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy includes:
[0154] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record;
[0155] According to the discount information of the first ride record, the ride fare information of the first ride record is obtained.
[0156] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0157] According to the time interval between the boarding time of the first boarding record and the right reference time of the third boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0158] According to the transfer time interval corresponding to the first ride record, the discount information corresponding to the first ride record is obtained, and different transfer time intervals correspond to different discount information.
[0159] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0160] According to the number of ride records in the charging interval to which the third ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0161] According to the number of transfers corresponding to the first ride record, the discount information corresponding to the first ride record is obtained, and different numbers of transfers correspond to different discount information.
[0162] In a possible implementation, obtaining the discount information corresponding to the first ride record includes:
[0163] According to the time interval between the boarding time of the first boarding record and the right reference time of the third boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0164] According to the number of ride records in the charging interval to which the third ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0165] Discount information corresponding to the first ride record is obtained according to the transfer time interval and the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer time intervals and the number of transfers.
[0166] In a possible implementation, after determining the third ride record with the earliest ride time from the historical ride records within the second time interval, the method further includes:
[0167] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is greater than the time interval threshold, the original fare of the first ride record is acquired as the ride fare information of the first ride record.
[0168] In one possible implementation, the method further includes:
[0169] If no historical riding record within the second time interval is found in the historical riding record of the user, the original fare of the first riding record is obtained as the riding fare information of the first riding record.
[0170] In a possible implementation, after receiving the first ride record of the user, the method further includes:
[0171] Acquire configuration information, where the configuration information is used to indicate the vehicle operator that supports the transfer discount policy and the ride time, ride route or vehicle that the vehicle operator supports the transfer discount policy;
[0172] If it is determined according to the configuration information that the first ride record supports the transfer discount policy, a step of querying from the historical ride records of the user is performed.
[0173] In a possible implementation, after receiving the first ride record of the user, the method further includes:
[0174] A distributed lock control method is used to execute the steps of querying the user's historical ride records and obtaining the fare information of the first ride record. The distributed lock control method is used to control the distributed system to charge a ride record of the same user at the same time.
[0175] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0176] Figure 3 This is a flow chart of a method for charging a ride provided by an embodiment of the present application. The method is executed by a server, see Figure 3 , the method comprising:
[0177] 301. If a first ride record of a user is received, query the historical ride records of the user according to the ride time of the first ride record to obtain the historical ride records within a first time interval.
[0178] The end time of the first time interval is the ride time of the first ride record, and the time interval of the first time interval is equal to the time interval threshold indicated by the transfer preferential policy. For example, if the ride time of the first ride record is C, and the time interval threshold indicated by the transfer preferential policy is K, then the first time interval is [CK, C].
[0179] Among them, the user's first ride record is the user's ride record currently received by the server, and the user's historical ride record is the user's ride record previously received by the server.
[0180] In the embodiment of the present application, each time a user uses a QR code to take a ride, the card reader can upload the user's ride record to the server, and the ride record may include the ride time, vehicle, route, vehicle operator, etc. Since the ride records received by the server may be out of order, the server may have received a ride record with a ride time earlier than the first ride record, or a ride record with a ride time later than the first ride record before receiving the first ride record currently, and these ride records can be used as the user's historical ride records.
[0181] When receiving the first ride record, the server can first execute the left query process from the user's historical ride records, that is, according to the ride time of the first ride record, query the historical ride records whose ride time is within the first time interval [CK, C], that is, query the historical ride records whose ride time is earlier than the ride time of the first ride record and the time interval between the ride time and the first ride record is not greater than the time interval threshold.
[0182] In a possible implementation, after receiving the user's first ride record, the server can obtain configuration information, which is used to indicate the vehicle operator that supports the transfer discount policy and the ride time, ride route or vehicle that the vehicle operator supports the transfer discount policy; if it is determined that the first ride record supports the transfer discount policy based on the configuration information, the step of querying from the user's historical ride records is performed. The vehicle operator can be a bus company or rail transit, and the configuration information can also indicate the basic fare information of the vehicle operator, so that the fare of the vehicles that transfer is kept consistent.
[0183] When receiving the first ride record, the server may obtain the pre-stored configuration information. If the ride time, route or vehicle of the first ride record meets the requirements of the vehicle operator, that is, the configuration information indicates that the vehicle operator supporting the transfer discount policy includes the vehicle operator in the first ride record, and the ride time, vehicle or route supported by the vehicle operator indicated by the configuration information includes the ride time, vehicle or route of the first ride record, then the server may determine that the first ride record supports the transfer discount policy, thereby executing the query step to calculate the ride fare of the first ride record.
[0184] In some embodiments, when receiving the first ride record, the server can perform deduplication of charges, that is, determine whether the first ride record has already calculated the fare information according to the transfer discount policy. If so, there is no need to perform the query process of step 301 and the subsequent steps of obtaining the fare information for the ride record again. This can avoid the problem that after a ride record is calculated for discount, the discount calculation for the ride record is re-calculated due to a failure in deduction.
[0185] 302. Determine the second ride record with the latest ride time from the historical ride records within the first time interval, and execute step 303 or step 304.
[0186] In the embodiment of the present application, if the server queries the historical ride records within the first time interval, the server can determine the historical ride record with the latest ride time from the historical ride records within the first time interval as the second ride record. For example, the server can sort the historical ride records within the first time interval in descending order, from right to left, with the earlier ride records being sorted to the left, and the later ride records being sorted to the right, and the server can use the rightmost historical ride record as the second ride record.
[0187] The server can determine whether the first ride record can enjoy the discount according to the transfer discount policy. The transfer discount policy is used to indicate whether the user can enjoy the discount and how to enjoy the discount when transferring within a certain time interval threshold. Therefore, after determining the second ride record, the server can determine the left reference time of the second ride record. The left reference time of the second ride record is the ride time of the earliest ride record in the billing interval to which the second ride record belongs. The time interval between any two ride records in the same billing interval is less than or equal to the time interval threshold. Then, the server can match the left reference time of the first ride record, calculate the time interval between the left reference time of the second ride record and the ride time of the first ride record, and execute the corresponding steps according to the relationship between the time interval and the time interval threshold indicated by the transfer discount policy to obtain the fare information of the first ride record.
[0188] Specifically, if the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, execute step 303; if the time interval between the left reference time of the second ride record and the ride time of the first ride record is greater than the time interval threshold, execute step 304.
[0189] 303. If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtain the fare information of the first ride record according to the transfer discount policy.
[0190] In an embodiment of the present application, if the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, the server can determine that the first ride record belongs to the billing interval to which the second ride record belongs. At this time, the server can calculate the fare of the first ride record based on the transfer discount policy.
[0191] In a possible implementation, the transfer discount policy may have a limit on the number of discounts, and the discount can only be enjoyed when there are currently remaining discounts. Accordingly, step 303 may include: if the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of discount usages in the billing interval to which the second ride record belongs; if the number of discount usages is less than or equal to the discount number threshold indicated by the transfer discount policy, executing the step of obtaining the fare information of the first ride record according to the transfer discount policy.
[0192] For the historical ride records in the billing interval to which the second ride record belongs, the server may have used discounts for some of the ride records, that is, the ride fares of these ride records are obtained according to the transfer discount policy. Therefore, the server can count the number of times the discount is used in the billing interval. If the number of times the discount is used does not reach the discount number threshold, it indicates that the server can use the discount for the current first ride record. At this time, the server can execute the step of obtaining the fare information of the first ride record according to the transfer discount policy. Among them, for the statistics of the number of times the discount is used, the server can use a record to count the number of times the discount is used in the billing interval to which the second ride record belongs. For example, each time the server uses a discount for a ride record in the billing interval, the number of times the discount is used in the record can be updated, that is, the number of times the discount is used can be increased by 1.
[0193] In a possible implementation, the transfer discount policy may indicate that a discount is provided for the ride record. Accordingly, step 303 may include: if the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record; and obtaining the fare information of the first ride record according to the discount information of the first ride record.
[0194] If the transfer preferential policy is a discount, the server may obtain the discount information corresponding to the first ride record according to the transfer preferential policy, and then calculate the discounted fare for the first ride record according to the discount information.
[0195] In a possible implementation, the transfer discount policy may indicate gradient discounts for different transfer time intervals, such as free rides within 30 minutes and 50% off within 120 minutes. Accordingly, obtaining the discount information corresponding to the first ride record includes: determining the transfer time interval corresponding to the first ride record from a plurality of transfer time intervals indicated by the transfer discount policy according to the time interval between the ride time of the first ride record and the left reference time of the second ride record; obtaining the discount information corresponding to the first ride record according to the transfer time interval corresponding to the first ride record, wherein different transfer time intervals correspond to different discount information.
[0196] The server may determine a transfer time interval that is greater than the time interval between the boarding time of the first ride record and the left reference time of the second ride record from among multiple transfer time intervals indicated by the transfer discount policy based on the time interval between the boarding time of the first ride record and the left reference time of the second ride record, and select the smallest transfer time interval from among the transfer time intervals that are greater than the time interval as the transfer time interval of the first ride record. The server may obtain discount information corresponding to the transfer time interval as the discount information corresponding to the first ride record.
[0197] In a possible implementation, the transfer discount policy may indicate gradient discounts for different transfer times, such as one free transfer and 50% off for each subsequent transfer. Accordingly, obtaining the discount information corresponding to the first ride record includes: obtaining the number of transfers corresponding to the first ride record according to the number of ride records in the charging interval to which the second ride record belongs; obtaining the discount information corresponding to the first ride record according to the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer times.
[0198] The server can count the number of historical ride records within the billing range to which the second ride record belongs, subtract 1 from the number of historical ride records to obtain the user's current historical transfer times, and add 1 to the historical transfer times to obtain the transfer times corresponding to the first ride record. The server can obtain the discount information corresponding to the transfer times as the discount information corresponding to the first ride record.
[0199] In a possible implementation, the transfer discount policy may indicate gradient discounts for different transfer times and different numbers of transfers, such as one free ride within 30 minutes and 50% off for unlimited times within 120 minutes. Accordingly, obtaining the discount information corresponding to the first ride record includes: determining the transfer time interval corresponding to the first ride record from multiple transfer time intervals indicated by the transfer discount policy based on the time interval between the ride time of the first ride record and the left reference time of the second ride record; obtaining the number of transfers corresponding to the first ride record based on the number of ride records in the billing interval to which the second ride record belongs; obtaining the discount information corresponding to the first ride record based on the transfer time interval and the number of transfers corresponding to the first ride record, and different transfer time intervals and numbers of transfers correspond to different discount information.
[0200] After determining the transfer time interval and the number of transfers corresponding to the first ride record, the server may use the discount information corresponding to the transfer time interval and the number of transfers as the discount information corresponding to the first ride record.
[0201] In some embodiments, the transfer discount policy may also indicate different discounts for different routes and vehicles, such as a 40% discount for route 1 and vehicle A, a 50% discount for route 1 and vehicle B, and a 40% discount for route 2 and vehicle B. Accordingly, obtaining the discount information corresponding to the first ride record includes: determining the discount information corresponding to the first ride record according to the vehicle and route of the first ride record. For example, if the vehicle of the first ride record is vehicle A and the route is route 1, it can be determined that the first ride record can enjoy a 40% discount.
[0202] 304. If the time interval between the left reference time of the second ride record and the ride time of the first ride record is greater than the time interval threshold, query the historical ride records of the user based on the ride time of the first ride record to obtain the historical ride records within the second time interval.
[0203] The start time of the second time interval is the riding time of the first riding record, and the time interval of the second time interval is equal to the time interval threshold.
[0204] In an embodiment of the present application, if the server first executes the left query process in step 301 to obtain the second ride record, but the time interval between the left reference time of the second ride record and the ride time of the first ride record is greater than the time interval threshold, the server can determine that the first ride record does not belong to the billing interval to which the second ride record belongs. At this time, the server can execute the right query process, that is, based on the ride time of the first ride record, query the historical ride records whose ride time is within the second time interval [C, C+K], that is, query the historical ride records whose ride time is later than the ride time of the first ride record and whose time interval with the first ride record is not greater than the time interval threshold.
[0205] This step 304 is explained by taking the example that the server queries the historical ride record within the second time interval. In some embodiments, in this step 304, if the historical ride record within the second time interval is not queried from the historical ride record of the user, the server can obtain the original fare of the first ride record as the ride fare information of the first ride record. If the server does not query the historical ride record within the second time interval, the server can confirm that the first ride record cannot enjoy the transfer discount. At this time, the server can charge the first ride record as the original fare.
[0206] It should be noted that step 304 is a case where historical ride records within the second time interval are queried on the premise that historical ride records within the first time interval are first queried in step 301. The server can also query historical ride records within the second time interval in other cases. For example, if no historical ride records within the first time interval are queried from the historical ride records of the user, the server queries the historical ride records of the user according to the ride time of the first ride record, obtains the historical ride records within the second time interval, and then executes the subsequent step 305.
[0207] 305. Determine the third ride record with the earliest ride time from the historical ride records within the second time interval, and execute step 306 or step 307.
[0208] In the embodiment of the present application, if the server searches for historical ride records within the second time interval, the server can determine the historical ride record with the earliest ride time from the historical ride records within the second time interval as the third ride record. For example, the server can sort the historical ride records within the first time interval in ascending order, from left to right, the earlier the historical ride record is sorted to the left, and the later the historical ride record is sorted to the right, and the server can use the leftmost historical ride record as the third ride record.
[0209] After determining the third ride record, the server can determine the right reference time of the third ride record, which is the ride time of the latest ride record in the billing interval to which the third ride record belongs. Then, the server can match the right reference time of the first ride record, calculate the time interval between the right reference time of the third ride record and the ride time of the first ride record, and perform corresponding steps according to the relationship between the time interval and the time interval threshold indicated by the transfer discount policy to obtain the ride fare information of the first ride record.
[0210] Specifically, if the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, execute step 306; if the time interval between the right reference time of the second ride record and the ride time of the first ride record is greater than the time interval threshold, execute step 307.
[0211] 306. If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, the fare information of the first ride record is obtained according to the transfer discount policy, and the right reference time of the third ride record is the ride time of the latest ride record within the billing interval to which the third ride record belongs.
[0212] In an embodiment of the present application, if the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, the server can determine that the first ride record belongs to the billing interval to which the second ride record belongs. At this time, the server can calculate the fare of the first ride record based on the transfer discount policy.
[0213] In a possible implementation, the transfer discount policy may have a limit on the number of discounts, and the discount can only be enjoyed when there are currently remaining discounts. Accordingly, step 306 may include: if the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of discount usages in the billing interval to which the third ride record belongs; if the number of discount usages in the billing interval to which the third ride record belongs is less than or equal to the discount number threshold indicated by the transfer discount policy, executing the step of obtaining the fare information of the first ride record according to the transfer discount policy.
[0214] For the historical ride records in the billing interval to which the third ride record belongs, the server may have used discounts for some of the ride records, that is, the ride fares of these ride records are obtained according to the transfer discount policy. Therefore, the server can count the number of times the discount is used in the billing interval. If the number of times the discount is used does not reach the discount number threshold, it indicates that the server can use the discount for the current first ride record. At this time, the server can execute the step of obtaining the fare information of the first ride record according to the transfer discount policy. Among them, for the statistics of the number of times the discount is used, the server can use a record to count the number of times the discount is used in the billing interval to which the third ride record belongs. For example, each time the server uses a discount for a ride record in the billing interval, the number of times the discount is used in the record can be updated, that is, the number of times the discount is used is increased by 1.
[0215] In a possible implementation, the transfer discount policy may indicate that a discount is provided for the ride record. Accordingly, step 303 may include: if the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record; and obtaining the fare information of the first ride record according to the discount information of the first ride record.
[0216] In a possible implementation, the transfer discount policy may indicate gradient discounts for different transfer time intervals, such as free rides within 30 minutes and 50% off within 120 minutes. Accordingly, obtaining the discount information corresponding to the first ride record includes: determining the transfer time interval corresponding to the first ride record from a plurality of transfer time intervals indicated by the transfer discount policy according to the time interval between the ride time of the first ride record and the right reference time of the third ride record; obtaining the discount information corresponding to the first ride record according to the transfer time interval corresponding to the first ride record, wherein different transfer time intervals correspond to different discount information.
[0217] The server may determine a transfer time interval that is greater than the time interval between the boarding time of the first ride record and the right reference time of the third ride record from among multiple transfer time intervals indicated by the transfer discount policy based on the time interval between the boarding time of the first ride record and the right reference time of the third ride record, and select the smallest transfer time interval from among the transfer time intervals that are greater than the time interval as the transfer time interval of the first ride record. The server may obtain the discount information corresponding to the transfer time interval as the discount information corresponding to the first ride record.
[0218] In a possible implementation, the transfer discount policy may indicate gradient discounts for different transfer times, such as one free transfer and 50% off for each subsequent transfer. Accordingly, obtaining the discount information corresponding to the first ride record includes: obtaining the number of transfers corresponding to the first ride record according to the number of ride records in the charging interval to which the third ride record belongs; obtaining the discount information corresponding to the first ride record according to the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer times.
[0219] The server can count the number of historical ride records within the billing range to which the third ride record belongs, subtract 1 from the number of historical ride records to obtain the user's current historical transfer times, and add 1 to the historical transfer times to obtain the transfer times corresponding to the first ride record. The server can obtain the discount information corresponding to the transfer times as the discount information corresponding to the first ride record.
[0220] In one possible implementation, the transfer discount policy may indicate gradient discounts for different transfer times and different numbers of transfers, such as one free ride within 30 minutes and 50% off for unlimited times within 120 minutes. Accordingly, obtaining discount information corresponding to the first ride record includes: determining the transfer time interval corresponding to the first ride record from multiple transfer time intervals indicated by the transfer discount policy based on the time interval between the ride time of the first ride record and the right reference time of the third ride record; obtaining the number of transfers corresponding to the first ride record based on the number of ride records in the billing interval to which the third ride record belongs; obtaining discount information corresponding to the first ride record based on the transfer time interval and number of transfers corresponding to the first ride record, and different transfer time intervals and numbers of transfers correspond to different discount information.
[0221] 307. If the time interval between the right reference time of the third ride record and the ride time of the first ride record is greater than the time interval threshold, obtain the original fare of the first ride record as the ride fare information of the first ride record.
[0222] In an embodiment of the present application, step 307 is a step performed under the premise that the time interval between the left reference time of the second ride record queried on the left and the ride time of the first ride record is greater than the time interval threshold, that is, the first ride record does not belong to the billing interval to which the second ride record belongs. If the time interval between the right reference time of the third ride record queried on the right and the ride time of the first ride record is also greater than the time interval threshold, that is, the first ride record does not belong to the billing interval to which the third ride record belongs, it indicates that the first ride record cannot enjoy the transfer discount. At this time, the server can bill the first ride record as the original fee.
[0223] The above steps 301 to 307 are the process in which the server, when receiving the first ride record, queries the historical ride records of the user according to the ride time of the first ride record, and obtains the fare information of the first ride record according to the query result. In one possible implementation, the server can use a distributed lock control method to execute the steps of querying the historical ride records of the user and obtaining the fare information of the first ride record. The distributed lock control method is used to control the distributed system to charge a ride record of the same user at the same time. By performing distributed lock control according to the user dimension, it can be ensured that only one record of the same user is being charged at the same time, thereby improving the accuracy of the billing results.
[0224] In order to more intuitively describe the above technical solution provided by the embodiment of the present application, Figure 4 The flowchart shown in FIG. 1 is used to illustrate the above technical solution. Figure 4 , provides a flow chart of a ride fare billing method, such as Figure 4 As shown, after receiving the current ride record, the server can perform billing deduplication, that is, determine whether the current ride record has been calculated for discounts. If so, no discount calculation will be performed on the ride record. This can avoid the problem that after a ride record is calculated for discounts, the ride record will be recalculated again when the deduction fails. The server can obtain configuration information to determine whether the current ride record supports the transfer discount policy. If the current ride record does not support the transfer discount policy, the server can use other discount calculation policies to obtain the fare information of the current ride record. If the current ride record supports the transfer discount policy, the current ride record is marked as a ride record that supports the transfer discount policy, and a distributed lock is obtained according to the user dimension. The control method of the distributed lock is used to calculate the fare of the current ride record. The server can obtain the transfer discount policy and read the maximum discount time width K, that is, the time interval threshold K indicated by the transfer discount policy.
[0225] The server can first perform a left query, querying the ride records whose ride times are in the interval [CK, C] according to the ride time of the current ride record, where C is the ride time of the first ride record, and K is the time interval threshold indicated by the transfer preferential policy. These ride records are sorted in descending order from right to left, and the ride records with earlier ride times are sorted to the left. If the left query result is not empty, these ride records sorted in descending order are traversed from near to far according to the ride time, and the first most recent ride record is found as the second ride record, and its left reference time LT is determined. The server can perform left reference time matching, that is, determine whether the second ride record found meets the condition, which is that the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold indicated by the transfer preferential policy, that is, the left reference time of the second ride record and the ride time of the first ride record are in the interval [CK, C]. If the server finds a second ride record that meets the conditions, the server can count the number of times the discount has been used, that is, count the number of times the discount has been used for historical ride records whose ride times are within the billing interval to which the second ride record belongs. The left reference time of the billing interval to which the second ride record belongs is the ride time of the earliest ride record in the billing interval, and the right reference time is the ride time of the latest ride record in the billing interval. If the number of times the discount is used does not exceed the discount number threshold, the server can calculate the discounted fare for the first ride record based on the discount information corresponding to the first ride record. If the transfer discount policy indicates that there is only one free ride within 30 minutes and an unlimited number of rides within 120 minutes with a 50% discount, then the first time the discount is enjoyed, the accounting fee will be 0 yuan, and the accounting fee will be the 50% discount thereafter. The server can classify the first ride record into the billing interval to which the second ride record belongs, and the server can also update the right reference time of the billing interval to which the second ride record belongs. Specifically, if the ride time of the first ride record is later than the ride time of any ride record within the billing interval, the server can update the right reference time of the billing interval to the ride time of the first ride record.
[0226] like Figure 4As shown, if the left query result is empty after executing the left query, or the left query result is not empty but the server has not found a second ride record that meets the conditions, then the right query is executed, and the ride records whose ride times are in the interval [C, C+K] are queried according to the current ride time, and these ride records are sorted in ascending order. From left to right, the ride records with later ride times are sorted to the right. If the right query result is not empty, these ascending ride records are traversed from near to far according to the ride time, and the first most recent ride record is found as the third ride record, and its right reference time RT is determined. The server can perform right reference time matching, that is, determine whether the third ride record found meets the condition, which is that the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold indicated by the transfer discount policy, that is, the right reference time of the third ride record and the ride time of the first ride record are in the interval [C, C+K]. If the server finds a third ride record that meets the conditions, the server can count the number of times the discount has been used, that is, count the number of times the discount has been used for historical ride records whose ride times are within the billing interval to which the third ride record belongs. The right reference time of the billing interval to which the third ride record belongs is the ride time of the latest ride record in the billing interval, and the left reference time is the ride time of the earliest ride record in the billing interval. If the number of times the discount is used does not exceed the discount number threshold, the server can calculate the discounted fare for the first ride record based on the discount information corresponding to the first ride record. If the transfer discount policy indicates that there is only one free ride within 30 minutes and an unlimited number of rides within 120 minutes with a 50% discount, then the first time the discount is enjoyed, the accounting fee will be 0 yuan, and the accounting fee will be the 50% discount thereafter. The server can classify the first ride record into the billing interval to which the third ride record belongs, and the server can also update the left reference time of the billing interval to which the third ride record belongs. Specifically, if the ride time of the first ride record is earlier than the ride time of any ride record within the billing interval, the server can update the left reference time of the billing interval to the ride time of the first ride record.
[0227] like Figure 4 As shown, if after executing the right query, the right query result is empty, or the right query result is not empty but the server does not find a third ride record that meets the conditions, the server charges the first ride record as the original fee.
[0228] After obtaining the fare of the first ride record, the server can return the fare information of the first ride record to the terminal. The fare information can be the fare after discount or the original fare. The fare is obtained according to the strategy and meets the requirements of the vehicle operator.
[0229] The above technical solution first searches for the ride records within the first time interval from the historical ride records of the day, and then finds the ride record with the latest ride time as the second ride record, and determines whether the current ride record can enjoy the transfer discount according to the time interval between the left reference time of the second ride record and the ride time of the first ride record. If the ride record within the first time interval is not found, the ride record within the second time interval can be searched from the historical ride records of the day, and then finds the ride record with the earliest ride time as the third ride record, and determines whether the current ride record can enjoy the transfer discount according to the time interval between the right reference time of the third ride record and the ride time of the first ride record.
[0230] Suppose a bus formula has the following transfer discount strategy: the basic fare for the transfer line is 1 yuan, and a 50% discount is offered if the user takes two rides within 30 minutes throughout the day (the time interval between the current ride and the first ride of the day does not exceed 30 minutes). The order of the user's four ride records is ABCD, the time interval between A, B and C is within 30 minutes, the time interval between B, C and D is within 30 minutes, and the time interval between A and D exceeds 30 minutes. According to the normal order, the charges should be 1 yuan, 0.5 yuan, 0.5 yuan and 1 yuan, a total of 3 yuan.
[0231] According to the relevant technology of ride charging method, if the order of the user's four ride records is out of order as follows, the charging is as shown in Table 1:
[0232] Table 1
[0233]
[0234] As can be seen from Table 1, the user should be charged 3 yuan, but because of the disordered delivery, the user will be charged 2.5 yuan. For example, if the abnormal sequence is BCDA, the charges are 1 yuan, 0.5 yuan, 0.5 yuan and 0.5 yuan, a total of 2.5 yuan.
[0235] The technical solution provided by the embodiment of the present application, assuming that the basic fare of the user's transfer vehicle is the same, can avoid the problem of inconsistent total deductions caused by asynchronous upload of the trip when using the QR code to transfer. The present application proposes the concept of deduction interval, which can correctly charge the ride record according to the user's ride time and avoid the problem of incorrect charging caused by asynchronous upload of the ride record.
[0236] When charging using the technical solution provided in the embodiment of the present application, assuming that the above transfer discount policy is still used, the charging for various uploading orders in Table 1 is as follows:
[0237] Table 2
[0238]
[0239] As shown in Table 2, for all upload sequences, if all the user's ride records are uploaded, there will be only one billing result, which is 3 yuan. The "|" indicates the division of the billing interval. The time interval between any two ride records in the same billing interval is less than the time interval threshold, such as 30 minutes.
[0240] For example, if the sequence exception is BCDA, then according to the technical solution provided in the embodiment of the present application, if ride record B is received, the left query result is empty, and the right query result is empty, then the fare of ride record B is the original fare of 1 yuan. If ride record C is received, the left query obtains ride record B, and the time interval between C and B does not exceed 30 minutes, then B and A are divided into one billing interval, and the fare of ride record A is 0.5 yuan. If ride record D is received, the left query obtains ride record B, and the time interval between D and B does not exceed 30 minutes, then D is divided into one billing interval with C and B, and the fare of ride record D is 0.5 yuan. If ride record A is received, the left query result is empty, and the right query obtains ride record D, and the time interval between A and D exceeds 30 minutes, then A is divided into another billing interval, and the fare of ride record A is the original fare of 1 yuan.
[0241] The method provided in the present application can implement transfers when taking a bus or subway based on a QR code and can ensure that the user's riding records can still be correctly charged when they are uploaded in disorder. A gradient discount algorithm can be used during calculation, which can meet the needs of bus or subway companies for gradient discounts in different time periods and different numbers of transfers, and can also be expanded to meet the needs of different discounts for different routes and different vehicles.
[0242] The method provided by the embodiment of the present application is to query the historical ride records of the user according to the ride time of the first ride record when receiving the first ride record of the user, and obtain the historical ride records within the first time interval, the ride time of the historical ride records within the first time interval is earlier than the ride time of the first ride record, and the ride time interval with the first ride record is less than or equal to the time interval threshold indicated by the transfer preferential policy, and then find the ride record with the latest ride time from the historical ride records within the first time interval as the second ride record, if the time interval between the left reference time of the second ride record and the ride time of the first ride record does not exceed the time interval threshold, it is determined that the first ride record can enjoy the transfer preferential treatment, and thus the ride fare information of the first ride record is obtained according to the transfer preferential policy. By correctly calculating the transfer preferential treatment according to the ride record of the user according to the ride time, the problem of incorrect deduction of fees can be avoided.
[0243] Figure 5 Schematic diagram of a bus fare charging device provided in an embodiment of the present application. Figure 5 , the device comprises:
[0244] The query module 501 is used for, if a first ride record of a user is received, querying the historical ride records of the user according to the ride time of the first ride record to obtain the historical ride records within a first time interval, where the end time of the first time interval is the ride time of the first ride record, and the time interval of the first time interval is equal to the time interval threshold indicated by the transfer discount policy;
[0245] A determination module 502, configured to determine a second ride record with the latest ride time from the historical ride records within the first time interval;
[0246] The acquisition module 503 is used to acquire the fare information of the first ride record according to the transfer discount policy if the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold;
[0247] Among them, the left reference time of the second ride record is the ride time of the earliest ride record in the billing interval to which the second ride record belongs, and the ride time interval between any two ride records in the same billing interval is less than or equal to the time interval threshold.
[0248] In a possible implementation, the acquisition module 503 is used to:
[0249] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of times the preferential usage of the charging interval to which the second ride record belongs;
[0250] If the number of preferential usages of the billing interval to which the second ride record belongs is less than or equal to the preferential number threshold indicated by the transfer preferential policy, a step of obtaining the fare information of the first ride record according to the transfer preferential policy is executed.
[0251] In a possible implementation, the acquisition module 503 is used to:
[0252] If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record;
[0253] According to the discount information of the first ride record, the ride fare information of the first ride record is obtained.
[0254] In a possible implementation, the acquisition module 503 is used to:
[0255] According to the time interval between the boarding time of the first boarding record and the left reference time of the second boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0256] According to the transfer time interval corresponding to the first ride record, the discount information corresponding to the first ride record is obtained, and different transfer time intervals correspond to different discount information.
[0257] In a possible implementation, the acquisition module 503 is used to:
[0258] According to the number of ride records in the charging interval to which the second ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0259] According to the number of transfers corresponding to the first ride record, the discount information corresponding to the first ride record is obtained, and different numbers of transfers correspond to different discount information.
[0260] In a possible implementation, the acquisition module 503 is used to:
[0261] According to the time interval between the boarding time of the first boarding record and the left reference time of the second boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0262] According to the number of ride records in the charging interval to which the second ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0263] Discount information corresponding to the first ride record is obtained according to the transfer time interval and the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer time intervals and the number of transfers.
[0264] In a possible implementation, the query module 501 is further configured to query the historical ride records of the user according to the ride time of the first ride record to obtain the historical ride records within the second time interval if no historical ride records within the first time interval are found from the historical ride records of the user;
[0265] The start time of the second time interval is the riding time of the first riding record, and the time interval of the second time interval is equal to the time interval threshold.
[0266] In a possible implementation, the query module 501 is further configured to query the historical ride records of the user according to the ride time of the first ride record to obtain historical ride records within a second time interval if the time interval between the left reference time of the second ride record and the ride time of the first ride record is greater than the time interval threshold, wherein the start time of the second time interval is the ride time of the first ride record, and the time interval of the second time interval is equal to the time interval threshold;
[0267] The determining module 502 is further configured to determine a third riding record with the earliest riding time from the historical riding records within the second time interval;
[0268] The acquisition module 503 is also used to obtain the fare information of the first ride record according to the transfer discount strategy if the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold. The right reference time of the third ride record is the ride time of the latest ride record within the billing interval to which the third ride record belongs.
[0269] In a possible implementation, the acquisition module 503 is used to:
[0270] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of times the preferential usage of the charging interval to which the third ride record belongs;
[0271] If the number of preferential usages of the billing interval to which the third ride record belongs is less than or equal to the preferential number threshold indicated by the transfer preferential policy, a step of obtaining the fare information of the first ride record according to the transfer preferential policy is executed.
[0272] In a possible implementation, the acquisition module 503 is used to:
[0273] If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record;
[0274] According to the discount information of the first ride record, the ride fare information of the first ride record is obtained.
[0275] In a possible implementation, the acquisition module 503 is used to:
[0276] According to the time interval between the boarding time of the first boarding record and the right reference time of the third boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0277] According to the transfer time interval corresponding to the first ride record, the discount information corresponding to the first ride record is obtained, and different transfer time intervals correspond to different discount information.
[0278] In a possible implementation, the acquisition module 503 is used to:
[0279] According to the number of ride records in the charging interval to which the third ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0280] According to the number of transfers corresponding to the first ride record, the discount information corresponding to the first ride record is obtained, and different numbers of transfers correspond to different discount information.
[0281] In a possible implementation, the acquisition module 503 is used to:
[0282] According to the time interval between the boarding time of the first boarding record and the right reference time of the third boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy;
[0283] According to the number of ride records in the charging interval to which the third ride record belongs, obtaining the number of transfers corresponding to the first ride record;
[0284] Discount information corresponding to the first ride record is obtained according to the transfer time interval and the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer time intervals and the number of transfers.
[0285] In one possible implementation, the acquisition module 503 is also used to obtain the original fare of the first ride record as the fare information of the first ride record if the time interval between the right reference time of the third ride record and the ride time of the first ride record is greater than the time interval threshold.
[0286] In one possible implementation, the acquisition module 503 is also used to obtain the original fare of the first ride record as the fare information of the first ride record if no historical ride record within the second time interval is found from the historical ride records of the user.
[0287] In a possible implementation, the acquisition module 503 is further used to acquire configuration information, where the configuration information is used to indicate the vehicle operator supporting the transfer discount policy and the ride time, ride route or vehicle that the vehicle operator supports the transfer discount policy;
[0288] The query module 501 is also used to execute the step of querying the historical ride records of the user if it is determined that the first ride record supports the transfer discount policy according to the configuration information.
[0289] In a possible implementation, the query module 501 is further used to adopt a distributed lock control method to execute a step of querying from the user's historical riding records;
[0290] The acquisition module 503 is also used to adopt a distributed lock control method to execute the step of acquiring the fare information of the first ride record. The distributed lock control method is used to control the distributed system to charge a ride record of the same user at the same time.
[0291] In the embodiment of the present application, when receiving the first ride record of the user, according to the ride time of the first ride record, the historical ride records within the first time interval are queried from the user's historical ride records to obtain the historical ride records within the first time interval, the ride time of the historical ride records within the first time interval is earlier than the ride time of the first ride record, and the ride time interval with the first ride record is less than or equal to the time interval threshold indicated by the transfer preferential policy, and then from the historical ride records within the first time interval, the ride record with the latest ride time is found as the second ride record, if the time interval between the left reference time of the second ride record and the ride time of the first ride record does not exceed the time interval threshold, it is determined that the first ride record can enjoy the transfer preferential treatment, and thus the ride fare information of the first ride record is obtained according to the transfer preferential policy. By correctly calculating the transfer preferential treatment according to the ride record of the user according to the ride time, the problem of erroneous deduction can be avoided.
[0292] It should be noted that: the fare metering device provided in the above embodiment only uses the division of the above functional modules as an example for fare metering. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the fare metering device provided in the above embodiment and the fare metering method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0293] Figure 66 is a schematic diagram of the structure of a server 600 provided in an embodiment of the present application. The server 600 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 601 and one or more memories 602, wherein the memory 602 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 601 to implement the methods provided in the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the server may also include other components for implementing device functions, which will not be described in detail here.
[0294] In an exemplary embodiment, a computer-readable storage medium storing a computer program is also provided, such as a memory storing a computer program, and the computer program is executed by a processor to implement the fare charging method in the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0295] A person skilled in the art will understand that all or part of the steps of implementing the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0296] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for charging a ride, characterized in that: The method comprises: If a first ride record of a user is received, a query is performed from the historical ride records of the user according to the ride time of the first ride record to obtain historical ride records within a first time interval, the end time of the first time interval is the ride time of the first ride record, and the time interval of the first time interval is equal to the time interval threshold indicated by the transfer discount policy; Determine a second ride record with the latest ride time from the historical ride records within the first time interval; If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy; The left reference time of the second ride record is the ride time of the earliest ride record in the billing interval to which the second ride record belongs, and the time interval between any two ride records in the same billing interval is less than or equal to the time interval threshold; After determining the second ride record with the latest ride time from the historical ride records within the first time interval, the method further includes: If the time interval between the left reference time of the second ride record and the ride time of the first ride record is greater than the time interval threshold, query the historical ride records of the user according to the ride time of the first ride record to obtain historical ride records within a second time interval, the start time of the second time interval is the ride time of the first ride record, and the time interval of the second time interval is equal to the time interval threshold; Determine a third ride record with the earliest ride time from the historical ride records within the second time interval; If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, the fare information of the first ride record is obtained according to the transfer discount policy, and the right reference time of the third ride record is the ride time of the latest ride record within the billing interval to which the third ride record belongs; If no historical ride record within the second time interval is found in the historical ride record of the user, the original fare of the first ride record is obtained as the ride fare information of the first ride record; If no historical ride record within the first time interval is found from the historical ride record of the user, a historical ride record within a second time interval is found from the historical ride record of the user according to the ride time of the first ride record, where the start time of the second time interval is the ride time of the first ride record, and the time interval of the second time interval is equal to the time interval threshold; Determine a third ride record with the earliest ride time from the historical ride records within the second time interval; If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, the fare information of the first ride record is obtained according to the transfer discount policy, and the right reference time of the third ride record is the ride time of the latest ride record within the billing interval to which the third ride record belongs.
2. The method according to claim 1, characterized in that If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy, comprises: If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of times the preferential usage of the billing interval to which the second ride record belongs; If the number of preferential usages of the billing interval to which the second ride record belongs is less than or equal to the preferential number threshold indicated by the transfer preferential policy, a step of obtaining the fare information of the first ride record according to the transfer preferential policy is executed.
3. The method according to claim 1, characterized in that If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy, comprises: If the time interval between the left reference time of the second ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record; The fare information of the first riding record is obtained according to the discount information of the first riding record.
4. The method according to claim 3, characterized in that The obtaining of discount information corresponding to the first ride record includes: According to the time interval between the boarding time of the first boarding record and the left reference time of the second boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy; According to the transfer time interval corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different transfer time intervals correspond to different discount information.
5. The method according to claim 3, characterized in that: The obtaining of discount information corresponding to the first ride record includes: According to the number of ride records in the charging interval to which the second ride record belongs, obtaining the number of transfers corresponding to the first ride record; According to the number of transfers corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different numbers of transfers correspond to different discount information.
6. The method according to claim 3, characterized in that The obtaining of discount information corresponding to the first ride record includes: According to the time interval between the boarding time of the first boarding record and the left reference time of the second boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy; According to the number of ride records in the charging interval to which the second ride record belongs, obtaining the number of transfers corresponding to the first ride record; Discount information corresponding to the first ride record is obtained according to the transfer time interval and the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer time intervals and the number of transfers.
7. The method according to claim 1, characterized in that If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy includes: If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, counting the number of times the preferential usage of the charging interval to which the third ride record belongs; If the number of preferential usages of the billing interval to which the third ride record belongs is less than or equal to the preferential number threshold indicated by the transfer preferential policy, a step of obtaining the fare information of the first ride record according to the transfer preferential policy is executed.
8. The method according to claim 1, characterized in that If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining the ride fare information of the first ride record according to the transfer discount policy includes: If the time interval between the right reference time of the third ride record and the ride time of the first ride record is less than or equal to the time interval threshold, obtaining discount information corresponding to the first ride record; The fare information of the first riding record is obtained according to the discount information of the first riding record.
9. The method according to claim 8, characterized in that The obtaining of discount information corresponding to the first ride record includes: According to the time interval between the boarding time of the first boarding record and the right reference time of the third boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy; According to the transfer time interval corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different transfer time intervals correspond to different discount information.
10. The method according to claim 8, characterized in that The obtaining of discount information corresponding to the first ride record includes: According to the number of ride records in the charging interval to which the third ride record belongs, obtaining the number of transfers corresponding to the first ride record; According to the number of transfers corresponding to the first riding record, the discount information corresponding to the first riding record is obtained, and different numbers of transfers correspond to different discount information.
11. The method according to claim 8, characterized in that The obtaining of discount information corresponding to the first ride record includes: According to the time interval between the boarding time of the first boarding record and the right reference time of the third boarding record, determining the transfer time interval corresponding to the first boarding record from a plurality of transfer time intervals indicated by the transfer preferential policy; According to the number of ride records in the charging interval to which the third ride record belongs, obtaining the number of transfers corresponding to the first ride record; Discount information corresponding to the first ride record is obtained according to the transfer time interval and the number of transfers corresponding to the first ride record, and different discount information corresponds to different transfer time intervals and the number of transfers.
12. The method according to claim 1, characterized in that After determining the third ride record with the earliest ride time from the historical ride records within the second time interval, the method further includes: If the time interval between the right reference time of the third ride record and the ride time of the first ride record is greater than the time interval threshold, the original fare of the first ride record is acquired as the ride fare information of the first ride record.
13. The method according to claim 1, characterized in that After receiving the first ride record of the user, the method further includes: Acquire configuration information, where the configuration information is used to indicate the vehicle operators that support the transfer discount policy and the ride times, ride routes or vehicles that the vehicle operators support the transfer discount policy; If it is determined according to the configuration information that the first riding record supports the transfer discount policy, a step of querying from the historical riding records of the user is performed.
14. The method according to any one of claims 1 to 13, characterized in that: After receiving the first ride record of the user, the method further includes: A distributed lock control method is used to execute the steps of querying the user's historical ride records and obtaining the fare information of the first ride record. The distributed lock control method is used to control the distributed system to charge a ride record of the same user at the same time.
15. A server, characterized in that: The method comprises one or more processors and one or more memories; the one or more memories are used to store computer programs; the one or more processors are used to execute the computer programs stored in the one or more memories to implement the method steps described in any one of claims 1 to 14.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 14 are implemented.
