Payment switching method, electronic equipment and computer readable storage medium
Through the automatic status push and switching mechanism between the cashier terminal and the server, the problem of untimely switching of online/offline payment status of the cashier terminal is solved, the stability and response speed of the payment system are improved, and problems caused by manual intervention are avoided. Delay.
Patent Information
- Application Number
- CN202410853253.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-27
AI Technical Summary
In the existing technology, the online/offline payment status switching of the cashier terminal relies on manual operation, which results in untimely switching and may cause serious failures such as a server crash.
Automatically determine the status of the server by pushing results between the cashier terminal and the server, and automatically switch the online/offline payment status of the cashier terminal according to the status to ensure that it switches to the offline state when the server is abnormal and switches to the online state when it returns to normal. .
It realizes the automatic status switching of the cashier terminal when the server is abnormal or returns to normal, improves the stability and response speed of the payment system, and avoids delays caused by manual intervention.
Smart Images

Figure CN118710263A
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic payment technology, and in particular to a payment switching method, an electronic device and a computer-readable storage medium. Background Art
[0002] With the rapid development of Internet technology and mobile payment, Internet traffic has increased dramatically, making the stability and stress resistance of the payment system particularly important. In order to deal with server anomalies and cash register terminal network problems, the commonly used method is to set the cash register terminal to support online and offline payment to achieve the decoupling of the cash register terminal from the server, so that when the cash register terminal is offline due to server anomalies or cash register terminal network anomalies, the cash register terminal can still support the offline payment process.
[0003] However, currently, most of the cash register terminals are manually switched between offline and online payment states by equipment management personnel. Due to manual switching, if the equipment management personnel are not at work or cannot be contacted, manual switching between online and offline cash register terminals may result in untimely switching, which will not only interfere with the smooth operation of payment services, but may even cause serious failures such as crashes of the backend system on the server side.
[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present application is to provide a payment switching method, an electronic device and a computer-readable storage medium, aiming to solve the problem of untimely switching caused by manual switching of the online / offline payment status of a cash register terminal.
[0006] To achieve the above object, the present application provides a payment switching method, which is applied to a cash register terminal, and the method comprises:
[0007] Obtaining a push result sent by the server, and determining the service status of the server according to the push result;
[0008] When the cashier terminal is in an online payment state, if the service state is an abnormal state, switching the cashier terminal from the online payment state to the offline payment state;
[0009] When the cash register terminal is in the offline payment state, if the service state is restored to a normal state, the cash register terminal is switched from the offline payment state to the online payment state.
[0010] In one embodiment, the push result includes a first response result, and the step of obtaining the push result sent by the server includes:
[0011] When the cash register terminal is in an online payment state, sending a transaction request to the server, so that the server sends the first response result to the cash register terminal based on the transaction request;
[0012] Receive the first response result sent by the server.
[0013] In one embodiment, the push result includes a second response result, and the step of obtaining the push result sent by the server includes:
[0014] When the cashier terminal is in an offline payment state, periodically sending an access request to the server, so that the server returns a second response result to the cashier terminal based on the access request;
[0015] Receive the second response result sent by the server.
[0016] In one embodiment, the push result includes a first response result, and the step of determining the service status of the server according to the push result includes:
[0017] Determining whether the first response result is abnormal;
[0018] If the first response result is abnormal, the acquired cumulative number of abnormalities of the cash register terminal is accumulated, and it is determined whether the cumulative number of abnormalities is greater than a preset abnormality threshold;
[0019] If the accumulated number of abnormalities is greater than a preset abnormality threshold, the service status is determined to be an abnormal status.
[0020] In one embodiment, the step of determining whether the first response result is abnormal includes:
[0021] Determine the response duration and the response content from the first response result;
[0022] Determine whether the response time is greater than a preset time, and determine whether the response content meets a preset abnormal error condition;
[0023] If the response duration is greater than the preset duration, and / or the response content satisfies a preset abnormal error reporting condition, then it is determined that the first response result is abnormal;
[0024] If the response time is less than or equal to the preset time, and the response content does not meet the preset abnormal error reporting condition, the first response result is determined to be normal, and the acquired accumulated number of abnormalities of the cash register terminal is reset.
[0025] In one embodiment, the push result includes a second response result, and the step of determining the service status of the server according to the push result includes:
[0026] If the second response result is normal, it is determined that the service status of the server is restored to normal.
[0027] To achieve the above purpose, the present application provides a payment switching method, which is applied to a server, and the method includes:
[0028] Send a push result to the cashier terminal; the cashier terminal is used to obtain the push result sent by the server, and determine the service status of the server according to the push result; when the cashier terminal is in an online payment state, if the service status is an abnormal state, the cashier terminal is switched from the online payment state to the offline payment state; when the cashier terminal is in the offline payment state, if the service status is restored to a normal state, the cashier terminal is switched from the offline payment state to the online payment state.
[0029] In one embodiment, upon receiving an access request sent by a cash register terminal, determining whether the server meets a preset normal recovery condition;
[0030] When the server meets the preset normal recovery condition, a normal second response result is returned to the cash register terminal;
[0031] The preset normal recovery conditions include that the memory usage of the server is less than or equal to a first preset threshold, the CPU occupancy of the server is less than or equal to a preset second threshold, and / or the average response time of the server is less than or equal to a preset third threshold.
[0032] In addition, to achieve the above objectives, the present application provides a payment system, the payment system comprising:
[0033] The cashier terminal is used to obtain the push result sent by the server, and determine the service status of the server according to the push result; when the cashier terminal is in the online payment state, if the service status is an abnormal state, the cashier terminal is switched from the online payment state to the offline payment state; when the cashier terminal is in the offline payment state, if the service status is restored to a normal state, the cashier terminal is switched from the offline payment state to the online payment state;
[0034] The server is used to send push results to the cash register terminal.
[0035] In addition, to achieve the above-mentioned purpose, the present application also provides an electronic device, which includes: a memory, a processor, and a program of the payment switching method stored in the memory and executable on the processor. When the program of the payment switching method is executed by the processor, the steps of the payment switching method as described above can be implemented.
[0036] In addition, to achieve the above-mentioned purpose, the present application also provides a computer-readable storage medium, on which is stored a program for implementing the payment switching method, and when the program of the payment switching method is executed by a processor, the steps of the payment switching method as described above are implemented.
[0037] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, including a computer program, which implements the steps of the payment switching method as described above when executed by a processor.
[0038] One or more technical solutions proposed in the present application have at least the following technical effects: the cashier terminal in the present application can obtain the push result sent by the server, so as to facilitate the judgment of the service status of the server according to the push result, so that when the cashier terminal is in the online payment state, if it is determined that the service status is abnormal, the cashier terminal can be switched from the online payment state to the offline payment state, so that when the status of the server is abnormal, the cashier terminal is automatically switched from the online payment state to the offline payment state; when the cashier terminal is in the offline payment state, if the service status is restored to normal, the cashier terminal is switched from the offline payment state to the online payment state, so that when the cashier terminal is offline and the server is restored to normal, the cashier terminal is automatically switched from the offline payment state to the online payment state, and the offline / online payment state of the cashier terminal can be automatically switched without manual reliance, thereby improving the response speed of the online / offline payment state switching of the cashier terminal when the server is abnormal or restored to normal, and solving the problem of untimely switching caused by manual switching of the online / offline payment state of the cashier terminal. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings herein are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the description, are used to explain the principles of the present application.
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0041] Figure 1A schematic diagram of a flow chart of an embodiment of a payment switching method of the present application;
[0042] Figure 2 A flowchart of another embodiment of the payment switching method of the present application;
[0043] Figure 3 A flowchart of the payment process in the payment switching method of this application;
[0044] Figure 4 A schematic diagram of the system structure of the payment system according to an embodiment of the present application;
[0045] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the payment switching method in the embodiment of the present application.
[0046] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0047] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0048] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0049] The main solution of the embodiment of the present application is: when the server is abnormal, the cash register terminal can automatically switch to the offline payment state; when the server recovers from abnormality to normal, the cash register terminal supports automatic switching to the online payment state. This improves the response speed of the device payment method switching when the server is abnormal or recovers to normal, ensures the smoothness and stability of the payment system, and avoids the waste of manpower for manual switching.
[0050] Specifically, when the cash register terminal is in the online payment state, 1) the cash register terminal sends a transaction request to the server, and the cash register terminal receives the first response result of the server. 2) If the cash register terminal determines that the first response result is not a normal business error, or the actual response time is greater than the preset time, the cash register terminal updates the abnormal cumulative number of times, otherwise the cumulative number is reset to 0. Among them, the normal business error refers to the situation where the payment failure returned by the background is correct, such as insufficient balance, user freezing and other scenarios agreed with the cash register terminal in advance. If the response time of the server becomes longer, it reflects that the traffic of the server has increased. By setting the preset time, when the response time is greater than the preset time, it is determined that the first response result is abnormal, and when the abnormal cumulative number is greater than the preset abnormal threshold, the cash register terminal is switched from the online mode to the offline mode, so that the paid order is first saved in the cash register terminal, so that the cash register terminal can automatically participate in sharing the traffic peak and play a cutting role to ensure the smoothness of the payment process, while avoiding the server from being overly stressed and causing a crash. 3) After the cumulative number of exceptions is accumulated, if the cumulative number of exceptions is greater than the preset exception threshold, the cashier terminal switches from the online payment state to the offline payment state; if the cumulative number of exceptions is less than the preset exception threshold, the online payment state of the cashier terminal is not modified.
[0051] 2. When the cashier terminal is in offline payment mode, 1) the cashier terminal sends an access request to the server at regular intervals. If the second response result returned by the server is normal, the cashier terminal is changed from the offline payment state to the online payment state. The service segment can comprehensively consider the CPU occupancy rate, memory usage rate and / or average response time of the server to determine whether to return a normal second response result to the cashier terminal. The cashier terminal sends an access request to the server at regular intervals, and receives the second response result to determine whether to switch the cashier terminal from the offline payment mode to the online payment mode, thereby avoiding a large number of orders to be paid to the cashier terminal, thereby reducing the memory pressure of the cashier terminal.
[0052] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device that can realize the above functions.
[0053] Based on this, the embodiment of the present application provides a payment switching method, which is applied to a cash register terminal, referring to Figure 1 , Figure 1 This is a flow chart of an embodiment of the payment switching method of the present application.
[0054] In this embodiment, the payment switching method includes steps S10 to S30:
[0055] Step S10, obtaining the push result sent by the server, and determining the service status of the server according to the push result;
[0056] It should be noted that in this embodiment, the execution subject is the cashier terminal, which can be used to read the user's payment data. The cashier terminal can identify and read various types of bank cards, prepaid cards and virtual accounts generated based on these accounts, as well as barcodes, QR codes, etc. The server refers to a computer program or system that provides services for the cashier terminal. For example, when the cashier terminal initiates a transaction request, the server will verify the legitimacy of the transaction, calculate the transaction amount, etc., and return the processing result to the cashier terminal.
[0057] The push result can be used to describe the data that the server actively sends to the cash register terminal, and can also be used to describe the response result that the server returns to the cash register terminal based on the request of the cash register terminal. The push result can include the response result, and can also include the active push result. The response result includes the first response result and the second response result. The active push result refers to the data that the server actively sends to the cash register terminal. In this embodiment, the cash register terminal can receive the active push result actively sent by the server, or can also send a request to the server so that the server can return the response result to the cash register terminal based on the request.
[0058] If the payment status of the cash register terminal is different, the request initiated by the cash register terminal to the server may not be the same; the payment status is used to describe the status of the cash register terminal, which can be online payment status or offline payment status. When the cash register terminal is in the online payment status, the request initiated by the cash register terminal to the server is a transaction request, and when the cash register terminal is in the offline payment status, the request initiated by the cash register terminal to the server is an access request.
[0059] The response results returned by the server may be different depending on the request initiated by the cash register terminal. When the cash register terminal initiates a transaction request, the push result returned by the server received by the cash register terminal is the first response result. When the cash register terminal initiates an access request, the push result returned by the server received by the cash register terminal is the second response result.
[0060] The service status can be used to describe whether the server is running normally. The service status can be abnormal, normal, or restored to normal. Abnormal means that the server is running abnormally, which may be caused by too many requests being processed by the server or the processing time being too long. Normal means that the server can process the requests sent by the cash register terminal smoothly. Restored to normal means that the server has recovered from an abnormal state to a normal state.
[0061] Exemplarily, receiving a response result sent by the server, and determining the service status of the server according to the response result; and / or receiving an active push result sent by the server, and determining the service status of the server according to the active push result. The step of receiving a response result sent by the server, and determining the service status of the server according to the response result may also include: when the cashier terminal is in an online payment state, the cashier terminal sends a transaction request to the server, receives a first response result returned by the server based on the transaction request, and determines the service status of the server based on the first response result; when the cashier terminal is in an offline payment state, the cashier terminal sends an access request to the server, receives a first response result returned by the server based on the access request, and determines the service status of the server based on the second response result.
[0062] In a feasible embodiment, step S10 includes steps S11 to S12:
[0063] Step S11, when the cash register terminal is in an online payment state, sending a transaction request to the server, so that the server sends a first response result to the cash register terminal based on the transaction request;
[0064] Step S12, receiving the first response result sent by the server.
[0065] It should be noted that when the cash register terminal is in the online payment state, it means that the cash register terminal can send a transaction request to the server. The transaction request refers to a payment order cancellation request, which is used to instruct the server to cancel the order in the transaction request. The first response result is used to describe the processing result and processing time of the transaction request by the server. The first response result includes the response content and the response time. The response content is used to describe the processing result of the server, and the response time is used to describe the processing time of the server.
[0066] The response content can be a normal error result, an abnormal error result, or a normal processing result. The normal error result is characterized by a pre-agreed error scenario, such as an abnormality on the user side of the payment. For example, the normal error result can be insufficient transaction limit, user freezing, etc. For example, when the user's transaction limit is insufficient, after the cashier terminal sends a transaction request about the user to the server, the first response result received will be expressed as insufficient balance. When the user's transaction card is frozen, after the cashier terminal sends a transaction request about the user to the server, the first response result received will be expressed as user freezing. The normal processing result means that the server can smoothly execute the transaction process corresponding to the transaction request sent by the cashier terminal, and there is no abnormality on the user side of the payment. The abnormal error result means an error caused by an abnormality on the server side. The abnormality on the server side can be a network abnormality on the server side, etc.
[0067] Exemplarily, when the cash register terminal is in an online payment state, a transaction request is sent to the server, so that the server sends a first response result to the cash register terminal based on the transaction request, and the cash register terminal receives the first response result sent by the server.
[0068] When the cash register terminal is in the online payment state, the cash register terminal will send the relevant information of the user's payment order to the server through a payment request, so that the server can process the payment request and send a first response result to the cash register terminal, and the cash register terminal can receive the first response result. This makes it easier for the cash register terminal to determine the service status of the server based on the first response result, so as to determine whether automatic switching is required. The first response result can be obtained without an additional request to determine the service status of the server, so as to improve the efficiency of determining the service status of the server.
[0069] In a feasible embodiment, after step S10, steps S13 and S14 are also included:
[0070] Step S13, when the cash register terminal is in an offline payment state, periodically sending an access request to the server, so that the server returns a second response result to the cash register terminal based on the access request;
[0071] Step S14, receiving a second response result sent by the server.
[0072] It should be noted that when the cash register terminal is in an offline payment state, it means that the payment order received by the cash register terminal is stored locally in the cash register terminal. Since it is in an offline payment state, the payment order cannot be uploaded to the server.
[0073] Since the payment order is stored locally in the terminal in the offline payment state, and in the continuous offline payment state of the cash register terminal, for the same user, only a preset number of payment orders of the user are supported, and the preset number is usually set to 1. The preset number can also be set based on the actual situation, and this embodiment does not make specific restrictions on this. Since the payment order is stored locally in the offline payment state, the order verification cannot be completed. It can be understood that in the offline payment state, the user submits the payment order, but the verification of the payment order has not been completed yet, and the deduction of the user's balance has not been completed. Therefore, in order to avoid the user submitting multiple payment orders in the offline payment state of the cash register terminal when the balance is insufficient, when the cash register terminal switches to the online payment state, the user's insufficient balance leads to the inability to complete the verification of multiple payment orders submitted in the offline payment state, thereby causing losses to the merchant, or to avoid other users from using the user's balance impersonally, resulting in property losses of the user. The preset number can be set based on the user's consumption and balance.
[0074] In order to avoid the cash register terminal storing too many payment orders locally, the cash register terminal can periodically send access requests to the server to determine whether the service status of the server has returned to normal. When the service status is restored to normal, the cash register terminal will send the payment orders stored locally in batches to the server for verification by the server.
[0075] The access request is used to instruct the server to return the service status of the server. The second response result is used to describe the current status of the server. The second response result can be normal or temporarily abnormal.
[0076] Exemplarily, when the cash register terminal is in an offline payment state, the cash register terminal sends an access request to the server according to a preset period, and receives a second response result sent by the server based on the access request.
[0077] Step S20, when the cash register terminal is in an online payment state, if the service state is abnormal, switching the cash register terminal from the online payment state to the offline payment state;
[0078] It should be noted that when the cash register terminal is in the online payment state, there may be an abnormality in the server's network, or the server may process too many requests, which may cause the server's service state to be abnormal. Therefore, in order to avoid the server crash, the cash register terminal can be switched from the online payment state to the offline payment state when the service state is abnormal, so as to avoid the server carrying too many requests. By setting the cash register terminal to the offline payment state, the cash register terminal will temporarily not send transaction requests to the server, and the payment order corresponding to the transaction request will be temporarily stored locally in the cash register terminal, so that the cash register terminal can temporarily share the requests processed by the server. The cash register terminal plays a cutting role and ensures the smoothness of the payment process, while avoiding excessive pressure on the server and causing a crash.
[0079] Exemplarily, when the cash register terminal is in an online payment state, when the service state is abnormal, the cash register terminal is automatically switched to an offline payment state. When the service state of the server is normal, there is no need to automatically switch the payment state of the cash register terminal.
[0080] Step S30: when the cash register terminal is in an offline payment state, if the service state is restored to a normal state, the cash register terminal is switched from the offline payment state to the online payment state.
[0081] It should be noted that when the cash register terminal is in an offline payment state, the cash register terminal may store too many payment orders to be cancelled locally. Therefore, in order to allow the payment orders to be cancelled to be cancelled as soon as possible and to avoid the cash register terminal storing too many payment orders to be cancelled, when the service status of the server is restored to normal, the cash register terminal can be automatically switched to the online payment state, so that the cancellation of the payment orders to be cancelled can be completed through the server, reducing the storage pressure of the cash register terminal.
[0082] Exemplarily, when the cashier terminal is in an offline payment state, when the service state is restored to normal, the cashier terminal is automatically switched to an online payment state. When the service state of the server is still abnormal, the payment state of the cashier terminal is temporarily not switched.
[0083] The cashier terminal of this embodiment can obtain the push result sent by the server, so as to judge the service status of the server according to the push result. Therefore, when the cashier terminal is in the online payment state, if it is determined that the service status is abnormal, the cashier terminal can be switched from the online payment state to the offline payment state, so that when the status of the server is abnormal, the cashier terminal is automatically switched from the online payment state to the offline payment state; when the cashier terminal is in the offline payment state, if the service status is restored to normal, the cashier terminal is switched from the offline payment state to the online payment state, so that when the cashier terminal is offline and the server is restored to normal, the cashier terminal is automatically switched from the offline payment state to the online payment state, and the offline / online payment state of the cashier terminal can be automatically switched without manual reliance, which improves the response speed of the online / offline payment state switching of the cashier terminal when the server is abnormal or restored to normal, and solves the problem of untimely switching caused by manual switching of the online / offline payment state of the cashier terminal.
[0084] Further, see Figure 2 In another feasible embodiment, step S10 further includes steps A10 to A30:
[0085] Step A10, determining whether the first response result is abnormal;
[0086] Step A20: if the first response result is abnormal, the acquired accumulated number of abnormalities of the cash register terminal is accumulated, and it is determined whether the accumulated number of abnormalities is greater than a preset abnormality threshold;
[0087] Step A30: If the accumulated number of abnormalities is greater than a preset abnormality threshold, the service status is determined to be an abnormal status.
[0088] It should be noted that the cumulative number of exceptions refers to the number of first response results of the exceptions received by the cash register terminal in a continuous period of time. The preset exception threshold is set in advance. The preset exception threshold can be determined based on the actual situation. This embodiment does not specifically limit this. When the cumulative number of exceptions is greater than the preset exception threshold, it means that the service status of the server is abnormal. By setting the preset exception threshold, the service status is determined to be abnormal only when the cumulative number of exceptions is greater than the preset exception threshold, thereby avoiding the cash register terminal from mistakenly switching to the offline payment state due to network fluctuations and improving the robustness of the payment system composed of the cash register terminal and the server.
[0089] The abnormal cumulative number is stored in the cash register terminal, and the abnormal cumulative number can be obtained from the storage module of the cash register terminal. Accumulating the abnormal cumulative number means adding 1 to the abnormal cumulative number to count the number of first response results received in a continuous time.
[0090] Exemplarily, the cashier terminal determines whether the first response result is abnormal. If the first response result is abnormal, the cumulative number of abnormalities is increased by 1, and it is determined whether the cumulative number of abnormalities is greater than the preset abnormal threshold. If the cumulative number of abnormalities is greater than the preset abnormal threshold, the service status of the server is determined to be abnormal; if the cumulative number of abnormalities is less than the preset abnormal threshold, the payment status of the cashier terminal will not be adjusted.
[0091] In a feasible embodiment, step A10 further includes steps A11 to A14:
[0092] Step A11, determining the response time and the response content from the first response result;
[0093] Step A12, determining whether the response time is greater than a preset time, and determining whether the response content meets a preset abnormal error reporting condition;
[0094] Step A13: if the response time is longer than the preset time, or the response content meets the preset abnormal error reporting condition, then the first response result is determined to be abnormal;
[0095] Step A14: if the response time is less than or equal to the preset time, and the response content does not meet the preset abnormal error reporting condition, the first response result is determined to be normal, and the acquired accumulated number of abnormalities of the cash register terminal is reset.
[0096] It should be noted that the response time refers to the time it takes for the server to process the transaction request after receiving the transaction request from the cash register terminal. The preset abnormal error reporting condition is indicated as abnormal error reporting of the response content, and the preset abnormal error reporting condition includes that the response content is an abnormal error reporting result.
[0097] The preset duration can be set in advance, and the preset duration can be determined based on the average duration when the server normally processes transaction requests. For example, the preset duration can be the average duration when the server processes transaction requests, or it can be 1.1 times the average duration, etc. This embodiment does not impose specific restrictions on this.
[0098] If the response time is longer than the preset time, it means that the server may have a large number of requests, or the network connection is poor, resulting in a long response time. The response content meets the preset abnormal error conditions, indicating that the server has an abnormal error result. Therefore, if the response time is longer than the preset time, and / or the response content meets the preset abnormal error conditions, it means that the first response result is abnormal.
[0099] If the response time is less than or equal to the preset time, and the response content does not meet the preset exception error conditions, it means that the first response result is normal. In order to avoid accidentally switching the payment status of the cash register terminal, the cumulative number of exceptions stored in the cash register terminal is reset, that is, the cumulative number of exceptions is reset to the initial value. For example, the cumulative number of exceptions can be reset to 0.
[0100] Exemplarily, the response duration and response content are determined from the first response result, and it is determined whether the response duration is greater than the preset duration, and whether the response content satisfies the preset abnormal error reporting conditions; if the response duration is greater than the preset duration, and / or the response content satisfies the preset abnormal error reporting conditions, the first response result is determined to be abnormal; if the response duration is less than or equal to the preset duration, and the response content does not meet the preset abnormal error reporting conditions, the first response result is determined to be normal, and the acquired accumulated number of abnormalities of the cash register terminal is reset.
[0101] In a feasible embodiment, step S10 further includes step B10:
[0102] Step B10: If the second response result is normal, determine that the service status of the server is restored to normal.
[0103] It should be noted that the second response result is the second response result returned to the cashier terminal based on the access request when the cashier terminal is in an offline payment state and the cashier terminal sends an access request to the server. Therefore, if the second response result is normal, it means that the service status of the server is restored to normal. Exemplarily, if the second response result is normal, the service status is normal service status; if the second response result is abnormal, the service status is abnormal status.
[0104] Furthermore, in another embodiment, the payment switching method may also be applied to the server, including step C10:
[0105] Step C10, sending a push result to the cashier terminal; the cashier terminal is used to obtain the push result sent by the server, and determine the service status of the server according to the push result. When the cashier terminal is in an online payment state, if the service status is abnormal, the cashier terminal is switched from the online payment state to the offline payment state; when the cashier terminal is in an offline payment state, if the service status is restored to normal, the cashier terminal is switched from the offline payment state to the online payment state.
[0106] It should be noted that the server can send a push result to the cashier terminal, and can actively send it, or return the corresponding result based on the request of the cashier terminal. For example, the server can automatically determine whether the service status is an abnormal state based on the current memory usage rate, CPU occupancy rate, average response time of the request, etc. of the server, so as to actively send the abnormal state to the cashier terminal connected to the server, so as to provide the cashier terminal with a basis for switching from the online payment state to the offline payment state. For example, when the memory usage rate is greater than the first threshold, the CPU occupancy rate is greater than the second threshold, and / or the average response time is greater than the preset third threshold, etc., the server actively sends an active push result including the service status as an abnormal state to the cashier terminal, so that the cashier terminal switches from the online payment state to the offline payment state. In this embodiment, it can also be set that the server does not send an active push result to the cashier terminal. It can be determined based on actual conditions, and this embodiment does not make specific limitations on this.
[0107] Exemplarily, the server sends an active push result to the cashier terminal, and / or, when the server receives a payment request sent by the cashier terminal, the server returns a first response result to the cashier terminal, and / or, when the server receives an access request sent by the cashier terminal, the server returns a second response result to the cashier terminal.
[0108] In a feasible embodiment, steps D10 to D20 are also included:
[0109] Step D10, upon receiving the access request sent by the cash register terminal, determining whether the server meets the preset normal recovery condition;
[0110] Step D20, when the server meets the preset normal recovery condition, a normal second response result is returned to the cash register terminal;
[0111] The preset normal recovery conditions include that the memory usage of the server is less than or equal to a first preset threshold, the CPU occupancy of the server is less than or equal to a preset second threshold, and / or the average response time of the server is less than or equal to a preset third threshold.
[0112] It should be noted that the server can receive access requests periodically sent by the cash register terminal, and the server will automatically determine whether it meets the preset normal recovery condition. The preset normal recovery condition indicates that the service status of the server has returned to normal.
[0113] The average response time refers to the average response time of the server processing requests. In addition to processing requests from cash register terminals, the server can also process other requests that are not cash register terminals. The average response time can be calculated based on the response time of the server processing other requests; or the server can also simulate processing transaction requests from cash register terminals. The average response time can be calculated based on the response time of the simulated transaction requests.
[0114] Memory usage, CPU occupancy, and average response time can directly reflect the current operation status of the server. A first preset threshold, a second preset threshold, and a third preset threshold can be set to determine whether the server meets the preset recovery conditions.
[0115] Exemplarily, the server receives an access request from the cash register terminal, the server obtains the memory usage rate, CPU occupancy rate and average response time of the server, and the server determines whether the memory usage rate is less than or equal to a first preset threshold, whether the CPU occupancy rate of the server is less than or equal to a preset second threshold, and / or whether the average response time of the server is less than or equal to a preset third threshold;
[0116] If the memory usage of the server is less than or equal to the first preset threshold, the CPU occupancy of the server is less than or equal to the preset second threshold, and / or the average response time of the server is less than or equal to the preset third threshold, a normal second response result is returned to the cashier terminal; if the memory usage of the server is greater than the first preset threshold, the CPU occupancy of the server is greater than the preset second threshold, and / or the average response time of the server is greater than the preset third threshold, an abnormal second response result is returned to the cashier terminal.
[0117] In this embodiment, the server determines whether the preset normal recovery condition is met, so that the normal second response result can be directly sent to the cashier terminal, so that the cashier terminal switches from the offline payment state to the online payment state.
[0118] For a better understanding of the embodiments of the present application, refer to Figure 3 , the payment process of this embodiment is described.
[0119] in Figure 3 The face recognition device shown in the figure is a type of cash register terminal. Figure 3Taking the face recognition device as an example, the payment process is explained. First, it is determined whether the face recognition device is connected to the Internet. If the face recognition device is not connected to the Internet, it means that the face recognition device is in an offline payment state. Then it is determined whether the user's payment device supports offline payment. If the user's payment device does not support offline payment, the transaction cannot be carried out, and the transaction is terminated. If the user's payment device supports offline payment, the local face recognition function of the face recognition device is called. If the face match is successful, the payment order raised by the user is stored locally in the face recognition device. When the face recognition device is switched to the online payment state, the payment order to be cancelled stored in the face recognition device is cancelled. When the face recognition device switches from the offline payment state to the online payment state, the payment order to be cancelled stored locally in the face recognition device is pushed to the server. The server batch synchronizes the offline payment orders, that is, the orders to be cancelled, so that the server can cancel the payment orders to be cancelled.
[0120] If the face recognition device is connected to the Internet, it is determined whether the remote face recognition function is offline (the face recognition function is offline, indicating that the face recognition device cannot currently call the remote face recognition, but the face recognition device also has a face recognition function locally. The number of faces successfully recognized by the local face recognition function of the face recognition device is generally less than the number of faces successfully recognized by the remote personnel recognition function). If the remote face recognition function is offline, the local face recognition function of the face recognition device is used for recognition. If the face match is successful, it means that the face recognition is successful. If the face match fails, it means that the face recognition fails. Then it is determined whether the remote face recognition can be called. If the remote face recognition cannot be called, the transaction is terminated. If the remote face recognition can be called, the face match is performed. If the face match is successful, it means that the face recognition is successful. If the remote face recognition function is not offline, the remote face recognition function is called for face matching. If the match is successful, it means that the face recognition is successful. Among them, the administrator of the payment system can manually control the opening or closing of the remote face recognition function.
[0121] When the face scanning device is connected to the Internet and the face recognition is successful, it is determined whether the face scanning device is in an offline payment state. If the face scanning device is not in an offline payment state, it means that the face scanning device is currently in an online payment state. Then the payment order can be cancelled and the response result can be returned to the face scanning device. If the response time of the response result is less than or equal to the preset time and the response content is normal, the abnormal cumulative number is reset to 0; if the response time of the response result is greater than the preset time, and / or the response content of the response result is abnormal, the abnormal cumulative number is accumulated, and it is determined whether the abnormal cumulative number is greater than the preset abnormal threshold. If the abnormal cumulative number is greater than the preset abnormal threshold, the face scanning device is switched to an offline payment state. If the abnormal cumulative number is less than or equal to the preset abnormal threshold, the payment state of the face scanning device is not switched first. In addition to automatically switching the payment state of the cash register terminal, this embodiment can also manually switch the payment state of the cash register terminal, which is not specifically limited in this embodiment. Among them, the server can be the server of the cafeteria background, and the payment order can be the user's dining consumption order.
[0122] This application also provides a payment system, please refer to Figure 4 , payment systems include:
[0123] The cash register terminal is used to obtain the push result sent by the server, and determine the service status of the server according to the push result; when the cash register terminal is in the online payment state, if the service status is abnormal, the cash register terminal is switched from the online payment state to the offline payment state; when the cash register terminal is in the offline payment state, if the service status is restored to normal, the cash register terminal is switched from the offline payment state to the online payment state;
[0124] The server is used to send push results to the cash register terminal.
[0125] The payment system provided by the present application adopts the payment switching method in the above-mentioned embodiment, aiming to solve the problem of untimely switching caused by manually switching the online / offline payment status of the cash register terminal. Compared with the prior art, the beneficial effects of the payment switching method provided by the embodiment of the present application are the same as the beneficial effects of the payment switching method provided by the above-mentioned embodiment, and other technical features of the payment system are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here. The embodiment of the present application provides an electronic device, which can be a playback device, and the electronic device includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor so that at least one processor can execute the payment switching method in the above-mentioned embodiment.
[0126] Reference below Figure 5, which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. The electronic device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0127] like Figure 5 As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM) 1004. In RAM 1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM 1002, and RAM 1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems may be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device may allow the electronic device to communicate wirelessly or wired with other devices to exchange data. Although the electronic device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have instead.
[0128] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1003, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0129] The electronic device provided by the present application adopts the payment switching method in the above-mentioned embodiment 1 to solve the problem of untimely switching caused by manually switching the online / offline payment status of the cash register terminal. Compared with the prior art, the beneficial effects of the product flow data distribution provided by the embodiment of the present application are the same as the beneficial effects of the payment switching method provided by the above-mentioned embodiment, and the other technical features of the payment system are the same as the features disclosed by the above-mentioned embodiment method, which will not be repeated here. It should be understood that the various parts of the present disclosure can be implemented by hardware, software, firmware or a combination thereof. In the description of the above-mentioned embodiments, specific features, structures, materials or characteristics can be combined in a suitable manner in any one or more embodiments or examples. The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims. The present embodiment provides a computer-readable storage medium having computer-readable program instructions stored thereon, and the computer-readable program instructions are used to execute the payment switching method in the above-mentioned embodiment 1. The computer-readable storage medium provided in the embodiment of the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor devices, equipment or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable EPROM (Electrical Programmable Read Only Memory) or flash memory, an optical fiber, a portable compact disk CD-ROM (compact disc read-only memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution device, device or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency, radio frequency), etc., or any suitable combination of the above. The above-mentioned computer-readable storage medium may be contained in an electronic device; it may also exist alone without being assembled into an electronic device.The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains the push result sent by the server, and determines the service status of the server according to the push result; when the cashier terminal is in the online payment state, if the service status is an abnormal state, the cashier terminal is switched from the online payment state to the offline payment state; when the cashier terminal is in the offline payment state, if the service status is restored to normal, the cashier terminal is switched from the offline payment state to the online payment state.
[0130] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a LAN (local area network) or WAN (Wide Area Network), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0131] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based device that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0132] The modules involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The name of the module does not, in some cases, constitute a limitation on the unit itself. The computer-readable storage medium provided in the present application stores computer-readable program instructions for executing the above-mentioned payment switching method, which is intended to solve the problem of untimely switching caused by manual switching of the online / offline payment status of the cash register terminal. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the embodiments of the present application are the same as the beneficial effects of the payment switching method provided in the above-mentioned embodiments, which will not be elaborated here.
[0133] The present application also provides a computer program product, including a computer program, which implements the steps of the payment switching method as described above when executed by a processor. The computer program product provided by the present application is intended to solve the problem of untimely switching caused by manually switching the online / offline payment status of the cash register terminal. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiment of the present application are the same as the beneficial effects of the payment switching method provided by the above embodiment, which will not be repeated here. The above is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of this application, or directly or indirectly used in other related technical fields, are similarly included in the patent processing scope of the present application.
Claims
1. A payment switching method, characterized in that: Applied to a cash register terminal, the method includes: Obtaining a push result sent by the server, and determining the service status of the server according to the push result; When the cashier terminal is in an online payment state, if the service state is an abnormal state, switching the cashier terminal from the online payment state to the offline payment state; When the cash register terminal is in the offline payment state, if the service state is restored to a normal state, the cash register terminal is switched from the offline payment state to the online payment state.
2. The method according to claim 1, characterized in that The push result includes a first response result, and the step of obtaining the push result sent by the server includes: When the cash register terminal is in an online payment state, sending a transaction request to the server, so that the server sends the first response result to the cash register terminal based on the transaction request; Receive the first response result sent by the server.
3. The method according to claim 1, characterized in that The push result includes a second response result, and the step of obtaining the push result sent by the server includes: When the cashier terminal is in an offline payment state, periodically sending an access request to the server, so that the server returns a second response result to the cashier terminal based on the access request; Receive the second response result sent by the server.
4. The method according to claim 1, characterized in that The push result includes a first response result, and the step of determining the service status of the server according to the push result includes: Determining whether the first response result is abnormal; If the first response result is abnormal, the acquired cumulative number of abnormalities of the cash register terminal is accumulated, and it is determined whether the cumulative number of abnormalities is greater than a preset abnormality threshold; If the accumulated number of abnormalities is greater than a preset abnormality threshold, the service status is determined to be an abnormal status.
5. The method according to claim 4, characterized in that The step of determining whether the first response result is abnormal comprises: Determine the response duration and the response content from the first response result; Determine whether the response time is greater than a preset time, and determine whether the response content meets a preset abnormal error condition; If the response duration is longer than the preset duration, and / or the response content satisfies a preset abnormal error reporting condition, then it is determined that the first response result is abnormal; If the response time is less than or equal to the preset time, and the response content does not meet the preset abnormal error reporting condition, the first response result is determined to be normal, and the acquired accumulated number of abnormalities of the cash register terminal is reset.
6. The method according to claim 1, characterized in that The push result includes a second response result, and the step of determining the service status of the server according to the push result includes: If the second response result is normal, it is determined that the service status of the server is restored to normal.
7. A payment switching method, characterized in that: Applied to the server, the method includes: Send a push result to the cashier terminal; the cashier terminal is used to obtain the push result sent by the server, and determine the service status of the server according to the push result. The cashier terminal is also used to switch the cashier terminal from the online payment state to the offline payment state when the cashier terminal is in the online payment state and the service status is an abnormal state. The cashier terminal is also used to switch the cashier terminal from the offline payment state to the online payment state when the cashier terminal is in the offline payment state and the service status is restored to a normal state.
8. The method according to claim 7, characterized in that The push result includes a second response result, and the method includes: Upon receiving an access request sent by the cash register terminal, determining whether the server meets a preset normal recovery condition; When the server meets the preset normal recovery condition, a normal second response result is returned to the cash register terminal; The preset normal recovery conditions include that the memory usage of the server is less than or equal to a first preset threshold, the CPU occupancy of the server is less than or equal to a preset second threshold, and / or the average response time of the server is less than or equal to a preset third threshold.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the steps of the payment switching method described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program for implementing the payment switching method, and the program for implementing the payment switching method is executed by a processor to implement the steps of the payment switching method as described in any one of claims 1 to 8.
