Method, device and computer equipment for sharing vehicle use
By introducing caching and write services into the shared vehicle system, a occupancy code is generated and written to the cache before being confirmed in the database. This solves the problem of abnormal vehicle usage caused by database crashes and ensures the stability of the vehicle state transition process and the user experience.
Patent Information
- Application Number
- CN202111282128.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-01
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2041-11-01
AI Technical Summary
In the shared vehicle system, the database crashes during peak usage periods due to excessive traffic, preventing users from using or returning vehicles normally.
By introducing caching and write services in the server, a occupancy code is generated and written to the cache first, and then confirmed in the database, ensuring that the vehicle state transition process can still be executed normally when the cache crashes.
Even if the database malfunctions, the vehicle status transition process can still be completed normally, avoiding situations where users cannot use the vehicle normally during peak usage periods, thus improving system stability and user experience.
Smart Images

Figure CN113986977B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicles, and more particularly to a method, apparatus, and computer equipment for using shared vehicles. Background Technology
[0002] When a user unlocks a shared vehicle via the terminal, or reserves a shared vehicle via the terminal, the server changes the status of the shared vehicle to occupied and establishes a connection with the terminal, thereby avoiding logical conflicts that may arise from multiple users using the same shared vehicle.
[0003] During the process of the server changing the status of a shared vehicle to occupied, the server generates random data associated with the unique serial number of the shared vehicle, writes it to the cache and database, and sends it to the terminal, thus completing the vehicle occupancy. When a user reserves or unlocks a vehicle, the server accesses the cache or database based on the unique serial number of the shared vehicle sent by the terminal to determine whether the shared vehicle is occupied. If occupied, the corresponding vehicle reservation or unlocking is completed. When the vehicle is returned, the server also accesses the cache or database to send a vehicle lock command to the central controller of the vehicle to be returned.
[0004] Understandably, during the process of vehicle occupancy, unlocking, and return, the cache and database are accessed frequently. When the cache malfunctions during peak usage periods, the database may crash due to excessive access traffic, preventing users from using or returning the vehicle. Summary of the Invention
[0005] In view of this, the present invention provides a method, apparatus and computer equipment for using shared vehicles, in order to improve the current situation where cache anomalies occur during peak usage periods, which may cause the database to crash due to excessive access traffic.
[0006] In a first aspect, embodiments of the present invention provide a method for using shared vehicles, applied to a server, the server storing write services, the method comprising:
[0007] Responding to the vehicle usage request sent by the terminal, obtain the vehicle number of the requested vehicle corresponding to the vehicle usage request;
[0008] Generate a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and write the vehicle number of the requested vehicle and the first occupancy code into the cache;
[0009] Send the first occupancy code and occupancy success notification information to the terminal, and send a write notification information including the vehicle number to the write service;
[0010] Based on the write service, the vehicle number of the requesting vehicle and the first occupancy code in the cache are obtained from the write notification information and written to the database.
[0011] In the shared vehicle usage method provided in this embodiment of the invention, when a user sends a vehicle usage request to the server through a terminal, the server determines the vehicle number of the requested vehicle based on the vehicle usage request, that is, determines the vehicle that the user needs to use. The vehicle usage request includes a vehicle reservation request and a vehicle unlocking request. Then, the server generates a successful occupancy notification message and a first occupancy code, associates the first occupancy code with the vehicle number, and writes the vehicle number and the first occupancy code into a cache, thereby changing the status of the requested vehicle to occupied. Then, the server sends the first occupancy code and the successful occupancy notification message to the terminal, so that the terminal knows that the vehicle has been successfully occupied and can request the server to reserve the vehicle or unlock the vehicle. At the same time, the server sends a write notification message including the vehicle number to the write service. However, at this time, the vehicle number of the requested vehicle and the first occupancy code associated with the vehicle number only exist in the cache but have not been written to the database, that is, the occupancy process has not been completed. Therefore, the server uses the write notification message to cause the write service to write the vehicle number and the first occupancy code associated with the vehicle number into the database. After the write service parses the write notification message to obtain the vehicle number, and then obtains the first occupancy code in the cache based on the vehicle number, it writes the vehicle number and the first occupancy code associated with the vehicle number into the database, and the occupancy process is completed.
[0012] Based on this, the shared vehicle usage method provided by the embodiments of the present invention enables the shared vehicle to be occupied normally even if the database is abnormal when the user reserves or unlocks the vehicle, thus allowing the unlocking or reservation to be completed normally, avoiding the situation where users cannot use the vehicle normally during peak usage periods.
[0013] Optionally, in one embodiment of the present invention, when writing data to the database fails, a step is performed to send a write notification message including the vehicle number to the write service.
[0014] Under this implementation method, the beneficial effects that the embodiments of the present invention can achieve are: even if the database fails to write data due to an anomaly, the server will re-execute the data writing operation to ensure the normal execution of the occupancy process and to ensure the normal completion of the occupancy process.
[0015] Optionally, in one embodiment of the present invention, after responding to a vehicle usage request sent by a terminal and obtaining the vehicle number of the requested vehicle corresponding to the vehicle usage request, and before generating a first occupancy code associated with the vehicle number of the requested vehicle, the method further includes:
[0016] Determine if a first occupancy code associated with the vehicle number of the requested vehicle exists in the cache or database;
[0017] If it does not exist, proceed with the steps of generating a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle.
[0018] Under this implementation method, the beneficial effects that the embodiments of the present invention can achieve are: avoiding the secondary occupation of vehicles that have already been occupied, and ensuring the reasonable conduct of the occupation process.
[0019] Optionally, in one embodiment provided by the present invention, it further includes:
[0020] Responding to the vehicle return request sent by the terminal, obtain the second occupancy code in the vehicle return request;
[0021] If a first occupancy code matching the second occupancy code is found in the cache, a vehicle lock command is sent to the requesting vehicle corresponding to the vehicle return request.
[0022] Under this implementation method, the beneficial effects that the present invention can achieve are: when the user performs the return operation and the server receives the data traffic, the data traffic is only processed by the cache and does not depend on the database, thereby avoiding the database crash caused by cache breakdown.
[0023] Furthermore, in one embodiment of the present invention, the server also stores application information for each shared vehicle, and the server is used to send control commands to the shared vehicle corresponding to the application information after obtaining the application information.
[0024] Generate a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and write the vehicle number of the requested vehicle and the first occupancy code into the cache, including:
[0025] Generate a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and write the vehicle number of the requested vehicle, the application information of the requested vehicle, and the first occupancy code into the cache;
[0026] If a first occupancy code matching the second occupancy code is found in the cache, a vehicle lock command is sent to the requesting vehicle corresponding to the vehicle return request, including:
[0027] If a first occupancy code matching the second occupancy code is found in the cache, obtain the application information of the requesting vehicle corresponding to the vehicle return request;
[0028] When the requested vehicle meets the preset return conditions, a vehicle lock command is sent to the requested vehicle based on the application information of the requested vehicle.
[0029] In this implementation, the server retrieves application information from the cache to ensure the vehicle locking command is sent, and at the same time confirms whether the vehicle meets the preset return conditions, such as whether the vehicle is located at the parking spot or whether the parking angle is correct, to ensure the correct return of the vehicle.
[0030] Optionally, in one embodiment provided by the present invention, it further includes:
[0031] If no first occupancy code matching the second occupancy code is found in the cache, obtain the application information of the requesting vehicle and send a vehicle lock command to the requesting vehicle based on the application information of the requesting vehicle.
[0032] In this implementation, if the server cannot find a first occupancy code matching the second occupancy code in the cache, it indicates a cache error. Therefore, the server cannot retrieve the first occupancy code matching the second occupancy code from the faulty cache. In this case, the server no longer retrieves the first occupancy code from the cache, but instead retrieves application information from other data storage spaces, and then sends a vehicle locking command to the shared vehicle based on the application information. Thus, this embodiment of the invention can still lock the vehicle even in the event of a cache failure, thereby ensuring the user's car-using experience.
[0033] Furthermore, in one embodiment of the present invention, if no first occupancy code matching the second occupancy code is found in the cache, after obtaining the application information of the requesting vehicle, the method further includes:
[0034] Write a preset number of vehicle IDs to be synchronized and the first occupancy code associated with each vehicle ID to be synchronized into the cache.
[0035] Under this implementation method, the beneficial effects that the embodiments of the present invention can achieve are: the server retrieves data from the database to restore the data in the crashed cache, so that the cache can normally support the processing of data traffic and ensure the reasonable operation of the entire vehicle use process.
[0036] Secondly, embodiments of the present invention provide a device for using shared vehicles, applied to a server, the server storing write services, the device comprising:
[0037] The first response module is used to respond to the vehicle use request sent by the terminal and obtain the vehicle number of the requested vehicle corresponding to the vehicle use request.
[0038] The cache writing module is used to generate a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and write the vehicle number and the first occupancy code of the requested vehicle into the cache.
[0039] The notification module is used to send the first occupancy code and occupancy success notification information to the terminal, and to send write notification information including the vehicle number to the write service;
[0040] The database writing module is used to obtain the vehicle number of the requesting vehicle and the first occupancy code in the cache from the write notification information based on the write service, and write them to the database.
[0041] Thirdly, embodiments of the present invention provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and the computer program, when run on the processor, executes a method of using a shared vehicle as disclosed in any of the first aspects.
[0042] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when run on a processor, executes a method of using a shared vehicle as disclosed in any of the first aspects. Attached Figure Description
[0043] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope of protection of the present invention. In the various drawings, similar components are numbered similarly.
[0044] Figure 1 A flowchart illustrating the first method of using a shared vehicle according to an embodiment of the present invention is shown;
[0045] Figure 2 A flowchart illustrating a second method of using a shared vehicle provided by an embodiment of the present invention is shown;
[0046] Figure 3 A flowchart illustrating a third method of using a shared vehicle provided in an embodiment of the present invention is shown;
[0047] Figure 4 A schematic diagram of the structure of the device for using shared vehicles provided in an embodiment of the present invention is shown. Detailed Implementation
[0048] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0049] The components of the embodiments of the invention described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0050] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of the invention, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.
[0051] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0052] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of the invention pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be interpreted as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of the invention.
[0053] Reference Figure 1 , Figure 1 This diagram illustrates a flowchart of a first method for using a shared vehicle according to an embodiment of the present invention. The method for using a shared vehicle provided in this embodiment is applied to a server, which stores data via a write service. The method for using a shared vehicle includes:
[0054] S110: Respond to the vehicle usage request sent by the terminal and obtain the vehicle number of the requested vehicle corresponding to the vehicle usage request.
[0055] It should be noted that vehicle usage requests include vehicle unlocking requests and vehicle reservation requests. When a user clicks a preset button or performs a preset operation on the terminal, such as clicking the "Use a vehicle" or "Reserve a vehicle" button in the application, the terminal will send the corresponding vehicle unlocking request or vehicle reservation request to the server. Upon receiving the vehicle usage request, the server determines the vehicle number of the requested vehicle. It is understood that each shared vehicle in this embodiment of the invention has a unique vehicle number.
[0056] It should also be noted that when the terminal generates a vehicle usage request, it can include the vehicle number of the requested vehicle in the request, allowing the server to directly parse the request and obtain the vehicle number; alternatively, the terminal can send a vehicle usage request to the server and, after receiving a response, send the vehicle number back to the server. The specific process by which the server obtains the vehicle number can be configured according to the actual situation.
[0057] S120: Generate a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and write the vehicle number of the requested vehicle and the first occupancy code into the cache.
[0058] Specifically, after the server determines that a shared vehicle is available for occupancy, it generates a successful occupancy notification and a first occupancy code. The vehicle number and the first occupancy code are then written to the cache, signifying the change in vehicle status to occupancy. It should be noted that the successful occupancy notification is used to inform the terminal that the vehicle has been successfully occupied.
[0059] It is understood that if a vehicle is already occupied, the server will not generate a successful occupancy notification message or a first occupancy code associated with the vehicle number of the requesting vehicle. Therefore, in one possible implementation provided by this embodiment of the invention, before S120, the method further includes:
[0060] Determine if a first occupancy code associated with the vehicle number of the requested vehicle exists in the cache or database;
[0061] If it does not exist, execute S120.
[0062] Based on this, when the server determines that there is no associated first occupancy code for the vehicle code, that is, when it determines that the requested vehicle is not occupied, the first occupancy code is generated again to avoid the same vehicle being occupied multiple times.
[0063] Furthermore, in one embodiment of the present invention, in addition to determining that the vehicle is not occupied, the server will also confirm whether the vehicle can work normally, such as whether the vehicle's positioning function is working properly and whether the heartbeat connection between the vehicle's central controller and various devices is normal. After confirming that the vehicle can work normally, the server generates a first occupancy code and occupancy success notification information.
[0064] S130, the first occupancy code and occupancy success notification information are sent to the terminal, and a write notification information including the vehicle number is sent to the write service.
[0065] Specifically, the server sends a successful occupancy notification to the terminal. The terminal determines that the vehicle has been occupied based on the successful occupancy notification and can then request the server to unlock or reserve the vehicle.
[0066] Understandably, since the vehicle number and first occupancy code exist in the cache, the terminal then requests the server to unlock or reserve the vehicle. Based on the vehicle number and first occupancy code in the cache, the server determines that the vehicle to be unlocked or reserved has been occupied by the terminal, and can then execute the vehicle reservation or unlocking process.
[0067] It is also understandable that although the terminal has confirmed vehicle occupancy through the successful occupancy notification and has received the first occupancy code, the vehicle number and the first occupancy code in the server only exist in the cache and have not been written to the database. This means the vehicle occupancy process is not yet complete, and if the cache crashes and data is lost, the user will be unable to unlock or reserve a vehicle normally. Therefore, while sending the successful occupancy notification and the first occupancy code to the terminal, the server also sends a write notification including the vehicle number to the write service, instructing the write service to write the vehicle number and the first occupancy code to the database, thereby ensuring the complete execution of the occupancy process. It should be clarified that the write service in this embodiment of the invention is used to write the vehicle number and the first occupancy code to the database.
[0068] It should be understood that in this occupancy process provided by the embodiments of the present invention, it is not required that both the cache write operation and the database write operation be successfully executed before a successful occupancy notification message is generated and sent to the terminal. This avoids the situation where the database write fails during peak usage periods, making it difficult for users to use the vehicle normally. In addition, in this occupancy process, since the first occupancy code and vehicle number already exist in the cache, vehicle unlocking and reservation can be completed normally, ensuring normal vehicle use for users.
[0069] S140, based on the write service, obtains the vehicle number of the requesting vehicle and the first occupancy code in the cache from the write notification information, and writes them to the database.
[0070] Understandably, after receiving the write notification and parsing out the vehicle number, the write service retrieves the first occupancy code associated with the vehicle number from the cache, and writes both to the database to complete the occupancy process, thereby avoiding a situation where the cache crashes and the user is unable to use the vehicle.
[0071] Based on this, the shared vehicle usage method provided by the embodiments of the present invention enables the shared vehicle to be occupied normally even if the database is abnormal when the user reserves or unlocks the vehicle, and thus the unlocking or reservation can be completed normally, avoiding the situation where users cannot use the vehicle normally during peak usage periods.
[0072] Optionally, in one embodiment of the present invention, the method further includes:
[0073] When writing data to the database fails, the procedure is to send a write notification message, including the vehicle number, to the write service.
[0074] Understandably, since both the vehicle ID and the first occupancy code need to be written to the database, and there is a large amount of data that needs to be written to the database during peak user periods, there may be situations where database anomalies prevent data from being written, or the write service fails to parse the write notification information, resulting in the write service not obtaining the vehicle ID. In this case, the server sends the write notification information including the vehicle ID to the write service again, so that the write service can write the data to the database.
[0075] Optional, see reference Figure 2 , Figure 2 The diagram illustrates a second method for using a shared vehicle according to an embodiment of the present invention. Specifically, in one implementation of the present invention, the method further includes:
[0076] S150, respond to the vehicle return request sent by the terminal and obtain the second occupancy code in the vehicle return request;
[0077] S160, if a first occupancy code matching the second occupancy code is found in the cache, a vehicle lock command is sent to the requesting vehicle corresponding to the vehicle return request.
[0078] Specifically, when a user needs to return a shared vehicle and performs a preset operation on the terminal, such as clicking the return button, the terminal generates a vehicle return request and sends it to the server. This request includes a second occupancy code. Upon receiving the return request, the server obtains the second occupancy code and searches its cache for a matching first occupancy code. If a matching first occupancy code is found, the server determines that the vehicle belongs to the user and sends a vehicle lock command, completing the return process.
[0079] It is understood that in this embodiment of the present invention, when the server receives a vehicle return request, i.e., receives data traffic, the data traffic is processed by the cache and does not depend on the server, thereby avoiding server crashes caused by cache breakdown. It is also understood that compared to restoring the database after a database crash, restoring the cache after a cache crash requires lower time and manpower costs. Therefore, the present invention utilizes caching to process data traffic, resulting in faster processing speeds and lower recovery costs.
[0080] Furthermore, in a feasible implementation method provided by the present invention, the vehicle reservation request and the vehicle use request are also processed by caching. That is, after the server receives the vehicle reservation request or the vehicle use request, it obtains the vehicle number or the second occupancy code in the vehicle reservation request or the vehicle use request, and determines that the first occupancy code managed by the vehicle number is stored in the cache, or after determining the second occupancy code that matches the first occupancy code, it performs vehicle unlocking and vehicle reservation.
[0081] Further reference Figure 3 , Figure 3 The flowchart of the third method of using shared vehicles provided by the embodiment of the present invention is shown. In one embodiment of the present invention, the server also stores application information of each shared vehicle. The server is used to send control commands to the shared vehicle corresponding to the application information after obtaining the application information.
[0082] Furthermore, S120 includes:
[0083] S121, Generate a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and write the vehicle number of the requested vehicle, the application information of the requested vehicle, and the first occupancy code into the cache.
[0084] Furthermore, S160 includes:
[0085] S161, if a first occupancy code matching the second occupancy code is found in the cache, obtain the application information of the requesting vehicle corresponding to the vehicle return request;
[0086] S162, when the requested vehicle meets the preset return conditions, a vehicle lock command is sent to the requested vehicle based on the application information of the requested vehicle.
[0087] Specifically, in this implementation, the server needs to obtain the vehicle's application information before it can generate and issue a vehicle locking command. It's important to understand that application information, or Appinfo, is used for the operation of interactive applications. The server needs to use application information when performing certain tasks, such as unlocking the vehicle.
[0088] Furthermore, to improve the efficiency of the server issuing vehicle locking commands, the server also stores application information in the cache when storing the first occupancy code and vehicle number.
[0089] Furthermore, in this implementation, the server will also detect whether the vehicle meets preset return conditions, such as whether the vehicle is parked in the designated parking area, whether the parking angle is correct, and whether the foot brake is engaged, among other conditions. It is understandable that the specific process for determining whether the vehicle meets the preset return conditions can be set according to time constraints. For example, after receiving a vehicle return request, the server obtains the vehicle's location information using its positioning function, and then determines whether the vehicle is at the parking area based on pre-stored parking area location information. Therefore, after the vehicle meets the preset return conditions, the server sends a vehicle locking command to the vehicle based on application information, completing the vehicle return.
[0090] Furthermore, in one embodiment provided by the present invention, it further includes:
[0091] If no first occupancy code matching the second occupancy code is found in the cache, obtain the application information of the requesting vehicle and send a vehicle lock command to the requesting vehicle based on the application information of the requesting vehicle.
[0092] It should be understood that in this embodiment of the present invention, if the server cannot find the first occupancy code that matches the second occupancy code in the cache, it may be because the cache has crashed before and some data was lost when the cache was restored, resulting in the inability to find the matching first occupancy code; or the cache is in an abnormal or crashed state, causing the server to be unable to obtain data from the cache.
[0093] In this situation, the server determines that the current cache is abnormal, and therefore the current vehicle return request is no longer processed based on the cache. Instead, it directly retrieves the application information from other storage spaces and sends a vehicle lock command to the vehicle based on the application information.
[0094] It is understandable that cache anomalies may occur because the cache needs to handle a large amount of data traffic simultaneously, i.e., multiple users return the vehicle at the same time. When the cache may be faulty, but multiple users need to return the vehicle, this embodiment of the invention, to ensure normal vehicle use for users, does not check whether the vehicle meets the preset return conditions before the cache is restored; that is, after obtaining the application information, it directly sends a vehicle lock command to the vehicle.
[0095] Furthermore, in one embodiment of the present invention, when the server receives any request and can obtain a matching first occupancy code from the cache, it is determined that the cache is not abnormal at this time.
[0096] Optionally, in another embodiment of the present invention, even if the cache is abnormal, the server will still send a vehicle lock command to the vehicle only after determining that the vehicle meets the preset return conditions.
[0097] Optionally, in one possible implementation of the present invention, if the server fails to obtain a matching first occupancy code through the cache during the processing of multiple consecutive vehicle return requests, it is determined that the cache is abnormal. Therefore, it no longer judges whether the vehicle meets the preset return conditions and directly issues a vehicle locking command after obtaining the application information.
[0098] Furthermore, in one embodiment of the present invention, if no first occupancy code matching the second occupancy code is found in the cache, after obtaining the application information of the requesting vehicle, the method further includes:
[0099] Write a preset number of vehicle IDs to be synchronized and the first occupancy code associated with each vehicle ID to be synchronized into the cache.
[0100] Understandably, when a cache malfunctions or crashes, the loss of data in the cache leads to abnormal data flow, preventing vehicle return, locking, and reservation from being executed correctly. Therefore, when the server determines that the cache is malfunctioning or has crashed, it retrieves the vehicle number to be synchronized and the first occupancy code associated with that vehicle number from the database to restore the data in the cache, thereby enabling normal data flow.
[0101] Corresponding to the method of using shared vehicles provided in the embodiments of the present invention, the embodiments of the present invention also provide a device for using shared vehicles, as described above. Figure 4 , Figure 4 This diagram illustrates the structure of a shared vehicle usage device according to an embodiment of the present invention. The shared vehicle usage device 200 provided in this embodiment is applied to a server, which stores write services. The device 200 includes:
[0102] The first response module 210 is used to respond to the vehicle use request sent by the terminal and obtain the vehicle number of the requested vehicle corresponding to the vehicle use request.
[0103] The cache writing module 220 is used to generate a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and write the vehicle number of the requested vehicle and the first occupancy code into the cache.
[0104] Notification module 230 is used to send the first occupancy code and occupancy success notification information to the terminal, and to send write notification information including the vehicle number to the write service;
[0105] The database writing module 240 is used to obtain the vehicle number of the requesting vehicle and the first occupancy code in the cache from the write notification information based on the write service, and write them to the database.
[0106] It is understood that the technical solution of the shared vehicle usage device disclosed in the embodiments of the present invention is used to perform various functional modules through their coordinated operation. Figure 1 The shared vehicle usage method disclosed in the illustrated method embodiment, the implementation schemes involved in the shared vehicle usage method, and the beneficial effects are also applicable to this embodiment, and will not be repeated here.
[0107] This invention also provides a computer device, including a memory and a processor. The memory stores a computer program, and the computer program executes the method of using a shared vehicle as disclosed in the embodiments when it runs on the processor.
[0108] This invention also provides a computer-readable storage medium storing a computer program that, when run on a processor, executes the method of using a shared vehicle as disclosed in the embodiments.
[0109] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, as an alternative implementation, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0110] In addition, the functional modules or units in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0111] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0112] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for using a shared vehicle, characterized in that, Applied to a server, the server storing write services, the method includes: In response to a vehicle usage request sent by the terminal, obtain the vehicle number of the requested vehicle corresponding to the vehicle usage request. Generate a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and write the vehicle number of the requested vehicle and the first occupancy code into the cache; The first occupancy code and occupancy success notification information are sent to the terminal, and a write notification information including the vehicle number is sent to the write service; the write service is used to write the vehicle number and the first occupancy code into the database; and the terminal determines that the vehicle has been occupied based on the occupancy success notification information, and then requests the server to unlock or reserve the vehicle. Based on the write service, the vehicle number of the requesting vehicle in the write notification information and the first occupancy code in the cache are obtained and written to the database; Responding to the vehicle return request sent by the terminal, obtain the second occupancy code in the vehicle return request; If a first occupancy code matching the second occupancy code is found in the cache, a vehicle lock command is sent to the requesting vehicle corresponding to the vehicle return request.
2. The method according to claim 1, characterized in that, The method further includes: When writing data to the database fails, the step of sending a write notification message including the vehicle number to the write service is performed.
3. The method according to claim 1, characterized in that, After responding to a vehicle usage request sent by a terminal and obtaining the vehicle number of the requested vehicle corresponding to the vehicle usage request, before generating a first occupancy code associated with the vehicle number of the requested vehicle, the method further includes: Determine whether a first occupancy code associated with the vehicle number of the requested vehicle exists in the cache or the database; If it does not exist, perform the steps of generating the successful occupancy notification information and the first occupancy code associated with the vehicle number of the requested vehicle.
4. The method according to claim 1, characterized in that, The server also stores application information for each shared vehicle. After obtaining the application information, the server sends control commands to the shared vehicle corresponding to the application information. The process of generating a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and writing the vehicle number of the requested vehicle and the first occupancy code into a cache, includes: Generate a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and write the vehicle number of the requested vehicle, the application information of the requested vehicle, and the first occupancy code into the cache; If a first occupancy code matching the second occupancy code is found in the cache, a vehicle lock command is sent to the requesting vehicle corresponding to the vehicle return request, including: If a first occupancy code matching the second occupancy code is found in the cache, the application information of the requesting vehicle corresponding to the vehicle return request is obtained. When the requested vehicle meets the preset return conditions, a vehicle lock command is sent to the requested vehicle based on the application information of the requested vehicle.
5. The method according to claim 4, characterized in that, Also includes: If no first occupancy code matching the second occupancy code is found in the cache, the application information of the requesting vehicle is obtained, and a vehicle lock command is sent to the requesting vehicle based on the application information of the requesting vehicle.
6. The method according to claim 5, characterized in that, If no first occupancy code matching the second occupancy code is found in the cache, after obtaining the application information of the requesting vehicle, the process further includes: A preset number of vehicle IDs to be synchronized and the first occupancy code associated with each vehicle ID to be synchronized are written into the cache.
7. A device for using a shared vehicle, characterized in that, Applied to a server, the server storing write services, the device includes: The first response module is used to respond to the vehicle use request sent by the terminal and obtain the vehicle number of the requesting vehicle corresponding to the vehicle use request. The cache writing module is used to generate a successful occupancy notification message and a first occupancy code associated with the vehicle number of the requested vehicle, and write the vehicle number of the requested vehicle and the first occupancy code into the cache. The notification module is used to send the first occupancy code and occupancy success notification information to the terminal, and to send write notification information including the vehicle number to the write service; the write service is used to write the vehicle number and the first occupancy code into the database; and the terminal determines that the vehicle has been occupied based on the occupancy success notification information, and then requests the server to unlock or reserve the vehicle. The database writing module is used to obtain the vehicle number of the requesting vehicle in the writing notification information and the first occupancy code in the cache based on the writing service, and write them to the database; The device is further configured to: respond to a vehicle return request sent by a terminal, obtain a second occupancy code in the vehicle return request; if a first occupancy code matching the second occupancy code is found in the cache, send a vehicle lock command to the requesting vehicle corresponding to the vehicle return request.
8. A computer device, characterized in that, It includes a memory and a processor, the memory storing a computer program that, when executed on the processor, performs the method of using the shared vehicle as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a processor, executes the method of using the shared vehicle as described in any one of claims 1-6.
Citation Information
Patent Citations
Time-sharing lease method and system of electric vehicle and vehicle networking platform
CN105894679A
Market data storage method and device, computer device and readable storage medium
CN113434516A