Business processing method and device, electronic equipment and storage medium

The business processing method addresses inefficiencies by loading logic based on target business requests and creating standardized API result objects, reducing duplicate code and improving processing speed and maintainability.

CN119201294AInactive Publication Date: 2024-12-27SHENZHEN SHENGQIANG TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411221782.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2024-12-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing business processing methods in computer applications suffer from inefficiencies due to repetitive code creation and resource exhaustion, leading to large code spaces and potential deadlocks, making the process cumbersome and time-consuming.

Method used

A business processing method that loads logic based on a target business request, creates a standardized API result object through a response construction method, and returns it to the frontend, eliminating the need for repeated object creation and encapsulation.

Benefits of technology

This approach reduces duplicate code, improves code maintainability, and enhances processing speed by standardizing the response construction, thereby addressing the inefficiencies of repetitive code writing and resource exhaustion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201294A_ABST
    Figure CN119201294A_ABST
Patent Text Reader

Abstract

The invention provides a business processing method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the steps that a service request initiated by a front end is acquired, and the service request is used for indicating the front end to request a target service processed by a rear end; loading service processing logic based on the target service indicated by the service request to obtain a processing result; and calling a response construction method, creating a corresponding API result object for the processing result, and returning the API result object to the front end. The problem that codes in the business processing process are not concise enough in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a business processing method, device, electronic device and storage medium. Background Art

[0002] In modern computer applications, the services required by users are implemented through code. In the process of business processing, data processing and response to request data are very important links. Data processing and response usually require writing a lot of code. For a business request, a new object needs to be created to return a response, and the new object needs to be encapsulated once. Therefore, there is a lot of repeated code in the business processing process, which leads to a large code space occupation.

[0003] Moreover, due to the frequent creation of new objects, resources may be exhausted, and multiple threads may wait for each other's resources, which may lead to deadlock. Based on this, developers need to consider many details when writing code, which is a very tedious task for developers.

[0004] From the above, we can see that the lack of conciseness in the code of the business processing process has become a problem that needs to be solved urgently. Summary of the invention

[0005] The present application provides a business processing method, device, electronic device and storage medium, which can solve the problem that the code of the business processing process in the related art is not concise enough. The technical solution is as follows:

[0006] According to one aspect of the present application, a business processing method is executed by a backend, and the method includes: obtaining a business request initiated by a frontend, the business request being used to indicate a target business that the frontend requests the backend to process; loading business processing logic based on the target business indicated by the business request to obtain a processing result; calling a response construction method to create a corresponding API result object for the processing result, and returning the API result object to the frontend.

[0007] According to one aspect of the present application, a business processing device includes: an acquisition module, used to obtain a business request initiated by a front end, the business request is used to indicate the target business that the front end requests the back end to process; a processing module, used to load the business processing logic based on the target business indicated by the business request to obtain a processing result; a calling module, used to call a response construction method, create a corresponding API result object for the processing result, and return the API result object to the front end.

[0008] According to one aspect of the present application, an electronic device includes at least one processor and at least one memory, wherein the memory stores computer-readable instructions; the computer-readable instructions are executed by one or more of the processors, so that the electronic device implements the business processing method as described above.

[0009] According to one aspect of the present application, a storage medium stores computer-readable instructions thereon, and the computer-readable instructions are executed by one or more processors to implement the business processing method as described above.

[0010] According to one aspect of the present application, a computer program product includes computer-readable instructions, which are stored in a storage medium. One or more processors of an electronic device read the computer-readable instructions from the storage medium, load and execute the computer-readable instructions, so that the electronic device implements the business processing method as described above.

[0011] The beneficial effects of the technical solution provided by this application are:

[0012] In the above technical solution, the business processing logic is loaded according to the target business indicated by the business request to obtain the processing result, and the corresponding API result object is created by uniformly calling a response construction method. Regardless of the processing result, the response construction method will encapsulate the processing result into a standardized API result object. There is no need to repeatedly write new object creation and encapsulation code in each business processing, thereby effectively reducing duplicate code and solving the problem that the code of the business processing process in the related technology is not concise enough. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can obtain other drawings based on these drawings without creative work.

