Application Programming Interface Update Method, Device, Computer Equipment, and Storage Medium

By receiving service refresh requests and loading target assembly information, and updating the application program interface using reflection loading technology, the business interruption caused by upgrades in the existing technology is solved, and efficient and seamless upgrade is achieved.

CN118363640BActive Publication Date: 2025-08-01HENAN XINXING SCI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410555829.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-07
Publication Date
2025-08-01
Estimated Expiration
2044-05-07

AI Technical Summary

Technical Problem

The existing application program interface update method requires the service to be stopped for overall replacement and upgrade, resulting in business interruption and long time, affecting normal operation.

Method used

By receiving a service refresh request, the service information of the target assembly is loaded from the preset folder, and the assembly to be upgraded in memory is updated without stopping the service. The service is instantiated using reflection loading technology, and the business logic is called according to the unique encoding.

Benefits of technology

It realizes smooth upgrade of application program interfaces without interrupting services, reduces failure rate and upgrade difficulty, and improves upgrade efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118363640B_ABST
    Figure CN118363640B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, computer device, and computer storage medium for updating an application programming interface, relating to the field of Internet technologies. The present application receives a service refresh request sent by a first device for a preset application item, where the service refresh request at least includes a preset refresh interface of the preset application item; in response to the service refresh request, reads and loads information of each service in a target assembly from a preset folder of the preset application item, and updates each service in a to-be-upgraded assembly in a first storage area in a preset memory according to the information of each service in the target assembly, for invoking each service based on the unique code of each service in the first storage area to execute corresponding business logics. The present application only upgrades each service in the to-be-upgraded assembly in the first storage area, without affecting the applications of the services in other assemblies, reduces the failure rate and upgrade difficulty of the application programming interface upgrade, and improves the upgrade efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technologies, and more particularly, to an application programming interface update method, apparatus, computer device, and storage medium. Background Art

[0002] Currently, in the field of Internet technologies, during the normal operation of an application programming interface after it goes live, when the business changes or there are problems in the application programming interface, it is necessary to update the application programming interface.

[0003] Currently, when updating an application programming interface, it is necessary to first stop the external service of the application programming interface, then perform an overall replacement and upgrade of the application programming interface code package, and then restart the external service of the application programming interface.

[0004] However, the existing update method has a relatively complex upgrade process and takes a long time. Moreover, if the application programming interface is upgraded after stopping its external service, it will cause the ongoing business to be interrupted or affect the services that do not need to be updated after the update, making the application programming interface unable to operate normally. Summary of the Invention

[0005] The purpose of this application is to provide an application programming interface update method, apparatus, computer device, and storage medium, which can perform targeted upgrades without affecting the application of services in other assemblies, reduce the failure rate and upgrade difficulty of the application programming interface upgrade, and improve the upgrade efficiency, aiming at the deficiencies in the above-mentioned existing technologies.

[0006] To achieve the above object, the technical solutions adopted in the embodiments of this application are as follows:

[0007] In a first aspect, an embodiment of this application provides an application programming interface update method, and the method includes:

[0008] Receiving a service refresh request sent by a first device for a preset application project, where the service refresh request at least includes: a preset refresh interface of the preset application project;

[0009] Responding to the service refresh request, reading and loading information of each service in a target program set from a preset folder of the preset application project, where the target program set at least includes: a program set to be upgraded pre-stored by the first device in the preset folder;

[0010] Updating each service in the program set to be upgraded in a first storage area of a preset memory according to the information of each service in the target program set, for invoking each service based on the unique encoding of each service in the first storage area to execute corresponding business logics.

[0011] Optionally, updating each service in the program set to be upgraded in the first storage area in the preset memory according to information of each service in the target program set includes:

[0012] Reading the service interface list of the target program set and the interface file of each service in the target program set from the preset folder, wherein the service interface list records the unique number of each service in the target program set;

[0013] The updating of each service in the program set to be upgraded in the first storage area in the preset memory according to the information of each service in the target program set includes:

[0014] According to the service interface list, the interface file of each service in the target program set is loaded by using the reflection loading technology to obtain the instantiation information of each service in the target program set;

[0015] According to the instantiation information of each service in the target program set, the instantiation information of each service in the program set to be upgraded in the first storage area is updated to update each service in the program set to be upgraded.

[0016] Optionally, the target assembly is the assembly to be upgraded, and the service refresh request includes: an identifier of the assembly to be upgraded;

[0017] The step of reading the service interface list of the target assembly and the interface files of each service in the target assembly from the preset folder includes:

[0018] According to the identifier of the assembly to be upgraded, the service interface list of the assembly to be upgraded and the interface file of each service in the assembly to be upgraded are read from the preset folder;

[0019] The updating of the instantiation information of each service in the program set to be upgraded in the first storage area according to the instantiation information of each service in the target program set, so as to update each service in the program set to be upgraded, includes:

[0020] The instantiation information of each service in the program set to be upgraded is updated into the first storage area to update each service in the program set to be upgraded.

[0021] Optionally, the target assembly is all assemblies including the assembly to be upgraded;

[0022] The step of reading the service interface list of the target assembly and the interface files of each service from the preset folder includes:

