CN116400954A - Interface configuration method, device, computer equipment and computer readable storage medium - Google Patents

Interface configuration method, device, computer equipment and computer readable storage medium Download PDF

Info

Publication number
CN116400954A
CN116400954A CN202310377325.0A CN202310377325A CN116400954A CN 116400954 A CN116400954 A CN 116400954A CN 202310377325 A CN202310377325 A CN 202310377325A CN 116400954 A CN116400954 A CN 116400954A
Authority
CN
China
Prior art keywords
interface
configuration file
information
target
configuration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310377325.0A
Other languages
Chinese (zh)
Inventor
时小琳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An International Financial Leasing Co Ltd
Original Assignee
Ping An International Financial Leasing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An International Financial Leasing Co Ltd filed Critical Ping An International Financial Leasing Co Ltd
Priority to CN202310377325.0A priority Critical patent/CN116400954A/en
Publication of CN116400954A publication Critical patent/CN116400954A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses an interface configuration method, an interface configuration device, computer equipment and a computer readable storage medium, which relate to the technical field of Internet, and a front-end server can directly acquire a target configuration file with the interface method configured, so that front-end developers do not need to manually write the configuration file, the project development efficiency is improved, and the project development time is saved. The method comprises the following steps: inquiring at least one interface information corresponding to at least one interface to be configured in an interface management platform, and inputting the at least one interface to be configured into a configuration file according to the at least one interface information; generating at least one interface method corresponding to at least one interface to be configured based on a preset plug-in the configuration file, and obtaining a target configuration file containing the at least one interface method; and uploading the target configuration file to the static server, so that the static server responds to a configuration request initiated by the front-end server and sends the target configuration file to the front-end server to complete interface configuration.

Description