[0014] Figure 1 is a flow chart of a business processing method according to an exemplary embodiment;

[0015] Figure 2 yes Figure 1 A flowchart of step 330 in one embodiment corresponding to the embodiment;

[0016] Figure 3 yes Figure 1 A flowchart of step 350 in one embodiment corresponding to the embodiment;

[0017] Figure 4 yes Figure 1 A flowchart of step 353 in one embodiment corresponding to the embodiment;

[0018] Figure 5 is a structural block diagram of a service processing device according to an exemplary embodiment;

[0019] Figure 6 is a hardware structure diagram of an electronic device according to an exemplary embodiment;

[0020] Figure 7 The present invention is a structural block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0021] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.

[0022] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present disclosure refers to the presence of the features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0023] The following is an introduction and explanation of several terms involved in this application:

[0024] Hypertext Transfer Protocol (HTTP) is a simple request-response protocol for exchanging information between client / server models.

[0025] Application Programming Interface (API) is a set of predefined functions used to define and integrate application software.

[0026] As mentioned earlier, implementing data processing and response usually requires writing a lot of code, and each business process requires repeating the creation and encapsulation code of new objects.

[0027] Specifically, for each business request, a new object needs to be created to return the processing result. It is understandable that if a new object is created every time a business request is responded to, a large amount of business code needs to be written, resulting in a lot of repeated code, a large project space, and a large amount of resources will be consumed because of the constant creation of new objects. In addition, since it takes time to create a new object and assign values ​​to the object, it also takes time, which will lead to slow data processing.

[0028] As can be seen from the above, the related technology still has the defect of cumbersome data processing process.

[0029] To this end, the business processing method provided in the present application can effectively improve the accuracy of data processing. Accordingly, the business processing method is applicable to a business processing device, which can be deployed in an electronic device. The electronic device can be a computer device configured with a von Neumann architecture, for example, the computer device includes a desktop computer, a laptop computer, a server, etc.

[0030] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0031] See also Figure 1 An embodiment of the present application provides a business processing method, which is applicable to an electronic device and is executed by a back-end of the electronic device. The electronic device may be a desktop computer, a laptop computer, a server, etc.

[0032] In the following method embodiments, for ease of description, the execution subject of each step of the method is taken as an electronic device as an example for illustration, but this does not constitute a specific limitation.

[0033] like Figure 1 As shown, the method may include the following steps:

[0034] Step 310: Obtain the service request initiated by the front end.

[0035] The service request is used to indicate the target service that the front-end requests the back-end to process. The target service is the service that the user expects to implement. For example, if the user expects to implement the account login service, the service request is used to implement the account login service.

[0036] The front end is the part that provides an interactive interface for users, such as browsers and applications. Users can initiate business requests by performing specific operations in the front end. The back end is the server part that processes business requests sent by the front end. The back end can load the corresponding business processing logic according to the business request, thereby executing the corresponding business processing operation and returning the processing result.

[0037] For example, a user may trigger a service request through an operation on an application or system interface, such as clicking a button, submitting a form, selecting a menu item, etc., thereby sending a service request to a server or backend system.

[0038] Step 330: Load the business processing logic based on the target business indicated by the business request to obtain a processing result.

[0039] First of all, it should be noted that the business processing logic is the specific steps and rules for implementing the operations required for the target business. For example, if the target business is an account login business, then the corresponding business processing operations may include verifying user credentials, generating session information, returning processing results, etc.

[0040] Regarding business processing logic loading, in a possible implementation, such as Figure 2 As shown, step 330 may include the following steps:

[0041] Step 331: parse the service request and extract parameters to obtain service request parameters.

[0042] The business request parameters are used to indicate specific business processing operations, which can drive and guide the execution of business processing logic, and the business request parameters can be used as inputs for specific business processing operations. For example, the business request parameters can include query conditions as inputs for data query operations, so that the backend can accurately find the specified data in the database.

[0043] It can be understood that the service request may carry service request parameters, which are obtained according to specific operations of the user, such as input data, selected options, query parameters, etc.

[0044] Step 333: Based on the service request parameters, determine the target service that the front end requests the back end to process.