[0023] Read the service interface list of all the assemblies and the interface files of each service in all the assemblies from the preset folder;

[0024] Updating the instantiation information of each service in the to-be-upgraded assembly in the first storage area according to the instantiation information of each service in the target assembly to update each service in the to-be-upgraded assembly includes:

[0025] Cache the instantiation information of each service in all the assemblies to the second storage area in the preset memory;

[0026] Compare the instantiation information of each service in all the assemblies cached in the second storage area with the instantiation information of each service in the historical assembly stored in the first storage area;

[0027] Update the instantiation information of each service in the to-be-upgraded assembly to the first storage area according to the comparison result to update each service in the to-be-upgraded assembly.

[0028] Optionally, the method further includes:

[0029] Receive a service call request sent by a second device for the preset application project, where the service call request at least includes: a preset call interface of the preset application project and a unique code of the target service;

[0030] Find and call the instantiation information of the target service from the first storage area according to the unique code of the target service to execute the business logic corresponding to the target service, and obtain the call result of the target service;

[0031] Return the call result of the target service to the second device.

[0032] Optionally, before receiving the service refresh request sent by the first device for the preset application project, the method further includes:

[0033] Receive the deployment request of the preset application project and the program assembly storage request sent by the first device;

[0034] Respond to the deployment request and the program assembly storage request, and store all the current program assemblies of the preset application project under the preset folder; where different program assemblies correspond to different services of the preset application project, and the same program assembly includes information of at least one service of the same service;

[0035] Read the information of each service in all the current program assemblies from the preset folder;

[0036] Load the information of each service in the currently loaded all assemblies into the first storage area.

[0037] Optionally, the information of each service includes: the attribute information of each service and the method information. The attribute information is used to indicate the unique code of each service, and the method information is used to indicate the corresponding business logic of each service.

[0038] In a second aspect, another embodiment of the present application provides an application programming interface update device, and the device includes:

[0039] A receiving module, configured to receive a service refresh request sent by a first device for a preset application item, where the service refresh request at least includes: a preset refresh interface of the preset application item;

[0040] A response module, configured to respond to the service refresh request, read and load the information of each service in a target assembly from a preset folder of the preset application item, where the target assembly at least includes: a to-be-upgraded assembly pre-stored by the first device in the preset folder;

[0041] An update module, configured to update each service in the to-be-upgraded assembly in a first storage area in a preset memory according to the information of each service in the target assembly, and is used to call each service to execute the corresponding business logic based on the unique code of each service in the first storage area.

[0042] In a third aspect, another embodiment of the present application provides a computer device, including: a processor, a storage medium, and a bus. The storage medium stores machine-readable instructions executable by the processor. When the computer device runs, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the application programming interface update method according to any one of the first aspects above.

[0043] In a fourth aspect, another embodiment of the present application provides a storage medium, on which a computer program is stored, and when the computer program is run by a processor, it performs the steps of the application programming interface update method according to any one of the first aspects above.

[0044] The beneficial effects of the present application are:

[0045] The present application provides a method, apparatus, computer device, and computer storage medium for updating an application program interface. By responding to a service refresh request sent by a first device for a preset application item, a preset refresh interface is determined. Then, information on each service in the target assembly is loaded from a preset folder of the preset application item according to the service refresh request, and each service of the program set to be upgraded in the first storage area of the preset memory is updated. It is possible to load information on each service in the target assembly from the preset refresh interface while not stopping the external service of the preset application item, thereby updating each service of the program set to be upgraded in the first storage area of the preset memory. The present application realizes the smooth upgrade of the service without interrupting the service of the preset application item; only upgrades each service in the program set to be upgraded in the first storage area, without affecting the use of services in other assemblies, reducing the failure rate of the upgrade; only needs to read and load information on each service in the target assembly from the preset folder, reducing the difficulty of the upgrade and improving the upgrade efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] To more clearly illustrate the technical solutions of the embodiments of the present application, the accompanying drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0047] Figure 1 It is a flowchart showing a method for updating an application program interface provided by an embodiment of the present application;

[0048] Figure 2 It is a flowchart showing the process of updating the program set to be upgraded in the first method for updating an application program interface provided by an embodiment of the present application;

[0049] Figure 3 It is a flowchart showing the process of updating the program set to be upgraded in the second method for updating an application program interface provided by an embodiment of the present application;

[0050] Figure 4 It is a flowchart showing the process of updating the program set to be upgraded in the third method for updating an application program interface provided by an embodiment of the present application;

[0051] Figure 5 It is a flowchart showing the process of a service call request for a preset application item in a method for updating an application program interface provided by an embodiment of the present application;

[0052] Figure 6 It is a flowchart showing the process of a service call request for a preset application item in another method for updating an application program interface provided by an embodiment of the present application;

[0053] Figure 7 It is a schematic flowchart of another application program interface update method provided by an embodiment of the present application;

[0054] Figure 8 It is a schematic structural diagram of an application program interface update device provided by an embodiment of the present application;

[0055] Figure 9 It is a schematic structural diagram of a computer device provided by an embodiment of the present application. Specific embodiments