Interface configuration method, device, computer equipment and computer readable storage medium
Technical Field
The present invention relates to the field of internet technologies, and in particular, to an interface configuration method, an apparatus, a computer device, and a computer readable storage medium.
Background
The API (Application Program Interface ) interface is a way for front-end and back-end developers to implement data interaction, and usually, the back-end developers give the front-end developers API interface documents, and then the front-end developers write the interfaces into projects one by one, so that when the component is used, the error processing of catch needs to be added at the end of each interface method.
If the project is large, the code amount required to be written by front-end developers is increased, so that human errors are easier to generate in the writing process, errors are not easy to find, and the development efficiency is low and the development time is long only when the front-end and back-end joint debugging interfaces are found. Therefore, how to improve the configuration efficiency of the interface is a problem to be solved.
Disclosure of Invention
In view of this, the present application provides an interface configuration method, apparatus, computer device, and computer readable storage medium, and is mainly aimed at solving the problem of how to improve the configuration efficiency of interfaces.
According to a first aspect of the present application, there is provided an interface configuration method, the method comprising:
inquiring at least one interface information corresponding to at least one interface to be configured in an interface management platform, and inputting the at least one interface to be configured into a configuration file according to the at least one interface information;
generating at least one interface method corresponding to the at least one interface to be configured based on a preset plug-in the configuration file, and obtaining a target configuration file containing the at least one interface method;
uploading the target configuration file to a static server, so that the static server responds to a configuration request initiated by a front-end server and sends the target configuration file to the front-end server to complete interface configuration.
Optionally, the querying, at the interface management platform, at least one interface information corresponding to at least one interface to be configured, and inputting, according to the at least one interface information, the at least one interface to be configured to a configuration file includes:
inquiring interface information corresponding to a functional module to be configured in the interface management platform to obtain at least one interface information corresponding to the at least one interface to be configured;
for each interface to be configured in the at least one interface to be configured, inputting interface information of each interface to be configured to a translation plug-in, and translating request information in the interface information into a specified format through the translation plug-in, wherein the request information comprises a request format and a request method;
and inputting request information in a specified format corresponding to each interface to be configured into the configuration file.
Optionally, the generating, based on a preset plug-in the configuration file, at least one interface method corresponding to the at least one interface to be configured, to obtain a target configuration file including the at least one interface method includes:
invoking a preset plug-in the configuration file, receiving at least one request message input into the configuration file, and generating at least one interface method corresponding to the at least one request message;
and determining interfaces to be configured corresponding to each piece of request information in the at least one piece of request information, and respectively associating at least one interface method with the interface names of the corresponding interfaces to be configured in the configuration file to obtain the target configuration file containing the interface methods.
Optionally, before the interface management platform queries the at least one interface to be configured, the method further includes: and acquiring an interface document, and integrating the interface information in the interface document to an interface management platform.
Optionally, the method further comprises:
when the front-end server is detected to initiate an interface query instruction to be invoked, querying interface information corresponding to an interface to be invoked on the interface management platform;
the interface information is sent to the front-end server, so that the front-end server obtains a name, a parameter format and a target data format of an interface to be called, which correspond to the interface to be called, through identifying the interface information, and inputs actual parameter variables into a global function according to the parameter format, and inputs the name, the target data format and prompt information of the interface to be called into the global function, wherein the prompt information is alarm information initiated when an interface reports errors;
and if the interface to be called operates normally, outputting the target data through the global function, and rendering a page by adopting the target data.
Optionally, the outputting the return data by the global function includes:
when the fact that the front-end server calls the global function to input an actual parameter variable into the interface method to be called associated with the interface name to be called in the target configuration file is detected, receiving the actual parameter variable transmitted by the interface method to be called, and determining returned data according to the actual parameter variable;
and transmitting the returned data back to the global function through the interface method to be called, so that the global function converts the data format of the returned data into the target data format, and the target data is obtained and output.
Optionally, after the interface method corresponding to the interface name is called in the target configuration file, the method further includes:
if the interface to be called runs abnormally, outputting corresponding prompt information through the global function, and sending the prompt information to a remote terminal, so that the remote terminal repairs the interface to be called based on the prompt information.
According to a second aspect of the present application, there is provided an interface configuration apparatus, comprising:
the query module is used for querying at least one interface information corresponding to at least one interface to be configured in the interface management platform, and inputting the at least one interface to be configured into the configuration file according to the at least one interface information;
the generating module is used for generating at least one interface method corresponding to the at least one interface to be configured based on a preset plug-in the configuration file to obtain a target configuration file containing the at least one interface method;
and the configuration module is used for uploading the target configuration file to the static server so that the static server responds to a configuration request initiated by the front-end server and sends the target configuration file to the front-end server to complete interface configuration.
Optionally, the query module is configured to query interface information corresponding to the functional module to be configured in the interface management platform to obtain at least one interface information corresponding to the at least one interface to be configured; for each interface to be configured in the at least one interface to be configured, inputting interface information of each interface to be configured to a translation plug-in, and translating request information in the interface information into a specified format through the translation plug-in, wherein the request information comprises a request format and a request method; and inputting request information in a specified format corresponding to each interface to be configured into the configuration file.
Optionally, the generating module is configured to invoke a preset plug-in the configuration file, receive at least one request information input into the configuration file, and generate at least one interface method corresponding to the at least one request information; and determining interfaces to be configured corresponding to each piece of request information in the at least one piece of request information, and respectively associating at least one interface method with the interface names of the corresponding interfaces to be configured in the configuration file to obtain the target configuration file containing the interface methods.
Optionally, the apparatus further comprises:
and the acquisition module is used for acquiring the interface document and integrating the interface information in the interface document into the interface management platform.
Optionally, the apparatus further comprises:
the detection module is used for inquiring interface information corresponding to the interface to be called in the interface management platform when the front-end server is detected to initiate the interface inquiry instruction to be called;
the sending module is used for sending the interface information to the front-end server, so that the front-end server obtains a to-be-called interface name, a parameter format and a target data format corresponding to the to-be-called interface through identifying the interface information, inputs actual parameter variables into a global function according to the parameter format, and inputs the to-be-called interface name, the target data format and prompt information into the global function, wherein the prompt information is alarm information initiated when an interface reports errors;
and the rendering module is used for outputting the target data through the global function and rendering a page by adopting the target data if the interface to be called runs normally.
Optionally, the rendering module is configured to receive an actual parameter variable transmitted by the interface method to be called when it is detected that the front-end server calls the global function to input the actual parameter variable to the interface method to be called associated with the interface name to be called in the target configuration file, and determine return data according to the actual parameter variable; and transmitting the returned data back to the global function through the interface method to be called, so that the global function converts the data format of the returned data into the target data format, and the target data is obtained and output.
Optionally, the apparatus further comprises:
and the error reporting module is used for outputting corresponding prompt information through the global function if the interface to be called runs abnormally, and sending the prompt information to a remote terminal so that the remote terminal repairs the interface to be called based on the prompt information.
According to a third aspect of the present application there is provided a computer device comprising a memory storing a computer program and a processor implementing the steps of the method of any of the first aspects described above when the computer program is executed by the processor.
According to a fourth aspect of the present application there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of any of the first aspects described above.
By means of the technical scheme, the interface configuration method, the device, the computer equipment and the computer readable storage medium are applicable to a configuration system, after a front-end server initiates an interface configuration application for a functional module to be configured, the configuration system queries interface information of at least one interface to be configured corresponding to the functional module to be configured in an interface management platform, and at least one interface to be configured is input into a configuration file according to the at least one interface information. Further, by using the function plug-in inserted in the configuration file, at least one interface method corresponding to at least one interface to be configured is generated, and a target configuration file containing at least one interface method is obtained. Finally, the configuration system uploads the target configuration file to the static server. The front-end server can directly acquire the target configuration file with the interface method configured in the static server, and the target configuration file integrated with each interface is adopted to interact with the back-end server. The front-end developer is not required to compare interface documents, and interfaces are added one by one. Once the interface is wrong or changed, the interface document uploaded by the back-end developer can be directly obtained, automatic modification and deployment are realized through the interface document, the project development efficiency is improved, and the project development time is saved.
The foregoing description is only an overview of the technical solutions of the present application, and may be implemented according to the content of the specification in order to make the technical means of the present application more clearly understood, and in order to make the above-mentioned and other objects, features and advantages of the present application more clearly understood, the following detailed description of the present application will be given.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
fig. 1 is a schematic flow chart of an interface configuration method according to an embodiment of the present application;
fig. 2A is a schematic flow chart of an interface configuration method according to an embodiment of the present application;
fig. 2B is a schematic flow chart of an interface configuration method according to an embodiment of the present application;
fig. 3A shows a schematic structural diagram of an interface configuration device according to an embodiment of the present application;
fig. 3B is a schematic structural diagram of an interface configuration device according to an embodiment of the present application;
fig. 3C illustrates a schematic structural diagram of an interface configuration device according to an embodiment of the present application;
fig. 3D is a schematic structural diagram of an interface configuration device according to an embodiment of the present application;
fig. 4 shows a schematic device structure of a computer device according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The API (Application Program Interface ) interface is a way for front-end and back-end developers to implement data interaction, and usually, the back-end developers give the front-end developers API interface documents, and then the front-end developers write the interfaces into projects one by one, so that when the component is used, the error processing of catch needs to be added at the end of each interface method. If the project is large, the code amount required to be written by front-end developers is increased, so that human errors are easier to generate in the writing process, errors are not easy to find, and the development efficiency is low and the development time is long only when the front-end and back-end joint debugging interfaces are found. Therefore, how to improve the configuration efficiency of the interface is a problem to be solved. Therefore, the application provides an interface configuration method which is suitable for a configuration system, after a front-end server initiates an interface configuration application for a functional module to be configured, the configuration system queries interface information of at least one interface to be configured corresponding to the functional module to be configured in an interface management platform, and inputs the at least one interface to be configured into a configuration file according to the at least one interface information. Further, by using the function plug-in inserted in the configuration file, at least one interface method corresponding to at least one interface to be configured is generated, and a target configuration file containing at least one interface method is obtained. Finally, the configuration system uploads the target configuration file to the static server. The front-end server can directly acquire the target configuration file with the interface method configured in the static server, and the target configuration file integrated with each interface is adopted to interact with the back-end server. The front-end developer is not required to compare interface documents, and interfaces are added one by one. Once the interface is wrong or changed, the interface document uploaded by the back-end developer can be directly obtained, automatic modification and deployment are realized through the interface document, the project development efficiency is improved, and the project development time is saved.
The embodiment of the application provides an interface configuration method, as shown in fig. 1, which includes:
101. and inquiring at least one interface information corresponding to the at least one interface to be configured in the interface management platform, and inputting the at least one interface to be configured into the configuration file according to the at least one interface information.
In the actual operation process, the back-end developer writes corresponding interface documents according to the development request of the front-end developer, such as Swagger, UI, yapi. In the embodiment of the application, the configuration system concentrates the interface information in the interface document to the interface management platform every time the back-end developer uploads the interface document. Therefore, in order to distinguish a large amount of interface information stored in the interface management platform, the interface management platform adopts a modularized management mode to divide the interface information of the same functional module into a group, so that the interface information of the corresponding interface to be configured can be conveniently inquired through the functional module. Further, after the interface management platform is called to obtain at least one interface information corresponding to at least one interface to be configured, the configuration system inputs the at least one interface information to be configured into the configuration file, so that a corresponding interface method is generated for each interface to be configured through a functional plug-in the configuration file.
102. And generating at least one interface method corresponding to the at least one interface to be configured based on the preset plug-in the configuration file, and obtaining a target configuration file containing the at least one interface method.
In this step, the developer inserts the set function plug-in the configuration file in advance. Further, after the configuration system inputs at least one interface information to be configured into the configuration file, the configuration file translates the request information in the interface information into a language form which can be received by the service method generating plug-in through the base translation plug-in, so that the method generating plug-in can accurately generate a corresponding interface method for each interface to be configured based on the request information corresponding to each interface to be configured, and a target configuration file containing at least one interface method is obtained. The interface method corresponding to each interface to be configured is automatically generated through the preset function plug-in the configuration file, repeated work such as writing of a large number of API interfaces by front-end developers is not needed, development time is further saved, and development efficiency is improved. It should be noted that, the method name of each interface method is unique, and the interface method and the interface are in one-to-one correspondence.
103. And uploading the target configuration file to the static server, so that the static server responds to a configuration request initiated by the front-end server and sends the target configuration file to the front-end server to complete interface configuration.
Further, since the target configuration file is used to implement the front-end and back-end data interaction, in this step, in order for the front-end server to acquire the target configuration file and interact with the back-end server, the configuration system will upload the target configuration file including the interface method to the static server. Further, the front-end server may directly initiate a profile acquisition request to the static server, such that the static server sends the target profile to the front-end server in response to the profile acquisition request. It should be noted that, when the front-end server receives the target configuration file, it is equivalent to obtaining the interface method corresponding to each interface, that is, the whole interface configuration process is completed.
The method provided by the embodiment of the application is suitable for the configuration system, after the front-end server initiates the interface configuration application for the function module to be configured, the configuration system inquires interface information of at least one interface to be configured corresponding to the function module to be configured in the interface management platform, and at least one interface to be configured is input into the configuration file according to the at least one interface information. Further, by using the function plug-in inserted in the configuration file, at least one interface method corresponding to at least one interface to be configured is generated, and a target configuration file containing at least one interface method is obtained. Finally, the configuration system uploads the target configuration file to the static server. The front-end server can directly acquire the target configuration file with the interface method configured in the static server, and the target configuration file integrated with each interface is adopted to interact with the back-end server. The front-end developer is not required to compare interface documents, and interfaces are added one by one. Once the interface is wrong or changed, the interface document uploaded by the back-end developer can be directly obtained, automatic modification and deployment are realized through the interface document, the project development efficiency is improved, and the project development time is saved.
The embodiment of the application provides an interface configuration method, as shown in fig. 2, which includes:
201. and acquiring an interface document, and integrating interface information in the interface document to an interface management platform.
In the actual operation process, the back-end developer writes corresponding interface documents according to the development requirements of the front-end developer, such as Swagger, UI, yapi. Further, the back-end developer uploads the interface document which is written to the configuration system, and interface information of each interface to be configured in the interface document is integrated to the swagger interface management platform through the configuration system. It should be noted that, the swagger platform may view names, request parameters and response data of all interface information, where the request parameters and the response data are all dummy data, and are used to prompt a corresponding data format for example. In the embodiment of the application, the configuration system extracts the interface information recorded by the interface document and concentrates the interface information to the interface management platform when the configuration system receives the interface document uploaded by the back-end developer, so that the interface management platform stores a large amount of interface information. Therefore, in order to distinguish a large amount of interface information stored in the interface management platform, the interface management platform adopts a modularized management manner. The interface information of the same functional module is divided into a group, so that the interface information of the corresponding interface to be configured can be conveniently inquired through the functional module.
202. And inquiring interface information corresponding to the functional module to be configured in the interface management platform to obtain at least one interface information corresponding to at least one interface to be configured, and inputting the at least one interface to be configured into the configuration file according to the at least one interface information.
And then, the configuration system acquires at least one interface information corresponding to at least one interface to be configured from the interface management platform according to the functional module to be configured indicated by the interface document. And then, inputting at least one interface information to be configured into the configuration file through the table translation plug-in, so as to generate a corresponding interface method for each interface to be configured through a function plug-in preset in the configuration file.
Specifically, the configuration system firstly identifies an interface document uploaded by a back-end developer, and determines a function module to be configured indicated by the interface document. Next, the interface information corresponding to the functional module to be configured is queried on the interface management platform through the configuration system, wherein the interface corresponding to the functional module to be configured is at least one interface to be configured, and the interface information corresponding to the functional module to be configured is at least one interface information. Further, in order to facilitate that a preset plug-in the configuration file can receive information conforming to the language specification of the preset plug-in to generate a corresponding interface method, the application is provided with a base translation plug-in. And translating the request information in the interface information through the table translation plug-in to obtain the request information with the specified format, wherein the request information comprises a request format and a request method. For example, the request format in interface get (api) is json format, and the request method is get (). And finally, inputting the request information with the specified format into the configuration file.
203. And generating at least one interface method corresponding to the at least one interface to be configured based on the preset plug-in the configuration file, and obtaining a target configuration file containing the at least one interface method.
The preset plug-in is used for generating an interface method, and specifically may be a service plug-in. In this step, a developer inserts a set method generating plug-in the configuration file in advance, and receives request information input by the translation plug-in through the method generating plug-in, so as to generate a corresponding interface method according to the request information corresponding to each interface to be configured, and finally obtain a target configuration file containing at least one interface method.
Specifically, a preset plug-in the configuration file is called, at least one request message input into the configuration file is received, and at least one interface method corresponding to the at least one request message is generated. And then, determining interfaces to be configured corresponding to each piece of request information in at least one piece of request information, and respectively associating at least one interface method with the interface names of the corresponding interfaces to be configured in the configuration file to obtain a target configuration file containing the interface methods. The method name of each interface method is unique, and the interface methods and the interfaces are in one-to-one correspondence. The interface method corresponding to each interface to be configured is automatically generated through the preset function plug-in the configuration file, repeated work such as writing of a large number of API interfaces by front-end developers is not needed, development time is further saved, and development efficiency is improved.
204. And uploading the target configuration file to the static server, so that the static server responds to a configuration request initiated by the front-end server and sends the target configuration file to the front-end server to complete interface configuration.
Further, since the target configuration file is used for implementing front-end and back-end data interaction, in this step, in order for the front-end server to acquire the target configuration file and interact with the back-end server, the configuration system uploads the target configuration file including the interface method to the static server, so that the front-end server can directly request the target configuration file from the static server.
Specifically, after the configuration system uploads the target configuration file to the static server, the front-end server may directly initiate a configuration file acquisition request to the static server, so that the static server sends the target configuration file to the front-end server in response to the configuration file acquisition request. It should be noted that, the target configuration file corresponds to an interface configuration file manually written by a front-end developer in the prior art, so that the front-end server receives the target configuration file and obtains an interface method corresponding to each interface for the front-end developer to use, that is, the whole interface configuration process is completed. When the API interface is mistaken or changed, the configuration system is directly changed and directly deployed, and a new target configuration file API. So that the front-end developer has no perception of the modification of the interface. In addition, if the interface information is changed and newly added in the actual operation process, the configuration system can be automatically uploaded to the static server. In the embodiment of the application, the front-end server directly requests the configured target configuration file api.js from the static server, so that a front-end developer does not need to manually write the API interface configuration file, and the coupling of front-end and back-end interface processing is reduced.
In addition, the front-end server can call an interface method corresponding to the interface to be called, output target data through the global function and render the page by adopting the target data. The parameters of the global function APICatch, APICatch function include an interface method name, an interface request parameter and prompt information (the prompt information of the interface request to the outside when the interface request is in error). In the actual running process, the catch error processing of the API interface can be uniformly processed through the packaged APICatch global function, so that the development amount of manually adding the catch error processing at the tail end of each interface method by a front-end developer is saved, and the development efficiency is improved. Further, when the configuration system detects that the front-end server initiates an interface query instruction to be called at the interface management platform, the interface information corresponding to the interface to be called is queried at the interface management platform according to the interface to be called, and the interface information is sent to the front-end server. The front-end server obtains the name, the parameter format and the target data format of the interface to be called corresponding to the interface to be called through identifying the interface information. And then, directly calling a global function access target configuration file in the component, determining a method to be called corresponding to the interface to be called, inputting actual parameter variables into the global function according to a parameter format, and inputting the name of the interface to be called, a target data format and prompt information into the global function together, wherein the prompt information is alarm information initiated when the interface reports errors.
If the interface to be called operates normally, after the front-end server calls the global function to input the actual parameter variable to the interface to be called method associated with the interface name to be called, the back-end server can receive the actual parameter variable and determine return data which should be returned to the front-end server according to the actual parameter variable. Further, the back-end server transmits the returned data back to the global function through the interface method to be called, so that the global function converts the data format of the returned data into the target data format, the target data is obtained, and the target data is output. In addition, if the interface to be called runs abnormally, corresponding prompt information is output through the global function, and the prompt information is sent to the remote terminal, so that the remote terminal repairs the interface to be called based on the prompt information. The flexibility of interface processing is improved by the way of transmitting the parameter to the APICatch method.
In summary, as shown in fig. 2B, after the back-end developer writes the API interface document, the API interface document is uploaded to the configuration system, and the configuration system integrates the interface information in the interface document into the interface management platform. Further, the configuration system gathers all interfaces on the platform to a configuration file through the table translation plug-in, and generates an interface method corresponding to each interface to be configured in the configuration file to obtain a target configuration file containing the interface methods. The target configuration file is then uploaded to the static server so that subsequent front-end items request the static server to retrieve the target configuration file. And finally, the front-end server starts a global function to perform error processing automatic configuration on each interface, and obtains data returned by the interface to perform page rendering by calling interface methods in the target configuration file through the global function.
The method provided by the embodiment of the application is suitable for the configuration system, after the front-end server initiates the interface configuration application for the function module to be configured, the configuration system inquires interface information of at least one interface to be configured corresponding to the function module to be configured in the interface management platform, and at least one interface to be configured is input into the configuration file according to the at least one interface information. Further, by using the function plug-in inserted in the configuration file, at least one interface method corresponding to at least one interface to be configured is generated, and a target configuration file containing at least one interface method is obtained. Finally, the configuration system uploads the target configuration file to the static server. The front-end server can directly acquire the target configuration file with the interface method configured in the static server, and the target configuration file integrated with each interface is adopted to interact with the back-end server. The front-end developer is not required to compare interface documents, and interfaces are added one by one. Once the interface is wrong or changed, the interface document uploaded by the back-end developer can be directly obtained, automatic modification and deployment are realized through the interface document, the project development efficiency is improved, and the project development time is saved.
Further, as a specific implementation of the method shown in fig. 1, an embodiment of the present application provides an interface configuration apparatus, as shown in fig. 3A, where the apparatus includes: a query module 301, a generation module 302, and a configuration module 303.
The query module 301 is configured to query, at an interface management platform, at least one interface information corresponding to at least one interface to be configured, and input the at least one interface to be configured to a configuration file according to the at least one interface information;
the generating module 302 is configured to generate at least one interface method corresponding to the at least one interface to be configured based on a preset plug-in the configuration file, so as to obtain a target configuration file including the at least one interface method;
the configuration module 303 is configured to upload the target configuration file to a static server, so that the static server responds to a configuration request initiated by a front-end server and sends the target configuration file to the front-end server to complete interface configuration.
In a specific application scenario, the query module 301 is configured to query, at the interface management platform, interface information corresponding to the functional module to be configured, to obtain at least one interface information corresponding to the at least one interface to be configured; for each interface to be configured in the at least one interface to be configured, inputting interface information of each interface to be configured to a translation plug-in, and translating request information in the interface information into a specified format through the translation plug-in, wherein the request information comprises a request format and a request method; and inputting request information in a specified format corresponding to each interface to be configured into the configuration file.
In a specific application scenario, the generating module 302 is configured to invoke a preset plug-in the configuration file, receive at least one request message input into the configuration file, and generate at least one interface method corresponding to the at least one request message; and determining interfaces to be configured corresponding to each piece of request information in the at least one piece of request information, and respectively associating at least one interface method with the interface names of the corresponding interfaces to be configured in the configuration file to obtain the target configuration file containing the interface methods.
In a specific application scenario, as shown in fig. 3B, the apparatus further includes: and an acquisition module 304.
The obtaining module 304 is configured to obtain an interface document, and integrate interface information in the interface document into an interface management platform.
In a specific application scenario, as shown in fig. 3C, the apparatus further includes: a detection module 305, a transmission module 306, a rendering module 307.
The detection module 305 is configured to query interface information corresponding to an interface to be invoked in the interface management platform when it is detected that the front-end server initiates the interface query instruction to be invoked;
the sending module 306 is configured to send the interface information to the front-end server, so that the front-end server obtains a name of an interface to be called, a parameter format, and a target data format corresponding to the interface to be called, and inputs an actual parameter variable to a global function according to the parameter format, and inputs the name of the interface to be called, the target data format, and prompt information to the global function, where the prompt information is alarm information initiated when an interface reports errors;
the rendering module 307 is configured to output the target data through the global function and render a page using the target data if the interface to be invoked is running normally.
In a specific application scenario, the rendering module 307 is configured to receive an actual parameter variable transmitted by the interface method to be invoked, and determine return data according to the actual parameter variable when it is detected that the front-end server invokes the global function to input the actual parameter variable to the interface method to be invoked associated with the interface name to be invoked in the target configuration file; and transmitting the returned data back to the global function through the interface method to be called, so that the global function converts the data format of the returned data into the target data format, and the target data is obtained and output.
In a specific application scenario, as shown in fig. 3D, the apparatus further includes: an error reporting module 308.
The error reporting module 308 is configured to output corresponding prompt information through the global function if the interface to be invoked is abnormal, and send the prompt information to a remote terminal, so that the remote terminal repairs the interface to be invoked based on the prompt information.
According to the device provided by the embodiment of the application, after the front-end server initiates the interface configuration application for the functional module to be configured, the configuration system queries the interface information of at least one interface to be configured corresponding to the functional module to be configured in the interface management platform, and inputs the at least one interface to be configured into the configuration file according to the at least one interface information. Further, by using the function plug-in inserted in the configuration file, at least one interface method corresponding to at least one interface to be configured is generated, and a target configuration file containing at least one interface method is obtained. Finally, the configuration system uploads the target configuration file to the static server. The front-end server can directly acquire the target configuration file with the interface method configured in the static server, and the target configuration file integrated with each interface is adopted to interact with the back-end server. The front-end developer is not required to compare interface documents, and interfaces are added one by one. Once the interface is wrong or changed, the interface document uploaded by the back-end developer can be directly obtained, automatic modification and deployment are realized through the interface document, the project development efficiency is improved, and the project development time is saved.
It should be noted that, for other corresponding descriptions of each functional unit related to the interface configuration device provided in the embodiment of the present application, reference may be made to corresponding descriptions in fig. 1 and fig. 2A to fig. 2B, which are not repeated herein.
In an exemplary embodiment, referring to fig. 4, there is further provided a device, which includes a communication bus, a processor, a memory, and a communication interface, and may further include an input-output interface and a display device, wherein the respective functional units may perform communication with each other through the bus. The memory stores a computer program, and a processor executes the program stored in the memory to perform the interface configuration method in the above embodiment.
A computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of the interface configuration method.
From the above description of the embodiments, it will be apparent to those skilled in the art that the present application may be implemented in hardware, or may be implemented by means of software plus necessary general hardware platforms. Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.), and includes several instructions for causing a computer device (may be a personal computer, a server, or a network device, etc.) to perform the methods described in various implementation scenarios of the present application.
Those skilled in the art will appreciate that the drawings are merely schematic illustrations of one preferred implementation scenario, and that the modules or flows in the drawings are not necessarily required to practice the present application.
Those skilled in the art will appreciate that modules in an apparatus in an implementation scenario may be distributed in an apparatus in an implementation scenario according to an implementation scenario description, or that corresponding changes may be located in one or more apparatuses different from the implementation scenario. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The foregoing application serial numbers are merely for description, and do not represent advantages or disadvantages of the implementation scenario.
The foregoing disclosure is merely a few specific implementations of the present application, but the present application is not limited thereto and any variations that can be considered by a person skilled in the art shall fall within the protection scope of the present application.