[0045] It can be understood that the business request is obtained by the user through specific operations on the front end, which can reflect the target business that the user expects to achieve, and the business request parameters are obtained based on the business request. Therefore, according to the business request parameters, the target business that the front end requests the back end to process can be determined.

[0046] Step 335: Execute corresponding business processing operations based on the determined target business to obtain a processing result.

[0047] First of all, it should be noted that each business has a specific processing flow, which is the business processing logic. By performing corresponding business processing operations according to the specific processing flow, the system can effectively receive, parse, verify and process business request parameters.

[0048] Business processing operations may include data verification and validation, data query, application of business rules, data manipulation, calling external services, generating return data, exception handling, etc. Depending on the target business, the business processing logic will be different, and the specific business processing operations will also be different.

[0049] In a possible implementation, after the service request is parsed to obtain the service request parameters, data verification is performed on the service request parameters according to the requirements of the target service to ensure the legitimacy and integrity of the service request parameters. Specifically, the data verification operation may include checking whether the service request parameters have required fields, whether the field formats are correct, etc. For example, if the target service is an account registration service, the data verification includes verifying whether the user name is empty, whether the password meets the complexity requirements, and whether the email format is correct.

[0050] After completing the verification of the business request parameters, the corresponding data processing operations can be performed based on the verified business request parameters, including data query, business rule application, data operation, generation of return data, etc. For example, if the target business is an account registration business, first perform a data query operation on the user name included in the business request parameters to check whether the user name already exists in the database. If the user name already exists, return an error return mark. If the user name is available, insert the new user information included in the business request parameters into the database. The new user information includes the user name, password (encrypted) and email address. After completing the above operations, return confirmation information (result data) of successful user registration. Of course, the business processing operations of the account registration business can also include calling external services and sending a confirmation email to the user's registered email address.

[0051] By performing the business processing operation on the business request parameters, a corresponding processing result can be obtained. In a possible implementation, the processing result may include at least one of an HTTP status code, result data, and a return message.

[0052] Through the above process, the business processing operation corresponding to the target business is executed, which can ensure that the business request can be correctly processed and return the expected processing result.

[0053] Step 350, call the response construction method, create a corresponding API result object for the processing result, and return the API result object to the front end.

[0054] First of all, it should be noted that the response construction method is used to create the corresponding API result object based on the processing result. Furthermore, the processing result can be regarded as the input parameter of the response construction method. That is to say, no matter what the processing result is, the response construction method will execute the pre-set creation process and encapsulate the processing result into a standardized API result object.

[0055] Specifically, in a possible implementation, such as Figure 3 As shown, step 350 includes the following steps:

[0056] Step 351, extracting a return identifier from the processing result.

[0057] The return flag is used to indicate whether the processing of the target business is successful or failed. The return flag can be a Boolean value, such as true or false, which is not limited here.

[0058] Step 353, in response to the return identifier being passed into the constructed request result class, at least one of the HTTP status code, return message, and result data included in the processing result is encapsulated into the request result class to obtain an API result object.

[0059] First of all, the request result class is a class used to encapsulate the processing results of the target business. It can be used to encapsulate return messages, result data, and HTTP status codes. For example, the request result class is ApiResult <t>Class, including HTTP status code, return message and result data three fields, among which ApiResult <t>The generic type T is used in the class to represent the type of the result data, making the type of the result data more flexible and clear.

[0060] It can be understood that the specific content of the processing results obtained when the target business processing is successful and when the target business processing fails is different. Therefore, the content encapsulated in the request result class is also different, and then the obtained API result object is also different.

[0061] Then, according to whether the processing process of the target business indicated by the return identifier is successful or failed, the specific content that needs to be encapsulated in the request result class in the processing result can be determined, so as to obtain the API result object.

[0062] Furthermore, an API result object is created through the request result class. Each time, you only need to input the processing result into the request result class, and it can automatically match the corresponding return result (API result object). Specifically, based on the input processing result, the request result class can determine the specific content, data format and structure of the response.

[0063] It should be noted that a unified API interface can be provided through the pre-built request result class, so the request result class can be used to implement version control. The specific request result class can identify the input processing result, determine the data format and version of the client request, and select the appropriate data format and structure for the processing result based on the identified version number, and encapsulate it into the request result class, so as to dynamically select the processing logic and data format, thereby ensuring the compatibility and flexibility of the system when facing changes in data formats.