[0056] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It should be understood that the accompanying drawings in the present application are only for the purposes of illustration and description, and are not used to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to actual scale. The flowcharts used in the present application illustrate the operations implemented according to some embodiments of the present application. It should be understood that the operations in the flowchart may not be implemented in sequence, and steps without logical context relationships may be reversed or implemented simultaneously. In addition, those skilled in the art may add one or more other operations to the flowchart or remove one or more operations from the flowchart under the guidance of the content of the present application.

[0057] In addition, the described embodiments are only some embodiments of the present application, rather than all embodiments. The components of the embodiments of the present application described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application claimed, but merely represents the selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative efforts belong to the scope of protection of the present application.

[0058] It should be noted that the term "including" will be used in the embodiments of the present application to indicate the existence of the features stated hereinafter, but does not exclude the addition of other features.

[0059] During the operation of an application programming interface (API), as business requirements change, the API needs to continuously adapt to new business requirements, which may include adding new services, modifying existing services, or optimizing existing services. When the above situations occur, the API needs to be updated. In the existing methods, it is necessary to stop the external services of the API, then replace the code package of the API, and then restart the external services of the API to complete the upgrade of the API. However, the upgrade process of the existing update method is complex and time-consuming. If the update of the API is achieved by stopping the external services of the application interface, it will cause the ongoing business to fail, affect the user experience, and may also cause the non-updated content to run abnormally. This application provides an API update method, which is applied to a server and can update the API without stopping the external services of the API.

[0060] The following explains the relevant terms in the embodiments of this application:

[0061] Assembly: The intermediate product obtained by compilation by a compiler and further compiled and executed by the Common Language Runtime (CLR), generally in the form of.dll or.exe.

[0062] Application Programming Interface (API): An interface combines public instance (non-static) methods and properties to encapsulate a specific function. When an interface is defined, it can be implemented in a service class, and the service class can support all the properties and members specified by the interface.

[0063] Service class: A service class is the basis for implementing information encapsulation in object-oriented programming (OOP). A service class is a user-defined reference data type, also known as a service class type. Each service class contains data descriptions and a set of functions that operate on the data or transmit messages. An instance of a service class is called an object. In the following embodiments of this application, the service class is uniformly abbreviated as a service.

[0064] Instantiation: In object-oriented programming, the process of creating an object using a class is called instantiation, which is the process of concretizing an abstract concept class into a physical object of that class. The instantiation process generally consists of class name, object name = create (new) class name (parameter 1, parameter 2... parameter n).

[0065] Attribute information: The attributes in a service class are actually variables in the service class, and the characteristics of the service class are described by defining variables in the body of the service class.

[0066] Method information: A function in a service class, consisting of a function name, parameters, and return value, which is a behavior or action that the service class possesses.

[0067] Reflection loading technology: Reflection loading technology refers to the ability of a program to access, detect, and modify its own state or behavior. Using reflection loading technology, instances of service classes can be created dynamically, binding service classes to existing objects or obtaining service classes from existing objects.

[0068] Caching technology: Caching is a technology for temporarily storing data, which means copying data to a faster storage medium before it is used.

[0069] Figure 1 The flowchart of an application programming interface update method provided by an embodiment of this application is as Figure 1 shown. The method includes:

[0070] Step 101, receive a service refresh request sent by a first device for a preset application project.

[0071] The service refresh request at least includes: a preset refresh interface of the preset application project.

[0072] Among them, the first device can be a terminal device of developers, interactors, or operators, such as a personal computer, a handheld device, etc. The specific personnel and terminal devices of the first device are not limited in the embodiments of this application. The preset application project can be a webapi project. The preset application project allows interaction between different software systems, sending and receiving data through the HTTP / HTTPS communication protocol, and can be used in various applications, such as mobile applications, web applications, or desktop applications, etc. A preset refresh interface is set in the preset application project. The preset refresh interface is used to re-obtain data or update the data status. The preset refresh interface obtains the latest data of the preset application project or resets the data by being called by the preset application project.

[0073] Exemplarily, when it is necessary to update the preset application project, the first device sends a service refresh request for the preset application project. By receiving the service refresh request sent by the first device for the preset application project, the preset refresh interface of the preset application project is determined.

[0074] Step 102, in response to the service refresh request, read and load the information of each service in the target assembly from the preset folder of the preset application project.

[0075] Among them, the target assembly at least includes: the assembly to be upgraded pre-stored by the first device in the preset folder.

[0076] Optionally, the information of the service in any embodiment of the present application includes: the attribute information and method information of each service. The attribute information is used to indicate the unique code of each service, and the method information is used to indicate the corresponding business logic of each service. Each service includes a data description, that is, a unique number, and a set of functions for operating data or transmitting messages, that is, method information. Each service must implement the IService interface, including the "TradeNo" attribute and the "DeelTrade" method. The "TradeNo" attribute is used to represent the unique code of the service, and the "DeelTrade" method is used to identify the business logic corresponding to the method information in the service. In the present application, only "TradeNo" and "DeelTrade" are taken as examples, and the specific attributes and method functions in the service are not limited.

