Interface version adaptation method, device and system, medium and electronic equipment

By receiving client requests on the server and determining target field information based on preset relationships, the complex problem of interface adaptation in different versions of the CS architecture is solved, compatible adaptation is achieved, and data transmission volume and compatibility cost are reduced.

CN119322633APending Publication Date: 2025-01-17BEIJING HONGTENG INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411117585.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2025-01-17

AI Technical Summary

Technical Problem

Under the CS architecture, the client cannot or does not upgrade, resulting in the server interface and fields that must remain existing for a long time, resulting in high adaptation complexity for interfaces of different versions.

Method used

The server receives the client's request for the target version interface, determines the target field parameters and service address of the target version interface based on the preset correspondence relationship, obtains and assembles the target field information, returns the request response result, and ensures that only the client needs to obtain this version of the client fields to achieve compatible adaptation of interfaces of different versions.

Benefits of technology

It reduces the adaptation complexity of interfaces of different versions, reduces the data transmission amount and bandwidth usage, and reduces the compatibility cost of developing new functions on the server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119322633A_ABST
    Figure CN119322633A_ABST
Patent Text Reader

Abstract

The invention discloses an interface version adaptation method, device and system, a medium and electronic equipment, and the method comprises the steps: receiving a request of a client for a target version interface through a server, determining a target field parameter and a target service address corresponding to the target version interface according to a preset corresponding relation in response to the request, and transmitting the target field parameter and the target service address to the client; the preset corresponding relationship is a corresponding relationship among an interface version, a field parameter corresponding to an interface of each version and a service address of field information corresponding to the field parameter, obtaining target field information corresponding to the target field parameter according to the target service address, and assembling the target field information to obtain a request response result, and returning a request response result to the client. Therefore, when the server receives the request sent by the client for the interface of a certain version, only the field required by the client of the version is acquired, the interfaces of different versions can be compatible and adapted on the database level, and the complexity of adaptation of the interfaces of different versions is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a method, device, system, medium and electronic device for interface version adaptation. Background Art

[0002] At present, under the CS architecture (Client / Server architecture), it is often the case that the client cannot be upgraded after release or the client does not upgrade, resulting in some interfaces or some fields in the interfaces on the server side having to remain in existence for a long time, making the adaptation of different versions of interfaces more complicated. Summary of the invention

[0003] The embodiments of the present application provide a method, device, system, medium and electronic device for interface version adaptation, which can reduce the complexity of adapting different version interfaces.

[0004] In a first aspect, an embodiment of the present application provides a method for interface version adaptation, which is applied to a server, including:

[0005] Receive a client request for the target version interface;

[0006] In response to the request, determining the target field parameters and the target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is a correspondence relationship between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters;

[0007] Acquire the target field information corresponding to the target field parameter according to the target service address;

[0008] The target field information is assembled to obtain a request response result, and the request response result is returned to the client.

[0009] In some embodiments, before receiving the client's request for the target version interface, the method further includes:

[0010] When each version of the interface is released, obtain the field parameters corresponding to each version of the interface;

[0011] Determine the service address of the field information corresponding to the field parameter;

[0012] The preset corresponding relationship between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters is established.

[0013] In some embodiments, the server includes a scheduler, and the determining the service address of the field information corresponding to the field parameter includes:

[0014] The dispatcher locates the service address of the field information corresponding to the field parameter according to the field parameter.

[0015] In some embodiments, the establishing of the preset correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters includes:

[0016] The interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters are registered by the scheduler to generate the preset corresponding relationship.

[0017] In some embodiments, assembling the target field information to obtain a request response result includes:

[0018] Packing the target field information into data in a preset format;

[0019] The data in the preset format is used as the request response result.

[0020] In a second aspect, an embodiment of the present application provides a method for interface version adaptation, which is applied to a client, including:

[0021] Sending a request for a target version interface to a server, so that the server responds to the request, determining a target field parameter and a target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is a correspondence relationship between an interface version, a field parameter corresponding to each version of the interface, and a service address of field information corresponding to the field parameter, obtaining the target field information corresponding to the target field parameter according to the target service address, assembling the target field information to obtain a request response result, and returning the request response result to the client;

[0022] Receive the request response result returned by the server.

[0023] In a third aspect, an embodiment of the present application further provides a device for interface version adaptation, which is applied to a server, including:

[0024] A first receiving module, used to receive a request from a client for a target version interface;

[0025] A determination module, configured to determine, in response to the request, a target field parameter and a target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is a correspondence relationship between the interface version, the field parameter corresponding to each version of the interface, and the service address of the field information corresponding to the field parameter;

[0026] An acquisition module, configured to acquire the target field information corresponding to the target field parameter according to the target service address;

[0027] The return module is used to assemble the target field information to obtain a request response result, and return the request response result to the client.

[0028] In a fourth aspect, an embodiment of the present application further provides a device for interface version adaptation, applied to a client, including:

[0029] A sending module, used for sending a request for a target version interface to a server, so that the server responds to the request, determines the target field parameters and the target service address corresponding to the target version interface according to a preset corresponding relationship, wherein the preset corresponding relationship is the corresponding relationship between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters, obtains the target field information corresponding to the target field parameters according to the target service address, assembles the target field information to obtain a request response result, and returns the request response result to the client;

[0030] The second receiving module is used to receive the request response result returned by the server.

[0031] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program runs on a computer, the computer executes the method for interface version adaptation provided in any embodiment of the present application.

[0032] In a sixth aspect, an embodiment of the present application also provides a server side, including a processor and a memory, wherein the memory has a computer program, and the processor calls the computer program to execute the interface version adaptation method provided in any embodiment of the server side in the present application.

[0033] In the seventh aspect, an embodiment of the present application also provides a client, including a processor and a memory, the memory having a computer program, and the processor is used to execute the interface version adaptation method provided by any embodiment of the client in the present application by calling the computer program.

[0034] In an eighth aspect, an embodiment of the present application further provides an interface version adaptation system, including a server and a client provided in an embodiment of the present application, wherein:

[0035] The server is used to receive a request from a client for a target version interface; in response to the request, determine the target field parameters and the target service address corresponding to the target version interface according to a preset correspondence relationship, where the preset correspondence relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters; obtain the target field information corresponding to the target field parameters according to the target service address; assemble the target field information to obtain a request response result, and return the request response result to the client;

[0036] The client is used to send a request for the target version interface to the server and receive the request response result returned by the server.

[0037] The technical solution provided by the embodiment of the present application is to receive the client's request for the target version interface through the server, and in response to the request, determine the target field parameters and target service address corresponding to the target version interface according to the preset corresponding relationship, the preset corresponding relationship is the corresponding relationship between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters, obtain the target field information corresponding to the target field parameters according to the target service address, assemble the target field information to obtain the request response result, and return the request response result to the client. In this way, in the present application, when the server receives a request from the client for a certain version of the interface, only the fields required by the client of this version are obtained, so that different versions of the interface can be compatible and adapted at the database level, reducing the complexity of adapting different versions of the interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0039] Figure 1 A schematic diagram of the architecture corresponding to the interface version adaptation method provided in the related art.

[0040] Figure 2 A first flow chart of the method for interface version adaptation provided in an embodiment of the present application.

[0041] Figure 3 A second flow chart of the method for interface version adaptation provided in an embodiment of the present application.

[0042] Figure 4 A schematic diagram of the architecture corresponding to the interface version adaptation method provided in an embodiment of the present application.

[0043] Figure 5 A schematic diagram of the interaction between the server and the client provided in an embodiment of the present application.

[0044] Figure 6 A third flow chart of the interface version adaptation method provided in an embodiment of the present application.

[0045] Figure 7 A first structural diagram of the device for interface version adaptation provided in an embodiment of the present application.

[0046] Figure 8 A second structural diagram of the device for interface version adaptation provided in an embodiment of the present application.

[0047] Fig. 9 A structural diagram of the interface version adaptation system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0049] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0050] At present, under the CS architecture (Client / Server architecture), it is often the case that the client cannot be upgraded after release or the client does not upgrade, resulting in some interfaces on the server or some fields in the interfaces having to remain in existence for a long time, which has brought great obstacles to the long-term development of the system. Although the client can be upgraded by only maintaining the latest N versions or taking forced upgrades, both are detrimental to the customer experience and the number of users.

[0051] For example, see Figure 1 , Figure 1The schematic diagram of the architecture corresponding to the method of interface version adaptation provided in the related technology. For example, the server releases a function A, which contains three fields a, b, and c. With the function upgrade, function A is upgraded to A1, and new fields d, e, and f are added. The previous v1 version of the client used the three fields a, b, and c of function A, the v2 version of the client used a, b, and d of A, and the v3 version used d, e, and f. In the related technology, with the upgrade of the client version and the function upgrade of the server, function A1 maintains six fields a, b, c, d, e, and f at the same time, and due to changes in the data model, it may be necessary to generate the three fields a, b, and c in A1 to ensure the forward compatibility of the entire function A1, which makes the adaptation of different versions of interfaces in the related technology more complicated.

[0052] In order to solve the problem of high complexity of adaptation of different versions of interfaces in the related art. The embodiment of the present application provides a method for interface version adaptation, which can receive a request from a client for a target version interface through a server, and in response to the request, determine the target field parameters and target service address corresponding to the target version interface according to a preset correspondence relationship, the preset correspondence relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters, obtain the target field information corresponding to the target field parameters according to the target service address, assemble the target field information to obtain the request response result, and return the request response result to the client, so that when the server receives a request from the client for a certain version of the interface, it only needs to obtain the fields required by the client of the version, so that different versions of the interface can be compatible and adapted at the database level, thereby reducing the complexity of adapting different versions of the interface.

[0053] Next, see Figure 2 , Figure 2 A first flow chart of the method for interface version adaptation provided in an embodiment of the present application. Figure 2 The interface version adaptation method shown is executed by the server. Figure 2 The specific process of the interface version adaptation method provided in the embodiment of the present application can be as follows:

[0054] S110: Receive a request from a client for a target version interface.

[0055] A server is a computer program or hardware device that provides services in a computer network. Its main responsibility is to receive requests from clients, process these requests, and return corresponding responses to the clients. Servers usually run on one or more servers, which can be physical servers, virtual machines, or cloud servers.

[0056] The client is the party that actively initiates requests and receives service responses in network communications. It is a software or hardware entity running on a terminal device (such as a personal computer, smartphone, tablet computer, etc.) that obtains the required information or services by communicating with the server (such as a server that provides related services, etc.).

[0057] A target version interface is an interface deployed on a server or API with a specific version number. An interface is an abstract representation of a service or function provided by a system, which defines the format and method for exchanging data between a client and a server. The version number is used to distinguish different iterations of the interface, ensuring that the communication between the client and the server remains compatible and consistent.

[0058] In an embodiment of the present application, the server receives a request from the client for a target version interface.

[0059] S120. In response to the request, determine the target field parameters and the target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters.

[0060] The preset corresponding relationship is the corresponding relationship between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters.

[0061] In computer networks and software development, a service address is a network address used to identify and locate a specific service or resource. The service address involved in the embodiment of the present application is a network address that can locate the field information corresponding to the field parameters of the interface.

[0062] In an embodiment of the present application, after receiving a request from a client for a target version interface, the server responds to the request and determines the target field parameters and the target service address corresponding to the target version interface according to a preset corresponding relationship.

[0063] In the embodiment of the present application, when each version of the interface is released, the field parameters corresponding to each version of the interface are obtained, the service address of the field information corresponding to the field parameters is determined, and a preset correspondence relationship is established between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters. In this way, when the server responds to the client's request for the interface, the response action can be performed through the preset correspondence relationship.

[0064] For example, the corresponding relationship between the interface version, field parameters and service address can be shown in the following Table 1:

[0065] Interface version Fields Service Address V1 a, b, c 127.0.0.1:30 V3 d, e, f 127.0.0.1:31

[0066] Table 1

[0067] S130. Obtain target field information corresponding to the target field parameter according to the target service address.

[0068] In this embodiment, after the target field parameter and the target service address corresponding to the target version interface are determined according to the preset corresponding relationship, the target field information corresponding to the target field parameter is acquired according to the target service address.

[0069] S140: Assemble the target field information to obtain a request response result, and return the request response result to the client.

[0070] In this embodiment, after the target field information corresponding to the target field parameter is obtained according to the target service address, the target field information is assembled to obtain a request response result.

[0071] It is understandable that the service address corresponding to each field information may be the same or different. In this application, only the required field information is obtained through the preset corresponding relationship, and the fields are spliced ​​and assembled before being returned to the client.

[0072] For example, assuming that the target field parameters are a, b, and d, the present application can obtain the three fields a, b, and d from the server, and assemble the three fields into a preset format and return them to the client, where the preset format can be JSON or XML format, and the preset format can be set by technical personnel in this field according to actual needs.

[0073] In specific implementation, the present application is not limited by the execution order of the various steps described. If no conflict occurs, some steps can be performed in other orders or simultaneously.

[0074] As can be seen from the above, the method for interface version adaptation provided by the embodiment of the present application receives the client's request for the target version interface through the server, and in response to the request, determines the target field parameters and target service address corresponding to the target version interface according to the preset corresponding relationship, the preset corresponding relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters, obtains the target field information corresponding to the target field parameters according to the target service address, assembles the target field information to obtain the request response result, and returns the request response result to the client. In this way, in the present application, when the server receives a request from the client for a certain version of the interface, only the fields required by the client of this version are obtained, so that different versions of interfaces can be compatible and adapted at the database level, reducing the complexity of adapting different versions of interfaces.

[0075] The method described in the above embodiment is further described in detail below with examples.

[0076] See also Figure 3 , Figure 3 A second flow chart of the method for interface version adaptation provided in an embodiment of the present application. Figure 3 The interface version adaptation method shown is executed by the server. Figure 3 The specific process of the interface version adaptation method provided in the embodiment of the present application can be as follows:

[0077] S210: Receive a request from a client for a target version interface.

[0078] For example, the client may be a user's smart phone. The user sends a request to the target version interface through the smart phone, and the server receives the request.

[0079] S220. In response to the request, determine the target field parameters and the target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters.

[0080] In the embodiment of the present application, when each version of the interface is released, the field parameters corresponding to each version of the interface are obtained, the service address of the field information corresponding to the field parameters is determined, and a preset correspondence relationship is established between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters. In this way, when the server responds to the client's request for the interface, the response action can be performed through the preset correspondence relationship.

[0081] In one embodiment, please refer to Figure 4 , Figure 4 The schematic diagram of the architecture corresponding to the interface version adaptation method provided in the embodiment of the present application, the server may include a scheduler, and the scheduler locates the service address of the field information corresponding to the field parameter according to the field parameter. In addition, when establishing the preset corresponding relationship, the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameter can be registered by the scheduler to generate the preset corresponding relationship.

[0082] For example, when each version of the interface is released, each version of the client can send the field parameters it needs to the scheduler. After obtaining the interface version and field parameters, the scheduler locates the accessible service according to the field parameters, thereby determining the service address for obtaining the field information corresponding to the field parameters. Then, the scheduler registers the above-obtained data to the registry, thereby forming the preset corresponding relationship.

[0083] It should be noted that due to the upgrade of functional modules, there will inevitably be old systems and new systems. In this application, the old technology will not be modified, only data adaptation will be performed. In this application, the old and new versions of the functions will be registered in the scheduler. For example, function A (a, b, c) means that function A requires three fields a, b, c. The upgraded version A1 (d, e, f) of function A needs to be registered in the scheduler and needs to carry the service address of the current service.

[0084] S230. Obtain target field information corresponding to the target field parameter according to the target service address.

[0085] In this embodiment, after determining the target field parameter and the target service address corresponding to the target version interface according to the preset corresponding relationship, the server obtains the target field information corresponding to the target field parameter according to the target service address.

[0086] S240: Pack the target field information into data in a preset format.

[0087] In this embodiment, after obtaining the required target field information, the server packages the target field information into data in a preset format, which may be JSON or XML format. The preset format may be set by those skilled in the art according to actual needs.

[0088] S250: Use the data in the preset format as the request response result, and return the request response result to the client.

[0089] In this embodiment, after packaging the required target field information into data in a preset format, the server uses the data in the preset format as a request response result and returns the request response result to the client.

[0090] As can be seen from the above, the method for interface version adaptation proposed in the embodiment of the present application receives the client's request for the target version interface through the server, and in response to the request, determines the target field parameters and target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters, obtains the target field information corresponding to the target field parameters according to the target service address, packages the target field information into data in a preset format, uses the data in the preset format as a request response result, and returns the request response result to the client. In this way, in the present application, when the server receives a request from the client for a certain version of the interface, only the fields required by the client of this version are obtained, so that different versions of interfaces can be compatible and adapted at the database level, reducing the complexity of adapting different versions of interfaces.

[0091] In general, the interface version adaptation method provided by this application reduces the amount of data transmission under the CS architecture. In the traditional mode, all field information before and after the upgrade needs to be transmitted to the old version of the client regardless of whether the client needs it or not. The interface version adaptation method provided by this application only obtains the field information required by the client of this version, reducing the use of bandwidth. In addition, the interface version adaptation method provided by this application reduces the compatibility cost for the development of new functions on the server side. In the traditional mode, the development of new functions needs to be compatible with all the fields published by the old functions, while this application only needs to consider the compatibility at the data level.

[0092] Next, please refer to Figure 5 The interaction steps between the server and the client provided in the embodiment of the present application are as follows:

[0093] S1. The client sends a request for the target version interface to the server.

[0094] S2. The server receives the client's request for the target version interface.

[0095] S3. The server responds to the request and determines the target field parameters and the target service address corresponding to the target version interface according to a preset correspondence relationship. The preset correspondence relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters. The server obtains the target field information corresponding to the target field parameters according to the target service address, and assembles the target field information to obtain the request response result.

[0096] S4. The server returns the request response result to the client.

[0097] S5. The client receives the request response result returned by the server.

[0098] The method described in the above embodiments is further described in detail below with examples.

[0099] See also Figure 6 , Figure 6 A third flow chart of the method for interface version adaptation provided in an embodiment of the present application. Figure 6 The interface version adaptation method shown is executed by the client. Figure 3 The specific process of the interface version adaptation method provided in the embodiment of the present application can be as follows:

[0100] S310. Send a request for the target version interface to the server so that the server responds to the request, determines the target field parameters and the target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters, obtains the target field information corresponding to the target field parameters according to the target service address, assembles the target field information to obtain the request response result, and returns the request response result to the client.

[0101] In this embodiment, the client sends a request for the target version interface to the server. In response to the request, the server determines the target field parameters and the target service address corresponding to the target version interface according to a preset correspondence, obtains the target field corresponding to the target field parameters according to the target service address, assembles the target field information to obtain the request response result, and returns the request response result to the client.

[0102] When assembling the target field information, the target field information may be packaged into data in a preset format.

[0103] The preset format may be a JSON format or an XML format, and the preset format may be set by those skilled in the art according to actual needs.

[0104] S320: Receive the request response result returned by the server.

[0105] In this implementation, when the server responds to the client's request for the target version interface, it returns a corresponding request response result, and the client receives the request response result returned by the server.