[0064] Through the above process, using the request result class, the processing results of different businesses are encapsulated through the same request result class. The constructed request result class can provide a consistent format, thereby simplifying the business processing logic, avoiding the definition and creation of new objects in each business processing, reducing code duplication, thereby reducing code redundancy and improving code maintainability.

[0065] Then, an API result object is created based on the processing result, and the API result object can be returned to the front end, so that the user can view the processing status of the target business through the API result object in the front end.

[0066] In combination with the above embodiments, the business processing logic is loaded according to the target business indicated by the business request to obtain the processing result, and the corresponding API result object is created by uniformly calling a response construction method. Regardless of the processing result, the response construction method will encapsulate the processing result into a standardized API result object. There is no need to repeatedly write new object creation and encapsulation code in each business processing, thereby effectively reducing duplicate code and solving the problem that the code of the business processing process in the related technology is not concise enough.

[0067] In an exemplary embodiment, Figure 4 As shown, step 353 includes the following steps:

[0068] Step 3531, if the return identifier is passed into the constructed request result class, determine to encapsulate the processing result into the content of the request result class,

[0069] The content includes at least one of an HTTP status code, a return message, and result data.

[0070] It should be noted that the processing result may include HTTP status code, result data, and return message, wherein the result data is the data obtained after executing the business processing operation corresponding to the target business based on the business request parameters, and the result data may also vary depending on the target business.

[0071] For example, if the target business is an account registration business, then the result data may be the registered user information; if the target business is a file upload business, then the result data may be the file path where the uploaded file is located; if the target business is a data query business, then the result data may be the specified data found in the database.

[0072] It should be understood that if the processing of the target business fails, then the correct result data may not be obtained, for example, the specified data cannot be found; or the result data is wrong, for example, the result data is garbled.

[0073] Based on this, when the processing process of the target business fails, it is determined that the content encapsulated into the request result class does not include result data.

[0074] Step 3533: Based on the determined content, set the object properties of the API result object to obtain the API result object.

[0075] First of all, it should be noted that the object properties of the API result object are used to represent the processing results of the business request. Therefore, the HTTP status code, return message, and result data of the API result object can be set based on the HTTP status code, return message, and result data in the processing results.

[0076] Regarding the return message, the return message is used to describe the processing result of the target business, for example, the target business processing is successful, or the target business processing fails.

[0077] In a possible implementation, the return information in the content determined by the return flag setting is set. For example, if the return flag is false, the Sucess method (response construction method) generates a failure message according to the return flag false, and the failure message can indicate that the business processing failed; if the return flag is true, the Sucess method generates a success message according to the return flag true, and the success message can indicate that the business processing was successful. The return message in the Success method is optional. If there is no custom message parameter, the default message parameter is used. For example, the message parameter of the success message is "business processing successful", and the message parameter of the failure message is "business processing failed".

[0078] It is further explained that the return information in the determined content can be set according to the result data. In one possible implementation, if the determined content includes result data, the corresponding return message is determined according to the result data; and the API result object is obtained based on the result data, the return message and the HTTP status code.

[0079] As mentioned above, the result data is the data obtained after executing the business processing operation corresponding to the target business according to the business request parameters. Therefore, if the result data indicates that the business processing is successful, a specific success message (such as "user registration successful") is returned according to the result data.

[0080] In another possible implementation, if the determined content does not include result data, the reason for not successfully returning the result data is analyzed based on the execution of the business processing operation corresponding to the target business, and a corresponding result return message is generated based on the reason; the API result object is obtained based on the return message and the HTTP status code.

[0081] It should be noted that if the business processing operation corresponding to the target business is not executed smoothly, it will lead to the inability to achieve the target business. Therefore, the execution status of the business processing operation corresponding to the target business can be analyzed to determine the specific reasons for the inability to achieve the target business.