[0077] The preset folder is used to store the assemblies to be upgraded, which are the assemblies generated after repackaging the added or changed assemblies in the assemblies to be upgraded. Through the assemblies to be upgraded, the services in the preset application project can be added or modified at any time. It only needs to repackage the modified assemblies to generate the assemblies to be upgraded. Generally, the services in the assemblies to be upgraded are in the.dll format. When the system changes, the format of the services in the assemblies may also change. The embodiments of the present application do not limit this. The target assembly can be one or more. Each assembly includes one or more services of the same business. The embodiments of the present application do not limit the number of target assemblies.

[0078] Optionally, determine the preset refresh interface of the reserved application project according to the service refresh request, read the information of the services in the target assembly from the preset folder of the preset application project, and load all the services in the target assembly that meet the requirements. When reading and loading the information of each service in the target assembly from the preset folder, it is necessary to judge whether each service can implement the IService interface, and whether the service includes attributes and methods. If not, the service cannot be loaded.

[0079] Step 103: Update each service in the assembly to be upgraded in the first storage area of the preset memory according to the information of each service in the target assembly, so as to call each service based on the unique code of each service in the first storage area to execute the corresponding business logic.

[0080] Among them, the first storage area is used to store the service list of the preset application project. The service list includes the unique code of the service and the corresponding business logic. The information of each service in the target assembly can be used to update each service in the assembly to be upgraded in the first storage area.

[0081] Optionally, compare the service information in the loaded target assembly with the service list in the first storage area to determine the services that have changed in the first storage area, and update the changed services.

[0082] This application provides an application programming interface update method. By responding to a service refresh request for a preset application item sent by a first device, a preset refresh interface is determined. Then, according to the service refresh request, the information of each service in the target assembly is loaded from a preset folder of the preset application item, and the services of the assembly to be upgraded in the first storage area of the preset memory are updated. It can achieve loading the information of each service in the target assembly from the preset refresh interface while not stopping the external service of the preset application item, so as to update the services of the assembly to be upgraded in the first storage area of the preset memory. This application realizes the smooth upgrade of the service without interrupting the preset application item; only needs to upgrade the services in the assembly to be upgraded in the first storage area, does not affect the application of the services in other assemblies, and reduces the failure rate of the upgrade; and only needs to read and load the information of each service in the target assembly from the preset folder, which reduces the upgrade difficulty and improves the upgrade efficiency.

[0083] Based on the above embodiments of this application, the following embodiments of this application illustrate the process of updating the assembly to be upgraded in the first application programming interface update method. Figure 2 It is a schematic flow diagram of updating the assembly to be upgraded in the first application programming interface update method provided by the embodiments of this application. As Figure 2 shown, in step 103 above, according to the information of each service in the target assembly, updating the services of the assembly to be upgraded in the first storage area of the preset memory includes:

[0084] Step 201: Read the service interface list of the target assembly and the interface files of each service in the target assembly from the preset folder.

[0085] Among them, the service interface list records the unique numbers of each service in the target assembly, and the unique numbers are used to call the service in the preset application item later. The interface file of each service includes the method information of the service, and the method information is used to indicate the business logic corresponding to each service. The unique number in the interface list of each service corresponds to the interface file of the service one by one.

[0086] In step 103 above, according to the information of each service in the target assembly, updating the services of the assembly to be upgraded in the first storage area of the preset memory includes:

[0087] Step 202: According to the service interface list, use the reflection loading technology to load the interface files of each service in the target assembly to obtain the instantiation information of each service in the target assembly.

[0088] Among them, the reflection loading technology program can access, detect, and modify the state or behavior of an object itself, use reflection to dynamically create instances of types, bind types to existing objects, or obtain types from existing objects. The reflection loading technology is used to read the service interface list from the target assembly and load the interface files of each service in the program inoculation, so as to obtain the instantiation information of each service in the target assembly.

[0089] Optionally, determine the numbers of each service according to the service interface list, and load the interface files in the target assembly through the reflection loading technology to obtain the instantiation information of each service in the target assembly. The unique numbers of each service in this instantiation information correspond to the business logic.

[0090] Step 203: Update the instantiation information of each service in the to-be-upgraded assembly in the first storage area according to the instantiation information of each service in the target assembly, so as to update each service in the to-be-upgraded assembly.

[0091] Optionally, compare the service information in the loaded target assembly with the service list in the first storage area to determine the services that have changed in the first storage area, and update the changed services.

[0092] In the embodiments of the present application, first, by reading the service interface list of the target assembly and the interface files of each service in the target assembly from a preset folder, each service is instantiated. Thus, the first storage area can be updated according to the instantiation information of each service in the target assembly, which can ensure the upgrade of the to-be-upgraded assembly with a purpose, reduce the upgrade difficulty, and improve the upgrade efficiency.

[0093] Based on the above embodiments of the present application, the following embodiments of the present application illustrate the process of updating the to-be-upgraded assembly in the second application program interface update method. Figure 3 It is a schematic flowchart of the process of updating the to-be-upgraded program in the second application program interface update method provided by the embodiments of the present application. As Figure 3 shown, the target assembly is the to-be-upgraded assembly, and the service refresh request includes: the identifier of the to-be-upgraded assembly; as in step 201 above, reading the service interface list of the target assembly and the interface files of each service in the target assembly from a preset folder, including:

[0094] Step 301: According to the identifier of the to-be-upgraded assembly, read the service interface list of the to-be-upgraded assembly and the interface files of each service in the to-be-upgraded assembly from a preset folder.

[0095] Among them, the identifier of the assembly to be upgraded is used to determine the assembly to be upgraded from multiple assemblies. The identifiers of each assembly are different. The assembly to be upgraded can be one or more, and the embodiments of the present application do not limit this. Specifically, it is determined according to the number of identifiers of the assembly to be upgraded. The identifier of the assembly to be upgraded can be any identifier that can determine the assembly to be upgraded, such as a number, a label, a name, or a version number.

[0096] Optionally, according to the identifier of the assembly to be upgraded, determine the assembly to be upgraded from a preset folder, so as to determine the service interface list of the assembly to be upgraded and the interface files of each service in the assembly to be upgraded.

[0097] As in step 203 above, according to the instantiation information of each service in the target assembly, update the instantiation information of each service in the assembly to be upgraded in the first storage area to update each service in the assembly to be upgraded, including:

[0098] Step 302: Update the instantiation information of each service in the assembly to be upgraded to the first storage area to update each service in the assembly to be upgraded.

[0099] Optionally, according to the instantiation information of each service in the assembly to be upgraded, determine the services corresponding to each service in the assembly to be upgraded in the first storage area, that is, determine the services with changes in the first storage area, and perform operations such as addition, deletion, or modification according to the services corresponding to the upgrade information of each service in the assembly to be upgraded, so as to update each service in the assembly to be upgraded.

[0100] In the embodiments of the present application, updating the instantiation information of each service in the assembly to be upgraded to the first storage area to update each service in the assembly to be upgraded can ensure targeted update of the assembly to be upgraded, thereby improving the efficiency of updating the assembly to be upgraded.

[0101] Based on the above embodiments of the present application, the following embodiments of the present application illustrate the process of determining the service interface in the target assembly in the third method for updating the application program interface. Figure 4 It is a schematic diagram of the process of determining the service interface in the target assembly in the third method for updating the application program interface provided by the embodiments of the present application. The target assembly is all assemblies including the assembly to be upgraded; as Figure 4 shown, as in step 201 above, reading the service interface list of the target assembly and the interface files of each service from a preset folder, including:

[0102] Step 401: Read the service interface list of all assemblies and the interface files of each service in all assemblies from a preset folder.

[0103] Optionally, determine all assemblies from a preset folder, and determine the list of service interfaces in all assemblies and the interface files of each service.

[0104] As in step 203 above, update the instantiation information of each service in the assembly to be upgraded in the first storage area according to the instantiation information of each service in the target assembly, so as to update each service in the assembly to be upgraded, including:

[0105] Step 402: Cache the instantiation information of each service in all assemblies to a second storage area in the preset memory.

[0106] Among them, the second storage area is used to store multiple services in the instantiated assembly. The second storage area is only used for storing multiple services in the assembly and cannot implement service calls.

[0107] Optionally, determine the numbers of each service according to the assemblies in the preset folder, load the interface files in each assembly through reflection loading technology, obtain the instantiation information of each service in each assembly, and cache it to the second storage area.

[0108] Step 403: Compare the instantiation information of each service in all assemblies cached in the second storage area with the instantiation information of each service in the historical assemblies stored in the first storage area.

[0109] Among them, the historical assembly is each service in the assembly that is currently stored in the first storage area and can be called by the preset application project.

[0110] Optionally, compare the unique numbers and business logics of each service in all assemblies cached in the second storage area with the unique numbers and business logics of each service in the historical assemblies stored in the first storage area, determine whether the business logics of services with the same unique number have changed, and determine whether the unique numbers and the business logics corresponding to the unique numbers of multiple services stored in the first storage area and the second storage area are the same.

[0111] Step 404: Update the instantiation information of each service in the assembly to be upgraded to the first storage area according to the comparison result, so as to update each service in the assembly to be upgraded.

[0112] In a possible implementation, when there is at least one service in all assemblies in the second storage area with the same unique number as the service in the historical assembly in the first storage area, the business logic for storing the service in the second storage area is compared with the business logic stored in the first storage area. If they are different, the instantiation information of each service in the program set to be upgraded is updated to the first storage area to update the service in the program set to be upgraded. Here, each service in the program set to be upgraded can be one or more, and the embodiments of the present application do not limit this, and it is specifically determined according to the comparison result.

[0113] In another possible implementation, when there is a certain unique number in the first storage area and the second storage area does not have this number, it means that the service has been deleted, so the service is deleted in the first storage area to update each service in the program set to be upgraded; when there is a certain unique number in the second storage area and the first storage area does not have this unique number, it means that the service is a newly added service, so the service is added to the first storage area to update each service in the program set to be upgraded.

[0114] In the embodiments of the present application, the service interface list of all assemblies and the interface files of each service in all assemblies are read from the preset folder, and the instantiation information of each service is cached in the second storage area. By updating the first storage area through the second storage area, the integrity of the service update can be ensured, and each service can be ensured to be updated.

