CN113051008A - Interface request processing method and device, computer equipment and storage medium - Google Patents

Interface request processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113051008A
CN113051008A CN202110355200.9A CN202110355200A CN113051008A CN 113051008 A CN113051008 A CN 113051008A CN 202110355200 A CN202110355200 A CN 202110355200A CN 113051008 A CN113051008 A CN 113051008A
Authority
CN
China
Prior art keywords
interface
request
service processing
processing result
transaction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110355200.9A
Other languages
Chinese (zh)
Inventor
邓志豪
卢沛东
李振
汪志芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN202110355200.9A priority Critical patent/CN113051008A/en
Publication of CN113051008A publication Critical patent/CN113051008A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse

Abstract

The application relates to an interface request processing method, an interface request processing device, computer equipment and a storage medium. The method comprises the following steps: receiving an interface request for a target transaction; for each interface request, after calling an interface specified by the interface request to perform service processing, verifying a generated service processing result; if the service processing result is verified to be successful, storing the service processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner; after the business processing results of the plurality of interface requests for realizing the target transaction are verified to be successful, storing each business processing result and the transaction identifier stored in the temporary memory into a formal memory. The method improves the accuracy of the transaction processing result.

Description

Interface request processing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to an interface request processing method and apparatus, a computer device, and a storage medium.
Background
With the development of computer technology, transactions are required to be performed by computers. In some cases, a computer cannot implement the whole transaction by calling one interface, but needs to call a plurality of server interfaces in sequence for business processing so as to implement the transaction.
When a plurality of server interfaces are called to perform service processing, if one of the interfaces is abnormal in the process of processing a service, only a part of service processing results corresponding to the successfully executed interfaces are stored in the memory, so that the atomic processing of a transaction cannot be ensured, and the processing result of the transaction is inaccurate.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an interface request processing method, an interface request processing apparatus, a computer device, and a storage medium, which can improve accuracy of a processing result of a transaction.
A method of interface request processing, the method comprising:
receiving an interface request for a target transaction;
for each interface request, after calling an interface specified by the interface request to perform service processing, verifying a generated service processing result;
if the service processing result is verified to be successful, storing the service processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner;
after the business processing results of the plurality of interface requests for realizing the target transaction are verified to be successful, storing each business processing result and the transaction identifier stored in the temporary memory into a formal memory.
In one embodiment, the method further comprises:
and if the service processing result is verified to be processing failure, performing rollback to clear the service processing result stored in the temporary memory in association with the transaction identifier.
In one embodiment, the method further comprises:
returning a request processing result to a request terminal based on the service processing result;
if the request processing result is a request failure, after receiving a first interface request which is retransmitted by the request end aiming at the transaction, returning to execute the step of verifying the generated service processing result after calling the interface specified by the interface request to perform service processing;
wherein the first interface request is an interface request sent by a first interface for implementing the target transaction.
In one embodiment, the method further comprises:
and if the request processing result is that the request is successful, after receiving a next interface request which is sent by the request end aiming at the target transaction, executing the step of verifying the generated service processing result after calling the interface specified by the interface request to perform service processing.
In one embodiment, after the checking that the service processing results of the plurality of interface requests for implementing the target transaction are all successfully processed, storing each service processing result and the transaction identifier stored in the temporary memory into a formal memory includes:
and when the service processing result of the last interface request aiming at the target transaction is verified to be successful, storing the service processing result corresponding to the last interface request and the service processing result associated with the transaction identifier in the temporary memory in association with the transaction identifier in a formal memory.
In one embodiment, the method further comprises:
when the interface request is a first interface request aiming at the target transaction, generating a transaction identifier of the target transaction; the first interface request is an interface request sent by a first interface for realizing the target transaction;
if the service processing result is verified to be successful, storing the service processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner, including:
and if the service processing result requested by the first interface is verified to be successful, storing the service processing result and the generated transaction identifier into a temporary memory in an associated manner.
In one embodiment, the method further comprises:
returning the generated transaction identifier to a request end;
if the service processing result is verified to be successful, storing the service processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner, including:
and if the service processing result of the non-first interface request is verified to be successful, storing the service processing result of the non-first interface request and the transaction identifier carried in the non-first interface request into a temporary memory in an associated manner.
An interface request processing apparatus, the apparatus comprising:
a receiving module, configured to receive an interface request for a target transaction;
the verification module is used for verifying the generated service processing result after calling the interface specified by the interface request to perform service processing aiming at each interface request;
the storage module is used for storing the business processing result and the transaction identifier of the target transaction into a temporary storage in a correlation manner if the business processing result is verified to be successful;
the storage module is further configured to store each service processing result and the transaction identifier stored in the temporary memory into a formal memory after checking that all service processing results of the plurality of interface requests for implementing the target transaction are successfully processed.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
receiving an interface request for a target transaction;
for each interface request, after calling an interface specified by the interface request to perform service processing, verifying a generated service processing result;
if the service processing result is verified to be successful, storing the service processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner;
after the business processing results of the plurality of interface requests for realizing the target transaction are verified to be successful, storing each business processing result and the transaction identifier stored in the temporary memory into a formal memory.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
receiving an interface request for a target transaction;
for each interface request, after calling an interface specified by the interface request to perform service processing, verifying a generated service processing result;
if the service processing result is verified to be successful, storing the service processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner;
after the business processing results of the plurality of interface requests for realizing the target transaction are verified to be successful, storing each business processing result and the transaction identifier stored in the temporary memory into a formal memory.
According to the interface request processing method, the interface request processing device, the computer equipment and the storage medium, the server conducts successful or failed verification on the service processing result of the interface appointed by each interface request, the service processing result which is successfully verified and the transaction identifier of the target transaction are stored in the temporary memory in an associated mode, and after the service processing results of the interface requests of the target transaction are successfully processed, the service processing results and the transaction identifier stored in the temporary memory are stored in the formal memory. That is, as long as there is an interface call exception, the formal memory does not store only the service processing results successfully processed by the target transaction part, but the target transaction does not take effect, and only after the service processing results of a plurality of interface requests for implementing the target transaction are all successfully processed, all the successfully processed service processing results are stored in the formal memory, thereby automatically ensuring the atomicity of the same transaction and improving the accuracy of the processing results of the transaction.
Drawings
FIG. 1 is a diagram of an application environment of a method for processing interface requests in one embodiment;
FIG. 2 is a flowchart illustrating a method for processing an interface request according to an embodiment;
FIG. 3 is an architecture diagram of a method for interface request processing in one embodiment;
FIG. 4 is a simplified flowchart illustration of a method for interface request processing in one embodiment;
FIG. 5 is a block diagram showing the structure of an interface request processing apparatus according to an embodiment;
FIG. 6 is a block diagram showing the structure of an interface request processing apparatus according to another embodiment;
FIG. 7 is a diagram illustrating an internal structure of a computer device according to an embodiment;
fig. 8 is an internal structural view of a computer device in another embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The interface request processing method provided by the application can be applied to the application environment shown in fig. 1. Wherein, the request end 102 communicates with the server 104 through the network. The requesting end 102 sends an interface request for the target transaction to the server 104 over the network. The server 104 may receive an interface request sent by the requesting end 102 for a target transaction, and perform a check on a processing result or a failure of a service processing result generated by an interface specified by the received interface request. If the processing is successful, the server 104 may store the transaction processing result and the transaction identifier association of the target transaction in the temporary memory. The server 104 may further store each service processing result and the transaction identifier stored in the temporary memory into the formal memory after all the service processing results requested by the plurality of interfaces of the target transaction are successfully processed. The requesting end 102 may be, but not limited to, various personal computers, notebook computers, desktop computers, and the like, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, an interface request processing method is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps:
at step 202, an interface request for a target transaction is received.
Wherein, the target transaction is the operation required to be executed. The interface request is an instruction for calling the interface. It can be understood that the interface request may specifically be a command requesting to invoke an interface, or may also be a data packet carrying related data required by invoking an interface.
Specifically, the request terminal responds to a target transaction input by a user to generate an interface request aiming at the target transaction and sends the interface request to the server. The server receives an interface request aiming at a target transaction sent by a request end, analyzes the interface request, determines an interface specified by the interface request, and calls the interface specified by the interface request to perform service processing according to the interface request.
In one embodiment, one interface requests one interface for specifying the calls required for the target transaction. Then, when the implementation of the target transaction requires to invoke multiple interfaces, the requesting end may invoke multiple interfaces for the target transaction by sending interface requests multiple times.
In one embodiment, one interface request may also be used to specify multiple interfaces that the target transaction needs to invoke. The server may, after receiving the interface request, sequentially invoke a plurality of interfaces specified by the interface request for service processing.
In one embodiment, the request end can call interfaces in a plurality of servers for business processing aiming at the target transaction. Wherein the interfaces in the plurality of servers may be interfaces of servers of different enterprises.
In one embodiment, the target transaction may be a transaction related to a financial internet transaction. The request terminal responds to a relevant transaction of one financial internet transaction input by a user, generates an interface request aiming at a target transaction and sends a server of a different enterprise.
In one embodiment, the transaction related to a financial internet transaction may be an order refund transaction. And the request terminal responds to the order refund transaction input by the user, generates an interface request aiming at the order refund transaction and sends the interface request to the servers of different enterprises. And the servers of different enterprises analyze the interface request, determine the own interface corresponding to the interface request and perform service processing.
And step 204, aiming at each interface request, after the interface appointed by the calling interface request is subjected to service processing, checking the generated service processing result.
And the service processing result is a result generated by calling a server interface to perform service processing according to the interface request.
Specifically, the server analyzes each interface request sent by the request end, determines an interface call corresponding to the request, and performs service processing according to the interface request to generate a service processing result. After the server calls the interface specified by each interface request to perform service processing, the generated service processing result is verified to be successful processing or failed processing.
In one embodiment, the request end may send each interface request for the target transaction to the server in turn according to a preset duration. The request end can also send an interface request aiming at the target transaction to the server firstly, and then send the next interface request aiming at the target transaction to the server after receiving the response of the server until all the interface requests aiming at the target transaction are sent.
In an embodiment, the server may receive a next interface request sent by the request end after calling an interface specified by the interface request to perform service processing.
And step 206, if the business processing result is verified to be successful, storing the business processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner.
Wherein, the transaction identifier is an identifier corresponding to the target transaction. The transaction identification is used to identify the interface request generated for the target transaction. The temporary memory is a memory for temporarily storing the service processing result.
In one embodiment, for the calling interface of the target transaction, not all interfaces successfully process the service, and the generated partial service processing result is stored in the temporary memory.
In one embodiment, the business process results corresponding to the target transaction are stored in temporary memory, and the target transaction is not recognized as a completed and validated target transaction.
For example, A, B and C interfaces are sequentially called to perform service processing when a target transaction is completed, after an a interface and a B interface are called to perform service processing and a service processing result is successful, but a service processing result of the 3 rd interface C is processing failure, when the server receives an interface request for the a interface and the B interface of the same target transaction again, if the corresponding service processing results of the a interface and the B interface exist in the formal memory, it is recognized that the target transaction is not valid, and the server may sequentially call A, B and C interfaces to perform service processing for the target transaction. The formal memory is a memory for formally storing the service processing result. It can be understood that, in contrast to the temporary memory, the formal memory stores the service processing results obtained after all the interfaces have successfully processed the service.
Specifically, the server checks whether the service processing result corresponding to the called interface is successful in processing or failed in processing. And if the service processing result is verified to be successful, the server stores the service processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner.
In one embodiment, the temporary storage may be a relational database, a non-relational database, or other independent file storage.
And step 208, after the service processing results of the plurality of interface requests for realizing the target transaction are verified to be successful, storing each service processing result and the transaction identifier stored in the temporary memory into a formal memory.
The plurality of interface requests are interface requests of a plurality of interfaces required to be called for realizing the target transaction.
Specifically, the server checks the obtained service processing results of the plurality of interfaces called by the target transaction, and stores each service processing result and the transaction identifier stored in the temporary memory into the formal memory if the service processing results are all successfully processed.
In one embodiment, as shown in fig. 3, 3 interfaces (API) are required to be called for service processing to complete one target transaction, and a request end (client) sends 3 Interface requests to a server for one target transaction. And the server calls an interface appointed by each interface request to perform service processing, the first 2 interfaces all finish the service processing, and if the service processing result is successful, the service processing results corresponding to the first 2 interfaces are stored in a temporary Storage (Temp Storage). And if the service processing is completed on all the 3 interfaces and the service processing result is successful, storing each service processing result and the transaction identifier stored in the temporary memory into a formal memory (DB: Data Base).
In the interface request processing method, the server performs successful or failed verification on the service processing result of the interface specified by each interface request, only the successfully verified service processing result is associated with the transaction identifier of the target transaction and stored in the temporary memory, and after the service processing results of the plurality of interface requests of the target transaction are successfully processed, each service processing result and the transaction identifier stored in the temporary memory are stored in the formal memory. That is, as long as there is an interface call exception, the formal memory does not store only the service processing results successfully processed by the target transaction part, but the target transaction does not take effect, and only after the service processing results of a plurality of interface requests for implementing the target transaction are all successfully processed, all the successfully processed service processing results are stored in the formal memory, thereby automatically ensuring the atomicity of the same transaction and improving the accuracy of the processing results of the transaction.
In one embodiment, the method further comprises: and if the service processing result is verified to be processing failure, performing rollback to clear the service processing result which is stored in the temporary memory in association with the transaction identifier.
Specifically, the server checks whether the service processing result corresponding to the called interface is successful in processing or failed in processing. And if the service processing result is verified to be processing failure, the server executes rollback, searches the associated service processing result according to the transaction identifier corresponding to the target transaction, and clears the searched service processing result from the temporary storage server.
In one embodiment, multiple interfaces are sequentially called to perform service processing when a target transaction is completed, and if a server calls one of the interfaces to perform service processing, generates a service processing result and verifies that the processing fails, rollback is performed to clear the service processing result stored in the temporary memory in association with the transaction identifier.
For example, when a target transaction is completed, A, B and C interfaces are sequentially called to perform service processing, and after the service processing is performed by calling the a interface and the B interface and the service processing result is processing success, but the service processing result of the 3 rd interface C is checked by the server as processing failure, rollback is performed to clear the service processing result corresponding to the a interface and the B interface stored in the temporary memory in association with the transaction identifier.
In one embodiment, after the server rolls back and clears the service processing result stored in the temporary memory in association with the transaction identifier, the target transaction may be ended, and an interface request sent by the requesting end for the same target transaction or a different target transaction next time is waited to be received.
In this embodiment, when it is checked that the service processing result of the called interface is a processing failure, the server directly clears the service processing result stored in association with the transaction identifier from the temporary memory, so that a target transaction with an interface call failure does not take effect, and a requirement that a plurality of interfaces execute atomic service processing at the same time is met.
In an embodiment, if an exception occurs in a part of the interfaces, the server may also call the interface in which the exception occurred to perform service processing after receiving the interface request corresponding to the interface in which the exception occurred, and store the service processing data and the transaction identifier in the temporary memory in an associated manner.
In one embodiment, when the network interruption causes an interface exception, which results in that the remaining interface requests are not sent to the server, the request terminal may continue to send the remaining interface requests to the server.
For example, A, B and C3 interfaces are sequentially called to perform service processing when a target transaction is completed, after the service processing is performed by calling the interface a and the interface B and the result of the service processing is successful, because the network is interrupted and the call to the interface C is not realized, the interface request of the 3 rd interface C can be successfully received, the called interface C performs service processing, and the result of the successfully processed service processing is stored in the temporary memory.
For example, the client needs to implement a refund transaction, a filling order information page returned by the server calling interface a is obtained through the interface a request, an express information page returned by the server calling interface B is obtained through the interface B request, and when the interface C request at the last step is a refund request submitted, because the network does not send the refund request out, the client can resend the interface C request to the server based on the stored information to complete the refund transaction.
In one embodiment, when the server calls part of the interfaces to perform service processing, an exception occurs, and the request terminal may resend the interface request to the server for the interface with the exception.
For example, A, B and C3 interfaces are sequentially called to perform service processing when a target transaction is completed, after the service processing is performed by calling the interface a and the interface B and the result of the service processing is successful, the server is abnormal when the service processing is performed by calling the interface C, and after the server can receive the interface request of the 3 rd interface C again, the called interface C performs service processing and stores the result of the successfully processed service processing in the temporary memory.
For example, the client needs to implement a refund transaction, a filling order information page returned by the server calling interface a is obtained through the interface a request, an express filling information page returned by the server calling interface B is obtained through the interface B request, and when the interface C request at the last step, namely the refund request is submitted, the server calling interface C is abnormal, and the refund processing is not completed. The user can send the refund complaint request again aiming at the interface C with the abnormality, and the server calls the interface C to process the refund complaint request so as to carry out refund processing and finally realize the refund transaction.
In this embodiment, the accuracy of the processing result of the transaction is ensured by recalling the interface for service processing for the interface with the exception.
In one embodiment, the method further comprises: returning a request processing result to the request terminal based on the service processing result; if the request processing result is a request failure, after receiving a first interface request which is retransmitted by the request end aiming at the transaction, returning to execute the step of verifying the generated service processing result after calling the interface specified by the interface request for service processing; the first interface request is an interface request sent by a first interface for realizing a target transaction.
The request processing result is a result obtained by processing the received interface request. It can be understood that, after receiving the interface request sent by the request end, the server calls the interface to perform service processing according to the interface request and generates a service processing result, and if the service processing result is verified to be failed, the server returns a request failure to the request end. The request terminal may execute the next operation according to the acquired request processing result of the request failure.
Specifically, the server checks the service processing result of the interface specified by the interface request, generates a request processing result and returns the request processing result to the request end sending the corresponding interface request. And if the request processing result is a request failure, after receiving the first interface request which is retransmitted by the request end aiming at the transaction, the server returns to execute the step of verifying the generated service processing result after calling the interface specified by the interface request for service processing.
In one embodiment, multiple interfaces are required to be sequentially called for service processing when a target transaction is completed, and if a server calls one of the interfaces for service processing, a service processing result is generated and verified as processing failure, the request processing result of the request failure is returned to a request end. And the request end receives the request processing result of the request failure and resends the first interface request aiming at the transaction to the server. And after receiving the first interface request which is retransmitted by the request end aiming at the transaction, the server returns to execute the step of verifying the generated service processing result after calling the interface specified by the interface request for service processing.
For example, to complete a target transaction, A, B and C, which are 3 interfaces, are sequentially called for service processing, so that the a interface is the first interface, and the interface request for calling the a interface is the first interface request. After calling the interface A and the interface B to perform service processing, and if the service processing result is successful, but the service processing result of the 3 rd interface C is verified to be failed by the server, returning the request processing result with failed request to the request end. If the requester receives the request processing result of the request failure, the first interface request (i.e., the interface request for calling the a interface) may be resent to the server for the target transaction. After the server receives the first interface request which is retransmitted by the request end for the transaction, the server may re-invoke the interface a to perform the service processing, that is, re-invoke the A, B and C interfaces in sequence to perform the service processing to complete the target transaction.
In one embodiment, the request end may make an identification when initiating the first interface request, so that the server may distinguish whether the received interface request is the first interface request according to the identification.
In this embodiment, the request end is informed that the request processing result is a request failure to receive the first interface request that is retransmitted by the request end for the transaction, so that the request end can be quickly informed to retransmit the first interface request instead of the next interface request under the condition that the interface call fails, so as to meet the requirement of multi-interface atomic operation.
In one embodiment, the method further comprises: and if the request processing result is that the request is successful, after receiving the next interface request sent by the request end aiming at the target transaction, executing a step of verifying the generated service processing result after calling the interface specified by the interface request to perform service processing.
Wherein the next interface request is an interface request sent by a next interface for implementing the target transaction.
Specifically, the server checks the service processing result of the interface specified by the interface request, generates a request processing result successful in the request and returns the request processing result to the request end sending the corresponding interface request. And after receiving the next interface request which is retransmitted by the request end aiming at the transaction, the server returns to execute the step of verifying the generated service processing result after calling the interface specified by the interface request for service processing.
In one embodiment, multiple interfaces are required to be sequentially called for service processing when a target transaction is completed, and if a server calls one of the interfaces for service processing, a service processing result is generated and verified as successful processing, the request processing result which is requested successfully is returned to a request end. And the requesting end receives the request processing result of the successful request, and sends the next interface request aiming at the transaction to the server. And after receiving the next interface request sent by the request end aiming at the transaction, the server executes the step of verifying the generated service processing result after calling the interface specified by the interface request to perform service processing.
For example, after completing a target transaction, A, B and C interfaces are sequentially called to perform service processing, and after the service processing is performed on the a interface, and the service processing result is verified as a request processing result that the request is successfully generated, and the request processing result that the request is successfully generated is returned to the request end. The requester receives the request processing result that the request is successful, and sends the next interface request (B interface request) to the server for the transaction. After receiving the next interface (B interface request) request sent by the request end aiming at the transaction, the server executes the step of verifying the generated service processing result after calling the interface specified by the interface request for service processing.
In this embodiment, the request end is informed that the request processing result is a request success to receive a next interface request sent by the request end for the transaction, and the request end can be quickly informed to send the next interface request under the condition that the interface call is successful, so as to improve the efficiency of implementing the target transaction.
In one embodiment, after verifying that the service processing results of the plurality of interface requests for implementing the target transaction are all successfully processed, storing each service processing result and the transaction identifier stored in the temporary memory into the formal memory includes: and when the service processing result of the last interface request aiming at the target transaction is verified to be successful, storing the service processing result corresponding to the last interface request and the service processing result associated with the transaction identifier in the temporary memory in association with the transaction identifier in the formal memory.
The last interface request is an interface request sent by the last interface for realizing the target transaction.
In one embodiment, the request end may perform serial number identification when initiating the last interface request, so that the server may identify whether the received interface request is the last interface request according to the identification.
In one embodiment, the server identifies the serial number identification of the received interface request. When the received interface request is the last interface request and the service processing result of the last interface request aiming at the target transaction is verified to be successful, the server stores the service processing result corresponding to the last interface request and the service processing result associated with the transaction identifier in the temporary memory in association with the transaction identifier in the formal memory.
In this embodiment, by identifying the serial number of the interface request, when the server obtains the last interface request and when the service processing result of the last interface request for the target transaction is verified to be successful, the service processing result associated with the transaction identifier in the temporary storage may be stored in the formal storage in association with the transaction identifier, so as to avoid that the server cannot determine when the service processing result in the temporary storage should be stored in the formal storage, and thus, the server waits for the request end to send the next interface request for a long time.
In one embodiment, the method further comprises: when the interface request is a first interface request aiming at a target transaction, generating a transaction identifier of the target transaction; if the business processing result is verified to be successful, the business processing result and the transaction identifier of the target transaction are stored in the temporary memory in an associated mode, and the method comprises the following steps: and if the service processing result of the first interface request is verified to be successful, the service processing result and the generated transaction identifier are stored in the temporary memory in an associated manner.
In one embodiment, the request end may perform serial number identification when initiating the first interface request, so that the server may identify whether the received interface request is the first interface request according to the identification.
In one embodiment, the server identifies the serial number identification of the received interface request. When the received interface request is the first interface request aiming at the target transaction, the server generates the transaction identification of the target transaction. And when the received interface request is the last interface request and the service processing result of the last interface request aiming at the target transaction is verified to be successful, the server stores the service processing result corresponding to the last interface request and the transaction identifier in the temporary memory in an associated manner.
In this embodiment, the server generates the transaction identifier of the target transaction, and stores the service processing result of the interface called by each target transaction in the temporary memory in association with the transaction identifier, so that when the service processing result of the subsequent interface corresponding to the same target transaction is verified as a processing failure, the service processing result associated with the transaction identifier in the temporary memory is found, rollback deletion is effectively performed, and atomicity of the target transaction is ensured.
In one embodiment, the method further comprises: returning the generated transaction identifier to the request end; if the business processing result is verified to be successful, the business processing result and the transaction identifier of the target transaction are stored in the temporary memory in an associated mode, and the method comprises the following steps: and if the service processing result of the non-first interface request is verified to be successful, the service processing result of the non-first interface request and the transaction identifier carried in the non-first interface request are stored in the temporary memory in an associated manner.
Specifically, after a first interface request sent from a service request interface to a request end is received, a service processing result corresponding to the first interface request is obtained, a request processing result carrying a transaction identifier is returned to the request end based on the service processing result, and the service processing result not requested by the first interface and the transaction identifier carried in the non-first interface request are stored in a temporary memory in an associated manner.
In one embodiment, one interface may be called for multiple target transactions, and the server may distinguish, by the transaction identifier carried by the interface request, which target transaction the interface request specifies to call for.
In one embodiment, the server may store the service processing results generated by multiple calls of the same interface and for different target transactions in a differentiated manner through the transaction identifier carried by the interface request.
In this embodiment, the server returns the generated transaction identifier to the request end, so that it can be effectively distinguished which target transaction the interface request specifies to invoke, so that the request end carries the transaction identifier for the same target transaction in the second interface request and the subsequent interface requests, and the server can distinguish which target transaction the received interface request is.
It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, the steps are not necessarily executed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
In an embodiment, as shown in fig. 4, which is a simplified flowchart of an interface request processing method in an embodiment, the interface request processing method is described as follows with reference to fig. 4:
a client sends a first interface request; the server side checks a service processing result corresponding to the first interface request; if the verification is successful, the server generates a transaction identifier of the target transaction, and executes the first-stage service processing result submission, namely, the transaction identifier and the service processing result are stored in a temporary memory in an associated manner; the server returns a transaction identification (transaction ID) and a request result to the client. The first stage is to store the service processing result in the temporary memory.
The client receives a request processing result returned by the server; if the request fails, the client ends the target transaction; if the request is successful, the client sends a next interface request carrying the transaction identifier to the server; the server side checks a service processing result corresponding to the received next interface request; if the verification is successful, the server stores the transaction identifier and the service processing result into a temporary memory in an associated manner; if the verification fails, the server executes rollback, and clears the service processing result stored in the temporary memory in association with the transaction identifier; and the server returns the transaction identifier and the request result to the client.
And repeatedly executing the request processing result returned by the client receiving server and the subsequent steps until the last interface request is sent to the server.
The server side checks a service processing result corresponding to the last interface request; if the verification is successful, the second-stage service processing result submission is executed, namely, the service processing result corresponding to the last interface request and the service processing result associated with the transaction identifier in the temporary memory are associated with the transaction identifier and stored in a formal memory; if the verification fails, the server executes rollback, and clears the service processing result stored in the temporary memory in association with the transaction identifier; and the server returns the transaction identifier and the request result to the client. The second stage is storing the service processing result in the formal memory.
In one embodiment, as shown in fig. 5, there is provided an interface request processing apparatus 500, including: a receiving module 502, a checking module 504, and a storing module 506, wherein:
a receiving module 502, configured to receive an interface request for a target transaction.
The checking module 504 is configured to, for each interface request, check a generated service processing result after the interface specified by the interface request is called for service processing.
The storage module 506 is configured to, if the service processing result is verified as successful processing, store the service processing result and the transaction identifier of the target transaction in the temporary storage in an associated manner.
The storage module 506 is further configured to store each service processing result and the transaction identifier stored in the temporary memory into the formal memory after checking that all the service processing results of the plurality of interface requests for implementing the target transaction are successfully processed.
In an embodiment, the storage module 506 is further configured to perform a rollback to clear the transaction result stored in the temporary memory in association with the transaction identifier if the transaction result is verified as a processing failure.
In one embodiment, the apparatus further comprises: a returning module 508, configured to return a request processing result to the requesting end based on the service processing result; the checking module 504 is further configured to, if the request processing result is a request failure, return to perform the step of checking the generated service processing result after the interface specified by the interface calling request is invoked for performing service processing after the first interface request retransmitted by the request end for the transaction is received; the first interface request is an interface request sent by a first interface for realizing a target transaction.
In an embodiment, the checking module 504 is further configured to, if the request processing result is that the request is successful, execute, after receiving a next interface request sent by the request end for the target transaction, a step of checking the generated service processing result after invoking an interface specified by the interface request to perform service processing.
In an embodiment, the storage module 508 is further configured to, when the service processing result of the last interface request for the target transaction is verified to be successful, store the service processing result corresponding to the last interface request and the service processing result associated with the transaction identifier in the temporary memory in association with the transaction identifier in the formal memory.
As shown in fig. 6, in one embodiment, the apparatus further comprises: a return module 508 and a generation module 510; a generating module 510, configured to generate a transaction identifier of a target transaction when the interface request is a first interface request for the target transaction; the checking module 504 is further configured to, if the service processing result of the first interface request is checked to be successful, store the service processing result and the generated transaction identifier in the temporary memory in an associated manner.
In an embodiment, the returning module 508 is further configured to return the generated transaction identifier to the requesting end; the storage module 506 is further configured to, if it is verified that the service processing result of the non-first interface request is successful, store the service processing result of the non-first interface request and the transaction identifier carried in the non-first interface request in the temporary storage in an associated manner.
For specific limitations of the interface request processing device, reference may be made to the above limitations of the interface request processing method, which is not described herein again. The modules in the interface request processing device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing interface request processing data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement an interface request processing method.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 8. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement an interface request processing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the configurations shown in fig. 7-8 are only block diagrams of some configurations relevant to the present disclosure, and do not constitute a limitation on the computing devices to which the present disclosure may be applied, and a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. An interface request processing method, the method comprising:
receiving an interface request for a target transaction;
for each interface request, after calling an interface specified by the interface request to perform service processing, verifying a generated service processing result;
if the service processing result is verified to be successful, storing the service processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner;
after the business processing results of the plurality of interface requests for realizing the target transaction are verified to be successful, storing each business processing result and the transaction identifier stored in the temporary memory into a formal memory.
2. The method of claim 1, further comprising:
and if the service processing result is verified to be processing failure, performing rollback to clear the service processing result stored in the temporary memory in association with the transaction identifier.
3. The method of claim 2, further comprising:
returning a request processing result to a request terminal based on the service processing result;
if the request processing result is a request failure, after receiving a first interface request which is retransmitted by the request end aiming at the transaction, returning to execute the step of verifying the generated service processing result after calling the interface specified by the interface request to perform service processing;
wherein the first interface request is an interface request sent by a first interface for implementing the target transaction.
4. The method of claim 1, further comprising:
and if the request processing result is that the request is successful, after receiving a next interface request which is sent by the request end aiming at the target transaction, executing the step of verifying the generated service processing result after calling the interface specified by the interface request to perform service processing.
5. The method of claim 4, wherein after the checking that the service processing results of the plurality of interface requests for implementing the target transaction are all successfully processed, storing each service processing result and the transaction identifier stored in the temporary memory into a formal memory comprises:
and when the service processing result of the last interface request aiming at the target transaction is verified to be successful, storing the service processing result corresponding to the last interface request and the service processing result associated with the transaction identifier in the temporary memory in association with the transaction identifier in a formal memory.
6. The method according to any one of claims 1 to 5, further comprising:
when the interface request is a first interface request aiming at the target transaction, generating a transaction identifier of the target transaction;
if the service processing result is verified to be successful, storing the service processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner, including:
and if the service processing result requested by the first interface is verified to be successful, storing the service processing result and the generated transaction identifier into a temporary memory in an associated manner.
7. The method of claim 6, further comprising:
returning the generated transaction identifier to a request end;
if the service processing result is verified to be successful, storing the service processing result and the transaction identifier of the target transaction into a temporary memory in an associated manner, including:
and if the service processing result of the non-first interface request is verified to be successful, storing the service processing result of the non-first interface request and the transaction identifier carried in the non-first interface request into a temporary memory in an associated manner.
8. An interface request processing apparatus, the apparatus comprising:
a receiving module, configured to receive an interface request for a target transaction;
the verification module is used for verifying the generated service processing result after calling the interface specified by the interface request to perform service processing aiming at each interface request;
the storage module is used for storing the business processing result and the transaction identifier of the target transaction into a temporary storage in a correlation manner if the business processing result is verified to be successful;
the storage module is further configured to store each service processing result and the transaction identifier stored in the temporary memory into a formal memory after checking that all service processing results of the plurality of interface requests for implementing the target transaction are successfully processed.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110355200.9A 2021-04-01 2021-04-01 Interface request processing method and device, computer equipment and storage medium Pending CN113051008A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110355200.9A CN113051008A (en) 2021-04-01 2021-04-01 Interface request processing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110355200.9A CN113051008A (en) 2021-04-01 2021-04-01 Interface request processing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113051008A true CN113051008A (en) 2021-06-29