[0082] For example, if data verification fails in a business processing operation and the business request parameters do not meet the expected format and content requirements, then the data verification failure makes it impossible to achieve the target business, thereby generating a corresponding return message: data verification failed; for another example, if the target business is an account registration business, when executing a data query operation, it is found that the user name in the business request parameters already exists in the database, then a return message indicating an error is returned: the user name already exists.

[0083] It should be noted that since users in different countries and regions use different languages, in one possible implementation, a multi-language string generation method is called to switch the language of the return message in the determined content, so as to create the API result object based on the return message after the language switch. Specifically, the LocatorString method can be used to switch the language of the result description message, so that users in different countries and regions can view the return message. For example, if the return message is Username already exists, after being processed by the LocatorString method, Username already exists is converted to Username already exists, so that Chinese users can view it conveniently.

[0084] Through the above process, the return message helps users understand the specific implementation status of the target business and provides users with more information.

[0085] In combination with the above embodiments, the content encapsulated into the request result class is uniformly processed by the request result class to ensure the consistency of the format and content of the output API result object class, avoiding the inconsistency caused by different developers using different business processing methods; and, regardless of whether the business processing is successful or failed, the API result object is displayed through the same structure, making the front-end processing more concise and unified; in addition, through unified processing, the processing time is reduced and the response speed of the system is improved.

[0086] In an exemplary embodiment, the processing result also includes an HTTP status code. Specifically, an HTTP status code enumeration method is called to generate a corresponding HTTP status code according to the processing process of the target service and add the code to the processing result.

[0087] Among them, the HTTP status code can be an enumeration value, and different enumeration values ​​correspond to different request statuses; further, if the processing result indicates that the target business is successfully completed, the enumeration value corresponds to the request success status; if the processing result indicates that the target business is not completed, the enumeration value corresponds to the request failure status.

[0088] First of all, it should be noted that different enumeration values ​​can be defined to indicate different request statuses through different enumeration values. For example, enumeration value 200 corresponds to a request success status, which is used to indicate that the target business is successfully completed, and enumeration value 400 corresponds to a request failure status, which is used to indicate that the target business is not completed.

[0089] In one possible implementation, the corresponding enumeration value can be determined based on the return identifier in the returned data. For example, if the return identifier is false, the corresponding enumeration value is the enumeration value of the request failure status; if the return identifier is true, the corresponding enumeration value is the enumeration value of the request success status.

[0090] Furthermore, if the processing result indicates that the target business is not completed, the execution status of the business processing operation corresponding to the target business can be analyzed to determine the specific reason why the target business cannot be achieved, and determine the corresponding enumeration value based on the reason.

[0091] For example, the enumeration value 400 means that the business request cannot be parsed. If the data format of the business request parameter is incorrect and cannot pass data verification, the enumeration value can be determined to be 400; the enumeration value 409 means a business processing operation conflict. If a user attempts to modify a user name, but the modified user name conflicts with an existing user name in the database, the enumeration value can be determined to be 409.

[0092] As mentioned above, the return message can be generated according to the specific reason why the target business cannot be achieved. Based on this, in a possible implementation method, the corresponding enumeration value can be determined according to the result description message in the processing result. For example, the return message "message":"Username already exists", the corresponding enumeration value "status_code":409; for another example, the return message "message":"User registered successfully", the corresponding enumeration value "status_code":201.

[0093] Through the above process, HTTP status codes are added to the processing results to describe different request statuses, which can make the business code more readable. In addition, when adding or modifying the HTTP status code, it only needs to be modified in one place (in the HTTP status code class) instead of searching and replacing hard-coded values ​​in multiple places in the code, which is easy to maintain.

[0094] Compared with the related technology, the business processing logic is loaded according to the target business indicated by the business request to obtain the processing result, and the corresponding API result object is created by uniformly calling a response construction method. Regardless of the processing result, the response construction method will encapsulate the processing result into a standardized API result object. There is no need to repeatedly write new object creation and encapsulation code in each business processing, thereby effectively reducing duplicate code and solving the problem that the code of the business processing process in the related technology is not concise enough.

[0095] In addition, based on the returned information, users can understand the specific implementation of the target business and provide more information to users. Furthermore, adding HTTP status codes in the result request class to describe different request states can make the business code easier to read, and when adding or modifying HTTP status codes, only one place (HTTP status code class) needs to be modified, rather than searching and replacing hard-coded values ​​in multiple places in the code, which is easy to maintain.