[0115] Based on the above embodiments of the present application, the following embodiments of the present application illustrate the process of a service call request for a preset application project in the application program interface update method. Figure 5 It is a schematic diagram of the process of a service call request for a preset application project in an application program interface update method provided by the embodiments of the present application. As Figure 5 shown, based on the above embodiments, the method further includes:

[0116] Step 501, receive a service call request for a preset application project sent by a second device.

[0117] Among them, the service call request at least includes: a preset call interface of the preset application project and the unique code of the target service; the second device is the calling device, such as a personal computer, a handheld device, etc. The embodiments of the present application do not limit the terminal device of the second device and the calling person.

[0118] Optionally, receive the preset call interface of the preset application project sent by the second device, and judge whether the interface is the same as the actual interface of the preset application project. If so, determine the unique code of the target service from the service call request of the preset application project.

[0119] Step 502: According to the unique encoding of the target service, search for and call the instantiation information of the target service in the first storage area to execute the business logic corresponding to the target service, and obtain the call result of the target service.

[0120] Optionally, the service call request further includes: parameters corresponding to the target service. Search for and call the instantiation information of the target service corresponding to the unique encoding in the first storage area according to the unique encoding of the target service, and determine whether the parameters corresponding to the target service in the target call request match the parameters required by the business logic corresponding to the target service. If so, execute the business logic corresponding to the target service to obtain the call result of the target service. It should be noted that in this application, the target service is called through caching technology. Before executing the business logic corresponding to the target service, the target service is copied to the memory outside the first storage area and the second storage area in the preset application project, and then the business logic corresponding to the target service is executed.

[0121] Step 503: Return the call result of the target service to the second device.

[0122] In the embodiment of this application, according to the service call request of the preset application project, the preset application project is determined, the target service is determined according to the unique encoding of the target service, and then the business logic corresponding to the target service is executed to obtain the call result of the target service, ensuring the call efficiency of the target service and making the returned call result of the target service more accurate.

[0123] Based on the above embodiments of this application, the following embodiments of this application illustrate the process of another service call request of the preset application project in the application program interface update method. Figure 6 For the process schematic diagram of the service call request of the preset application project in another application program interface update method provided by the embodiment of this application, as Figure 6 shown, before the above step 501, it further includes:

[0124] Step 601: Receive the deployment request of the preset application project and the program set storage request of the preset application project sent by the first device.

[0125] Optionally, receive the deployment request of the preset application project sent by the first device, and determine the preset application project in the deployment request and the program set storage request for the preset application project.

[0126] Step 602: Respond to the deployment request and the program set storage request, and store all the current program sets of the preset application project in the preset folder.

[0127] Among them, different assemblies correspond to different services of a preset application project, and at least one service information of the same service is included in the same assembly. Multiple assemblies are stored in a preset folder.

[0128] Optionally, according to the storage request of the assembly in the deployment request, at least one assembly is stored under the preset folder of the corresponding preset application project.

[0129] Step 603: Read the information of each service in all current assemblies from the preset folder.

[0130] Optionally, it is judged from the preset assembly whether each service in the current assembly includes attribute information and method information. If the service information cannot implement the interface and there is attribute information and method information, then the service cannot be loaded. If the service information can implement the interface and there is attribute information and method information, then the service can be loaded.

[0131] Step 604: Load the information of each service in all current assemblies into the first storage area.

[0132] Optionally, when all services in the preset assembly include attribute information and method information, the information of each service in all current assemblies is loaded into the first storage area through the reflection loading technology.

[0133] In the embodiment of the present application, by receiving the deployment request of the preset application project and the assembly storage request of the preset application project sent by the first device, and storing the assembly of the preset application project into the corresponding preset application project, it can be ensured that the services in the preset assembly correspond to the preset application project. At the same time, it is also judged whether the service can be stored through the information of each service, ensuring the effectiveness and accuracy of the services stored in the preset application project.

[0134] The following is a description of the application program interface update method provided in the embodiment of the present application in combination with the flowchart. Figure 7 This is a schematic flowchart of another application program interface update method provided in the embodiment of the present application. As Figure 7 shown, when deploying a preset application project, the first device sends a deployment request of the preset application project and an assembly storage request of the preset application project to the server. The server responds to the request sent by the first device, stores all current assemblies of the preset application project under the preset folder, reads the information of each service in all current assemblies from the preset folder, and loads the information of each service in all current assemblies into the first storage area, completing the deployment of the preset application project and the storage of the assembly of the preset application project.

[0135] When the second device needs to invoke a service in a preset application project, it sends a service invocation request for the preset application project to the server. The server responds to the service invocation request and, based on the unique encoding of the target service in the service invocation request, looks up and invokes the instantiation information of the target service from the first storage area, thereby executing the business logic corresponding to the target service, obtaining the invocation result of the target service, and returning the invocation result of the target service to the second device.

[0136] When it is necessary to update a service in a preset application project, the first device pre-stores the program set to be upgraded in a preset folder in advance and sends a service refresh request for the preset application project to the server. The server responds to the service refresh request sent by the first device, reads and loads the information of each service in the target program set from the preset folder of the preset application project, and updates each service in the program set to be upgraded in the first storage area in the preset memory according to the information of each service in the target program set.