Claims (10)

1. An interface configuration method, comprising:
inquiring at least one interface information corresponding to at least one interface to be configured in an interface management platform, and inputting the at least one interface to be configured into a configuration file according to the at least one interface information;
generating at least one interface method corresponding to the at least one interface to be configured based on a preset plug-in the configuration file, and obtaining a target configuration file containing the at least one interface method;
uploading the target configuration file to a static server, so that the static server responds to a configuration request initiated by a front-end server and sends the target configuration file to the front-end server to complete interface configuration.
2. The method according to claim 1, wherein the querying, at the interface management platform, at least one interface information corresponding to at least one interface to be configured, and inputting the at least one interface to be configured into the configuration file according to the at least one interface information includes:
inquiring interface information corresponding to a functional module to be configured in the interface management platform to obtain at least one interface information corresponding to the at least one interface to be configured;
for each interface to be configured in the at least one interface to be configured, inputting interface information of each interface to be configured to a translation plug-in, and translating request information in the interface information into a specified format through the translation plug-in, wherein the request information comprises a request format and a request method;
and inputting request information in a specified format corresponding to each interface to be configured into the configuration file.
3. The method of claim 1, wherein the generating at least one interface method corresponding to the at least one interface to be configured based on the preset plugin in the configuration file, to obtain the target configuration file including the at least one interface method, includes:
invoking a preset plug-in the configuration file, receiving at least one request message input into the configuration file, and generating at least one interface method corresponding to the at least one request message;
and determining interfaces to be configured corresponding to each piece of request information in the at least one piece of request information, and respectively associating at least one interface method with the interface names of the corresponding interfaces to be configured in the configuration file to obtain the target configuration file containing the interface methods.
4. The method of claim 1, wherein prior to querying the at least one interface to be configured by the interface management platform, the method further comprises: and acquiring an interface document, and integrating the interface information in the interface document to an interface management platform.
5. The method according to claim 1, wherein the method further comprises:
when the front-end server is detected to initiate an interface query instruction to be invoked, querying interface information corresponding to an interface to be invoked on the interface management platform;
the interface information is sent to the front-end server, so that the front-end server obtains a name, a parameter format and a target data format of an interface to be called, which correspond to the interface to be called, through identifying the interface information, and inputs actual parameter variables into a global function according to the parameter format, and inputs the name, the target data format and prompt information of the interface to be called into the global function, wherein the prompt information is alarm information initiated when an interface reports errors;
and if the interface to be called operates normally, outputting the target data through the global function, and rendering a page by adopting the target data.
6. The method of claim 5, wherein outputting the return data via the global function comprises:
when the fact that the front-end server calls the global function to input an actual parameter variable into the interface method to be called associated with the interface name to be called in the target configuration file is detected, receiving the actual parameter variable transmitted by the interface method to be called, and determining returned data according to the actual parameter variable;
and transmitting the returned data back to the global function through the interface method to be called, so that the global function converts the data format of the returned data into the target data format, and the target data is obtained and output.
7. The method of claim 5, wherein after the calling the interface method corresponding to the interface name in the target configuration file, the method further comprises:
if the interface to be called runs abnormally, outputting corresponding prompt information through the global function, and sending the prompt information to a remote terminal, so that the remote terminal repairs the interface to be called based on the prompt information.
8. An interface configuration apparatus, comprising:
the query module is used for querying at least one interface information corresponding to at least one interface to be configured in the interface management platform, and inputting the at least one interface to be configured into the configuration file according to the at least one interface information;
the generating module is used for generating at least one interface method corresponding to the at least one interface to be configured based on a preset plug-in the configuration file to obtain a target configuration file containing the at least one interface method;
and the configuration module is used for uploading the target configuration file to the static server so that the static server responds to a configuration request initiated by the front-end server and sends the target configuration file to the front-end server to complete interface configuration.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202310377325.0A 2023-04-10 2023-04-10 Interface configuration method, device, computer equipment and computer readable storage medium Pending CN116400954A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310377325.0A CN116400954A (en) 2023-04-10 2023-04-10 Interface configuration method, device, computer equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310377325.0A CN116400954A (en) 2023-04-10 2023-04-10 Interface configuration method, device, computer equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN116400954A true CN116400954A (en) 2023-07-07