[0106] As can be seen from the above, the method for interface version adaptation proposed in the embodiment of the present application is to send a request for the target version interface to the server through the client, so that the server responds to the request, and determines the target field parameters and the target service address corresponding to the target version interface according to the preset corresponding relationship. The preset corresponding relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters. The target field information corresponding to the target field parameters is obtained according to the target service address, and the target field information is assembled to obtain the request response result, and the request response result is returned to the client. Then, the client receives the request response result returned by the server. In this way, in the present application, when the server receives a request for a certain version of the interface from the client, only the fields required by the client of this version are obtained, so that different versions of interfaces can be compatible and adapted at the database level, reducing the complexity of adapting different versions of interfaces.

[0107] In one embodiment, a device for adapting an interface version is also provided. Figure 7 , Figure 7 A schematic diagram of the structure of the interface version adaptation device 400 provided in the embodiment of the present application. The interface version adaptation device 400 is applied to the server, and the interface version adaptation device 400 includes a first receiving module 401, a determining module 402, an acquiring module 403 and a returning module 404, as follows:

[0108] The first receiving module 401 is used to receive a request from a client for a target version interface;

[0109] A determination module 402 is used to determine, in response to the request, a target field parameter and a target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is a correspondence relationship between the interface version, the field parameter corresponding to each version of the interface, and the service address of the field information corresponding to the field parameter;

[0110] The acquisition module 403 is used to acquire the target field information corresponding to the target field parameter according to the target service address;

[0111] The return module 404 is used to assemble the target field information to obtain a request response result, and return the request response result to the client.

[0112] In some embodiments, the determination module 402 may also be used to:

[0113] When each version of the interface is released, obtain the field parameters corresponding to each version of the interface;

[0114] Determine the service address of the field information corresponding to the field parameter;

[0115] A preset correspondence is established between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters.

[0116] In some embodiments, the server includes a scheduler, and the determination module 402 may also be used to:

[0117] The dispatcher locates the service address of the field information corresponding to the field parameter according to the field parameter.

[0118] In some embodiments, the determination module 402 may also be used to:

[0119] The interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters are registered through the scheduler to generate a preset corresponding relationship.

[0120] In some embodiments, the return module 404 may be used to:

[0121] Pack the target field information into data in a preset format;

[0122] The data in the preset format is used as the request response result.

[0123] It should be noted that the interface version adaptation device 400 provided in the embodiment of the present application belongs to the same concept as the interface version adaptation method in the above embodiment applied to the server. The interface version adaptation device 400 can be used to implement the interface version adaptation method applied to any method provided in the embodiment of the server. The specific implementation process is detailed in the embodiment of the interface version adaptation method applied to the server, which will not be repeated here.

[0124] In one embodiment, a device for interface version adaptation is also provided, which is applied to a client. Figure 8 , Figure 8 A schematic diagram of the structure of an interface version adaptation device 500 provided in an embodiment of the present application. The interface version adaptation device 500 is applied to a client, and the interface version adaptation device 500 includes a sending module 501 and a second receiving module 502, as follows:

[0125] The sending module 501 is used to send a request for a target version interface to the server, so that the server responds to the request, determines the target field parameters and the target service address corresponding to the target version interface according to a preset corresponding relationship, the preset corresponding relationship is the corresponding relationship between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters, obtains the target field information corresponding to the target field parameters according to the target service address, assembles the target field information to obtain a request response result, and returns the request response result to the client;

[0126] The second receiving module 502 is used to receive the request response result returned by the server.

[0127] It should be noted that the interface version adaptation device 500 provided in the embodiment of the present application belongs to the same concept as the interface version adaptation method in the above embodiment applied to the client. The interface version adaptation device 500 can be used to implement the interface version adaptation method applied to any method provided in the embodiment of the client. The specific implementation process is detailed in the embodiment of the interface version adaptation method applied to the client, which will not be repeated here.

[0128] In one embodiment, an interface version adaptation system is also provided, including a server and a client provided in the embodiment of the present application. Fig. 9 , Fig. 9 A structural diagram of the interface version adaptation system provided in an embodiment of the present application.

[0129] Specifically, the interface version adaptation system 600 includes a server 601 and a client 602 .