Family

ID=76517052

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110355200.9A Pending CN113051008A (en) 2021-04-01 2021-04-01 Interface request processing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113051008A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114666399A (en) * 2022-03-08 2022-06-24 北京沃东天骏信息技术有限公司 Service request verification method, device, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019042101A1 (en) * 2017-08-29 2019-03-07 华为技术有限公司 Cross-chain trading method and apparatus
CN109710235A (en) * 2018-12-29 2019-05-03 杭州趣链科技有限公司 A kind of affairs realization system and method based on Java intelligence contract service logic
CN110032428A (en) * 2019-02-21 2019-07-19 阿里巴巴集团控股有限公司 The execution method and apparatus of distributed transaction
CN110288255A (en) * 2019-06-28 2019-09-27 深圳前海微众银行股份有限公司 A kind of logistics method and device of distributed transaction
CN110309052A (en) * 2019-05-22 2019-10-08 梁俊杰 A kind of data verification method and relevant device
CN111857978A (en) * 2020-06-28 2020-10-30 苏州浪潮智能科技有限公司 Distributed transaction processing method and device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019042101A1 (en) * 2017-08-29 2019-03-07 华为技术有限公司 Cross-chain trading method and apparatus
CN109710235A (en) * 2018-12-29 2019-05-03 杭州趣链科技有限公司 A kind of affairs realization system and method based on Java intelligence contract service logic
CN110032428A (en) * 2019-02-21 2019-07-19 阿里巴巴集团控股有限公司 The execution method and apparatus of distributed transaction
CN110309052A (en) * 2019-05-22 2019-10-08 梁俊杰 A kind of data verification method and relevant device
CN110288255A (en) * 2019-06-28 2019-09-27 深圳前海微众银行股份有限公司 A kind of logistics method and device of distributed transaction
CN111857978A (en) * 2020-06-28 2020-10-30 苏州浪潮智能科技有限公司 Distributed transaction processing method and device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114666399A (en) * 2022-03-08 2022-06-24 北京沃东天骏信息技术有限公司 Service request verification method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111666162B (en) Distributed message transmission method, device, computer equipment and storage medium
US9251194B2 (en) Automatic data request recovery after session failure
CN109951547B (en) Transaction request parallel processing method, device, equipment and medium
CN111667334B (en) Audit failure order processing method and device, computer equipment and storage medium
CN111598575A (en) Business process control method and device, electronic equipment and readable storage medium
CN112817995A (en) Data processing method and device, electronic equipment and storage medium
CN114090113B (en) Method, device, equipment and storage medium for dynamically loading data source processing plug-in
CN113051008A (en) Interface request processing method and device, computer equipment and storage medium
CN112527416A (en) Task processing method and device, computer equipment and storage medium
CN112995262A (en) Distributed transaction submission method, system and computing equipment
CN110543360A (en) Task processing method and system
CN113254467B (en) Method and blockchain node for performing transactions in blockchain system
CN116010926A (en) Login authentication method, login authentication device, computer equipment and storage medium
CN111859403B (en) Dependency vulnerability determination method and device, electronic equipment and storage medium
CN111324668B (en) Database data synchronous processing method, device and storage medium
CN113987035A (en) Block chain external data access method, device, system, equipment and medium
CN108121580A (en) The implementation method and device of application notification service
CN113098977A (en) Method and device for preventing form from being repeatedly submitted
CN112583890A (en) Message pushing method and device based on enterprise office system and computer equipment
CN112149951A (en) Risk control method and device, computer equipment and storage medium
CN111552551A (en) User management method and device based on master-slave system, computer equipment and medium
CN110442447B (en) Message queue-based load balancing method and device and computer equipment
CN116720818B (en) Warehouse processing method, device and computer equipment based on block chain
CN113409109B (en) Order creation method, device, server and storage medium
CN113873029B (en) Cryptographic service monitoring method, server, cryptographic machine, system, and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination