A method and apparatus for processing service requests

By receiving and processing business requests in the business system, finding and saving request unique identifiers, and parsing response information to obtain business processing instructions, the problem of relying on manual operations by relying on operation and maintenance personnel in the prior art is solved, which improves business processing efficiency and reduces operation and maintenance costs.

CN113704222BActive Publication Date: 2025-06-13BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010436981.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-21
Publication Date
2025-06-13
Estimated Expiration
2040-05-21

AI Technical Summary

Technical Problem

When multiple processing of services is required in specific scenarios, the existing technology relies on operation and maintenance personnel to perform manual operations, thereby increasing the workload and operation and maintenance costs of operation and maintenance personnel and reducing the efficiency of handling services.

Method used

By receiving the service request, the request unique identifier is found, if it is not found, the identifier is saved into the request historical data, the service request is successfully processed and the response information is parsed to obtain the service processing instruction, and to determine whether the service request is allowed to be processed again based on the instructions.

Benefits of technology

It solves the problem of relying on operation and maintenance personnel to manually operate when services need to be allowed to be processed multiple times in specific scenarios, which improves the efficiency of handling services and reduces the operation and maintenance costs of the business system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113704222B_ABST
    Figure CN113704222B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and an apparatus for processing a service request, relating to the field of computer technologies. A specific embodiment of the method includes: receiving a service request, searching for the request unique identifier in the request history data, and when the request unique identifier is not found, performing an operation of saving the request unique identifier into the request history data; when the result of the operation indicates successful saving, processing the service request, obtaining a service processing instruction by parsing corresponding response information, and determining whether to allow reprocessing of the service request according to the service processing instruction. This embodiment can partially solve the problem of relying on operation and maintenance personnel to perform manual operations when allowing multiple processing of services in specific scenarios, thereby improving the efficiency of processing services and reducing the operation and maintenance costs of the service system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a method and apparatus for processing service requests. Background Art

[0002] In a software application system, it is usually necessary to ensure the idempotency of service operations. Idempotency means that the results generated by system A calling the interface of system B multiple times are the same as those generated by calling once, so as to avoid the impact of repeated request operations on the system and services. For example, for a transfer request, if the operation is submitted repeatedly and there is no idempotency processing, multiple transfers will occur. The existing methods for implementing idempotency usually create a duplicate prevention data table related to service identifiers in a relational database. When the server receives a service request, it checks the duplicate prevention data table before service execution to determine whether the service has been executed, so as to ensure the idempotency of service operations. In some specific scenarios or specific time ranges, multiple calls of service requests need to be allowed according to specific requirements.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] When it is necessary to change the idempotency interception operation and allow multiple processing of services in a specific scenario, the existing implementation requires an operation and maintenance personnel to manually remove the service request from the duplicate prevention data table. When the number of such requirements is large, it increases the workload and operation and maintenance costs of the operation and maintenance personnel, and at the same time reduces the efficiency of processing services. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a method and apparatus for processing service requests, which can receive a service request, search for the request unique identifier in the request history data. When the request unique identifier is not found, perform an operation of saving the request unique identifier to the request history data; when the result of the operation indicates successful saving, process the service request, obtain a service processing instruction by parsing the corresponding response information, and determine whether to allow the service request to be processed again according to the service processing instruction. This implementation can solve the problem of relying on manual operations by operation and maintenance personnel when it is necessary to allow multiple processing of services in a specific scenario, thereby improving the efficiency of processing services and reducing the operation and maintenance costs of the service system.

[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, there is provided a method for processing a service request, characterized by including: receiving a service request, where the service request at least includes a request unique identifier; searching for the request unique identifier in the request history data, and when the request unique identifier is not found, performing an operation of saving the request unique identifier to the request history data; when the result of the operation indicates successful saving, processing the service request, obtaining response information corresponding to the service request, and obtaining a service processing instruction by parsing the response information; and processing the service request according to the service processing instruction.

[0007] Optionally, the method for processing a service request is characterized in that

[0008] when the request unique identifier is found in the request history data, or when the result of the operation indicates that the request unique identifier already exists, the service request is not processed, and the response information of the service request saved in the request history data is sent.

[0009] Optionally, the method for processing a service request is characterized in that

[0010] Obtaining response information corresponding to the service request and obtaining a service processing instruction by parsing the response information includes:

[0011] Obtaining response information corresponding to the service request, searching for a predefined service keyword in the response information, and determining the service processing instruction according to the predefined service information indicated by the service keyword.

[0012] Optionally, the method for processing a service request is characterized in that

[0013] Processing the service request according to the service processing instruction includes:

[0014] When the service processing instruction indicates that the service is not completed, for the service request, a response information including the service not completed information is sent, and the request unique identifier is deleted from the request history data.

[0015] Optionally, the method for processing a service request is characterized in that

[0016] Processing the service request according to the service processing instruction includes:

[0017] When the service processing instruction indicates that the service is completed, the response information of the service request corresponding to the request unique identifier is saved to the request history data, and a response information including the service completed information is sent.

[0018] Optionally, the method for processing a service request is characterized in that

[0019] perform an operation of saving the unique identifier of the request into request history data, including:

[0020] When the request history data is stored in a relational database, save the unique identifier of the request by using the rule of a unique index.

[0021] Optionally, the method for processing a service request is characterized in that

[0022] perform an operation of saving the unique identifier of the request into request history data, including:

[0023] When the request history data is stored in a non-relational database, save the unique identifier of the request by using the rule of a distributed lock.

[0024] To achieve the above object, according to the second aspect of the embodiments of the present invention, there is provided an apparatus for processing a service request, characterized by including: a service identifier saving module, a response information parsing module, and a service request processing module; wherein,

[0025] The service identifier saving module is configured to receive a service request, where the service request at least includes a unique identifier of the request; search for the unique identifier of the request in the request history data, and when the unique identifier of the request is not found, perform an operation of saving the unique identifier of the request into the request history data;

[0026] The response information parsing module is configured to, when the result of the operation indicates a successful save, process the service request, obtain response information corresponding to the service request, and obtain a service processing instruction by parsing the response information;

[0027] The service request processing module is configured to process the service request according to the service processing instruction.

[0028] Optionally, the apparatus for processing a service request is characterized in that

[0029] when the unique identifier of the request is found in the request history data, or when the result of the operation indicates that the unique identifier of the request already exists, do not process the service request, and send the response information of the service request saved in the request history data.

[0030] Optionally, the apparatus for processing a service request is characterized in that

[0031] Obtain response information corresponding to the service request, and obtain a service processing instruction by parsing the response information, including:

[0032] Obtain response information corresponding to the service request, search for predefined service keywords in the response information, and determine the service processing instruction according to the predefined service information indicated by the service keywords.

[0033] Optionally, the apparatus for processing a service request is characterized in that

[0034] Processing the service request according to the service processing instruction includes:

[0035] When the service processing instruction indicates that the service is not completed, for the service request, send a response message including the service not completed information, and delete the request unique identifier from the request history data.

[0036] Optionally, the apparatus for processing a service request is characterized in that

[0037] Processing the service request according to the service processing instruction includes:

[0038] When the service processing instruction indicates that the service is completed, save the response information of the service request corresponding to the request unique identifier to the request history data, and send a response message including the service completed information.

[0039] Optionally, the apparatus for processing a service request is characterized in that

[0040] Performing the operation of saving the request unique identifier to the request history data includes:

[0041] When the request history data is stored in a relational database, save the request unique identifier using the rule of a unique index.

[0042] Optionally, the apparatus for processing a service request is characterized in that

[0043] Performing the operation of saving the request unique identifier to the request history data includes:

[0044] When the request history data is stored in a non-relational database, save the request unique identifier using the rule of a distributed lock.

[0045] To achieve the above object, according to the third aspect of the embodiments of the present invention, there is provided an electronic device for processing a service request, characterized in that it includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enabling the one or more processors to implement any of the methods in the above method for processing a service request.

[0046] To achieve the above object, according to the fourth aspect of the embodiments of the present invention, there is provided a computer-readable medium having a computer program stored thereon, characterized in that when the program is executed by a processor, it implements any one of the methods for processing service requests as described above.

[0047] One embodiment of the above invention has the following advantages or beneficial effects: Receive a service request, search for the request unique identifier in the request history data, and when the request unique identifier is not found, perform an operation of saving the request unique identifier to the request history data; when the result of the operation indicates successful saving, process the service request, obtain a service processing instruction by parsing the corresponding response information, and determine whether to allow reprocessing of the service request according to the service processing instruction. This implementation can solve the problem of relying on operation and maintenance personnel to perform manual operations when allowing multiple processing of services in a specific scenario, thereby improving the efficiency of processing services and reducing the operation and maintenance costs of the service system.

[0048] The further effects of the above non-conventional optional methods will be described in conjunction with specific embodiments below. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention. Among them:

[0050] Figure 1 is a flowchart of a method for processing a service request provided by an embodiment of the present invention;

[0051] Figure 2 is a flowchart of a process for processing a service request provided by an embodiment of the present invention;

[0052] Figure 3 is a flowchart of a process for processing a service request multiple times provided by an embodiment of the present invention;

[0053] Figure 4 is a structural diagram of a device for processing a service request provided by an embodiment of the present invention;

[0054] Figure 5 is an exemplary system architecture diagram to which the embodiments of the present invention can be applied;

[0055] Figure 6 is a structural diagram of a computer system of a terminal device or a server suitable for implementing the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0056] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, descriptions of well-known functions and structures are omitted in the following description for clarity and conciseness.

