Order synchronization method and apparatus, computer device, and storage medium
By dynamically adjusting the order set acquisition method, timely synchronization between the server-side database and the client-side database is achieved, solving the problems of low order data synchronization efficiency and low query efficiency, and improving user experience and delivery speed.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU LANCHUAN TECH CO LTD
- Filing Date
- 2023-04-26
- Publication Date
- 2026-06-23
AI Technical Summary
Existing technologies have low efficiency in synchronizing and querying order data, leading to errors in order information and a poor user experience. In particular, the server-side computing and bandwidth pressure is high when there are too many user access requests.
By obtaining the difference between the current synchronization time and the historical synchronization time, the method of obtaining the order set is dynamically adjusted, including the first order set to be synchronized and the second order set to be synchronized. Combined with the preset synchronization interval, timely synchronization between the server database and the client database is achieved, and reasonable updates are performed on the client.
It improved the efficiency of order data synchronization and querying, reduced order information errors, optimized user experience, and reduced the consumption of server-side computing resources.
Smart Images

Figure CN116708472B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to an order synchronization method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the development of internet technology, online shopping applications have become increasingly widespread. As the demand for online shopping continues to rise, the timeliness of order updates and the speed of delivery have become important factors affecting the consumer shopping experience.
[0003] In related technologies, new order data is periodically retrieved by the server and stored in a server-side database. When users, such as couriers and shippers, query orders, they often need to manually search through the user interface or periodically update the database to obtain the latest order data. When order data changes, the lag in order data synchronization in these technologies results in the client still receiving outdated data, leading to errors in order information. Furthermore, when there are too many user requests, the server experiences significant computational and bandwidth pressure, impacting the user experience. Therefore, the order data synchronization and query efficiency in these technologies is relatively low.
[0004] There is currently no effective solution to the technical problems of low synchronization and query efficiency of order data in related technologies. Summary of the Invention
[0005] Based on this, this application provides an order synchronization method, apparatus, computer equipment, and storage medium to solve the technical problems of low synchronization efficiency and query efficiency of order data in related technologies.
[0006] Firstly, this application provides an order synchronization method applied to a server, the method comprising:
[0007] Obtain the current synchronization time and the historical synchronization time of the last update to the server database, which is updated based on a preset synchronization interval;
[0008] If the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, a first set of orders to be synchronized is obtained; if the synchronization time difference is not higher than the synchronization threshold, a second set of orders to be synchronized is obtained. The first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval.
[0009] The first or second order set to be synchronized is saved to the server database, and the updated data in the server database is sent to the client so that the client synchronizes the server database to the client database.
[0010] In one embodiment, the method further includes:
[0011] If the synchronization time difference is not higher than the preset synchronization interval, then a third set of orders to be synchronized is obtained, and the third set of orders to be synchronized is determined based on the preset synchronization interval.
[0012] In one embodiment, after saving the first or second order set to be synchronized to the server database, the method further includes:
[0013] The current synchronization time point is saved to the server database.
[0014] In one embodiment, the method further includes:
[0015] Obtain the current inspection time and the historical inspection time of the last inspection of the server database. The server database is inspected based on a preset inspection interval, and the current inspection time is determined based on the current synchronization time.
[0016] If the difference between the current inspection time and the historical inspection time is higher than the inspection threshold, a first set of orders to be inspected is obtained; if the difference between the inspection time and the inspection threshold is not higher than the inspection threshold, a second set of orders to be inspected is obtained. The first set of orders to be inspected is determined based on the difference between the inspection time and the second set of orders to be inspected is determined based on the difference between the inspection time and the preset inspection interval.
[0017] The first set of orders to be checked or the second set of orders to be checked is matched and checked in the server database. If an out-of-sync order is found in the server database, the out-of-sync order is saved to the server database.
[0018] Secondly, this application provides an order synchronization method applied to a client, including the order synchronization method described in any one of the embodiments of the first aspect above, the method further comprising:
[0019] Obtain the last update time of the client database;
[0020] If the time without update is higher than the time without update threshold, the server database is synchronized to the client database using a full update method. If the time without update is not higher than the time without update threshold, the server database is synchronized to the client database using an incremental update method.
[0021] In one embodiment, after synchronizing the server-side database to the client-side database, the process further includes:
[0022] Obtain the shipping addresses of orders in the client database, and merge orders with the same shipping address.
[0023] In one embodiment, after synchronizing the server-side database to the client-side database, the process further includes:
[0024] Obtain printer status information and / or order status information, and send unprinted orders to the printer based on the printer status information and / or order status information.
[0025] In one embodiment, after synchronizing the server-side database to the client-side database, the process further includes:
[0026] Obtain the user's query request, which contains the order to be queried;
[0027] Based on the query request, the client data is matched and retrieved to obtain relevant information about the order to be queried;
[0028] The relevant information for the order to be queried is displayed on the page.
[0029] Thirdly, this application also provides an order synchronization device, the device comprising:
[0030] The first acquisition module is used to acquire the current synchronization time point and the historical synchronization time point of the last update to the server database, wherein the server database is updated based on a preset synchronization interval;
[0031] The second acquisition module is used to acquire a first set of orders to be synchronized if the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, and to acquire a second set of orders to be synchronized if the synchronization time difference is not higher than the synchronization threshold; the first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval.
[0032] The storage module is used to save the first order set to be synchronized or the second order set to be synchronized to the server database, and send the updated data in the server database to the client so that the client synchronizes the server database to the client database.
[0033] Fourthly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0034] Obtain the current synchronization time and the historical synchronization time of the last update to the server database, which is updated based on a preset synchronization interval;
[0035] If the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, a first set of orders to be synchronized is obtained; if the synchronization time difference is not higher than the synchronization threshold, a second set of orders to be synchronized is obtained. The first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval.
[0036] The first or second order set to be synchronized is saved to the server database, and the updated data in the server database is sent to the client so that the client synchronizes the server database to the client database.
[0037] Fifthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0038] Obtain the current synchronization time and the historical synchronization time of the last update to the server database, which is updated based on a preset synchronization interval;
[0039] If the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, a first set of orders to be synchronized is obtained; if the synchronization time difference is not higher than the synchronization threshold, a second set of orders to be synchronized is obtained. The first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval.
[0040] The first or second order set to be synchronized is saved to the server database, and the updated data in the server database is sent to the client so that the client synchronizes the server database to the client database.
[0041] This application provides an order synchronization method, apparatus, computer device, and storage medium. The method includes: obtaining the current synchronization time point and the historical synchronization time point of the last update to a server-side database, wherein the server-side database is updated based on a preset synchronization interval; if the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than a synchronization threshold, then obtaining a first set of orders to be synchronized; if the synchronization time difference is not higher than the synchronization threshold, then obtaining a second set of orders to be synchronized; the first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval; saving the first set of orders to be synchronized or the second set of orders to be synchronized to the server-side database, and sending the updated data in the server-side database to a client, so that the client synchronizes the server-side database to its own database. This application, while periodically updating the server-side database, also obtains the time when the server-side database has not been updated and retrieves the orders to be synchronized based on that time for updating, ensuring the timeliness of order data updates. Simultaneously, the aforementioned order data is promptly synchronized to the client-side database, allowing users to directly query the latest order information on the client without needing to access the server via a network channel. This solves the technical problems of low synchronization and query efficiency of order data in related technologies, improving order synchronization and query efficiency, thereby increasing order delivery speed and optimizing the user experience. Attached Figure Description
[0042] Figure 1 This is an application environment diagram of an order synchronization method according to an embodiment of this application;
[0043] Figure 2 This is a flowchart illustrating an embodiment of the order synchronization method of this application;
[0044] Figure 3 This is a schematic diagram of a synchronization time axis according to an embodiment of this application;
[0045] Figure 4 This is a schematic diagram of the architecture of an order synchronization method according to an embodiment of this application;
[0046] Figure 5 This is a schematic diagram of the full synchronization process according to an embodiment of this application;
[0047] Figure 6 This is a schematic diagram of the incremental synchronization process according to an embodiment of this application;
[0048] Figure 7 This is a structural block diagram of an order synchronization device according to an embodiment of this application;
[0049] Figure 8This is an internal structural diagram of a computer device according to an embodiment of this application. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0051] The order synchronization method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located in the cloud or on other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0052] Please see Figure 2 , Figure 2 This is a flowchart illustrating an embodiment of the order synchronization method of this application.
[0053] In one embodiment, such as Figure 2 As shown, the order synchronization methods include:
[0054] S202: Obtain the current synchronization time and the historical synchronization time of the last update to the server database. The server database is updated based on a preset synchronization interval.
[0055] Specifically, during the order synchronization process, the server first obtains the current time as the current synchronization time for this synchronization task, and then obtains the time when the server database was last updated as the historical synchronization time for this synchronization task.
[0056] Specifically, in this embodiment, the server updates the server database periodically based on a preset synchronization interval. For example, with a preset synchronization interval of 1 second, the server retrieves new order data every 1 second and updates the server database.
[0057] S204: If the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, then obtain the first set of orders to be synchronized; if the synchronization time difference is not higher than the synchronization threshold, then obtain the second set of orders to be synchronized. The first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval.
[0058] Specifically, after obtaining the current synchronization time and the historical synchronization time, it is determined whether the difference between the current synchronization time and the historical synchronization time, i.e., the synchronization time difference, is higher than the synchronization threshold. If the synchronization time difference is higher than the synchronization threshold, it indicates that the server database has not been updated for a long time, and the first order set to be synchronized is obtained; if the synchronization time difference is lower than the synchronization threshold, it indicates that the server database has not been updated for a short time, and the second order set to be synchronized is obtained.
[0059] In this embodiment, the process of determining the first set of orders to be synchronized is as follows: determine the time period corresponding to the synchronization time difference between the current synchronization time point and the historical synchronization time point, and obtain all new orders added within the time period as the first set of orders to be synchronized.
[0060] In this embodiment, the process of determining the second set of orders to be synchronized is as follows: determine the first time period corresponding to the synchronization time difference between the current synchronization time point and the historical synchronization time point, and the second time period corresponding to a preset synchronization interval before the current time point; determine the third time period based on the difference between the first time period and the second time period; and obtain all new orders added within the third time period as the second set of orders to be synchronized.
[0061] Please see Figure 3 , Figure 3 This is a schematic diagram of a synchronization timeline according to an embodiment of this application.
[0062] For example, such as Figure 3 As shown, a preset time interval of 1 second is used. The current synchronization time point is 0s, the historical synchronization time point is -10s, and the synchronization time difference is 11 seconds. If the synchronization threshold is set to 5 seconds, the synchronization time difference is higher than the threshold, so all new orders from -10s to 0s are considered the first set of orders to be synchronized. If the synchronization threshold is set to 15 seconds, the synchronization time difference is lower than the threshold, so all new orders from -10s to -1s are considered the second set of orders to be synchronized. In this case, -10s to 0s corresponds to the first time period, -1s to 0s corresponds to the second time period, and -10s to -1s corresponds to the third time period.
[0063] In this embodiment, the synchronization threshold is used to measure the length of the interval between the current synchronization time point and the historical synchronization time point. The size of the synchronization threshold can be set based on the actual use scenario.
[0064] Understandably, when the synchronization time difference is higher than the synchronization threshold, the synchronization progress needs to be accelerated because the interval between the current synchronization time point and the historical synchronization time point is too long. Therefore, all new orders before the current synchronization time point are directly synchronized. When the synchronization time difference is not higher than the synchronization threshold, the synchronization progress does not need to be accelerated because the interval between the current synchronization time point and the historical synchronization time point is short. Therefore, only all new orders within the third time period mentioned above need to be synchronized. New orders within the second time period can be synchronized according to the normal preset synchronization interval update process.
[0065] S206: Save the first or second order set to be synchronized to the server database, and send the updated data in the server database to the client so that the client can synchronize the server database to the client database.
[0066] Specifically, after obtaining the first or second order set to be synchronized, the server writes either set to the server-side database to save the newly added orders. Then, the server sends the updated data from its database to the client, which receives and stores the data, thus synchronizing the server-side database to the client-side database.
[0067] Understandably, after synchronizing the server-side database to the client-side database, users can directly query and print orders in the client-side database without needing to access the server-side database.
[0068] In this embodiment, the server-side database is used as the server-side order search database.
[0069] Optionally, after saving the first or second set of orders to be synchronized to the server database, the order change time of all newly added orders can be adjusted to the current synchronization time.
[0070] This embodiment obtains the current synchronization time point and the historical synchronization time point of the last update to the server database. The server database is updated based on a preset synchronization interval. If the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, a first set of orders to be synchronized is obtained. If the synchronization time difference is not higher than the synchronization threshold, a second set of orders to be synchronized is obtained. The first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval. The first set of orders to be synchronized or the second set of orders to be synchronized is saved to the server database, and the updated data in the server database is sent to the client so that the client synchronizes the server database to the client database. This application, while periodically updating the server-side database, also obtains the time when the server-side database has not been updated and retrieves the orders to be synchronized based on that time for updating, ensuring the timeliness of order data updates. Simultaneously, the aforementioned order data is promptly synchronized to the client-side database, allowing users to directly query the latest order information on the client without needing to access the server via a network channel. This solves the technical problems of low synchronization and query efficiency of order data in related technologies, improving order synchronization and query efficiency, thereby increasing order delivery speed and optimizing the user experience.
[0071] In another embodiment, the method further includes:
[0072] If the synchronization time difference is not higher than the preset synchronization interval, then the third set of orders to be synchronized is obtained, and the third set of orders to be synchronized is determined based on the preset synchronization interval.
[0073] Specifically, if the synchronization time difference between the current synchronization point and the historical synchronization point is not higher than the preset synchronization interval, it indicates that the synchronization progress has caught up with the update progress based on the preset synchronization interval. At this time, it is only necessary to continue the update process for the preset synchronization interval. Specifically, within each preset synchronization interval, all newly added orders are obtained as the third set of orders to be synchronized and saved to the server database.
[0074] For example, the server-side database is periodically checked by a batch processing thread. If the synchronization progress has caught up with the update progress of the preset synchronization interval, the order synchronization method is adjusted to the normal synchronization of new orders according to the preset synchronization interval, such as synchronizing new orders within 1 second per second.
[0075] In this embodiment, if the synchronization progress of the server database catches up with the update progress of the preset synchronization interval, the order synchronization method is adjusted, and the orders are periodically updated according to the preset synchronization interval, thereby releasing the corresponding computing resources and reducing the cost of order synchronization.
[0076] In another embodiment, after saving the first or second order set to be synchronized to the server database, the method further includes:
[0077] Save the current synchronization time point to the server database.
[0078] Specifically, after saving the first or second set of orders to be synchronized to the server database, the current synchronization time point is also saved to the server database accordingly. Understandably, in the next synchronization process, this current synchronization time point will serve as the historical synchronization time point for that next synchronization process.
[0079] In this embodiment, after the synchronization of new orders is completed, the current synchronization time point is saved to the server database so that the historical synchronization time point can be obtained in the next synchronization process, thereby improving the efficiency of server-side order synchronization.
[0080] In another embodiment, the method further includes:
[0081] Step 1: Obtain the current check time and the historical check time of the last check of the server database. The server database is checked based on a preset check interval, and the current check time is determined based on the current synchronization time.
[0082] Step 2: If the difference between the current inspection time and the historical inspection time is higher than the inspection threshold, then obtain the first set of orders to be inspected; if the difference is not higher than the inspection threshold, then obtain the second set of orders to be inspected. The first set of orders to be inspected is determined based on the difference in inspection time, and the second set of orders to be inspected is determined based on the difference in inspection time and the preset inspection interval.
[0083] Step 3: Perform a matching check on the first or second order set to be checked in the server database. If any unsynchronized orders are found in the server database, save the unsynchronized orders to the server database.
[0084] Specifically, the current inspection time and the historical inspection time of the last inspection of the server database are obtained. In this embodiment, the server database performs routine inspections based on a preset inspection interval.
[0085] In this embodiment, the current inspection time point needs to be determined based on the current synchronization time point. To avoid the inspection progress catching up with the synchronization progress, the current inspection time point is generally set later than the current synchronization time point. For example, the current synchronization time point is subtracted by 10 seconds to obtain the current inspection time point.
[0086] Specifically, it is determined whether the difference between the current inspection time and the historical inspection time is higher than the inspection threshold. If the difference is higher than the inspection threshold, it indicates that the server database has not been inspected for a long time, and the first set of orders to be inspected is obtained. If the difference is lower than the inspection threshold, it indicates that the server database has not been inspected for a short time, and the second set of orders to be inspected is obtained.
[0087] In this embodiment, the process of determining the first set of orders to be inspected is as follows: determine the time period corresponding to the time difference between the current inspection time point and the historical inspection time point, and obtain all new orders added within this time period as the first set of orders to be inspected.
[0088] In this embodiment, the process of determining the second set of orders to be inspected is as follows: determine the fourth time period corresponding to the difference between the current inspection time point and the historical inspection time point, and the fifth time period corresponding to a preset inspection interval before the current inspection time point; determine the sixth time period based on the difference between the fourth time period and the fifth time period; and obtain all new orders added within the sixth time period as the second set of orders to be inspected.
[0089] In this embodiment, the inspection threshold is used to measure the length of the interval between the current inspection time point and the historical inspection time point. The size of the inspection threshold can be set based on the actual use scenario.
[0090] Understandably, when the inspection time difference is higher than the inspection threshold, the inspection process needs to be accelerated because the interval between the current inspection time and the historical inspection time is too long. Therefore, all new orders before the current inspection time are directly obtained for inspection. When the inspection time difference is not higher than the inspection threshold, the inspection process does not need to be accelerated because the interval between the current inspection time and the historical inspection time is short. Therefore, only all new orders within the sixth time period mentioned above need to be inspected. New orders within the fourth time period can be inspected according to the normal preset inspection interval process.
[0091] Specifically, after obtaining the first or second set of orders to be checked, all the orders mentioned above are retrieved in the server database. If an unsynchronized order is found that exists in the first or second set of orders to be checked but does not exist in the server database, the unsynchronized order is saved to the server database, thereby making up for the orders missed during the synchronization process.
[0092] For example, during the inspection process, a batch processing thread performs periodic checks on the order data in the server-side database. If the inspection progress has caught up with the inspection progress based on a preset inspection interval, the inspection method is adjusted to a regular inspection based on the preset inspection interval. For example, checking every second whether orders added within 1 second have been completed synchronously.
[0093] For example, after completing the current inspection process, the current inspection time point is saved to the server database so that it can be used as a historical inspection time point for the next inspection process.
[0094] Please see Figure 4 , Figure 4 This is a schematic diagram of the architecture of an order synchronization method according to an embodiment of this application.
[0095] For example, such as Figure 4 As shown, the server receives order data such as the order search table and order update time, and performs synchronization and inspection on the orders based on the synchronization thread group and the order replenishment thread group in the server, thereby obtaining the order table data in the server database.
[0096] In this embodiment, while periodically checking the server database through a regular check process based on a preset check interval, the unchecked time of the server database is determined based on the time difference between the current check time and the historical check time. New orders are then checked based on the length of this unchecked time, thereby more effectively avoiding the problem of order omissions that may occur during the synchronization of new orders by the server, reducing the probability of lost orders, and improving the accuracy of order synchronization.
[0097] In another embodiment, the order synchronization method further includes:
[0098] Step 1: Obtain the last update time of the client database;
[0099] Step 2: If the time without update is higher than the time without update threshold, the server database will be synchronized to the client database using a full update method. If the time without update is not higher than the time without update threshold, the server database will be synchronized to the client database using an incremental update method.
[0100] Specifically, the order synchronization method in this embodiment applies to a client, and the steps of the order synchronization method executed by the server corresponding to the client include the steps of any of the above embodiments. Specifically, when the client synchronizes the server database, it first determines the unupdated time based on the current synchronization time and the historical time of the last synchronization, and then determines whether the unupdated time is higher than the unupdated threshold. If the unupdated time of the client database is higher than the unupdated threshold, it indicates that the unupdated time of the client database is relatively long, and in this case, the server database is synchronized to the client database through a full update; if the unupdated time of the client database is not higher than the unupdated threshold, it indicates that the unupdated time of the client database is relatively short, and in this case, the server database is synchronized to the client database through an incremental update.
[0101] In this embodiment, the value of the unupdated threshold can be set based on the actual usage scenario.
[0102] For example, before synchronizing the client database, it is necessary to determine whether the user's browser supports the client database, so that the user can directly operate on the client database through the browser.
[0103] Please see Figure 5 , Figure 5 This is a schematic diagram of the full synchronization process according to an embodiment of this application.
[0104] For example, such as Figure 5 As shown, order data in the client database is synchronized using a full synchronization method. First, the total number of orders is obtained, for example, the total number of pending and shipped orders generated within the last three months. It is then determined whether the total number of orders exceeds a threshold. If it exceeds the threshold, it indicates that the total number of orders is too high. In this case, the user is prompted to synchronize orders according to time periods, thereby achieving batch processing synchronization and reducing the waiting time for each synchronization task. If it does not exceed the threshold, it indicates that the total number of orders is low, and synchronization is performed automatically. After the client obtains the order data to be synchronized, it first clears the local data in the client database and then synchronizes the order data to the client database.
[0105] For example, in this embodiment, the order data synchronized to the client database includes, but is not limited to, detailed order information, printing operation information, etc.
[0106] Please see Figure 6 , Figure 6 This is a schematic diagram of the incremental synchronization process according to an embodiment of this application.
[0107] For example, in this embodiment, a long connection or polling mechanism is established between the client and the server for real-time communication. Figure 6 As shown, when a new order or order information change occurs on the server, the server retrieves the new order or order change information; it determines whether to remind the user to update the client database. If not, the client database is automatically updated to minimize disruption to the user; if a user needs to be reminded, the server determines the corresponding reminder type, which includes strong reminders and weak reminders, and the reminder type can be determined based on the importance of the changed order; after the user receives the reminder and agrees to the update, the client database is updated.
[0108] In this embodiment, the time since the last update of the client database is obtained, and the order data synchronization method of the client database is determined based on the length of the time since the last update: full synchronization or component synchronization. This allows for reasonable configuration of computing and communication resources for the synchronization process based on different situations, reducing the cost of order synchronization and improving the efficiency of order synchronization.
[0109] In another embodiment, after synchronizing the server-side database to the client-side database, the process further includes:
[0110] Retrieve the shipping addresses of orders from the client database and merge orders with the same shipping address.
[0111] Specifically, after synchronizing the server database to the client database, the client retrieves the shipping addresses of the orders in the client database and merges orders with the same shipping address.
[0112] For example, during the order merging process, if the order status is "pending printing", the orders are merged directly; if the order status is "printed", a pop-up window prompts the user whether they need to merge the orders.
[0113] In this embodiment, orders with the same delivery address are merged, thereby avoiding multiple printing and shipping of orders with the same delivery address in the subsequent processing, and preventing the same consumer from receiving multiple orders multiple times, reducing delivery costs and optimizing the consumer experience.
[0114] In another embodiment, after synchronizing the server-side database to the client-side database, the process further includes:
[0115] Obtain printer status information and / or order status information, and send unprinted orders to the printer based on the printer status information and / or order status information.
[0116] Specifically, before a user prints a new order from the client database, the system first obtains the printer status information and the order status information. Based on the printer status information and the order status information, it determines whether to print and sends any unprinted orders to the printer.
[0117] In this embodiment, the printer status information includes, but is not limited to: whether the printer is functioning properly, and whether the printing components are connected correctly. The order status information in this embodiment includes, but is not limited to: whether the current order synchronization is normal, whether the current order list contains duplicate tracking numbers, whether the current order list has already been printed, whether the current order list is in the process of refunding or not pending shipment, and whether the printing status of the order to be printed is consistent with the server status.
[0118] Specifically, once all the printer status information and order status information have passed the checks, the operation of printing the waybill is executed. The unprinted orders are sent to the printer for printing, and the printing information is updated to the server database after successful printing.
[0119] For example, the relevant code for detecting order status information and printer status information is as follows:
[0120]
[0121]
[0122]
[0123]
[0124] Optionally, in this embodiment, if the order status changes to "refund in progress" or "not yet ready to ship" before printing the order, the order status is marked as "unoperable" to avoid printing the order by mistake.
[0125] Optionally, when order information in the client database changes, if the order status is "printed", a pop-up window will prompt the user to check to avoid incorrect printing and shipment; if the order status is "not printed", the order information will be partially updated directly to avoid interfering with the user's operation.
[0126] In this embodiment, before printing an order, the printer status information and the order status information are first obtained. The printing operation is determined based on the printer status information and the order status information, which improves the accuracy of order printing and reduces the probability of misprinting and misdelivery of orders.
[0127] In another embodiment, after synchronizing the server-side database to the client-side database, the process further includes:
[0128] Step 1: Obtain the user's query request, which contains the order to be queried;
[0129] Step 2: Based on the query request, perform matching and retrieval in the client data and obtain relevant information about the order to be queried;
[0130] Step 3: Display the relevant information of the order to be queried on the display page.
[0131] Specifically, when a user queries order information based on the client database, the client first obtains the query request entered by the user from the display page. This query request contains the order to be queried. Based on the order information in the query request, the client searches the client database to obtain the order and related information, and then displays the information on the display page.
[0132] For example, a user's query request may include the order number of the order to be queried. The client uses the order number to search for the corresponding order and related information such as the recipient and products in the client database, and then displays the order information on the display page.
[0133] In this embodiment, the system receives the user's query request and queries the order in the client database. This eliminates the need to access the server through a network channel, avoiding the impact of network congestion on order queries and improving the efficiency of order queries for users.
[0134] In another embodiment, before an order needs to be shipped, it is checked whether the list of orders to be shipped contains submitted but not printed orders and orders in the process of being refunded. If they do not exist, the shipping procedure is called to ship the orders in the list of orders to be shipped. If they exist, the submitted but not printed orders and orders in the process of being refunded are checked to avoid errors in the order shipping process.
[0135] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0136] Based on the same inventive concept, this application also provides an order synchronization apparatus for implementing the order synchronization method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more order synchronization apparatus embodiments provided below can be found in the limitations of the order synchronization method described above, and will not be repeated here.
[0137] In one embodiment, such as Figure 7 As shown, an order synchronization device is provided, comprising:
[0138] The first acquisition module 10 is used to acquire the current synchronization time point and the historical synchronization time point of the last update to the server database. The server database is updated based on a preset synchronization interval.
[0139] The second acquisition module 20 is used to acquire a first set of orders to be synchronized if the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, and to acquire a second set of orders to be synchronized if the synchronization time difference is not higher than the synchronization threshold. The first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval.
[0140] The storage module 30 is used to save the first or second order set to be synchronized to the server database and send the updated data in the server database to the client so that the client can synchronize the server database to the client database.
[0141] The order synchronization device also includes a third acquisition module;
[0142] The third acquisition module is used to acquire the third set of orders to be synchronized if the synchronization time difference is not higher than the preset synchronization interval. The third set of orders to be synchronized is determined based on the preset synchronization interval.
[0143] The order synchronization device also includes a time point storage module;
[0144] The time point saving module is used to save the current synchronization time point to the server database;
[0145] The order synchronization device also includes a checking module;
[0146] The inspection module is used to obtain the current inspection time and the historical inspection time of the last inspection of the server database. The server database is inspected based on a preset inspection interval, and the current inspection time is determined based on the current synchronization time.
[0147] If the difference between the current inspection time and the historical inspection time is higher than the inspection threshold, a first set of orders to be inspected is obtained; if the difference is not higher than the inspection threshold, a second set of orders to be inspected is obtained. The first set of orders to be inspected is determined based on the difference in inspection time, and the second set of orders to be inspected is determined based on the difference in inspection time and the preset inspection interval.
[0148] The first or second set of orders to be checked is matched against the server database. If any unsynchronized orders are found in the server database, they are saved to the server database.
[0149] Each module in the aforementioned order synchronization device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0150] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, memory, and network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores order data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements an order synchronization method. The display screen can be an LCD screen or an e-ink display screen. The input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device casing, or an external keyboard, touchpad, or mouse.
[0151] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0152] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0153] Get the current synchronization time and the historical synchronization time of the last update to the server database. The server database is updated based on a preset synchronization interval.
[0154] If the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, then the first set of orders to be synchronized is obtained; if the synchronization time difference is not higher than the synchronization threshold, then the second set of orders to be synchronized is obtained. The first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval.
[0155] Save the first or second set of orders to be synchronized to the server database, and send the updated data from the server database to the client so that the client can synchronize the server database to the client database.
[0156] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0157] Get the current synchronization time and the historical synchronization time of the last update to the server database. The server database is updated based on a preset synchronization interval.
[0158] If the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, then the first set of orders to be synchronized is obtained; if the synchronization time difference is not higher than the synchronization threshold, then the second set of orders to be synchronized is obtained. The first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval.
[0159] Save the first or second set of orders to be synchronized to the server database, and send the updated data from the server database to the client so that the client can synchronize the server database to the client database.
[0160] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0161] Get the current synchronization time and the historical synchronization time of the last update to the server database. The server database is updated based on a preset synchronization interval.
[0162] If the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, then the first set of orders to be synchronized is obtained; if the synchronization time difference is not higher than the synchronization threshold, then the second set of orders to be synchronized is obtained. The first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval.
[0163] Save the first or second set of orders to be synchronized to the server database, and send the updated data from the server database to the client so that the client can synchronize the server database to the client database.
[0164] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0165] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0166] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0167] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. An order synchronization method, applied to the server side, characterized in that, The method includes: Obtain the current synchronization time and the historical synchronization time of the last update to the server database, which is updated based on a preset synchronization interval; If the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, a first set of orders to be synchronized is obtained; if the synchronization time difference is not higher than the synchronization threshold, a second set of orders to be synchronized is obtained. The first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval. The first or second order set to be synchronized is saved to the server database, and the updated data in the server database is sent to the client so that the client synchronizes the server database to the client database. The method further includes: Obtain the current inspection time and the historical inspection time of the last inspection of the server database. The server database is inspected based on a preset inspection interval, and the current inspection time is determined based on the current synchronization time. If the difference between the current inspection time and the historical inspection time is higher than the inspection threshold, a first set of orders to be inspected is obtained; if the difference between the inspection time and the inspection threshold is not higher than the inspection threshold, a second set of orders to be inspected is obtained. The first set of orders to be inspected is determined based on the difference between the inspection time and the second set of orders to be inspected is determined based on the difference between the inspection time and the preset inspection interval. The first set of orders to be checked or the second set of orders to be checked is matched and checked in the server database. If an out-of-sync order is found in the server database, the out-of-sync order is saved to the server database.
2. The order synchronization method according to claim 1, characterized in that, The method further includes: If the synchronization time difference is not higher than the preset synchronization interval, then a third set of orders to be synchronized is obtained, and the third set of orders to be synchronized is determined based on the preset synchronization interval.
3. The order synchronization method according to claim 1, characterized in that, After saving the first or second order set to be synchronized to the server database, the method further includes: The current synchronization time point is saved to the server database.
4. An order synchronization method, applied to a client, comprising the order synchronization method according to any one of claims 1-3, characterized in that, The method further includes: Obtain the last update time of the client database; If the time without update is higher than the time without update threshold, the server database is synchronized to the client database using a full update method. If the time without update is not higher than the time without update threshold, the server database is synchronized to the client database using an incremental update method.
5. The order synchronization method according to claim 4, characterized in that, The process of synchronizing the server database to the client database also includes: Obtain the shipping addresses of orders in the client database, and merge orders with the same shipping address.
6. The order synchronization method according to claim 4, characterized in that, The process of synchronizing the server database to the client database also includes: Obtain printer status information and / or order status information, and send unprinted orders to the printer based on the printer status information and / or order status information.
7. The order synchronization method according to claim 4, characterized in that, The process of synchronizing the server database to the client database also includes: Obtain the user's query request, which contains the order to be queried; Based on the query request, a matching search is performed in the client database to obtain relevant information about the order to be queried; The relevant information for the order to be queried is displayed on the page.
8. An order synchronization device, characterized in that, The device includes: The first acquisition module is used to acquire the current synchronization time point and the historical synchronization time point of the last update to the server database, wherein the server database is updated based on a preset synchronization interval; The second acquisition module is used to acquire a first set of orders to be synchronized if the synchronization time difference between the current synchronization time point and the historical synchronization time point is higher than the synchronization threshold, and to acquire a second set of orders to be synchronized if the synchronization time difference is not higher than the synchronization threshold; the first set of orders to be synchronized is determined based on the synchronization time difference, and the second set of orders to be synchronized is determined based on the synchronization time difference and the preset synchronization interval. The storage module is used to save the first order set to be synchronized or the second order set to be synchronized to the server database, and send the updated data in the server database to the client so that the client can synchronize the server database to the client database. The second acquisition module is further configured to acquire the current inspection time point and the historical inspection time point of the last inspection of the server database, wherein the server database is inspected based on a preset inspection interval, and the current inspection time point is determined based on the current synchronization time point; if the inspection time difference between the current inspection time point and the historical inspection time point is higher than an inspection threshold, a first set of orders to be inspected is acquired; if the inspection time difference is not higher than the inspection threshold, a second set of orders to be inspected is acquired; the first set of orders to be inspected is determined based on the inspection time difference, and the second set of orders to be inspected is determined based on the inspection time difference and the preset inspection interval; a matching inspection is performed on the first set of orders to be inspected or the second set of orders to be inspected in the server database; if an out-of-synchronization order is found in the server database, the out-of-synchronization order is saved to the server database.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.