[0096] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0097] The following is an embodiment of the device of the present application, which can be used to execute the business processing method involved in the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the method embodiment of the business processing method involved in the present application.

[0098] See also Figure 5 In an embodiment of the present application, a business processing device 900 is provided, including but not limited to: an acquisition module 910, a processing module 930, and a calling module 950.

[0099] The acquisition module 910 is used to acquire a service request initiated by the front end, wherein the service request is used to indicate a target service that the front end requests the back end to process;

[0100] The processing module 930 is used to load the business processing logic based on the target business indicated by the business request to obtain a processing result;

[0101] The calling module 950 is used to call the response construction method, create a corresponding API result object for the processing result, and return the API result object to the front end.

[0102] It should be noted that, when the business processing device provided in the above embodiment performs data processing, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the business processing device will be divided into different functional modules to complete all or part of the functions described above.

[0103] In addition, the business processing device and the business processing method provided in the above embodiments belong to the same concept, and the specific manner in which each module performs the operation has been described in detail in the method embodiment and will not be repeated here.

[0104] Figure 6 The structure of an electronic device is shown according to an exemplary embodiment. The electronic device may be a notebook computer, a server, a desktop computer, etc.

[0105] It should be noted that the electronic device is only an example adapted to the present application and cannot be considered to provide any limitation on the scope of use of the present application. The electronic device cannot be interpreted as requiring dependence on or having Figure 6 One or more components of exemplary electronic device 2000 are shown.

[0106] The hardware structure of the electronic device 2000 may vary greatly due to differences in configuration or performance, such as Figure 6 As shown, the electronic device 2000 includes: a power supply 210 , an interface 230 , at least one memory 250 , and at least one central processing unit (CPU) 270 .

[0107] Specifically, the power supply 210 is used to provide operating voltage for each hardware device on the electronic device 2000 .

[0108] The interface 230 includes at least one wired or wireless network interface 231 for interacting with external devices.

[0109] Of course, in other examples adapted by the present application, the interface 230 may further include at least one serial-to-parallel conversion interface 233, at least one input-output interface 235, and at least one USB interface 237, etc. Figure 6 As shown, this is not intended to be a specific limitation.

[0110] The memory 250 is a carrier for storing resources, which may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 251, an application 253 and data 255, etc. The storage method may be temporary storage or permanent storage.

[0111] Among them, the operating system 251 is used to manage and control various hardware devices and application programs 253 on the electronic device 2000 to enable the central processor 270 to calculate and process the massive data 255 in the memory 250. It can be WindowsServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0112] The application program 253 is a computer-readable instruction that performs at least one specific task based on the operating system 251, and may include at least one module ( Figure 6 (not shown), each module may respectively include computer-readable instructions for the electronic device 2000. For example, the service processing device may be regarded as an application 253 deployed on the electronic device 2000.

[0113] The data 255 may be photos, pictures, etc. stored in a disk, or may be request result classes, etc., stored in the memory 250 .

[0114] The central processor 270 may include one or more processors and is configured to communicate with the memory 250 through at least one communication bus to read the computer-readable instructions stored in the memory 250, thereby realizing the operation and processing of the mass data 255 in the memory 250. For example, the business processing method is completed by the central processor 270 reading a series of computer-readable instructions stored in the memory 250.

[0115] In addition, the present application can also be implemented through hardware circuits or hardware circuits combined with software. Therefore, the implementation of the present application is not limited to any specific hardware circuits, software, or a combination of the two.

[0116] See also Figure 7 In an embodiment of the present application, an electronic device 4000 is provided, and the electronic device 4000 may include: a desktop computer, a laptop computer, a server, etc.

[0117] exist Figure 7 In the embodiment, the electronic device 4000 includes at least one processor 4001 and at least one memory 4003.

[0118] The data interaction between the processor 4001 and the memory 4003 can be realized through at least one communication bus 4002. The communication bus 4002 may include a path for transmitting data between the processor 4001 and the memory 4003. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0119] Optionally, the electronic device 4000 may further include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.