[0057] As Figure 1 shown, an embodiment of the present invention provides a method for processing a service request, and the method may include the following steps:

[0058] Step S101: Receive a service request, where the service request at least includes a request unique identifier; search for the request unique identifier in the request history data, and when the request unique identifier is not found, perform an operation of saving the request unique identifier to the request history data;

[0059] Specifically, receive a service request, and the service request may come from any client or server; different service requests are generated according to different service requirements and scenarios. For example, send an order payment request, a bank transfer request, a commodity query request, etc.; the service request at least includes a request unique identifier, and the unique identifier is used to uniquely identify the service request. Among them, the unique identifier may be a string composed of letters and numbers generated according to a predefined naming rule, or may be composed of a combination of the service request unique identifier and the information included in the service request. For example, for an order payment request, the service request identifier and the order identifier are combined to form the unique identifier of the service request; it can be understood that the service request at least includes a request unique identifier, and the service request also includes other service-related information. For example, in addition to the request unique identifier, the order service request also includes an order number, a payment amount, etc.

[0060] The present invention does not limit the content of the service request, the content and form of the request unique identifier.

[0061] Further, search for the request unique identifier in the request history data, and when the request unique identifier is not found, perform an operation of saving the request unique identifier to the request history data;

[0062] To prevent the impact caused by sending the same business request multiple times, the method of forming request historical data is used to record the information of the processed business requests. When a business request is received, the request unique identifier is searched in the request historical data. When the request unique identifier is not found, the operation of saving the request unique identifier into the request historical data is executed; that is, when searching for the request unique identifier in the request historical data and the request unique identifier is not found, the operation of saving the request unique identifier into the request historical data is further executed; when the saving is successful, it is considered that the business request is received for the first time; it can be understood that when concurrent requests occur, only relying on the result of the request unique identifier found in the request historical data cannot completely intercept the duplicate processing of the business. Therefore, by combining the query of the request unique identifier and the operation of saving the request unique identifier into the request historical data, the non-repetitiveness of business processing is further maintained by determining the uniqueness of the request unique identifier.

[0063] Specifically, if the saving is successful, it is considered that a new business request is received, and then the business request is processed. When the same business request is sent again, the request unique identifier can be found in the request historical data, or the operation of saving the request unique identifier into the request historical data will prompt failure, indicating that the request unique identifier already exists.

[0064] Further, when the request unique identifier is found in the request historical data, or when the result of the operation indicates that the request unique identifier already exists, the business request is not processed, and the response information of the business request saved in the request historical data is sent.

[0065] Further, when the result of the operation of saving the request unique identifier indicates that the request unique identifier already exists, it is indicated that the business request has been processed, then the business request is not processed, and the response information of the business request saved in the request historical data is sent.

[0066] Among them, the way of indicating "saving successful" or "request unique identifier already exists" is related to the storage method of storing the request historical data. For example, relational databases, non-relational databases, and other storage methods use different methods to indicate "saving successful"; the present invention does not limit the storage method of historical data and the specific content of indicating "saving successful" or "request unique identifier already exists".

[0067] It can be understood that according to the needs of the business scenario, in addition to the unique identifier of the business request, the request historical data can also contain other information related to the business. The present invention does not limit the other information except the unique identifier.

[0068] The request history data can be stored in a data table of a database, or stored in the form of a file or a linked list. The present invention does not limit the storage method of the request history data.

[0069] Preferably, the request history data is stored in a data table of a database. According to the type of database used by the application, there are two ways to perform the operation of saving the request unique identifier into the request history data:

[0070] The first way, the request history data is stored in a relational database: that is, the operation of saving the request unique identifier into the request history data includes:

[0071] When the request history data is stored in a relational database, the request unique identifier is saved according to the rule of the unique index.

[0072] Specifically, for an application system, it may include a database that provides business support. When the database is a relational database, the request unique identifier and the response information corresponding to the service request are saved according to the rule of the unique index of the relational database. Taking the MySQL database as an example, the following example can be used to save the service information;

[0073] insert into table1(key_id)values(“a1b2c3d4e5”)