[0130] The server 601 is used to receive a request from a client for a target version interface, and in response to the request, determine the target field parameters and the target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters, obtain the target field information corresponding to the target field parameters according to the target service address, assemble the target field information to obtain a request response result, and return the request response result to the client.

[0131] The client 602 is used to send a request for a target version interface to the server so that the server responds to the request, determines the target field parameters and the target service address corresponding to the target version interface according to a preset correspondence relationship, the preset correspondence relationship is the correspondence between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters, obtains the target field information corresponding to the target field parameters according to the target service address, assembles the target field information to obtain a request response result, and returns the request response result to the client; receives the request response result returned by the server.

[0132] Since the server 601 and the client 602 can execute any interface version adaptation method of the corresponding end provided in the embodiments of the present application, the specific implementation process is detailed in the above-mentioned interface version adaptation method embodiments and will not be repeated here.

[0133] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the computer executes the method for interface version adaptation described in any of the above embodiments.

[0134] It should be noted that, a person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the storage medium can include but is not limited to: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0135] In addition, the terms "first", "second", and "third" in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or modules is not limited to the listed steps or modules, but some embodiments also include steps or modules that are not listed, or some embodiments also include other steps or modules inherent to these processes, methods, products, or devices.

[0136] The above is a detailed introduction to the interface version adaptation method, device, system, medium and electronic device provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application; at the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for interface version adaptation, characterized in that: include: Receive a client request for the target version interface; In response to the request, determining the target field parameters and the target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is a correspondence relationship between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters; Acquire the target field information corresponding to the target field parameter according to the target service address; The target field information is assembled to obtain a request response result, and the request response result is returned to the client.

2. The method for interface version adaptation according to claim 1, characterized in that: Before receiving the request of the client for the target version interface, the method further includes: When each version of the interface is released, obtain the field parameters corresponding to each version of the interface; Determine the service address of the field information corresponding to the field parameter; The preset corresponding relationship between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters is established.

3. The method for interface version adaptation according to claim 2, characterized in that: The server includes a scheduler, and the service address of the field information corresponding to the field parameter is determined, including: The dispatcher locates the service address of the field information corresponding to the field parameter according to the field parameter.

4. The method for interface version adaptation according to claim 3, characterized in that: The establishing of the preset corresponding relationship between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters includes: The interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters are registered by the scheduler to generate the preset corresponding relationship.

5. The method for interface version adaptation according to claim 1, characterized in that: The step of assembling the target field information to obtain a request response result includes: Packing the target field information into data in a preset format; The data in the preset format is used as the request response result.

6. The method for interface version adaptation according to claim 5, characterized in that: The preset format is JSON format or XML format.

7. An interface version adaptation device, characterized in that: include: A first receiving module, used to receive a request from a client for a target version interface; A determination module, configured to determine, in response to the request, a target field parameter and a target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is a correspondence relationship between the interface version, the field parameter corresponding to each version of the interface, and the service address of the field information corresponding to the field parameter; An acquisition module, configured to acquire the target field information corresponding to the target field parameter according to the target service address; The return module is used to assemble the target field information to obtain a request response result, and return the request response result to the client.

8. An interface version adaptation system, characterized in that: Including server and client, The server is used to receive a request from a client for a target version interface; in response to the request, determine a target field parameter and a target service address corresponding to the target version interface according to a preset correspondence relationship, wherein the preset correspondence relationship is a correspondence relationship between the interface version, the field parameters corresponding to each version of the interface, and the service address of the field information corresponding to the field parameters; and obtain the target field information corresponding to the target field parameters according to the target service address; Assembling the target field information to obtain a request response result, and returning the request response result to the client; The client is used to send a request for a target version interface to the server; and receive a response result of the request returned by the server.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed on a computer, the computer is enabled to execute the method for interface version adaptation according to any one of claims 1 to 6.

10. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a computer program, and is characterized in that the processor is used to execute the interface version adaptation method as described in any one of claims 1 to 6 by calling the computer program.