[0137] Based on the same inventive concept, an application programming interface update device corresponding to the application programming interface update method is further provided in the embodiments of the present application. Since the principle of problem-solving of the device in the embodiments of the present application is similar to that of the above application programming interface update method in the embodiments of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0138] Figure 8 It is a schematic structural diagram of an application programming interface update device provided in the embodiments of the present application, as Figure 8 shown. The device includes: a receiving module 81, a response module 82, and an update module 83; where:

[0139] The receiving module 81 is configured to receive a service refresh request for a preset application project sent by the first device. The service refresh request at least includes: a preset refresh interface of the preset application project;

[0140] The response module 82 is configured to respond to the service refresh request, read and load the information of each service in the target program set from the preset folder of the preset application project, where the target program set at least includes: the program set to be upgraded pre-stored by the first device in the preset folder;

[0141] The update module 83 is configured to update each service in the program set to be upgraded in the first storage area in the preset memory according to the information of each service in the target program set, and is configured to invoke each service based on the unique encoding of each service in the first storage area to execute the corresponding business logic.

[0142] In a possible implementation, the update module 83 is specifically configured to: read the service interface list of the target assembly and the interface files of each service in the target assembly from a preset folder, where the unique number of each service in the target assembly is recorded in the service interface list.

[0143] In a possible implementation, the update module 83 is specifically configured to: according to the service interface list, use the reflection loading technique to load the interface files of each service in the target assembly to obtain the instantiation information of each service in the target assembly;

[0144] According to the instantiation information of each service in the target assembly, update the instantiation information of each service in the program set to be upgraded in the first storage area, so as to update each service in the program set to be upgraded.

[0145] In a possible implementation, the target assembly is the program set to be upgraded, and the service refresh request includes: the identifier of the program set to be upgraded; the update module 83 is specifically configured to: according to the identifier of the program set to be upgraded, read the service interface list of the program set to be upgraded and the interface files of each service in the program set to be upgraded from a preset folder;

[0146] In a possible implementation, the update module 83 is specifically configured to: update the instantiation information of each service in the program set to be upgraded to the first storage area, so as to update each service in the program set to be upgraded.

[0147] In a possible implementation, the target assembly is all assemblies including the program set to be upgraded; the update module 83 is specifically configured to: read the service interface list of all assemblies and the interface files of each service in all assemblies from a preset folder.

[0148] In a possible implementation, the update module 83 is specifically configured to: cache the instantiation information of each service in all assemblies to the second storage area in the preset memory;

[0149] Compare the instantiation information of each service in all assemblies cached in the second storage area with the instantiation information of each service in the historical assemblies stored in the first storage area;

[0150] According to the comparison result, update the instantiation information of each service in the program set to be upgraded to the first storage area, so as to update each service in the program set to be upgraded.

[0151] In a possible implementation, the application programming interface update device further includes: a call module. The call module is specifically configured to: receive a service call request for a preset application project sent by a second device, where the service call request at least includes: a preset call interface of the preset application project, and the unique code of the target service;

[0152] Based on the unique encoding of the target service, search for and invoke the instantiation information of the target service from the first storage area to execute the business logic corresponding to the target service, and obtain the invocation result of the target service;

[0153] Return the invocation result of the target service to the second device.

[0154] In a possible implementation manner, the application programming interface update device further includes: a deployment module. The deployment module is further configured to: receive a deployment request for a preset application project and an assembly storage request for the preset application project sent by the first device;

[0155] In response to the deployment request and the assembly storage request, store all current assemblies of the preset application project under a preset folder; wherein, different assemblies correspond to different businesses of the preset application project, and the same assembly includes information of at least one service of the same business;

[0156] Read the information of each service in all current assemblies from the preset folder;

[0157] Load the information of each service in all current assemblies into the first storage area.

[0158] In a possible implementation manner, the information of each service includes: the attribute information of each service and the method information. The attribute information is used to indicate the unique encoding of each service, and the method information is used to indicate the business logic corresponding to each service.

[0159] For the description of the processing flow of each module in the device and the interaction flow between each module, reference can be made to the relevant descriptions in the above method embodiments, which will not be elaborated here.

[0160] An embodiment of the present application further provides a computer device, Figure 9 is a schematic structural diagram of the computer device provided by the embodiment of the present application, as Figure 9 shown, the computer device includes: a processor 91, a memory 92, and optionally, a bus 93 may also be included. The memory 92 stores machine-readable instructions executable by the processor 91. When the computer device runs, the processor 91 communicates with the memory 92 through the bus 93, and when the machine-readable instructions are executed by the processor 91, the steps of the above application programming interface update method are executed.

[0161] An embodiment of the present application further provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, the steps of the above application programming interface update method are executed.

[0162] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the method embodiments, and will not be elaborated herein. In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some communication interfaces, and the indirect coupling or communication connection of the devices or modules can be in electrical, mechanical or other forms.

[0163] In addition, in each embodiment of the present application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0164] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, and all should be covered by the protection scope of the present application.

Claims

