Transaction state updating method and device and electronic equipment
By constructing a transaction state node graph in financial transactions and verifying state update instructions, the problem of low accuracy in transaction state updates is solved, and accurate and consistent control of transaction states is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-13
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, the accuracy of transaction status updates in financial transactions is low. Improper concurrent update operations or network failures can easily lead to incorrect entry of status information, affecting the accuracy of transaction status.
Upon receiving a status update instruction, the system determines the current transaction status of the target transaction and obtains its status configuration information to determine if the status update instruction is incorrect. If incorrect, the current status remains unchanged; if correct, the status is changed according to the instruction. A transaction status node graph is constructed to define the legal state transitions, ensuring the accuracy of the status update.
It improves the accuracy of transaction status updates, avoids erroneous status change operations, and ensures the correctness and consistency of transaction status.
Smart Images

Figure CN122022997A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology, and more specifically, to a method, apparatus, and electronic device for updating transaction status. Background Technology
[0002] In financial transactions, database tables can be used to record detailed information about each transaction, and the status of a transaction can be determined by the status field in the database table. For example, the transaction status can be "not started", "processing", "success", "failure", etc., and the current execution status of the transaction can be determined by recording specific fields in the database table.
[0003] However, when changing the transaction status, due to improper concurrent update operations or abnormal situations such as network system failures, the status information may be entered incorrectly, resulting in errors in the transaction status recorded in the database table and affecting the accuracy of the transaction status.
[0004] There is currently no effective solution to the problem of low accuracy in updating transaction status in related technologies. Summary of the Invention
[0005] The main objective of this application is to provide a method, apparatus, and electronic device for updating transaction status, in order to solve the problem of low accuracy in updating transaction status in related technologies.
[0006] To achieve the above objectives, according to one aspect of this application, a method for updating the transaction status is provided. The method includes: upon receiving a status update instruction, determining the target transaction indicated by the status update instruction and determining the current transaction status of the target transaction; obtaining status configuration information of the target transaction and determining whether the status update instruction is erroneous based on the status configuration information; if the status update instruction is erroneous, maintaining the current transaction status of the target transaction unchanged; and if the status update instruction is correct, changing the current transaction status of the target transaction according to the status update instruction.
[0007] Optionally, the state configuration information is obtained by configuring the following: obtaining the transaction state of the target transaction at each transaction execution stage to obtain M initial transaction states, where M is a positive integer; generating a transaction state node graph based on the connection relationship between each initial transaction state, wherein the transaction state node graph includes M nodes and multiple directed edges, each node corresponds to an initial transaction state, and each directed edge is used to represent the state change direction between two initial transaction states; and determining the transaction state node graph as the state configuration information of the target transaction.
[0008] Optionally, determining whether a status update instruction is erroneous based on status configuration information includes: obtaining the target transaction status indicated by the status update instruction; determining whether it is permissible for the target transaction's transaction status to change from the current transaction status to the target transaction status based on the status configuration information; if the change is permissible, determining that the status update instruction is correct; if the change is not permissible, determining that the status update instruction is erroneous.
[0009] Optionally, before determining whether the status update instruction is erroneous based on the status configuration information, the method further includes: obtaining the original transaction status indicated by the status update instruction; determining whether the original transaction status is the same as the current transaction status; if the original transaction status is the same as the current transaction status, performing the step of determining whether the status update instruction is erroneous based on the status configuration information; if the original transaction status is different from the current transaction status, determining that the status update instruction is erroneous.
[0010] Optionally, changing the current transaction status of the target transaction according to the status update instruction includes: obtaining the target transaction status indicated by the status update instruction and the time of the status change, and determining the storage space for storing the status information of the target transaction; when the time of the status change is reached, changing the stored information in the storage space from the current transaction status to the target transaction status.
[0011] Optionally, after changing the current transaction status of the target transaction according to the status update instruction, the method further includes: obtaining the trigger information corresponding to the changed transaction status, and executing the trigger operation indicated by the trigger information.
[0012] Optionally, upon receiving a status update instruction, the method further includes: if the number of sub-instructions carried in the status update instruction is greater than one, determining whether the target transactions indicated by the multiple sub-instructions are the same; if the target transactions indicated by the multiple sub-instructions are different, performing a transaction status update operation on each sub-instruction as a status update instruction; if the target transactions indicated by the multiple sub-instructions are the same, generating a target update instruction based on the multiple sub-instructions, and modifying the status update instruction into a target update instruction.
[0013] Optionally, generating a target update instruction based on multiple sub-instructions includes: determining whether the target transaction states indicated by the multiple sub-instructions are the same; if the target transaction states indicated by the multiple sub-instructions are the same, determining any one of the sub-instructions as the target update instruction; if the target transaction states indicated by the multiple sub-instructions are not the same, determining whether there is a time difference between the multiple sub-instructions; if there is a time difference between the multiple sub-instructions, generating a serial instruction chain according to the order of the multiple sub-instructions, and determining the serial instruction chain as the target update instruction; if there is no time difference between the multiple sub-instructions, determining that the state update instruction is incorrect.
[0014] To achieve the above objectives, according to another aspect of this application, a transaction status update apparatus is provided. The apparatus includes: a first determining unit, configured to, upon receiving a status update instruction, determine the target transaction indicated by the status update instruction and determine the current transaction status of the target transaction; a first judging unit, configured to acquire status configuration information of the target transaction and judge whether the status update instruction is erroneous based on the status configuration information; a first processing unit, configured to, if the status update instruction is erroneous, maintain the current transaction status of the target transaction unchanged; and a second processing unit, configured to, if the status update instruction is correct, change the current transaction status of the target transaction according to the status update instruction.
[0015] Optionally, the state configuration information is obtained through the following devices: a first acquisition unit, used to acquire the transaction state of the target transaction in each transaction execution stage, and obtain M initial transaction states, where M is a positive integer; a first generation unit, used to generate a transaction state node graph according to the connection relationship between each initial transaction state, wherein the transaction state node graph includes M nodes and multiple directed edges, each node corresponds to an initial transaction state, and each directed edge is used to represent the state change direction between two initial transaction states; and a second determination unit, used to determine the transaction state node graph as the state configuration information of the target transaction.
[0016] Optionally, the first judgment unit includes: a first acquisition module, used to acquire the target transaction state indicated by the status update instruction; a first judgment module, used to determine whether the transaction state of the target transaction is allowed to change from the current transaction state to the target transaction state based on the status configuration information; a first determination module, used to determine that the status update instruction is correct if the transaction state of the target transaction is allowed to change from the current transaction state to the target transaction state; and a second determination module, used to determine that the status update instruction is incorrect if the transaction state of the target transaction is not allowed to change from the current transaction state to the target transaction state.
[0017] Optionally, before determining whether the status update instruction is erroneous based on the status configuration information, the device further includes: a second acquisition unit, configured to acquire the original transaction status indicated by the status update instruction; a second judgment unit, configured to determine whether the original transaction status is the same as the current transaction status; a first execution unit, configured to execute the step of determining whether the status update instruction is erroneous based on the status configuration information if the original transaction status is the same as the current transaction status; and a third determination unit, configured to determine that the status update instruction is erroneous if the original transaction status is different from the current transaction status.
[0018] Optionally, the second processing unit includes: a second acquisition module, used to acquire the target transaction state and the state change time indicated by the state update instruction, and determine the storage space for storing the state information of the target transaction; and a change module, used to change the stored information in the storage space from the current transaction state to the target transaction state when the state change time is reached.
[0019] Optionally, after changing the current transaction status of the target transaction according to the status update instruction, the device further includes: a third acquisition unit, used to acquire the trigger information corresponding to the changed transaction status, and execute the trigger operation indicated by the trigger information.
[0020] Optionally, upon receiving a status update instruction, the device further includes: a third judgment unit, configured to determine whether the target transactions indicated by the multiple sub-instructions are the same if the number of sub-instructions carried in the status update instruction is greater than one; a second execution unit, configured to perform a transaction status update operation on each sub-instruction as a status update instruction if the target transactions indicated by the multiple sub-instructions are different; and a second generation unit, configured to generate a target update instruction based on the multiple sub-instructions if the target transactions indicated by the multiple sub-instructions are the same, and modify the status update instruction into a target update instruction.
[0021] Optionally, the second generation unit includes: a second judgment module, used to judge whether the target transaction states indicated by multiple sub-instructions are the same; a third determination module, used to determine any one sub-instruction as the target update instruction when the target transaction states indicated by multiple sub-instructions are the same; a third judgment module, used to judge whether there is a time difference among the multiple sub-instructions when the target transaction states indicated by multiple sub-instructions are not the same; a fourth determination module, used to generate a serial instruction chain according to the order of the multiple sub-instructions when there is a time difference among the multiple sub-instructions, and determine the serial instruction chain as the target update instruction; and a fifth determination module, used to determine that the state update instruction is incorrect when there is no time difference among the multiple sub-instructions.
[0022] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, the electronic device including a memory storing an executable program; and a processor for running the program, wherein the program executes the above-described transaction state update method during runtime.
[0023] To achieve the above objectives, according to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement the steps of the above-described transaction state update method.
[0024] In this embodiment, upon receiving a status update instruction, the system determines the target transaction indicated by the instruction and its current transaction status; obtains the target transaction's status configuration information and determines whether the status update instruction is incorrect based on the configuration information; if the status update instruction is incorrect, the current transaction status of the target transaction remains unchanged; if the status update instruction is correct, the current transaction status of the target transaction is changed according to the instruction. By using the target transaction's status configuration information to determine the correctness of the status update instruction upon receipt, and thus verifying the status update instruction, the system ensures that the transaction status of the target transaction can only be controlled and adjusted by correct status update instructions. This improves the accuracy of updating the transaction status of the target transaction, thereby solving the technical problem of low accuracy in updating transaction status in related technologies. Attached Figure Description
[0025] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0026] Figure 1 A hardware block diagram of a computer terminal for implementing a method for updating transaction status is shown.
[0027] Figure 2 This is a flowchart of a transaction status update method according to Embodiment 1 of this application;
[0028] Figure 3 This is a schematic diagram of an optional transaction state node diagram provided according to Embodiment 1 of this application;
[0029] Figure 4 This is a flowchart of an optional transaction status update method provided according to Embodiment 1 of this application;
[0030] Figure 5 This is a schematic diagram of a transaction status update device according to Embodiment 2 of this application;
[0031] Figure 6 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0032] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0033] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0034] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0035] It should be noted that the transaction status update method, device, and electronic device determined in this disclosure can be used in the financial technology field, or in any field other than the financial technology field. The application field of the transaction status update method, device, and electronic device determined in this disclosure is not limited.
[0036] It should be noted that all information, user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, and displayed data) used in this application are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with the relevant laws, regulations, and standards of the relevant regions, have taken necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse use. If the user chooses to refuse, the process will proceed to the expert decision-making process. For example, this system has an interface with relevant users or organizations. Before obtaining relevant information, a request to obtain the information needs to be sent to the aforementioned user or organization through the interface. After receiving consent from the aforementioned user or organization, the relevant information is obtained. Users can view the purpose of data use in real time through the authorization interface and have the right to withdraw authorization or delete data at any time. After the authorization is withdrawn, the system will terminate the relevant data processing within 24 hours.
[0037] The embodiments or examples disclosed herein are not exhaustive, but merely illustrative of some embodiments or examples, and are not intended to limit the scope of protection of this disclosure. Unless otherwise specified, each step in a particular embodiment or example can be implemented as an independent embodiment, and the steps can be arbitrarily combined. For example, a solution after removing some steps in a particular embodiment or example can also be implemented as an independent embodiment, and the order of the steps in a particular embodiment or example can be arbitrarily interchanged. Furthermore, optional methods or examples in a particular embodiment or example can be arbitrarily combined; moreover, embodiments or examples can be arbitrarily combined. For example, some or all steps of different embodiments or examples can be arbitrarily combined, and a particular embodiment or example can be arbitrarily combined with optional methods or examples of other embodiments or examples.
[0038] Example 1
[0039] According to an embodiment of this application, an embodiment of a method for updating transaction status is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0040] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing a method for updating transaction states is shown. Figure 1As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, processing devices such as microprocessors or programmable logic devices), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface, a universal serial bus port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0041] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0042] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the transaction status update method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned transaction status update method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0043] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0044] The display may be, for example, a touchscreen LCD display that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0045] Under the aforementioned operating environment, this application provides the following: Figure 2 The method for updating the transaction status is shown. Figure 2 This is a flowchart of the transaction status update method according to Embodiment 1 of this application, as follows: Figure 2 As shown, the method includes:
[0046] Step S201: Upon receiving a status update instruction, determine the target transaction indicated by the status update instruction and determine the current transaction status of the target transaction.
[0047] It should be noted that the execution entity in this embodiment can be a transaction status update system or platform, such as a state machine, which is a programmatic model.
[0048] It should be noted that a state update instruction can be a command sent by the client when a transaction needs to transition from one state to another, triggering the state machine to perform the state transition. For example, to transition a transaction's state from "pending" to "processing," a corresponding state update instruction is required to perform this operation. The target transaction refers to the specific transaction instance that needs to undergo a state transition according to the state update instruction; the current transaction state is the state recorded in the database for the target transaction before receiving the state update instruction.
[0049] For example, when it is necessary to update the transaction status of a certain transaction, a status update instruction needs to be sent to the state machine first. After receiving the status update instruction, the state machine first needs to determine the target transaction for which the status update needs to be performed. This can be achieved by parsing the transaction identification information contained in the status update instruction, such as the transaction number.
[0050] Furthermore, the system will query the data table corresponding to the target transaction in the database and read the current status field of the transaction to determine its current transaction status.
[0051] Step S202: Obtain the status configuration information of the target transaction, and determine whether the status update instruction is incorrect based on the status configuration information.
[0052] It should be noted that the state configuration information refers to the transaction's configuration information, which may include the allowed state transition rules for the target transaction and the definition of the final state. The state configuration information is the basis for the state machine to determine whether a state update instruction is correct.
[0053] For example, after confirming the target transaction and its current transaction status, the system needs to obtain the target transaction's status configuration information. This status configuration information contains all legal paths for the target transaction's status transition; for example, "pending" can transition to "processing," and "processing" can transition to "success" or "failed." The system will then compare the current transaction status with the target transaction status in the status update instruction, and check the status configuration information to determine whether the status update is correct, that is, whether the content indicated by the status update instruction can be achieved. For example, if the current status is "processing," and the status update instruction attempts to update it to "pending," then the instruction will be considered an erroneous instruction.
[0054] Step S203: In the event of an error in the status update instruction, maintain the current transaction status of the target transaction unchanged.
[0055] For example, if the status update instruction is found to be erroneous in step S202, the system will not perform any status update operation, thereby maintaining the current status of the target transaction unchanged. For instance, if the status of the target transaction is "paid," and the status update instruction attempts to update it to "awaiting order confirmation," the system will determine based on the status configuration information that this is an erroneous status transition instruction and will refuse to execute the update instruction, thus preventing the transaction status from being incorrectly modified.
[0056] Step S204: If the status update instruction is correct, change the current transaction status of the target transaction according to the status update instruction.
[0057] For example, if the status update instruction is determined to be correct, the current transaction status of the target transaction can be changed according to the status change content indicated in the status update instruction, thereby completing the status update operation of the target transaction.
[0058] The transaction status update method provided in this application improves the accuracy of updating the transaction status by: upon receiving a status update instruction, determining the target transaction indicated by the instruction and its current transaction status; obtaining the target transaction's status configuration information and determining whether the status update instruction is erroneous based on the configuration information; maintaining the target transaction's current transaction status unchanged if the instruction is erroneous; and changing the target transaction's current transaction status according to the instruction if the instruction is correct. By verifying the status update instruction using the target transaction's configuration information, the method ensures that the target transaction's transaction status can only be controlled and adjusted by correct instructions. This improves the accuracy of updating the target transaction's transaction status and solves the technical problem of low accuracy in updating transaction status in related technologies.
[0059] Optionally, in the transaction status update method provided in this application embodiment, the status configuration information is configured as follows: obtain the transaction status of the target transaction in each transaction execution stage to obtain M initial transaction states, where M is a positive integer; generate a transaction status node graph according to the connection relationship between each initial transaction state, wherein the transaction status node graph includes M nodes and multiple directed edges, each node corresponds to an initial transaction state, and each directed edge is used to represent the state change direction between two initial transaction states; determine the transaction status node graph as the status configuration information of the target transaction.
[0060] For example, when configuring the status configuration information of the target transaction, it is first necessary to obtain all the initial transaction statuses of the target transaction, such as "not started", "processing", "success", "failure" and other statuses. By comprehensively identifying and recording the transaction status, the necessary data foundation is provided for the subsequent construction of the transaction status node diagram, so that the state machine can cover the entire life cycle of the transaction and provide complete state transition control.
[0061] Furthermore, after obtaining all initial transaction states, it is necessary to construct a transaction state node graph based on the business relationships between these states. In the graph, each node represents a transaction state, and directed edges represent the flow direction between states. Figure 3 This is a schematic diagram of an optional transaction state node diagram provided in Embodiment 1 of this application, as follows: Figure 3 As shown, the initial transaction status can include: pending execution, canceled execution, executing, execution failed, execution successful, execution result generation in progress, and execution result feedback. Based on the business relationships between the various initial transaction statuses, we can obtain the following: Figure 3The transaction status node diagram is shown below.
[0062] Finally, the completed transaction state node diagram is determined as the state configuration information of the target transaction. In the subsequent transaction state update process, the state machine will use this state configuration information to determine whether the state update instruction is correct and how to execute the state update operation.
[0063] This embodiment determines the state configuration information by constructing a transaction state node graph, so that when the state machine updates the transaction state, it can use a predefined state change direction, avoid erroneous state transitions, and improve the accuracy of state change operations.
[0064] To accurately determine whether a status update instruction is erroneous, optionally, in the transaction status update method provided in this application embodiment, determining whether a status update instruction is erroneous based on status configuration information includes: obtaining the target transaction status indicated by the status update instruction; determining whether it is allowed for the transaction status of the target transaction to change from the current transaction status to the target transaction status based on the status configuration information; if it is allowed for the transaction status of the target transaction to change from the current transaction status to the target transaction status, determining that the status update instruction is correct; if it is not allowed for the transaction status of the target transaction to change from the current transaction status to the target transaction status, determining that the status update instruction is erroneous.
[0065] For example, when the system detects a status update instruction, it first needs to parse the instruction and extract the target transaction status. This process involves standardizing the instruction format so that the intended target transaction status can be accurately interpreted from the instruction. For instance, suppose the received status update instruction is "update the status of transaction number 12345 in the payment_order table from processing to success". The system will extract the information that "target_transaction_status" is "success" from the instruction, meaning the target transaction status is "success".
[0066] Furthermore, the system will refer to the status configuration information to check whether the target transaction is allowed to be updated from the current transaction status to the target transaction status. That is, the system will determine the position of the current transaction status in the status configuration information, and determine whether there is a directed edge between the target transaction status and the current transaction status based on the directed edge connected to the current transaction status in the status configuration information, and whether the directed edge points from the current transaction status to the target transaction status.
[0067] If there is a directed edge between the target transaction state and the current transaction state, and the directed edge points from the current transaction state to the target transaction state, it can be determined that the transaction state of the target transaction is allowed to change from the current transaction state to the target transaction state. At this time, it can be determined that the state update instruction is correct, and the corresponding transaction state change operation is executed according to the state update instruction.
[0068] If there is no directed edge between the target transaction state and the current transaction state, or if the directed edge does not point from the current transaction state to the target transaction state, it can be determined that the transaction state of the target transaction is not allowed to change from the current transaction state to the target transaction state. In this case, it can be determined that the state update instruction is incorrect, and the state change operation is not executed.
[0069] This embodiment improves the accuracy of status update operations by using status configuration information to determine whether the status update instruction is erroneous, thereby avoiding the phenomenon of executing incorrect change operations based on erroneous instructions.
[0070] To accurately determine whether a status update instruction is erroneous, optionally, in the transaction status update method provided in this application embodiment, before determining whether the status update instruction is erroneous based on the status configuration information, the method further includes: obtaining the original transaction status indicated by the status update instruction; determining whether the original transaction status is the same as the current transaction status; if the original transaction status is the same as the current transaction status, performing the step of determining whether the status update instruction is erroneous based on the status configuration information; if the original transaction status is different from the current transaction status, determining that the status update instruction is erroneous.
[0071] It should be noted that the original transaction state is the current transaction state indicated in the state update instruction. For example, if the state update instruction is to change from state A to state B, the original transaction state is state A and the target transaction state is state B.
[0072] For example, after receiving a status update instruction, one can first determine whether the status update instruction is incorrect based on its content. This can be done by obtaining the current transaction status of the target transaction and the original transaction status indicated by the status update instruction. If the current transaction status and the original transaction status are inconsistent, it indicates that the initial transaction status indicated by the status update instruction is incorrect, and the status update instruction can be directly determined to be an erroneous instruction. This could be due to errors in the target transaction information or incorrect sending time, causing the inconsistency between the status update instruction content and the current transaction status. In this case, the status update instruction can be directly determined to be erroneous without further processing.
[0073] If the current transaction status is consistent with the original transaction status, it indicates that the instruction indicates the transaction status of the target transaction at the current moment. Then, the subsequent steps of judging whether the status update instruction is incorrect based on the status configuration information are executed normally. Thus, the correctness of the status update instruction is accurately determined through two judgment operations.
[0074] This embodiment compares the current transaction status with the original transaction status to determine whether the status update instruction is correct, thereby improving the accuracy of the status update operation and avoiding the phenomenon of executing incorrect change operations based on incorrect instructions.
[0075] To accurately execute the state change operation, optionally, in the transaction state update method provided in the embodiments of this application, changing the current transaction state of the target transaction according to the state update instruction includes: obtaining the target transaction state indicated by the state update instruction and the state change time, and determining the storage space for storing the state information of the target transaction; when the state change time is reached, changing the stored information in the storage space from the current transaction state to the target transaction state.
[0076] For example, when changing the transaction status, the system needs to parse the status update instruction to extract the target transaction status and the time of the status change. The system also needs to determine the specific storage space for storing the target transaction status information, i.e., the database table and the status field. For instance, suppose the status update instruction requires updating the status of transaction number 12345 in the "payment_order" table from "processing" to "success," and the status change time is the current time. The system will recognize "target_transaction_status" as "success," "change_timestamp" as the current system time, and determine that the stored information is located in the storage space of the "payment_order" table with "transaction_status" as the field.
[0077] Furthermore, after determining the target transaction status, the time of the status change, and the storage space, the system will check whether the current time has reached the time of the status change. If so, the system will update the current transaction status in the storage space to the target transaction status based on the previously determined storage space information.
[0078] It should be noted that when the state change time is reached, it is possible to check again whether the original transaction state is the same as the current transaction state. This ensures that the current transaction state has not changed when the state change is performed, thus avoiding the need to repeatedly execute the transaction state change operation.
[0079] This embodiment improves the accuracy of state update operations by determining the storage space and performing state changes when the state change time arrives.
[0080] Optionally, in the transaction status update method provided in the embodiments of this application, after changing the current transaction status of the target transaction according to the status update instruction, the method further includes: obtaining the trigger information corresponding to the changed transaction status, and executing the trigger operation indicated by the trigger information.
[0081] For example, after a transaction's state successfully changes to the target transaction state through the state machine's update mechanism, the system will retrieve the state configuration information to find trigger information that matches the target transaction state. Trigger information can include a series of business logic operations or data processing tasks, such as sending a notification to the client, updating the state of related transactions, or performing data cleanup tasks. For instance, when the state of a payment transaction changes from "processing" to "success," the system will search the state configuration information for trigger information related to the "success" state.
[0082] Upon receiving the trigger information, the system will parse the operation instructions within the trigger information and immediately initiate the corresponding trigger operation. Trigger operations can be highly diverse, depending on business needs, and may include calling external services, starting scheduled tasks, updating related database tables, etc., to complete the corresponding business operation. For example, for the payment transaction mentioned above, when the status changes to "success," the trigger information could instruct the system to send a payment success notification to the merchant and update the merchant's account balance.
[0083] This embodiment achieves the technical effect of improving the automation level of status update operations and related operations by executing corresponding trigger operations based on the target transaction status after the transaction status is changed, so that no manual execution of the corresponding trigger operations is required after the status is updated.
[0084] Optionally, in the transaction status update method provided in the embodiments of this application, when a status update instruction is received, the method further includes: if the number of sub-instructions carried in the status update instruction is greater than one, determining whether the target transactions indicated by the multiple sub-instructions are the same; if the target transactions indicated by the multiple sub-instructions are not the same, performing a transaction status update operation on each sub-instruction as a status update instruction; if the target transactions indicated by the multiple sub-instructions are the same, generating a target update instruction based on the multiple sub-instructions, and modifying the status update instruction into a target update instruction.
[0085] It should be noted that a sub-instruction can be multiple independent instructions that may be contained in a state update instruction, with each sub-instruction indicating a specific state update operation for different or the same transaction.
[0086] For example, when a status update instruction contains more than one sub-instruction, the system first parses the instruction, identifies the sub-instruction entries, and checks whether these sub-instructions all point to the same target transaction. For instance, a status update instruction might contain sub-instructions updating transaction A from "processing" to "success" and updating transaction B from "pending" to "processing." In this case, the system needs to determine whether transaction A and transaction B are the same transaction instance.
[0087] If the system determines that a sub-instruction points to different target transactions, it will process each sub-instruction separately, treating it as an independent state update instruction and performing the corresponding state update operation for each target transaction. For example, for the instruction mentioned above, the system will first update the state of transaction A, and then update the state of transaction B.
[0088] When the system detects that multiple sub-instructions all point to the same target transaction, it will merge these sub-instructions to generate a composite target update instruction, and then perform a status update operation based on the composite target update instruction.
[0089] This embodiment improves the accuracy of the instruction content of the state update instruction by combining multiple sub-instructions in the state update instruction, thereby improving the accuracy of the state update operation.
[0090] Optionally, in the transaction status update method provided in this application embodiment, generating a target update instruction based on multiple sub-instructions includes: determining whether the target transaction statuses indicated by the multiple sub-instructions are the same; if the target transaction statuses indicated by the multiple sub-instructions are the same, determining any one sub-instruction as the target update instruction; if the target transaction statuses indicated by the multiple sub-instructions are not the same, determining whether there is a time difference between the multiple sub-instructions; if there is a time difference between the multiple sub-instructions, generating a serial instruction chain according to the order of the multiple sub-instructions, and determining the serial instruction chain as the target update instruction; if there is no time difference between the multiple sub-instructions, determining that the status update instruction is incorrect.
[0091] For example, when generating a target update instruction based on multiple sub-instructions, it is first necessary to determine whether these sub-instructions all instruct the transaction status to be updated to the same target transaction status. For instance, suppose the received instruction contains two sub-instructions, which respectively request the transaction status to be updated from "processing" to "success" and "completed". The system will compare them to determine whether the target transaction status is consistent.
[0092] If multiple sub-instructions target the same transaction state, the system will select any one of them as the target update instruction for execution. For example, if all three sub-instructions require updating the transaction state to "success", the system will choose any one to execute, maintaining the singleness and consistency of transaction state updates.
[0093] It should be noted that before execution, it is still necessary to determine whether the sub-instruction is correct in order to maintain the accuracy of the transaction status update operation.
[0094] If the target transaction states of the sub-instructions are inconsistent, the system further checks for time differences between them, i.e., whether the sub-instructions were generated or should have been executed at different times. For example, two sub-instructions may request the transaction state to be updated to "success" and "completed" respectively, but the "success" instruction was generated earlier than the "completed" instruction. When a time difference exists and the target transaction states of the sub-instructions are inconsistent, the system will chain these sub-instructions into a single instruction chain based on the order in which they were issued, forming a composite target update instruction. For example, if the sub-instructions request the state to be updated to "success" and "completed" sequentially, the system will create an instruction chain, first executing the "success" instruction, then the "completed" instruction, and checking the correctness of each sub-instruction. Only if the sub-instructions are correct will they be executed, thus completing the automatic combination of instructions while maintaining the accuracy of the state update operation.
[0095] If multiple sub-instructions with inconsistent target states do not have a time difference, it indicates that there is a logical conflict in the state update instructions. The system will directly determine that the state update instruction is wrong and avoid execution, thereby avoiding chaos in the transaction state.
[0096] This embodiment achieves flexible processing of composite state update instructions by judging the consistency of the states of multiple sub-instructions, identifying time differences, and constructing instruction chains, thereby improving the accuracy of transaction state update operations.
[0097] Figure 4 This is a flowchart of an optional transaction status update method provided in Embodiment 1 of this application, as shown below. Figure 4 As shown, after receiving the status update instruction, the target transaction indicated by the status update instruction is obtained, and the original transaction status and the target transaction status are determined, and the initial transaction status of the target transaction is determined.
[0098] Determine whether the initial transaction state and the original transaction state are consistent. If they are inconsistent, the state update instruction is incorrect. If they are consistent, the state configuration information of the target transaction needs to be obtained, and the state configuration information is used to determine whether it is allowed to update from the initial transaction state to the target transaction state.
[0099] If updating from the initial transaction state to the target transaction state is allowed, the status update instruction is determined to be correct, and the current transaction state of the target transaction is changed according to the status update instruction. If updating from the initial transaction state to the target transaction state is not allowed, the status update instruction is determined to be incorrect.
[0100] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0101] Example 2
[0102] This application also provides a transaction status updating apparatus. It should be noted that the transaction status updating apparatus of this application can be used to execute the transaction status updating method provided in the above embodiments. The transaction status updating apparatus provided in this application will be described below.
[0103] According to an embodiment of this application, an apparatus for implementing the above-described transaction status update method is also provided. Figure 5 This is a schematic diagram of a transaction status update device according to Embodiment 2 of this application, as shown below. Figure 5 As shown, the device includes:
[0104] The first determining unit 51 is used to determine the target transaction indicated by the status update instruction and determine the current transaction status of the target transaction when a status update instruction is received.
[0105] The first judgment unit 52 is used to obtain the status configuration information of the target transaction and determine whether the status update instruction is incorrect based on the status configuration information.
[0106] The first processing unit 53 is used to maintain the current transaction state of the target transaction unchanged in the event of an error in the state update instruction.
[0107] The second processing unit 54 is used to change the current transaction status of the target transaction according to the status update instruction if the status update instruction is correct.
[0108] The transaction status update apparatus provided in this application embodiment, upon receiving a status update instruction, comprises a first determining unit 51 that determines the target transaction indicated by the status update instruction and determines the current transaction status of the target transaction; a first judging unit 52 that obtains the status configuration information of the target transaction and judges whether the status update instruction is incorrect based on the status configuration information; a first processing unit 53 that maintains the current transaction status of the target transaction unchanged if the status update instruction is incorrect; and a second processing unit 54 that changes the current transaction status of the target transaction according to the status update instruction if the status update instruction is correct. By using the status configuration information of the target transaction to judge whether the status update instruction is correct upon receiving the status update instruction, the transaction status of the target transaction can only be controlled and adjusted by the correct status update instruction, thereby improving the accuracy of updating the transaction status of the target transaction and achieving the technical effect of improving the accuracy of updating the transaction status of the target transaction. This solves the technical problem of low accuracy in updating transaction status in related technologies.
[0109] Optionally, in the transaction status update device provided in this application embodiment, the status configuration information is obtained through the following device configuration: a first acquisition unit, used to acquire the transaction status of the target transaction in each transaction execution stage, and obtain M initial transaction states, where M is a positive integer; a first generation unit, used to generate a transaction status node graph according to the connection relationship between each initial transaction state, wherein the transaction status node graph includes M nodes and multiple directed edges, each node corresponds to an initial transaction state, and each directed edge is used to characterize the state change direction between two initial transaction states; and a second determination unit, used to determine the transaction status node graph as the status configuration information of the target transaction.
[0110] Optionally, in the transaction status update device provided in this application embodiment, the first judgment unit 52 includes: a first acquisition module, used to acquire the target transaction status indicated by the status update instruction; a first judgment module, used to determine whether the transaction status of the target transaction is allowed to change from the current transaction status to the target transaction status based on the status configuration information; a first determination module, used to determine that the status update instruction is correct if the transaction status of the target transaction is allowed to change from the current transaction status to the target transaction status; and a second determination module, used to determine that the status update instruction is incorrect if the transaction status of the target transaction is not allowed to change from the current transaction status to the target transaction status.
[0111] Optionally, in the transaction status update device provided in this application embodiment, before determining whether the status update instruction is erroneous based on the status configuration information, the device further includes: a second acquisition unit, used to acquire the original transaction status indicated by the status update instruction; a second judgment unit, used to determine whether the original transaction status is the same as the current transaction status; a first execution unit, used to execute the step of determining whether the status update instruction is erroneous based on the status configuration information when the original transaction status is the same as the current transaction status; and a third determination unit, used to determine that the status update instruction is erroneous when the original transaction status is different from the current transaction status.
[0112] Optionally, in the transaction status update device provided in this application embodiment, the second processing unit 54 includes: a second acquisition module, used to acquire the target transaction status indicated by the status update instruction and the status change time, and determine the storage space for storing the status information of the target transaction; and a change module, used to change the stored information in the storage space from the current transaction status to the target transaction status when the status change time is reached.
[0113] Optionally, in the transaction status update device provided in this application embodiment, after changing the current transaction status of the target transaction according to the status update instruction, the device further includes: a third acquisition unit, used to acquire trigger information corresponding to the changed transaction status, and execute the trigger operation indicated by the trigger information.
[0114] Optionally, in the transaction status update apparatus provided in this application embodiment, upon receiving a status update instruction, the apparatus further includes: a third judgment unit, configured to determine whether the target transactions indicated by the multiple sub-instructions are the same if the number of sub-instructions carried in the status update instruction is greater than one; a second execution unit, configured to execute the transaction status update operation by treating each sub-instruction as a status update instruction if the target transactions indicated by the multiple sub-instructions are different; and a second generation unit, configured to generate a target update instruction based on the multiple sub-instructions if the target transactions indicated by the multiple sub-instructions are the same, and modify the status update instruction into a target update instruction.
[0115] Optionally, in the transaction status update apparatus provided in this application embodiment, the second generation unit includes: a second judgment module, used to judge whether the target transaction status indicated by multiple sub-instructions is the same; a third determination module, used to determine any one sub-instruction as the target update instruction when the target transaction status indicated by multiple sub-instructions is the same; a third judgment module, used to judge whether there is a time difference among the multiple sub-instructions when the target transaction status indicated by multiple sub-instructions is not the same; a fourth determination module, used to generate a serial instruction chain according to the order of the multiple sub-instructions when there is a time difference among the multiple sub-instructions, and determine the serial instruction chain as the target update instruction; and a fifth determination module, used to determine that the status update instruction is incorrect when there is no time difference among the multiple sub-instructions.
[0116] It should be noted that the first determining unit 51, the first judging unit 52, the first processing unit 53, and the second processing unit 54 mentioned above correspond to steps S201 to S204 in Embodiment 1. The instances and application scenarios implemented by each of the above units and the corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware components or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also be part of a device and can run in the computer terminal 10 provided in Embodiment 1.
[0117] Example 3
[0118] Embodiments of this application may provide an electronic device. Figure 6 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 6 As shown, the electronic device may include: one or more ( Figure 6 (Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0119] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0120] Those skilled in the art will understand that Figure 6 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 6 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 6 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 6 The different configurations shown.
[0121] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0122] Example 4
[0123] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the transaction status update method provided in Embodiment 1.
[0124] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0125] Embodiments of this application also provide a computer program product, which, when executed on a data processing device, is adapted to perform the steps of a method for updating transaction status.
[0126] Embodiments of this application also provide a computer-readable storage medium, which includes a stored executable program, wherein, when the executable program is running, it controls the device where the computer-readable storage medium is located to perform the above-described transaction status update method.
[0127] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0128] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0129] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0130] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0131] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0132] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0133] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for updating transaction status, characterized in that, include: Upon receiving a status update instruction, determine the target transaction indicated by the status update instruction, and determine the current transaction status of the target transaction; Obtain the status configuration information of the target transaction, and determine whether the status update instruction is incorrect based on the status configuration information; In the event of an error in the status update instruction, the current transaction status of the target transaction shall remain unchanged. If the status update instruction is correct, the current transaction status of the target transaction is changed according to the status update instruction.
2. The method according to claim 1, characterized in that, The status configuration information is obtained by configuring it in the following way: Obtain the transaction status of the target transaction at each transaction execution stage to obtain M initial transaction states, where M is a positive integer; A transaction state node graph is generated based on the connection relationships between each initial transaction state. The transaction state node graph includes M nodes and multiple directed edges. Each node corresponds to an initial transaction state, and each directed edge is used to represent the direction of state change between two initial transaction states. The transaction status node graph is determined as the status configuration information of the target transaction.
3. The method according to claim 1, characterized in that, Determining whether the status update instruction is erroneous based on the status configuration information includes: Obtain the target transaction status indicated by the status update instruction; Based on the status configuration information, determine whether it is permissible to change the transaction status of the target transaction from the current transaction status to the target transaction status; If the transaction status of the target transaction is allowed to change from the current transaction status to the target transaction status, the status update instruction is determined to be correct; If the transaction status of the target transaction is not allowed to change from the current transaction status to the target transaction status, the status update instruction is determined to be incorrect.
4. The method according to claim 1, characterized in that, Before determining whether the status update instruction is erroneous based on the status configuration information, the method further includes: Obtain the original transaction state indicated by the state update instruction; Determine whether the original transaction state is the same as the current transaction state; If the original transaction state is the same as the current transaction state, the step of determining whether the state update instruction is incorrect based on the state configuration information is executed. If the original transaction state differs from the current transaction state, the state update instruction is determined to be incorrect.
5. The method according to claim 1, characterized in that, Changing the current transaction status of the target transaction according to the status update instruction includes: Obtain the target transaction status and the time of status change indicated by the status update instruction, and determine the storage space for storing the status information of the target transaction; When the state change time is reached, the stored information in the storage space is changed from the current transaction state to the target transaction state.
6. The method according to claim 1, characterized in that, After changing the current transaction status of the target transaction according to the status update instruction, the method further includes: Obtain the trigger information corresponding to the changed transaction status, and execute the trigger operation indicated by the trigger information.
7. The method according to claim 1, characterized in that, Upon receiving a status update instruction, the method further includes: If the number of sub-instructions carried in the status update instruction is greater than one, determine whether the target transactions indicated by the multiple sub-instructions are the same; If the target transactions indicated by the multiple sub-instructions are different, each sub-instruction shall be used as the status update instruction to perform the transaction status update operation. If the target transactions indicated by the multiple sub-instructions are the same, a target update instruction is generated based on the multiple sub-instructions, and the status update instruction is modified to be the target update instruction.
8. The method according to claim 7, characterized in that, The generation of target update instructions based on the multiple sub-instructions includes: Determine whether the target transaction states indicated by the multiple sub-instructions are the same; If the target transaction states indicated by the multiple sub-instructions are the same, any one of the sub-instructions will be determined as the target update instruction; If the target transaction states indicated by the multiple sub-instructions are not the same, determine whether there is a time difference between the multiple sub-instructions; When the time difference exists between the multiple sub-instructions, a serial instruction chain is generated according to the order of the multiple sub-instructions, and the serial instruction chain is determined as the target update instruction; If the time difference between the multiple sub-instructions is not present, the state update instruction is determined to be incorrect.
9. A device for updating transaction status, characterized in that, include: The first determining unit is configured to, upon receiving a status update instruction, determine the target transaction indicated by the status update instruction and determine the current transaction status of the target transaction; The first judgment unit is used to obtain the status configuration information of the target transaction and determine whether the status update instruction is incorrect based on the status configuration information. The first processing unit is configured to maintain the current transaction state of the target transaction unchanged in the event of an error in the status update instruction. The second processing unit is used to change the current transaction status of the target transaction according to the status update instruction if the status update instruction is correct.
10. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, executes the transaction state update method according to any one of claims 1 to 8.