[0074] Among them, it is assumed that table1 is an already created request history data table, which contains at least entries of the request unique identifier and business response information; in the above example statement, key_id is the entry for saving the unique identifier of the service, and key_id is set as the unique index to ensure the uniqueness of this piece of data;

[0075] The second way, the request history data is stored in a relational database: that is, the operation of saving the request unique identifier into the request history data includes:

[0076] When the request history data is stored in a non-relational database, the request unique identifier is saved according to the rule of the distributed lock.

[0077] Specifically, for an application, it may include a database supported by the server. When the background database is a non-relational database, the request unique identifier is saved according to the rule of the distributed lock of the non-relational database. Taking Redis as an example, the setNx method can be used to save at least the request unique identifier.

[0078] The present invention does not limit the types of relational databases and non-relational databases and the specific content of the data table where the request history data is located.

[0079] Step S102: When the result of the operation indicates successful saving, process the service request, obtain response information corresponding to the service request, and obtain a service processing instruction by parsing the response information;

[0080] Specifically, when the result of the operation indicates successful saving, it means that the request unique identifier is not included in the request history data. Then, it is considered that this service request occurs for the first time. The way to indicate successful saving is related to the storage method of storing the request history data. For example, relational databases, non-relational databases, and other storage methods indicate successful storage in different ways;

[0081] Furthermore, when the result of the operation indicates successful saving, process the service request, obtain response information corresponding to the service request, and obtain a service processing instruction by parsing the response information;

[0082] Obtain response information corresponding to the service request, search for predefined service keywords in the response information, and determine the service processing instruction according to the predefined service information indicated by the service keywords.

[0083] The following uses an example to describe the process of obtaining a service processing instruction by parsing the response information, including obtaining response information corresponding to the service request by parsing, searching for predefined service keywords in the response information, parsing the predefined service information indicated by the service keywords, and then determining the service processing instruction;

[0084] For example: The response information feedback according to the service request is as follows,

[0085] {"success":true,"code":0,"msg":"Execution successful"}

[0086] Search for predefined business keywords in the response information. Taking the above response information as an example, in the above example response information, assume that the predefined business keyword is "code". By searching for "code" in the response information, it is obtained that "code" is "0"; and according to the predefined rule, when "code" is "0", it indicates that the business is completed. "0" is the predefined business information indicated by parsing the business keyword. Further, parse the predefined business information to determine the business processing instruction. In this example, according to the predefined business information, that is, "0", and by parsing, it can be known that the business instruction corresponding to "0" is business completion, so as to further determine that the business processing instruction is business completion; it can be understood that the predefined business keyword and the predefined business information indicated by the business keyword are defined according to the scenario. For example, in the above example, the predefined business keyword can also be "msg", and "execution successful" is the predefined business information indicated by the business keyword, and it indicates that the business request is completed;

[0087] Further, assume that the response information obtained by the business request is:

[0088] {"success":false,"code":-1,"msg":"System internal error, please retry"}

[0089] Search for predefined business keywords in the response information. Still take "code" in the response information as the predefined business keyword, where "code" indicates -1, and "-1" is the predefined business information. And by parsing, it can be known that the predefined rule makes "-1" indicate that the business is not completed. Further, according to the predefined business information indicated by the business keyword, determine the business processing instruction. In this example, the business processing instruction is that the business is not completed;

[0090] It can be understood that the predefined business keyword and the predefined business information indicated by the business keyword are defined according to the scenario. For example, in the above example, the predefined business keyword can also be "msg", and "System internal error, please retry" is set as the predefined business information, indicating that the business is not completed;

[0091] Further, when the business request is not completed and the business request is accepted again, it is allowed to process the business request again; it can be understood that if the response information obtained by processing the business request again is still {"success":false,"code":-1,"msg":"System internal error, please retry"}, search for predefined business keywords in the response information, and according to the predefined business information indicated by the business keyword, determine the business processing instruction;

[0092] The description of the service for processing the service request according to the service processing instruction is as described in step S103.

[0093] The present invention does not limit the specific content and format of the predefined service keywords and predefined service information;

[0094] That is, perform the operation of saving the request unique identifier to the request history data;

[0095] When the result indication of the operation is successful saving, process the service request, obtain the response information corresponding to the service request, obtain the service processing instruction by parsing the response information; process the service request according to the service processing instruction;

[0096] Obtain the response information corresponding to the service request, and obtain the service processing instruction by parsing the response information, including: obtaining the response information corresponding to the service request, searching for predefined service keywords in the response information, and determining the service processing instruction according to the predefined service information indicated by the service keywords.

[0097] Step S103: The service for processing the service request according to the service processing instruction.