1. A method for updating an application programming interface, characterized in that The method includes: Receiving a service refresh request for a preset application item sent by a first device, where the service refresh request at least includes: a preset refresh interface of the preset application item; Responding to the service refresh request, reading and loading information of each service in a target assembly from a preset folder of the preset application item, where the target assembly at least includes: an assembly to be upgraded pre-stored by the first device in the preset folder; If the target assembly is all assemblies including the assembly to be upgraded, reading a service interface list of all the assemblies and interface files of each service in all the assemblies from the preset folder, where the service interface list records unique numbers of each service in the target assembly; According to the service interface list, using reflection loading technology to load the interface files of each service in the target assembly to obtain instantiation information of each service in the target assembly; Caching the instantiation information of each service in all the assemblies to a second storage area in a preset memory; where the second storage area is only used to store the instantiation information of each service in all the assemblies and cannot implement the call of the corresponding service; Comparing the instantiation information of each service in all the assemblies cached in the second storage area with the instantiation information of each service in a historical assembly stored in a first storage area in the preset memory; According to the comparison result, updating the instantiation information of each service in the assembly to be upgraded to the first storage area for invoking the updated instantiation information service based on the unique code of each service in the first storage area to execute the business logic of the corresponding service; Among them, comparing the instantiation information of each service in all the assemblies cached in the second storage area with the instantiation information of each service in the historical assembly stored in the first storage area includes: comparing the business logics corresponding to the services with the same unique numbers of the historical assembly stored in the first storage area and the unique numbers of each service in all the assemblies cached in the second storage area.

2. The method for updating an application programming interface according to claim 1, wherein The target assembly is the assembly to be upgraded, and the service refresh request includes: an identifier of the assembly to be upgraded; The reading the service interface list of the target assembly and the interface files of each service in the target assembly from the preset folder includes: According to the identifier of the assembly to be upgraded, reading the service interface list of the assembly to be upgraded and the interface files of each service in the assembly to be upgraded from the preset folder; The updating the instantiation information of each service in the assembly to be upgraded in the first storage area according to the instantiation information of each service in the target assembly to update each service in the assembly to be upgraded includes: Updating the instantiation information of each service in the assembly to be upgraded to the first storage area to update each service in the assembly to be upgraded.

3. The method for updating an application programming interface according to claim 1, wherein The method further includes: Receive a service call request for the preset application item sent by a second device, where the service call request at least includes: a preset call interface of the preset application item and a unique code of a target service; According to the unique code of the target service, find and call the instantiation information of the target service from the first storage area to execute the business logic corresponding to the target service, and obtain the call result of the target service; Return the call result of the target service to the second device.

4. The method for updating an application programming interface according to claim 1, wherein Before receiving the service refresh request for the preset application item sent by the first device, the method further includes: Receive a deployment request for the preset application item and an assembly storage request for the preset application item sent by the first device; In response to the deployment request and the assembly storage request, store all current assemblies of the preset application item under the preset folder; where different assemblies correspond to different businesses of the preset application item, and the same assembly includes information of at least one service of the same business; Read the information of each service in all current assemblies from the preset folder; Load the information of each service in all current assemblies into the first storage area.

5. The method for updating an application programming interface according to claim 1, wherein The information of each service includes: the attribute information of each service and the method information, where the attribute information is used to indicate the unique code of each service, and the method information is used to indicate the business logic corresponding to each service.

6. An application programming interface update device, characterized in that The device includes: A receiving module, configured to receive a service refresh request for a preset application item sent by a first device, where the service refresh request at least includes: a preset refresh interface of the preset application item; A response module, configured to respond to the service refresh request, read and load the information of each service in a target assembly from the preset folder of the preset application item, where the target assembly at least includes: a to-be-upgraded assembly pre-stored by the first device in the preset folder; An update module, configured to, if the target assembly is all assemblies including the to-be-upgraded assembly, read the service interface list of all assemblies and the interface files of each service in all assemblies from the preset folder, where the unique numbers of each service in the target assembly are recorded in the service interface list; According to the service interface list, use the reflection loading technique to load the interface files of each service in the target assembly to obtain the instantiation information of each service in the target assembly; Cache the instantiation information of each service in all assemblies into a second storage area in a preset memory; where the second storage area is only used to store the instantiation information of each service in all assemblies and cannot implement the call of the corresponding service; Compare the instantiation information of each service in all assemblies cached in the second storage area with the instantiation information of each service in the historical assemblies stored in the first storage area; According to the comparison result, update the instantiation information of each service in the program set to be upgraded to the first storage area, so as to call the updated instantiation information service based on the unique code of each service in the first storage area to execute the business logic of the corresponding service; The update module is used to compare the business logics corresponding to the services whose unique numbers of each service cached in the second storage area are the same as the unique numbers of the historical program set stored in the first storage area.

7. A computer device, characterized in that, including: A processor, a storage medium and a bus. The storage medium stores program instructions executable by the processor. When the computer device runs, the processor communicates with the storage medium through the bus. The processor executes the program instructions to perform the steps of the application program interface update method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, A computer program is stored on the storage medium. When the computer program is run by the processor, it performs the steps of the application program interface update method according to any one of claims 1 to 5.