Data synchronization method and device, computer readable storage medium and electronic equipment
By comparing the order update time between terminal and cloud, the problem of inaccurate multi-terminal data during table dining is solved, and the timely synchronous update of data is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202411727709.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-04-25
AI Technical Summary
In the dining scene of tables, multiple terminals perform orders and checkout operations on the same table, resulting in inaccurate data, and possible missed checkout and inventory disorders.
By comparing the latest update times of local orders and cloud orders for each terminal, determine whether the local order and cloud order data need to be updated to ensure that the data of each terminal and cloud is synchronized.
It realizes timely synchronous update of multi-terminal data during table dining, avoids the problem of inaccurate data and improves user experience.
Smart Images

Figure CN119892851A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Internet technology, and in particular to a data synchronization method, device, computer-readable storage medium, and electronic device. Background Art
[0002] With the rapid development of the Internet, more and more industries are realizing intelligence and efficiency on the Internet.
[0003] Taking the catering industry as an example, by using Internet technology, people can order food through the terminal without having to manually register the order, which is convenient and fast.
[0004] However, for table dining, multiple terminals are often used for ordering and checkout operations at the same table. This may result in inaccurate data such as missed dishes and inventory disorders, which in turn brings a bad experience to users. Summary of the invention
[0005] The main purpose of the present disclosure is to provide a data synchronization method, device, computer-readable storage medium and electronic device to solve the problem of inaccurate data for table dining in the related art.
[0006] In order to achieve the above object, the first aspect of the present disclosure provides a data synchronization method, comprising:
[0007] In response to first requests from multiple first terminals for a target table, determining a processing order for each of the first terminals; wherein the first request is used to request to place an order or update an order;
[0008] According to the processing order, the following first operation is performed on each of the first terminals in turn:
[0009] Obtain the latest update time of the local order currently corresponding to the first terminal and the latest update time of the same order corresponding to the target table stored in the cloud;
[0010] If the latest update time of the local order corresponding to the current first terminal is consistent with the latest update time of the same order corresponding to the cloud, then update the order data in the cloud, and synchronize the latest updated order data in the cloud to the current first terminal, so that the current first terminal updates the order data of the corresponding local order;
[0011] If the latest update time of the local order corresponding to the first terminal is inconsistent with the latest update time of the same order corresponding to the cloud, instruct the first terminal to update the order data of the corresponding local order;
[0012] The order data at least includes the time of the order.
[0013] Optionally, further, the instructing the first terminal to update the order data of the corresponding local order includes:
[0014] Generate first information, where the first information is used to prompt that current order data has been changed;
[0015] Sending first information to the current first terminal, so that the current first terminal obtains the latest updated order data from the cloud, so as to update the order data of the local order corresponding to the current first terminal;
[0016] Displaying first information and a first control on a current interface of the first terminal;
[0017] The first control is used for the first terminal to currently execute at least one of the following:
[0018] confirming the first information;
[0019] View the latest order data;
[0020] Re-order or update your order.
[0021] Optionally, further, the determining a processing order for each of the first terminals includes:
[0022] If there is one first terminal, determining that the processing order of the first terminal is the first;
[0023] If there are multiple first terminals, the request time nodes of the first requests received from each first terminal are obtained, and the time sequence of the request time nodes of each first request is used as the processing sequence of each first terminal.
[0024] Optionally, further, the method further includes:
[0025] If it is detected that the order data in the cloud has changed, second information is generated, where the second information is used to prompt that the current order data has changed;
[0026] Sending second information to a second terminal and / or remaining first terminals except the current first terminal, so that the second terminal and / or the remaining first terminals obtain the latest updated order data from the cloud, so as to update the order data of the local order corresponding to the second terminal and / or the order data of the local order corresponding to the remaining first terminals;
[0027] Displaying second information and a second control on a current interface of the second terminal or a current interface of the remaining first terminals;
[0028] The second terminal is a terminal whose current interface supports triggering the first request and has not currently sent the first request, the second information is used to prompt that the current order data has been changed, and the second control is used for the second terminal or the remaining first terminals to perform at least one of the following:
[0029] confirming the first information;
[0030] View the latest order data;
[0031] Re-order or update your order.
[0032] Optionally, further, the method further includes:
[0033] In response to a second request of at least one third terminal for a target table in an idle state, obtaining a request time node of the second request received from each of the third terminals, wherein the second request is used to request to start a table;
[0034] According to the request time nodes of each second request, determining to perform a table opening operation for the second target terminal, so as to display the first interface on the second target terminal; wherein the second target terminal is a third terminal corresponding to the earliest request time node among all the request time nodes of the second requests, and the first interface is an operable interface for table ordering;
[0035] Sending third information to other third terminals except the second target terminal, and updating the status of the target table; wherein the third information is used to prompt that the target table has been opened.
[0036] Optionally, further, the method further includes:
[0037] In response to a third request from a third target terminal, locking the target table, so that the third target terminal checks out the order of the target table; wherein the third request is used to request checkout, and the third target terminal is any of the first terminals or any of the second terminals; and
[0038] The current interface of the first terminal or the second terminal except the third target terminal is controlled to be an inoperable interface.
[0039] Optionally, further, the method further includes:
[0040] After locking the target table, it is automatically unlocked by the following second operation:
[0041] The time starts from the lock order and reaches the preset time interval; or,
[0042] The action that triggers exit checkout.
[0043] A second aspect of the present disclosure provides a data synchronization device, including:
[0044] a determining unit, configured to determine a processing order for each of the first terminals in response to first requests for a target table from a plurality of first terminals, wherein the first request is used to request to place an order or update an order;
[0045] A processing unit, configured to perform the following first operation on each of the first terminals in sequence according to the processing order:
[0046] Obtain the latest update time of the local order currently corresponding to the first terminal and the latest update time of the same order corresponding to the target table stored in the cloud;
[0047] If the latest update time of the local order corresponding to the current first terminal is consistent with the latest update time of the order corresponding to the cloud, then update the order data of the cloud, and synchronize the latest updated order data of the cloud to the current first terminal, so that the current first terminal updates the order data of the corresponding local order;
[0048] If the latest update time of the local order corresponding to the current first terminal is inconsistent with the latest update time corresponding to the cloud, instructing the current first terminal to update the order data of the corresponding local order;
[0049] The order data at least includes the time of the order.
[0050] A third aspect of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data synchronization method provided by any one of the first aspects.
[0051] The fourth aspect of the present disclosure provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor executes the data synchronization method provided in any one of the first aspects.
[0052] A fifth aspect of the present disclosure provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, implements the data synchronization method provided in any one of the first aspects.
[0053] In the data synchronization method provided in the embodiment of the present disclosure, when a request for placing an order or updating an order based on a target table is received from each first terminal, data is processed in sequence on each first terminal in a determined processing order. By comparing whether the latest update time of the local order corresponding to the first terminal is consistent with the latest update time of the order corresponding to the cloud, it is determined whether the order data of the local order corresponding to the first terminal or the order data in the cloud needs to be updated, thereby achieving the purpose of data synchronization between the terminal and the cloud and / or data synchronization between terminals, thereby achieving the technical effect of timely synchronization and update of multi-terminal data when dining at the table, and further solving the technical problems of inaccurate data such as missed checkout of dishes and inventory disorder caused by untimely data update. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1 A schematic diagram of a scenario of a data synchronization method provided by an embodiment of the present disclosure;
[0056] Figure 2 Schematic diagram of the interface of the data synchronization method provided by the embodiment of the present disclosure Figure 1 ;
[0057] Figure 3 Schematic diagram of the interface of the data synchronization method provided by the embodiment of the present disclosure Figure 2 ;
[0058] Figure 4 Schematic diagram of the interface of the data synchronization method provided by the embodiment of the present disclosure Figure 3 ;
[0059] Figure 5 A flowchart of a data synchronization method provided by an embodiment of the present disclosure;
[0060] Figure 6 Schematic diagram of the interface of the data synchronization method provided by the embodiment of the present disclosure Figure 4 ;
[0061] Figure 7 A block diagram of a data synchronization device provided in an embodiment of the present disclosure;
[0062] Figure 8 A block diagram of an electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0063] In order to enable those skilled in the art to better understand the disclosed solution, the technical solution in the disclosed embodiment will be clearly and completely described below in conjunction with the drawings in the disclosed embodiment. Obviously, the described embodiment is only a part of the disclosed embodiment, not all of the embodiments. Based on the embodiments in the disclosed embodiment, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the disclosed embodiment.
[0064] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so as to describe the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0065] In the present disclosure, the terms "upper", "lower", "left", "right", "front", "back", "top", "bottom", "inner", "outer", "middle", "vertical", "horizontal", "lateral", "longitudinal" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the drawings. These terms are mainly used to better describe the present disclosure and its embodiments, and are not used to limit the indicated devices, elements or components to have a specific orientation, or to be constructed and operated in a specific orientation.
[0066] In addition, some of the above terms may be used to express other meanings in addition to indicating orientation or positional relationship. For example, the term "on" may also be used to express a certain dependency or connection relationship in some cases. For those of ordinary skill in the art, the specific meanings of these terms in this disclosure can be understood according to specific circumstances.
[0067] In addition, the terms "installed", "set", "provided with", "connected", "connected", and "socketed" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral structure; it can be a mechanical connection, or an electrical connection; it can be a direct connection, or an indirect connection through an intermediate medium, or it can be an internal connection between two devices, elements, or components. For those of ordinary skill in the art, the specific meanings of the above terms in this disclosure can be understood according to specific circumstances.
[0068] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0069] Currently, in the catering industry, you can order food through terminals without having to manually register the order, which is convenient and fast. However, for table dining, different terminals are often used to place orders for the same table, which may result in inaccurate data such as missed dishes and disordered inventory, which in turn brings a bad experience to users.
[0070] In order to solve the above problems, the technical concept of the present invention is that for any terminal that initiates an order request or an order update request, it can determine whether to update the order data of the local order corresponding to the terminal and / or update the order data stored in the cloud by comparing the latest update time of the local order corresponding to the terminal and the latest update time of the same order stored in the cloud. This ensures data synchronization between the terminal and the cloud, and realizes multi-terminal data synchronization. Since each terminal can achieve data synchronization with the cloud through the above process, and then achieves data synchronization between multiple terminals, it ensures the timeliness of data updates during table dining, thereby ensuring data accuracy and improving user experience.
[0071] In practical applications, the execution subject of the present disclosure may be a data synchronization device, which may be deployed in an electronic device, such as a server. The following takes the case where the client of the data synchronization device is installed on a terminal device (e.g., a terminal device 1 with an application (Application, APP) having an ordering function installed, a cash register with an ordering function, etc., where the cash register can be used as a terminal device 2) or a terminal device that supports the function of the data synchronization device (e.g., a terminal device 3 having the same table ordering function as the APP or cash register installed through a QR code scanning applet), and the data synchronization process is performed by the service end (such as a server) of the data synchronization device, and the order data of the order of each terminal device is stored or cached in the cloud as an example, and the data synchronization method is described in detail.
[0072] For example, see Figure 1 As shown, Figure 1A scenario diagram of the data synchronization method provided for the embodiment of the present disclosure. Taking a certain merchant's ordering system as an example, the ordering system includes multiple clients 101 (or ordering applets) (for example, terminal device A and terminal device B), a server 102, and a cloud 103; wherein the client 101 (or ordering applets) is used to provide an ordering operation interface, the server is used to process the data generated by ordering (such as data synchronization), and the cloud is used to store or cache the order data of each terminal device ordering, and the order data (or order information) includes product data, order number, order time, discount information, membership information, ordering user information, etc. The ordering process may include: opening a table, placing an order, and checking out.
[0073] Specifically, multi-terminal devices, such as terminal device 1, terminal device 2, and terminal device 3, can be regarded as three different types of terminals, and the same group of consumers can be regarded as a group of users. Taking two groups of users as an example (user group 1 and user group 2), when dining at the same merchant, first, user group 1 and user group 2 can open a table through at least one terminal device such as terminal device 1, terminal device 2, and terminal device 3 of each user in their respective user groups. For example: user group 1 uses terminal device 2 to open a table through the merchant's service personnel 1, user group 2 scans the code through the user's own terminal device 3 to enter the mini program to open a table, the service personnel opens the table by clicking on the table panel provided by terminal device 2, and the users of user group 2 open the table through the table panel provided by terminal device 3. Among them, before opening the table, the interfaces of terminal device 2 and terminal device 3 both display the current status of the merchant's table: idle state, pending order state (indicating that the table has not been ordered yet), occupied state (indicating that the table has been ordered), pending clearing state (indicating that the table has not been cleared yet), etc., see Figure 2 As shown, in addition to displaying the status of each table, the table ordering interface can also display the number of tables in each state and the usage time (or cumulative usage time) of the occupied tables, etc., and can also customize the display of other information, which is not specifically limited here. In addition, in order to further distinguish the status of the table, different colors can be used to represent different states, or different shapes can be used to represent different states, and other methods can also be used to distinguish, which are not specifically limited here.
[0074] When waiter 1 uses terminal device 1 and waiter 2 uses terminal device 2 to open an idle table (for example, middle package 1) at the same time, server 102 will determine which terminal device to open based on the request time nodes of the opening requests triggered by terminal devices 1 and 2. For example, if the request time node of terminal device 1 is earlier than the request time node of terminal device 2, server 102 will prioritize the opening request of terminal device 1. After opening the table, the status of the table will be updated to the waiting order status, and terminal device 1 will display an operable interface for ordering. Figure 3 As shown, waiter 1 clicks on the "Middle Pack 1" which is in the idle state (see Figure 3 (a) in the figure), and then enter the interface where you can select specific start-up information (see Figure 3 (b) in the figure), by selecting the specific information of the opening, after confirming the opening, the "order" interface is displayed from the current interface, through the "order" interface (combined with Figure 6 As shown in FIG. 1 , the user can place an order, check out, etc., and the server 102 returns a prompt message to the terminal device 2 indicating that the table has been opened. Figure 4 As shown, waiter 2 clicks on the "middle package 1" which is in the idle state (see Figure 4 As shown in (a), since "Middle Package 1" has been opened for terminal device 1 at the server 102, the current interface of terminal device 2 now displays a prompt message "The current table has been opened, please pay attention to the opening information" (see Figure 4 (b) Vegetarian), by clicking the control used to indicate exit or the current interface automatically updates the status of the table (see Figure 4 As shown in (c), at this time, the total number of tables in the "waiting order state" has increased by 1, and the total number of tables in the "waiting to open" state has decreased by 1). At this time, user group 2 can reselect other idle tables through waiter 2 using terminal device 2. In addition, during the opening process, members, the number of diners, etc. can be selected.
[0075] The following takes user group 1 ordering as an example. After opening the terminal device 2, you can place an order through terminal device 1, terminal device 2, and terminal device 3 of each user of user group 1 (there can be multiple terminal devices 3): select products, discount methods, etc. When the terminal device places an order, the order data of the order will be synchronized to the cloud storage or cache, so that each terminal device can be synchronized with the data in the cloud, thereby realizing data synchronization of multiple terminal devices. Specifically, in the scenario where multiple terminal devices place orders at the same time, the server 102 will process the order request or update order request of each terminal device in a certain processing order: by comparing the latest update time of the local order corresponding to the terminal with the latest update time of the same order stored in the cloud, it is determined whether to update the order data of the local order corresponding to the terminal and / or update the order data stored in the cloud, thereby ensuring data synchronization between each terminal and the cloud.
[0076] During the checkout process, once a terminal device enters the checkout, in order to prevent other terminal devices from continuing to operate the table and causing data anomalies, the table will be locked and only the current checkout table can continue to operate.
[0077] Therefore, the present disclosure can achieve timely update of data, thereby ensuring the accuracy of ordering data.
[0078] It should be noted that in the technical solution of the present invention, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0079] The following specific embodiments are used to describe the technical solution of the present disclosure in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0080] The present disclosure provides a data synchronization method. Figure 5 As shown, the method includes the following steps S51 to S52:
[0081] Step S51: In response to first requests from multiple first terminals for a target table, determining a processing order for each first terminal; wherein the first request is used to request to place an order or update an order.
[0082] Step S52: Execute the first operation for each first terminal in turn according to the processing order.
[0083] The first operation includes:
[0084] Step a1: Obtain the latest update time of the local order corresponding to the first terminal and the latest update time of the same order corresponding to the target table stored in the cloud;
[0085] Step a2: If the latest update time of the local order corresponding to the current first terminal is consistent with the latest update time of the same order corresponding to the cloud, then update the order data in the cloud, and synchronize the latest updated order data in the cloud to the current first terminal, so that the current first terminal updates the order data of the corresponding local order;
[0086] Step a3: If the latest update time of the local order corresponding to the first terminal is inconsistent with the latest update time of the same order corresponding to the cloud, instruct the first terminal to update the order data of the corresponding local order.
[0087] The order data at least includes the time of the order, and the order may include local orders of each terminal, orders in the cloud, etc.
[0088] In the disclosed embodiments, for any terminal that initiates an order request or an order update request, a determination is made as to whether to update the order data of the local order corresponding to the terminal and / or update the order data stored in the cloud by comparing the latest update time of the local order corresponding to the terminal with the latest update time of the order stored in the cloud to see whether they are consistent, thereby ensuring data synchronization between the terminal and the cloud and realizing multi-terminal data synchronization. Since the above process can realize data synchronization between each terminal and the cloud, and then realize data synchronization between multiple terminals, the timeliness of data updates during table dining is guaranteed, thereby ensuring data accuracy and improving user experience.
[0089] Specifically, each terminal can place an order on the table to be ordered. Consumers (here refers to the user group) find the cashier (here refers to the service staff) to place an order using the cash register or APP, or scan the table code to purchase items to complete the order. After placing an order, the table enters the "occupied" state.
[0090] If multiple terminals are operating to place orders at the same time, in order to avoid data disorder on multiple terminals, such as device A's order data covering the dishes ordered by device B, each terminal places an order to the cloud. After the cloud updates the order, the latest order will be pushed to each terminal synchronously, and each terminal will update the dishes ordered in the shopping cart. Figure 6 shown.
[0091] In order to ensure that data on multiple terminals can be updated synchronously, when each terminal operates and updates orders, such as changing membership, adding or removing dishes, changing discounts, checking out, etc., it is necessary to first submit the shopping cart information of this terminal + the time of the current shopping cart update and compare it with the latest order time on the cloud. If the time is inconsistent, it is necessary to pull the latest order data from the cloud and the terminal can continue to circulate after it has updated itself. Otherwise, if the time of the last local order modification is consistent with the latest order update time on the cloud, the cloud data can be submitted and updated normally.
[0092] Optionally, the data synchronization method may further include:
[0093] In response to a first request from a first terminal to a target table, obtaining the latest update time of a local order currently corresponding to the first terminal and the latest update time of the same order corresponding to the target table stored in the cloud; wherein the first request is used to request to place an order or update an order;
[0094] If the latest update time of the local order corresponding to the first terminal is consistent with the latest update time of the same order corresponding to the cloud, then update the order data in the cloud, and synchronize the latest updated order data in the cloud to the first terminal, so that the first terminal updates the order data of the corresponding local order;
[0095] If the latest update time of the local order corresponding to the first terminal is inconsistent with the latest update time of the same order corresponding to the cloud, instructing the first terminal to update the order data of the corresponding local order;
[0096] and, instructing a second terminal to update order data of a corresponding local order, where the second terminal is a terminal whose current interface supports triggering the first request and which has not currently sent the first request;
[0097] The order data at least includes the time of the order.
[0098] In the disclosed embodiment, for a target table (i.e., the target table is a table opened for the current user group, the target table is in a waiting-for-order state or an occupied state, and currently only the user group or service personnel can place an order for the target table), if there is currently a first request triggered by a first terminal for the target table (for example, an order request or an order update request, where the first request also includes a request to add a product to a shopping cart), the server receives the first request and performs a first operation on the first terminal.
[0099] Specifically, for example, scenario 1: Terminal A places an order. Terminal A first calls the interface to check whether the update time of the local order of Terminal A is consistent with the time of the cloud order. If not, it pulls (here refers to obtaining) the latest order from the cloud to update the local terminal A, and then calls the order interface, which can ensure that the data is updated in time before the order is placed; if they are consistent, it continues to call the order interface.
[0100] The front end (here refers to terminal A) calls the order placement interface and transmits the latest update time of the local order of terminal A to the back end (here refers to the server). After receiving the request, the back end compares the time sent by the front end with the latest update time of the target table in the cloud. If they are consistent, the cloud order data is updated and the latest order data is synchronized to terminal A. Terminal A will update the local order and record the time of the updated order. If they are inconsistent, the front end is notified to update the local data of terminal A. Figure 6 As shown, the first information (such as "order information has been changed") is displayed on the interface of terminal A to prompt that the current order data has been changed. This can further ensure that the data is updated in a timely manner, thereby achieving data synchronization on multiple terminals.
[0101] The backend will also push the order change information to other terminals (including the second terminal) through websocket. After receiving the push, the other terminals will update their respective local orders and record the time of updating the order.
[0102] For example, scenario 2: Terminal A and Terminal B place an order at the same time. This is the same as the scenario 1 above where a single terminal (such as Terminal A) places an order. The difference is that when placing orders at the same time, when the backend receives the requests, they are also processed one by one. For example, the request of Terminal A is processed first. The processing process is described in the scenario 1 above. After the processing is completed, when processing Terminal B, the latest update time transmitted by Terminal B will inevitably be inconsistent with the cloud time. The backend will remind Terminal B to update the order and then place the order again. Optionally, instructing the current first terminal to update the order data of the corresponding local order includes:
[0103] Generate first information, where the first information is used to prompt that current order data has been changed;
[0104] Sending first information to the current first terminal, so that the current first terminal obtains the latest updated order data from the cloud, so as to update the order data of the local order corresponding to the current first terminal;
[0105] Displaying first information and a first control on a current interface of the first terminal;
[0106] The first control is used for the first terminal to currently execute at least one of the following:
[0107] confirming the first information;
[0108] View the latest order data;
[0109] Re-order or update your order.
[0110] In the disclosed embodiment, after the server pushes the information that the current order data has been changed to the first terminal, after the first terminal receives the push, it will update the local order of the first terminal and record the time of updating the order. In order to remind the user, the prompt information can be displayed on the current interface of the first terminal. In order to confirm that the user is aware of it, a first control can be set, such as an "update order" control. If the first terminal needs to re-order or view the latest order information, it needs to click the "update order" control. On the one hand, it can confirm that the user is aware of the change information, and on the other hand, the user can continue to operate the interface, re-order or update the order or check out.
[0111] Optionally, the control may not be displayed on the current interface of the first terminal, that is, the prompt information automatically disappears after being displayed on the interface of the current first terminal for a preset time (for example, 5 seconds), which can save the user's interaction steps on the terminal.
[0112] Optionally, determining a processing order for each of the first terminals includes:
[0113] Obtaining a request time node of the first request received from each of the first terminals;
[0114] The time sequence of the request time nodes of the first requests is used as the processing sequence of the first terminals.
[0115] In the embodiment of the present disclosure, in order to improve the user experience, if multiple first terminals request to place an order or request to update an order, and in order to avoid data disorder caused by multi-terminal operations, the server will process the requests of each terminal in a certain order. Among them, the method of determining the processing order can refer to at least two of the following:
[0116] Method 1: Sort the processed requests according to the time sequence of the request time nodes, and then determine the order in which the requests of each terminal are processed.
[0117] Method 2: Sort the requests to be processed according to the priority of the requests, and then determine the order in which the requests from each terminal are processed. For example, the priority of updating an order using a discount request is higher than the priority of other requests. This is not specifically limited here. The purpose is to process the requests from each terminal in a certain order, and then synchronize the data between the terminals and the cloud to ensure the accuracy of the ordering data.
[0118] Optionally, the data synchronization method further includes:
[0119] If it is detected that the order data in the cloud has changed, second information is generated, where the second information is used to prompt that the current order data has changed;
[0120] Sending second information to a second terminal and / or remaining first terminals except the current first terminal, so that the second terminal and / or the remaining first terminals obtain the latest updated order data from the cloud, so as to update the order data of the local order corresponding to the second terminal and / or the order data of the local order corresponding to the remaining first terminals;
[0121] Displaying second information and a second control on a current interface of the second terminal and / or current interfaces of the remaining first terminals;
[0122] The second terminal is a terminal whose current interface supports triggering the first request and has not currently sent the first request, the second information is used to prompt that the current order data has been changed, and the second control is used for the second terminal or the remaining first terminals to perform at least one of the following:
[0123] confirming the first information;
[0124] View the latest order data;
[0125] Re-order or update your order.
[0126] In the embodiment of the present disclosure, the specific contents of the first information and the second information may be the same or different, but both are used to indicate that the current order information has been changed. For example, the first information is that the current order information has been changed, and the second information is that the shopping cart item has been changed, the membership has been changed, the discount policy has been changed, etc.
[0127] The second control may be similar to the first control, and the second control may not be displayed on the current interface, and the second information may automatically disappear or be hidden after being displayed for a preset period of time, that is, the server controls the second information to disappear on the interface or the server deletes the second information. The functions of the first control and the second control may be the same or different; in addition, the specific control names may be the same or different (for example, the second control is an "OK" control). If the first terminal needs to re-place an order or view the latest order information, it is necessary to click the "OK" control. On the one hand, it can confirm that the user is aware of the change information, and on the other hand, the user can continue to operate the interface, re-place an order, update an order, or check out.
[0128] When the server executes the first operation, it will push the order change information to other terminals. After receiving the push, other terminals will update the local order and record the time of updating the order. For example, terminal 1, terminal 2 and terminal 3 have entered the order interface, among which terminal 1 and terminal 2 have triggered the first request, but terminal 3 has not triggered the first request. When the order is changed due to the operation of terminal 1 and / or terminal 2, the information will also be synchronized to terminal 3.
[0129] Specifically, scenarios for modifying orders that have already been placed, including returning dishes, changing prices, updating order membership, continuing to place orders, and other operations, all of which update order data.
[0130] Taking dish return as an example, terminal 1 needs to return dish 1. When returning the dish, it will first check whether the local order time is consistent with the cloud order update time. If they are inconsistent, the local order will be updated first. If they are consistent, the dish return interface will be called. If other terminals also call the backend order interface at the same time, the backend will still process them one by one, which is similar to scenario 2 and will not be repeated here.
[0131] If the return request is processed first, the return completion is fed back to terminal 1, and terminal 1 updates the order data and the latest local order time. The backend also pushes the order change information to other terminals through websocket, and the other terminals update the order and order time. This enables timely update of order data and ensures consistency of multi-terminal data.
[0132] If the remaining terminals are processed first, such as the order request from terminal 2, the latest order will be fed back to terminal 2, and terminal 2 will update the order data and the latest local order time. The backend will also push the order change information to the remaining terminals through websocket, and the remaining terminals will update the order and order time. In other words, the return of the dish by terminal 1 will fail, and you need to click Update Order to continue the return operation. This can achieve timely update of order data and ensure the consistency of multi-terminal data.
[0133] Optionally, the data synchronization method further includes:
[0134] In response to second requests from multiple third terminals for a target table in an idle state, obtaining a request time node of the second request received from each of the third terminals, wherein the second request is used to request to start a table;
[0135] According to the request time nodes of each second request, determining to perform a table opening operation for the second target terminal, so as to display the first interface on the second target terminal; wherein the second target terminal is a third terminal corresponding to the earliest request time node among all the request time nodes of the second requests, and the first interface is an operable interface for table ordering;
[0136] Sending third information to other third terminals except the second target terminal, and updating the status of the target table; wherein the third information is used to prompt that the target table has been opened.
[0137] In the disclosed embodiment, regarding the process of opening a table: the cashier is supported to use a cash register or an APP to help consumers open a table, and consumers are also supported to use the scan code ordering applet to scan the table code to complete the opening of the table by themselves. After opening the table, the table enters the "waiting for order" state. No matter which end opens the table, the state will be synchronized to other terminals. Each terminal will also verify the current actual state of the table when opening the table, limiting the repeated opening of the table, thereby facilitating user ordering and improving user experience.
[0138] Specifically, for example, when multiple terminal devices are turned on at the same time, the backend will also have a processing order (for example, the request time nodes for turning on the request are sorted in the order of time as the processing order):
[0139] When a merchant (for example, a merchant's service staff) clicks on the table panel to open the table, the front end will call the table opening interface and initiate a table opening request to the back end. The back end will process the requests in sequence according to the time nodes of the received requests. During the processing, the current table status will be determined. If the table opening is supported, the table opening will be processed and returned to the corresponding terminal. Then, the requests of the remaining terminals will continue to be processed. If the table status has changed, it will directly return to the terminal to prompt that the table has been opened. After receiving the feedback, the terminal will give a prompt and automatically pull the latest status of all tables to update the table panel.
[0140] It should be noted that a table is only allowed to be opened if it is idle. A table is not allowed to be opened if it is waiting for an order (i.e. no orders have been taken yet), occupied, or waiting to be cleared.
[0141] Optionally, the data synchronization method further includes:
[0142] In response to a third request from a third target terminal, locking the target table, so that the third target terminal checks out the order of the target table; wherein the third request is used to request checkout, and the third target terminal is any of the first terminals or any of the second terminals; and,
[0143] The current interface of the first terminal or the second terminal except the third target terminal is controlled to be an inoperable interface.
[0144] In the disclosed embodiment, the server can support any terminal that can operate the target table to check out. Once the checkout is completed, the order can be locked to prevent the operations of other terminals from affecting the checkout data. For example: Terminal 1 initiates a checkout request and locks the order of the target table, that is, other terminals cannot modify the order temporarily. After the checkout interface is displayed, Terminal 1 can check out the current order of the target table. If Terminal 1 exits the checkout interface, other terminals can check out the current order of the target table.
[0145] Optionally, the data synchronization method further includes:
[0146] After locking the target table, it is automatically unlocked by the following second operation:
[0147] The time starts from the lock order and reaches the preset time interval; or,
[0148] The action that triggers exit checkout.
[0149] Specifically, for example, it will be automatically unlocked after the 5-minute countdown ends; or, it will be automatically unlocked when you manually exit the checkout.
[0150] In addition, if the locking terminal crashes and restarts during the locking process, the lock will not be canceled, but the terminal can continue to enter the checkout page, operate the checkout or exit the checkout, avoiding the situation where the table cannot continue to operate due to abnormal situations, thereby improving the user experience.
[0151] From the above description, it can be seen that the present disclosure achieves the following technical effects: through the table opening operation, no matter which terminal opens the table, the status will be synchronized to other terminals, and each terminal will also check the current actual status of the table when opening the table, limiting the repeated opening behavior of the table, thereby facilitating users to place orders and improving user experience; after opening the table, for any terminal that initiates an order request or an order update request, by comparing the latest update time of the local order corresponding to the terminal with the latest update time of the order stored in the cloud, it is determined whether to update the order data of the local order corresponding to the terminal and / or update the order data stored in the cloud, thereby ensuring the data synchronization between the terminal and the cloud, and realizing multi-terminal data synchronization. Since each terminal can be synchronized with the cloud data through the above process, and then the data synchronization between multiple terminals is realized, the timeliness of data update during the table dining process is guaranteed, thereby ensuring the accuracy of the data and improving the user experience. In the checkout stage, the server can support any terminal that can operate the target table to check out. Once the checkout is completed, it can enter the locked order state to prevent the operation of other terminals from affecting the checkout data, which can ensure the accuracy of the data and improve the user experience.
[0152] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0153] The present disclosure also provides a data synchronization device for implementing the above method embodiment. Figure 7 As shown, the data synchronization device 70 includes:
[0154] A determining unit 701 is configured to determine a processing order for each of the first terminals in response to first requests for a target table from multiple first terminals, wherein the first request is used to request to place an order or update an order;
[0155] The processing unit 702 is configured to perform the following first operation on each of the first terminals in sequence according to the processing order:
[0156] Obtain the latest update time of the local order currently corresponding to the first terminal and the latest update time of the same order corresponding to the target table stored in the cloud;
[0157] If the latest update time of the local order corresponding to the current first terminal is consistent with the latest update time of the order corresponding to the cloud, then update the order data of the cloud, and synchronize the latest updated order data of the cloud to the current first terminal, so that the current first terminal updates the order data of the corresponding local order;
[0158] If the latest update time of the local order corresponding to the current first terminal is inconsistent with the latest update time corresponding to the cloud, instructing the current first terminal to update the order data of the corresponding local order;
[0159] The order data at least includes the time of the order.
[0160] Optionally, when the processing unit 702 instructs the first terminal to update the order data of the corresponding local order, the processing unit 702 specifically includes:
[0161] Generate first information, where the first information is used to prompt that current order data has been changed;
[0162] Sending first information to the current first terminal, so that the current first terminal obtains the latest updated order data from the cloud, so as to update the order data of the local order corresponding to the current first terminal;
[0163] Displaying first information and a first control on a current interface of the first terminal;
[0164] The first control is used for the first terminal to currently execute at least one of the following:
[0165] confirming the first information;
[0166] View the latest order data;
[0167] Re-order or update your order.
[0168] Optionally, further, when the determining unit 701 determines the processing order for each of the first terminals, the determining unit 701 specifically includes:
[0169] If there is one first terminal, determining that the processing order of the first terminal is the first;
[0170] If there are multiple first terminals, the request time nodes of the first requests received from each first terminal are obtained, and the time sequence of the request time nodes of each first request is used as the processing sequence of each first terminal.
[0171] Optionally, further, the device is also used to perform the following operations:
[0172] If it is detected that the order data in the cloud has changed, second information is generated, where the second information is used to prompt that the current order data has changed;
[0173] Sending second information to a second terminal and / or remaining first terminals except the current first terminal, so that the second terminal and / or the remaining first terminals obtain the latest updated order data from the cloud, so as to update the order data of the local order corresponding to the second terminal and / or the order data of the local order corresponding to the remaining first terminals;
[0174] Displaying second information and a second control on a current interface of the second terminal or a current interface of the remaining first terminals;
[0175] The second terminal is a terminal whose current interface supports triggering the first request and has not currently sent the first request, the second information is used to prompt that the current order data has been changed, and the second control is used for the second terminal or the remaining first terminals to perform at least one of the following:
[0176] confirming the first information;
[0177] View the latest order data;
[0178] Re-order or update your order.
[0179] Optionally, further, the device is also used to perform the following operations:
[0180] In response to a second request of at least one third terminal for a target table in an idle state, obtaining a request time node of the second request received from each of the third terminals, wherein the second request is used to request to start a table;
[0181] According to the request time nodes of each second request, determining to perform a table opening operation for the second target terminal, so as to display the first interface on the second target terminal; wherein the second target terminal is a third terminal corresponding to the earliest request time node among all the request time nodes of the second requests, and the first interface is an operable interface for table ordering;
[0182] Sending third information to other third terminals except the second target terminal, and updating the status of the target table; wherein the third information is used to prompt that the target table has been opened.
[0183] Optionally, further, the device is also used to perform the following operations:
[0184] In response to a third request from a third target terminal, locking the target table, so that the third target terminal checks out the order of the target table; wherein the third request is used to request checkout, and the third target terminal is any of the first terminals or any of the second terminals; and,
[0185] The current interface of the first terminal or the second terminal except the third target terminal is controlled to be an inoperable interface.
[0186] Optionally, further, the device is also used to perform the following operations:
[0187] After locking the target table, it is automatically unlocked by the following second operation:
[0188] The time starts from the lock order and reaches the preset time interval; or,
[0189] The action that triggers exit checkout.
[0190] The specific manner in which each unit in the above device embodiment performs operations has been described in detail in the embodiment of the method, and will not be elaborated on here.
[0191] The present disclosure also provides an electronic device, such as Figure 8 As shown, the electronic device includes one or more processors 81 and a memory 82. Figure 8 A processor 81 is taken as an example.
[0192] The controller may further include: an input device 83 and an output device 84 .
[0193] The processor 81, the memory 82, the input device 83 and the output device 84 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.
[0194] The processor 81 can be a central processing unit (CPU), or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips. The general-purpose processor can be a microprocessor or any conventional processor.
[0195] The memory 82 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the control method in the embodiment of the present disclosure. The processor 81 executes various functional applications and data processing of the server by running the non-transitory software programs, instructions and modules stored in the memory 82, that is, the data synchronization method of the above method embodiment is implemented.
[0196] The memory 82 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of a processing device operated by the server, etc. In addition, the memory 82 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 82 may optionally include a memory remotely arranged relative to the processor 81, and these remote memories may be connected to a network connection device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0197] The input device 83 can receive input digital or character information, and generate key signal input related to user settings and function control of the processing device of the server. The output device 84 can include display devices such as a display screen.
[0198] One or more modules are stored in the memory 82, and when executed by one or more processors 81, the execution is as follows: Figure 5 The method shown.
[0199] The embodiment of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute and implement the data synchronization method as described above.
[0200] The embodiment of the present disclosure also provides a computer program product, including a computer program, which implements the data synchronization method as described above when executed by a processor.
[0201] Those skilled in the art can understand that the implementation of all or part of the processes in the above method embodiments can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes in the above method embodiments. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (FM), a hard disk drive (HDD), or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memory.
[0202] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A data synchronization method, characterized in that: include: In response to first requests from multiple first terminals for a target table, determining a processing order for each of the first terminals; wherein the first request is used to request to place an order or update an order; According to the processing order, the following first operation is performed on each of the first terminals in turn: Obtain the latest update time of the local order currently corresponding to the first terminal and the latest update time of the same order corresponding to the target table stored in the cloud; If the latest update time of the local order corresponding to the current first terminal is consistent with the latest update time of the same order corresponding to the cloud, then update the order data in the cloud, and synchronize the latest updated order data in the cloud to the current first terminal, so that the current first terminal updates the order data of the corresponding local order; If the latest update time of the local order corresponding to the first terminal is inconsistent with the latest update time of the same order corresponding to the cloud, instruct the first terminal to update the order data of the corresponding local order; The order data at least includes the time of the order.
2. The method according to claim 1, characterized in that The instructing the first terminal to update the order data of the corresponding local order includes: Generate first information, where the first information is used to prompt that current order data has been changed; Sending first information to the current first terminal, so that the current first terminal obtains the latest updated order data from the cloud, so as to update the order data of the local order corresponding to the current first terminal; Displaying first information and a first control on a current interface of the first terminal; The first control is used for the first terminal to currently execute at least one of the following: confirming the first information; View the latest order data; Re-order or update your order.
3. The method according to claim 1, characterized in that The determining a processing order for each of the first terminals includes: Obtaining a request time node of the first request received from each of the first terminals; The time sequence of the request time nodes of the first requests is used as the processing sequence of the first terminals.
4. The method according to claim 1, characterized in that: The method further comprises: If it is detected that the order data in the cloud has changed, second information is generated, where the second information is used to prompt that the current order data has changed; Sending second information to a second terminal and / or remaining first terminals except the current first terminal, so that the second terminal and / or the remaining first terminals obtain the latest updated order data from the cloud, so as to update the order data of the local order corresponding to the second terminal and / or the order data of the local order corresponding to the remaining first terminals; Displaying second information and a second control on a current interface of the second terminal and / or current interfaces of the remaining first terminals; The second terminal is a terminal whose current interface supports triggering the first request and has not currently sent the first request, the second information is used to prompt that the current order data has been changed, and the second control is used for the second terminal or the remaining first terminals to perform at least one of the following: confirming the first information; View the latest order data; Re-order or update your order.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: In response to second requests from multiple third terminals for a target table in an idle state, obtaining a request time node of the second request received from each of the third terminals, wherein the second request is used to request to start a table; According to the request time nodes of each second request, determining to perform a table opening operation for the second target terminal, so as to display the first interface on the second target terminal; wherein the second target terminal is a third terminal corresponding to the earliest request time node among all the request time nodes of the second requests, and the first interface is an operable interface for table ordering; Sending third information to other third terminals except the second target terminal, and updating the status of the target table; wherein the third information is used to prompt that the target table has been opened.
6. The method according to claim 4, characterized in that The method further comprises: In response to a third request from a third target terminal, locking the target table, so that the third target terminal checks out the order of the target table; wherein the third request is used to request checkout, and the third target terminal is any of the first terminals or any of the second terminals; and The current interface of the first terminal or the second terminal except the third target terminal is controlled to be an inoperable interface.
7. The method according to claim 6, characterized in that The method further comprises: After locking the target table, it is automatically unlocked by the following second operation: The time starts from the lock order and reaches the preset time interval; or, The action that triggers exit checkout.
8. A data synchronization device, characterized in that: include: a determining unit, configured to determine a processing order for each of the first terminals in response to first requests for a target table from a plurality of first terminals, wherein the first request is used to request to place an order or update an order; A processing unit, configured to perform the following first operation on each of the first terminals in sequence according to the processing order: Obtain the latest update time of the local order currently corresponding to the first terminal and the latest update time of the same order corresponding to the target table stored in the cloud; If the latest update time of the local order corresponding to the current first terminal is consistent with the latest update time of the order corresponding to the cloud, then update the order data of the cloud, and synchronize the latest updated order data of the cloud to the current first terminal, so that the current first terminal updates the order data of the corresponding local order; If the latest update time of the local order corresponding to the current first terminal is inconsistent with the latest update time corresponding to the cloud, instructing the current first terminal to update the order data of the corresponding local order; The order data at least includes the time of the order.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data synchronization method described in any one of claims 1 to 7.
10. An electronic device, characterized in that: The electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor executes the data synchronization method described in any one of claims 1 to 7.