[0098] Specifically, as described in step S102, parse the response information according to the predefined service processing rule to obtain the service processing instruction, and the service processing instruction is "service completed" or "service not completed";

[0099] Process the service request according to the service processing instruction, including: when the service processing instruction indicates that the service is completed, save the response information of the service request corresponding to the request unique identifier to the request history data, and send a response information including the service completion information;

[0100] Specifically, when the service processing instruction indicates that the service is completed, it is considered that the service request has been successfully executed and processed. As can be seen from step S101, the unique identifier of the service already exists in the request history data. To maintain idempotency, when receiving the service request multiple times, do not process the service, and save the response information of the service request corresponding to the request unique identifier to the request history data;

[0101] It can be understood that the response information regarding the business request is saved in the request history data together with its corresponding request unique identifier, and the response information containing the business completion information is sent. When the business request is sent again, as described in step S101, the operation of saving the request unique identifier into the request history data is performed. Then, when the result of the operation indicates that the request unique identifier already exists, further, the response information of the business request saved in the request history data is directly sent.

[0102] That is, when the request unique identifier is found in the request history data, or when the result of the operation indicates that the request unique identifier already exists, the business request is not processed, and the response information of the business request saved in the request history data is sent.

[0103] Further, according to the business processing instruction, the business request is processed, including: when the business processing instruction indicates that the business is not completed, for the business request, a response information containing the business not-completed information is sent, and the request unique identifier is deleted from the request history data;

[0104] Specifically, when the business processing instruction indicates that the business is not completed, that is, the response information is parsed according to the predefined keywords and the predefined business information indicated by the keywords, and then the business processing instruction of "business not completed" is obtained. And according to the predefined rules, under the business processing instruction of "business not completed", the business request can be allowed to be processed again. Specifically, a response information containing the business not-completed information is sent to the sender to notify the sender of the response result of the business request. Further, the request unique identifier is deleted from the request history data. It can be understood that by deleting the unique identifier of the business request, when the business request is allowed to be received again, the business can be reprocessed;

[0105] According to the different storage methods of the request history data, corresponding methods are adopted to delete the unique identifier of the business request from the request history data. For example, when the request history data is stored in a relational database, a statement of the relational database is used for deletion. When the request history data is stored in a non-relational database, a method of the non-relational database is used for deletion. When the request history data is stored in other storage formats, such as files, corresponding methods are adopted for deletion. The present invention does not limit the specific method of deleting the unique identifier of the business request.

[0106] Through the above method, it can be judged whether multiple processing of the business request is allowed, without relying on the operation and maintenance personnel to manually delete the request unique identifier from the anti-duplication database (i.e., the request history data), thereby improving the efficiency of processing the business and reducing the operation and maintenance cost of the business system.

[0107] As Figure 2 shown, an embodiment of the present invention provides a schematic diagram of a process for multiple service processing. The process of this method may include the following steps:

[0108] Step S201: Receive a service request and search in the request history data according to the unique identifier of the service request;

[0109] Regarding receiving the service request, and the specific description of the unique identifier included in the service request and searching for the unique identifier of the request in the request history data is the same as that in step S101, which will not be elaborated here;

[0110] Further, if the unique identifier of the request is found, execute step S206; if the unique identifier of the request is not found, execute step S202.

[0111] Step S202: Perform an operation of saving the unique identifier of the request into the request history data; if it is indicated that the saving is successful, execute step S205; if it is indicated that the unique identifier of the request already exists, execute step S206;

[0112] That is, when the result of the operation indicates that the saving is successful, process the service request, obtain response information corresponding to the service request, and obtain a service processing instruction by parsing the response information;

[0113] When the unique identifier of the request is found in the request history data, or when the result of the operation indicates that the unique identifier of the request already exists, do not process the service request, and send the response information of the service request saved in the request history data.

[0114] Further, different storage methods can be adopted according to the request history data. If a relational database is used for storage, execute step S203; if a non-relational database is used for storage, execute step S204;

[0115] That is, performing the operation of saving the unique identifier of the request into the request history data includes: when the request history data is stored in a relational database, saving the unique identifier of the request using the rule of a unique index.

[0116] Performing the operation of saving the unique identifier of the request into the request history data includes: when the request history data is stored in a non-relational database, saving the unique identifier of the request using the rule of a distributed lock.

[0117] Step S203: Save the unique identifier of the request and the response information using the rule of a unique index;

[0118] Specifically, saving the request unique identifier into the request history data includes: when the request history data is stored in a relational database, saving at least the request unique identifier according to the rule of a unique index.