[0120] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0121] The memory 4003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program instructions or codes in the form of instructions or data structures and can be accessed by the electronic device 400, but is not limited to this.

[0122] Computer-readable instructions are stored in the memory 4003 , and the processor 4001 can read the computer-readable instructions stored in the memory 4003 through the communication bus 4002 .

[0123] The computer-readable instructions are executed by one or more processors 4001 to implement the business processing methods in the above-mentioned embodiments.

[0124] In addition, an embodiment of the present application provides a storage medium on which computer-readable instructions are stored. The computer-readable instructions are executed by one or more processors to implement the business processing method as described above.

[0125] A computer program product is provided in an embodiment of the present application. The computer program product includes computer-readable instructions. The computer-readable instructions are stored in a storage medium. One or more processors of an electronic device read the computer-readable instructions from the storage medium, load and execute the computer-readable instructions, so that the electronic device implements the business processing method as described above.

[0126] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.< / t> < / t>

Claims

1. A business processing method, characterized in that: Executed by the backend, the method includes: Obtaining a service request initiated by a front end, wherein the service request is used to indicate a target service that the front end requests the back end to process; Loading business processing logic based on the target business indicated by the business request to obtain a processing result; Call the response construction method, create a corresponding API result object for the processing result, and return the API result object to the front end.

2. The method according to claim 1, characterized in that The loading of the business processing logic based on the target business indicated by the business request to obtain a processing result includes: Parsing and extracting parameters of the service request to obtain service request parameters; Based on the service request parameters, determining the target service that the front end requests the back end to process; A corresponding business processing operation is performed based on the determined target business to obtain the processing result.

3. The method according to claim 2, characterized in that After executing the corresponding business processing operation based on the determined target business and obtaining the processing result, the method further includes: The HTTP status code enumeration method is called to generate a corresponding HTTP status code according to the processing process of the target business and add it to the processing result.

4. The method according to claim 1, characterized in that The calling response construction method creates a corresponding API result object for the processing result, including: Extracting a return identifier from the processing result; the return identifier is used to indicate whether the processing of the target business is successful or failed; In response to the return identifier being passed into the constructed request result class, at least one of the HTTP status code, return message, and result data contained in the processing result is encapsulated into the request result class to obtain the API result object.

5. The method according to claim 4, characterized in that In response to the return identifier being passed into the constructed request result class, at least one of the HTTP status code, the return message, and the result data included in the processing result is encapsulated into the request result class to obtain the API result object, including: If the return identifier is passed into the constructed request result class, determine to encapsulate the processing result into the content of the request result class, wherein the content includes at least one of an HTTP status code, a return message, and result data; Based on the determined content, the object attribute of the API result object is set to obtain the API result object.

6. The method according to claim 5, characterized in that The step of setting the object attribute of the API result object based on the determined content to obtain the API result object includes: If the determined content includes the result data, a corresponding return message is generated according to the set rules; The API result object is obtained based on the result data, the return message and the HTTP status code.

7. The method according to claim 5, characterized in that The step of setting the object attribute of the API result object based on the determined content to obtain the API result object includes: If the determined content does not include the result data, analyzing the reason why the result data is not successfully returned according to the execution status of the business processing operation corresponding to the target business, and generating a corresponding result return message according to the reason; The API result object is obtained based on the return message and the HTTP status code.

8. The method according to claim 5, characterized in that The step of setting the object attribute of the API result object based on the determined content to obtain the API result object includes: A multi-language character string generation method is called to switch the language of the return message in the determined content, so as to create the API result object based on the return message after the language switching.

9. A service processing device, characterized in that: include: An acquisition module, used to acquire a service request initiated by a front end, wherein the service request is used to indicate a target service that the front end requests the back end to process; A processing module, used to load business processing logic based on the target business indicated by the business request to obtain a processing result; The calling module is used to call the response construction method, create a corresponding API result object for the processing result, and return the API result object to the front end.

10. An electronic device, characterized in that: include: at least one processor and at least one memory, wherein: The memory has computer-readable instructions stored thereon; The computer-readable instructions are executed by one or more of the processors, so that the electronic device implements the business processing method according to any one of claims 1 to 12.