Family

ID=87009959

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310377325.0A Pending CN116400954A (en) 2023-04-10 2023-04-10 Interface configuration method, device, computer equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN116400954A (en)

Similar Documents

Publication Publication Date Title
CN109376088B (en) Automatic test system and automatic test method
CN108196878A (en) Generation method, device, electronic equipment and the storage medium of application program installation kit
CN111597110B (en) Page test method and device, electronic equipment and storage medium
CN106557308A (en) A kind of software continuous integrated approach and device
CN111459835A (en) Service debugging method and device, electronic equipment and computer readable storage medium
CN110727581A (en) Collapse positioning method and electronic equipment
CN110969417A (en) Government affair item synchronization method, device, system, computer equipment and storage medium
CN111369237B (en) Data processing method and device and computer storage medium
CN104503768A (en) Call method and device for application programming interface (API)
CN106658666A (en) Method and device for building wireless connection
CN110716912B (en) SQL performance detection method and server
CN110134583B (en) Software testing and data processing method and device
CN116400954A (en) Interface configuration method, device, computer equipment and computer readable storage medium
CN115276844B (en) Communication module testing method and device, storage medium and electronic equipment
CN110933070A (en) User identification method, system, equipment and computer readable storage medium
CN111680475B (en) Data conversion method and device, electronic equipment and storage medium
CN110597712B (en) Component attribute verification method, device, terminal and storage medium
CN104407846B (en) Information processing method and device
CN109086145B (en) Data generation method and device and computer storage medium
CN109446462B (en) Page-based data monitoring processing method, device, equipment and storage medium
CN112445811A (en) Data service method, device, storage medium and component based on SQL configuration
CN111158661A (en) System interface docking method, device, medium and electronic equipment
CN114818645B (en) Automatic report generation method, device, equipment and medium based on data body
CN113626007B (en) Application method and device of connector model and server
CN112988427B (en) Data exchange method, device and medium

Legal Events

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