[0119] The description of saving the request unique identifier according to the rule of a unique index is the same as that in step S102, and will not be elaborated here;

[0120] Step S204: Saving the request unique identifier according to the rule of a distributed lock;

[0121] Specifically, saving the request unique identifier into the request history data includes: when the request history data is stored in a non-relational database, saving at least the request unique identifier according to the rule of a distributed lock.

[0122] The description of saving the request unique identifier according to the rule of a distributed lock is the same as that in step S102, and will not be elaborated here;

[0123] Step S205: Processing the service request, parsing the response information, and determining the corresponding service processing instruction according to the obtained keyword; when the service processing instruction is that the service is not completed, execute step S207; when the service processing instruction is that the service is completed, execute step S208;

[0124] Specifically, when the result indication of the operation is successful saving, parsing the service request response information according to the predefined service processing rules, and judging whether the service request can be processed again according to the obtained result;

[0125] That is, obtaining the response information corresponding to the service request, and obtaining the service processing instruction by parsing the response information, including: obtaining the response information corresponding to the service request, searching for the predefined service keyword in the response information, and determining the service processing instruction according to the predefined service information indicated by the service keyword.

[0126] The service processing instructions include: service completed and service not completed;

[0127] The description of parsing the response information according to the predefined service processing rules is the same as that in step S102, and will not be elaborated here.

[0128] Step S206: When the result indication of the operation of saving the request unique identifier into the request history data is that the request unique identifier already exists, not processing the service request, and sending the response information of the service request saved in the request history data.

[0129] That is, when the request unique identifier is found in the request history data, or when the result of the operation indicates that the request unique identifier already exists, the service request is not processed, and the response information of the service request saved in the request history data is sent.

[0130] Step S207: Send a response message containing the service incomplete information, and delete the request unique identifier from the request history data;

[0131] That is, according to the service processing instruction, the service request is processed, including: when the service processing instruction indicates that the service is incomplete, for the service request, send a response message containing the service incomplete information, and delete the request unique identifier from the request history data.

[0132] The processing description when the service processing instruction indicates that the service is incomplete is the same as that in step S103, and will not be elaborated here;

[0133] Step S208: Save the response information of the service request to the request history data, and send a completion response message;

[0134] Specifically, according to the service processing instruction, the service of processing the service request includes: when the service processing instruction indicates that the service is completed, save the response information of the service request to the request history data, and send a completion response message;

[0135] The processing description when the service processing instruction indicates that the service is completed is the same as that in step S103, and will not be elaborated here;

[0136] When accepting a service request again, repeat steps S201 - S208; using the method of steps S201 - S208 can not only ensure the idempotent processing of the service request, but also allow the service request to be processed multiple times under the predefined service processing rules. It improves the efficiency of the service request and reduces the operation and maintenance cost.

[0137] As Figure 3 shown, an embodiment of the present invention provides a schematic flowchart of a process for processing a service request multiple times. The process of this method may include the following steps:

[0138] Steps S301 - S307 describe a schematic flowchart of the interaction between the sender and the server where a service request can be processed multiple times;

[0139] Step S301: The sender sends a service request;

[0140] Specifically, the sender can be a client, a server, or other modules that send service requests; the present invention does not limit the specific form of the sender;

[0141] Step S302: The server receives a service request;

[0142] Step S303: Search for the request unique identifier in the request history data. When the request unique identifier is not found, perform the operation of saving the request unique identifier to the request history data; determine that the result indication of the operation is successful saving;

[0143] Steps S301 - S303 describe receiving a service request, where the service request includes at least a request unique identifier; searching for the request unique identifier in the request history data. When the request unique identifier is not found, perform the operation of saving the request unique identifier to the request history data; when the result indication of the operation is successful saving, process the service request, obtain response information corresponding to the service request, and obtain a service processing instruction by parsing the response information;

[0144] The specific description of receiving the service request is the same as that in Step S101 and will not be elaborated here;

[0145] Step S304: Process the service request, parse the response information corresponding to the service, and determine the corresponding service processing instruction according to the obtained keyword; specifically, perform the operation of saving the request unique identifier to the request history data; when the result indication of the operation is successful saving, obtain the response information corresponding to the service request, and obtain a service processing instruction by parsing the response information;

[0146] Furthermore, obtain the response information corresponding to the service request, obtain the response information corresponding to the service request, search for a predefined service keyword in the response information, and determine the service processing instruction according to the predefined service information indicated by the service keyword.

[0147] The description of parsing the response information is the same as that in Step S102 and will not be elaborated here;

[0148] Step S305: Send a response message containing the service not completed information, and delete the request unique identifier from the request history data;

[0149] Specifically, when the service processing instruction indicates that the service is not completed, for the service request, send a response message containing the service not completed information, and delete the request unique identifier from the request history data.

[0150] The description of the processing when the service processing instruction indicates that the service is not completed is the same as that in Step S103 and will not be elaborated here;

[0151] Step S306: The sender sends a service request;

[0152] Specifically, the sender sends the service request again. For example, based on a payment error returned by an order payment, the service request is sent again; or when performance testing of interface access is required, multiple service requests are allowed to be received.

[0153] Step S307: The server processes the service request according to the service request processing flow;

[0154] The description of the server receiving and processing the service request is the same as that in Steps S201 - S208, and will not be elaborated here.

[0155] As Figure 4 shown, an embodiment of the present invention provides a device 400 for processing service requests, including: a service identifier saving module 401, a response information parsing module 402, and a service request processing module 403; wherein,

[0156] The service identifier saving module 401 is configured to receive a service request, where the service request at least includes a request unique identifier; search for the request unique identifier in the request history data, and when the request unique identifier is not found, perform an operation of saving the request unique identifier to the request history data;

[0157] The response information parsing module 402 is configured to, when the result of the operation indicates successful saving, process the service request, obtain response information corresponding to the service request, and obtain a service processing instruction by parsing the response information;

[0158] The service request processing module 403 is configured to process the service request according to the service processing instruction.

[0159] Optionally, the response information parsing module 402 is configured to, when the request unique identifier is found in the request history data, or when the result of the operation indicates that the request unique identifier already exists, not process the service request and send the response information of the service request saved in the request history data.

[0160] Optionally, the response information parsing module 402 is configured to obtain response information corresponding to the service request and obtain a service processing instruction by parsing the response information, including:

[0161] Obtain response information corresponding to the service request, search for a predefined service keyword in the response information, and determine the service processing instruction according to the predefined service information indicated by the service keyword.

[0162] Optionally, the service request processing module 403 is configured to process the service request according to the service processing instruction, including:

[0163] When the service processing instruction indicates that the service is not completed, for the service request, a response message including the service not completed information is sent, and the request unique identifier is deleted from the request history data.

[0164] Optionally, the service request processing module 403 is configured to process the service request according to the service processing instruction, including:

[0165] When the service processing instruction indicates that the service is completed, the response information of the service request corresponding to the request unique identifier is saved to the request history data, and a response message including the service completed information is sent.

[0166] Optionally, the service identifier saving module 401 is configured to perform an operation of saving the request unique identifier to the request history data, including:

[0167] When the request history data is stored in a relational database, the request unique identifier is saved using the rule of a unique index.

[0168] Optionally, the service identifier saving module 401 is configured to perform an operation of saving the request unique identifier to the request history data, including:

[0169] When the request history data is stored in a non-relational database, the request unique identifier is saved using the rule of a distributed lock.

[0170] An embodiment of the present invention further provides an electronic device for processing a service request, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enabling the one or more processors to implement the method provided in any of the above embodiments.

[0171] An embodiment of the present invention further provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method provided in any of the above embodiments is implemented.

[0172] Figure 5 An exemplary system architecture 500 is shown to which the method for processing a service request or the device for processing a service request according to an embodiment of the present invention can be applied.

[0173] As Figure 5As shown, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is used to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0174] Users can use the terminal devices 501, 502, 503 to interact with the server 505 through the network 504 to receive or send messages, etc. Various client applications may be installed on the terminal devices 501, 502, 503, such as e-commerce applications, web browser applications, search applications, instant messaging tools, and email clients, etc.

[0175] The terminal devices 501, 502, 503 may be various electronic devices with a display screen and supporting client applications such as e-commerce applications, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.

[0176] The server 505 may be a server providing various services, such as a back-end management server that supports service requests sent by users using the terminal devices 501, 502, 503. The back-end management server may process received service requests, etc., and feedback response information to the terminal devices.

[0177] It should be noted that the method for processing service requests provided by the embodiments of the present invention is generally executed by the server 505. Correspondingly, the device for processing service requests is generally provided in the server 505.

[0178] It should be understood that Figure 5 the numbers of terminal devices, networks, and servers in

[0179] are merely illustrative. According to implementation needs, there may be any number of terminal devices, networks, and servers. Figure 6 Shown below is a schematic structural diagram of a computer system 600 of a terminal device suitable for implementing the embodiments of the present invention with reference to Figure 6 The shown terminal device is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.

[0180] As Figure 6As shown, computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0181] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read from it can be installed into the storage section 608 as needed.

[0182] Specifically, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowchart can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program product that includes a computer program carried on a computer-readable medium, and the computer program contains program codes for performing the methods shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above functions defined in the system of the present invention are executed.

[0183] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which the computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0184] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0185] The modules and / or units involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules and / or units can also be provided in a processor. For example, it can be described as: a processor includes a module for saving service identifiers, a module for parsing response information, and a module for processing service requests. Among them, the names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the module for processing service requests can also be described as "a module for determining whether to allow reprocessing of the service request according to service processing instructions".

[0186] As another aspect, the present invention also provides a computer-readable medium. The computer-readable medium can be included in the device described in the above embodiments; or it can exist separately and not be assembled into the device. The above computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the device includes: receiving a service request, where the service request at least includes a request unique identifier; searching for the request unique identifier in request history data, and when the request unique identifier is not found, performing an operation of saving the request unique identifier to the request history data; when the result of the operation indicates successful saving, processing the service request, obtaining response information corresponding to the service request, and obtaining service processing instructions by parsing the response information; and processing the service request according to the service processing instructions.

[0187] According to the technical solution of the embodiments of the present invention, this implementation can partially solve the problem of relying on operation and maintenance personnel to perform manual operations when allowing multiple processing of services in a specific scenario, thereby improving the efficiency of processing services and reducing the operation and maintenance costs of the service system.

[0188] The above specific implementation manners do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A method for processing a service request, characterized in that, comprising: Receiving a service request, the service request at least including a request unique identifier; Searching for the request unique identifier in the request history data, and when the request unique identifier is not found, performing an operation of saving the request unique identifier to the request history data; When the result of the operation indicates successful saving, processing the service request, obtaining response information corresponding to the service request, and obtaining a service processing instruction by parsing the response information; According to the service processing instruction, processing the service request, including: when the service processing instruction indicates that the service is not completed, sending response information including the service not completed information for the service request; And deleting the request unique identifier from the request history data to reprocess the service.

2. The method according to claim 1, characterized in that, When the request unique identifier is found in the request history data, or when the result of the operation indicates that the request unique identifier already exists, the service request is not processed, and the response information of the service request saved in the request history data is sent.

3. The method according to claim 1, characterized in that, Obtaining response information corresponding to the service request, and obtaining a service processing instruction by parsing the response information, including: Obtaining response information corresponding to the service request, searching for a predefined service keyword in the response information, and determining the service processing instruction according to the predefined service information indicated by the service keyword.

4. The method according to claim 1, characterized in that, According to the service processing instruction, processing the service request, including: When the service processing instruction indicates that the service is completed, saving the response information of the service request corresponding to the request unique identifier to the request history data, and sending response information including the service completed information.

5. The method according to claim 1, characterized in that, Performing the operation of saving the request unique identifier to the request history data, including: When the request history data is stored in a relational database, saving the request unique identifier using the rule of a unique index.

6. The method according to claim 1, characterized in that, Performing the operation of saving the request unique identifier to the request history data, including: When the request history data is stored in a non-relational database, saving the request unique identifier using the rule of a distributed lock.

7. A device for processing a service request, characterized in that, comprising: A save service identifier module, a parse response information module, and a process service request module; wherein, The save service identifier module is configured to receive a service request, the service request at least including a request unique identifier; search for the request unique identifier in the request history data, and when the request unique identifier is not found, perform an operation of saving the request unique identifier to the request history data; The parsing response information module is configured to process the service request when the result indication of the operation is successful saving, obtain the response information corresponding to the service request, and obtain a service processing instruction by parsing the response information; The service request processing module is configured to process the service request according to the service processing instruction, including: when the service processing instruction indicates that the service is not completed, sending, for the service request, a response information including the service not completed information; and deleting the request unique identifier from the request history data to reprocess the service.

8. The apparatus according to claim 7, wherein, when the request unique identifier is found in the request history data, or when the result indication of the operation is that the request unique identifier already exists, the service request is not processed, and the response information of the service request saved in the request history data is sent.

9. The apparatus according to claim 7, wherein, obtaining the response information corresponding to the service request, and obtaining a service processing instruction by parsing the response information, includes: obtaining the response information corresponding to the service request, searching for a predefined service keyword in the response information, and determining the service processing instruction according to the predefined service information indicated by the service keyword.

10. An electronic device, wherein, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enabling the one or more processors to implement the method according to any one of claims 1-6.

11. A computer-readable medium, on which a computer program is stored, wherein, the program, when executed by a processor, implements the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Service request processing method and service request processing device

    CN105915627A

  • Data processing method and device

    CN109766362A