CN117850869A - Interface message generation method and device, storage medium and electronic equipment - Google Patents
Interface message generation method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN117850869A CN117850869A CN202410052320.5A CN202410052320A CN117850869A CN 117850869 A CN117850869 A CN 117850869A CN 202410052320 A CN202410052320 A CN 202410052320A CN 117850869 A CN117850869 A CN 117850869A
- Authority
- CN
- China
- Prior art keywords
- interface
- field
- target
- identifier
- message
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 76
- 238000013507 mapping Methods 0.000 claims abstract description 56
- 230000006870 function Effects 0.000 claims description 24
- 238000004590 computer program Methods 0.000 claims description 13
- 230000008569 process Effects 0.000 abstract description 14
- 238000011161 development Methods 0.000 abstract description 13
- 238000005516 engineering process Methods 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 10
- 238000006243 chemical reaction Methods 0.000 description 8
- 230000008859 change Effects 0.000 description 7
- 238000012360 testing method Methods 0.000 description 6
- 230000000694 effects Effects 0.000 description 5
- 230000005540 biological transmission Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 238000012423 maintenance Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000033764 rhythmic process Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 238000011144 upstream manufacturing Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Communication Control (AREA)
Abstract
The application discloses a method and a device for generating an interface message, a storage medium and electronic equipment, and relates to the fields of software development, financial science and technology and other related technical fields. Wherein the method comprises the following steps: obtaining a mapping relation between the first field and the second field; storing the mapping relation between the first field and the second field to a target field corresponding to the interface document; under the condition that the first interface is consistent with the target interface and the configuration parameters of the interface document are first preset parameters, generating a target message according to the target field, wherein the first interface is an interface actually called by a product layer, the target interface is an interface defined by using the first field, the first preset parameters are used for representing that the target message has an association relationship with the first field and the second field, and the target message is used for representing message information received by an application layer. The method and the device solve the technical problem of low generation efficiency of the interface message caused by inconsistent update periods of codes and interface documents in the development process.
Description
Technical Field
The present invention relates to the field of software development, financial science and technology, and in particular, to a method and apparatus for generating an interface message, a storage medium, and an electronic device.
Background
In the field of software development, in the process of developing a software product, a technician can integrate interface implementation codes of the same function set for different product layers into the same downstream application layer, then connect the product layer and the downstream application layer through a middle platform, and then utilize interface documents in the middle platform to realize interface call between the product layer and the application layer.
However, under the situation that the user needs change or the user needs increase, the technician needs to adaptively modify or add codes of the product layer and the downstream application layer, and under the situation that the development task is urgent and the development period is short, in the prior art, the technician needs to correspondingly modify the interface document of the intermediate platform and realize the way of calling the interface between the product layer and the application layer according to the updated interface document, but this way generates additional development labor cost and development time cost.
In addition, there are cases where the update periods of the code and interface documents in the related art are inconsistent, for example: the middle stage serves as a tandem platform for product layers and downstream accounting applications, which are typically distributed quarterly, while the product layers and downstream accounting applications are distributed monthly according to user needs. Under the condition that the code updating period is inconsistent with the interface document updating period, the interface document of the middle platform cannot be updated in time, so that the problem of low interface calling efficiency and low interface message generating efficiency can be caused by the way of realizing the interface calling between the product layer and the application layer according to the updated interface document.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The application provides a method, a device, a storage medium and electronic equipment for generating an interface message, which are used for at least solving the technical problem of low generation efficiency of the interface message caused by inconsistent update periods of codes and interface documents in the development process.
According to one aspect of the present application, there is provided a method for generating an interface packet, including: obtaining a mapping relation between a first field and a second field, wherein the first field is an newly added field in codes corresponding to a product layer, the second field is an newly added field in codes corresponding to an application layer, and the codes corresponding to the application layer are used for realizing product functions corresponding to interfaces called by the product layer; storing the mapping relation between the first field and the second field to a target field corresponding to the interface document; and under the condition that the first interface is consistent with the target interface and the configuration parameters of the interface document are first preset parameters, generating a target message according to the target field, wherein the first interface is an interface actually called by a product layer, the target interface is an interface defined by using the first field, the first preset parameters are used for representing that the target message has an association relationship with the first field and the second field, and the target message is used for representing message information received by an application layer.
Optionally, the method for generating the interface message further includes: determining a first field according to the new added code corresponding to the product layer; determining a second field according to the newly added code corresponding to the application layer; creating a correspondence between the first field and the second field; and taking the corresponding relation between the first field and the second field as the mapping relation between the first field and the second field.
Optionally, the method for generating the interface message further includes: acquiring a first identifier and a second identifier corresponding to a target interface, wherein the first identifier is an identifier corresponding to a developer of the target interface, and the second identifier is an identifier corresponding to the target interface; acquiring a third identifier and a fourth identifier corresponding to the first interface, wherein the third identifier is the identifier corresponding to the developer of the first interface, and the fourth identifier is the identifier corresponding to the first interface; and determining a matching state corresponding to the first interface and the target interface according to the first identifier, the second identifier, the third identifier and the fourth identifier, wherein the matching state is a success state or a failure state, the success state is used for representing that the first interface is consistent with the target interface, and the failure state is used for representing that the first interface is inconsistent with the target interface.
Optionally, the method for generating the interface message further includes: under the condition that the first identifier is the same as the third identifier and the second identifier is the same as the fourth identifier, determining that the matching state corresponding to the first interface and the target interface is a successful state; and under the condition that the first identifier is different from the third identifier and/or the second identifier is different from the fourth identifier, determining that the matching state corresponding to the first interface and the target interface is a failure state.
Optionally, the method for generating the interface message further includes: judging whether the configuration parameters are first preset parameters or second preset parameters, wherein the second preset parameters are used for representing that no association relation exists between the target message and the first field and the second field; generating prompt information under the condition that the configuration parameters are parameters except the first preset parameters and the second preset parameters, wherein the prompt information is used for representing that the configuration parameters need to be updated; generating a target message according to the target field and interface information corresponding to the first interface under the condition that the configuration parameter is a first preset parameter; under the condition that the configuration parameters are second preset parameters, converting interface information corresponding to the first interface into a first message according to preset rules, and determining the first message as a target message.
Optionally, the method for generating the interface message further includes: and converting interface information corresponding to the first interface into a first message according to a preset rule, and determining the first message as a target message.
Optionally, the method for generating the interface message further includes: converting interface information corresponding to the first interface into a first message according to a preset rule; updating the first field in the first message to the second field according to the mapping relation between the first field and the second field stored in the target field; and taking the updated first message as a target message.
According to another aspect of the present application, there is also provided a device for generating an interface packet, including: the first acquisition unit is used for acquiring a mapping relation between a first field and a second field, wherein the first field is an newly added field in codes corresponding to a product layer, the second field is an newly added field in codes corresponding to an application layer, and the codes corresponding to the application layer are used for realizing product functions corresponding to interfaces called by the product layer; the storage unit is used for storing the mapping relation between the first field and the second field to the target field corresponding to the interface document; the generating unit is used for generating a target message according to the target field under the condition that the first interface is consistent with the target interface and the configuration parameters of the interface document are first preset parameters, wherein the first interface is an interface actually called by the product layer, the target interface is an interface defined by using the first field, the first preset parameters are used for representing that the target message has an association relationship with the first field and the second field, and the target message is used for representing message information received by the application layer.
According to another aspect of the present application, there is further provided a computer readable storage medium, in which a computer program is stored, where the computer readable storage medium is controlled to execute the method for generating the interface packet according to any one of the above steps when the computer program is run.
According to another aspect of the present application, there is further provided an electronic device, where the electronic device includes one or more processors and a memory, and the memory is configured to store one or more programs, where the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method for generating an interface packet according to any one of the foregoing.
In the application, a mapping relation between a first field and a second field is obtained first, wherein the first field is a newly added field in codes corresponding to a product layer, the second field is a newly added field in codes corresponding to an application layer, the codes corresponding to the application layer are used for realizing product functions corresponding to interfaces called by the product layer, then the mapping relation between the first field and the second field is stored in a target field corresponding to an interface document, then a target message is generated according to the target field under the conditions that the first interface is consistent with the target interface and configuration parameters of the interface document are first preset parameters, the first interface is an interface actually called by the product layer, the target interface is an interface defined by using the first field, the first preset parameters are used for representing the association relation between the target message and the first field and the second field, and the target message is used for representing message information received by the application layer.
As can be seen from the above, the mapping relationship between the expansion fields in the product layer and the application layer (i.e. the mapping relationship between the first field and the second field) is stored in the common field (i.e. the target field) corresponding to the interface document, and then the configuration parameters are set for the interface document to be used, so that the purpose of generating the target message through the target field and the configuration parameters is achieved, and the purpose of calling the interface between the product layer and the application layer is achieved through the target message. Compared with the prior art, under the condition of facing to user demand change, the method for synchronously modifying the codes of the product layer, the codes of the application layer and the interface document is needed, the method and the device only need to modify the codes of the product layer and the application layer, and store the corresponding relation of the expansion fields in the product layer and the application layer to the target field, so that the labor cost and the time cost generated by synchronously modifying the interface document are avoided.
Therefore, the method and the device realize the purpose of ensuring that the interface corresponding to the newly added function can be called between the application layer and the product layer under the condition that the code of the product layer and the code of the application layer are inconsistent with the preset edition release period of the interface document by storing the corresponding relation of the expansion field in the product layer and the application layer to the target field, realize the technical effect of improving the generation efficiency of the interface message between the application layer and the product layer, and further solve the technical problem of low generation efficiency of the interface message caused by inconsistent update period of the code and the interface document in the development process.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
FIG. 1 is a flow chart of an alternative method of generating interface messages according to an embodiment of the present application;
FIG. 2 is a flow chart of an alternative method of determining a target message according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an alternative interface message generation apparatus according to an embodiment of the present application;
fig. 4 is a schematic diagram of an alternative electronic device according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be further noted that, the related information (including code information of the product layer, code information of the application layer, and interface document information) and the data (including, but not limited to, data for presentation and data for analysis) related to the present application are information and data authorized by the user or sufficiently authorized by each party. For example, an interface is provided between the system and the relevant user or institution, before acquiring the relevant information, the system needs to send an acquisition request to the user or institution through the interface, and acquire the relevant information after receiving the consent information fed back by the user or institution.
According to the embodiments of the present application, there is provided an embodiment of a method for generating an interface packet, it should be noted that, steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and although a logic sequence is illustrated in the flowchart, in some cases, steps illustrated or described may be performed in a different order than that illustrated herein.
The application provides a method system for generating an interface message (abbreviated as generating system) for executing a method for generating an interface message in the application, fig. 1 is a flowchart of an alternative method for generating an interface message according to an embodiment of the application, as shown in fig. 1, and the method includes the following steps:
step S101, obtaining a mapping relationship between the first field and the second field.
In step S101, the first field is an added field in the code corresponding to the product layer, and the second field is an added field in the code corresponding to the application layer, where the code corresponding to the application layer is used to implement the product function corresponding to the interface called by the product layer.
Optionally, the product layer is upstream of the application layer, and the code of the same application layer can provide interface calling service for different product layers through the middle platform interface document. The middle platform interface file is used for storing the detailed description and specification of the interface, and at least comprises information such as an interface name, a URL (Uniform Resource Locator ), a request parameter, a response parameter, an interface call example, an error code definition, an interface version number, an authentication mode, an interface use limit and the like, wherein the information can be used for subsequent interface maintenance and system upgrading. In addition, interface documents are typically stored in a version control system in text format or in the form of online documents.
Step S102, storing the mapping relation between the first field and the second field into a target field corresponding to the interface document.
Optionally, a system control interface document is generated to expose a chain cabin dedicated field (i.e., a target field), where the chain cabin dedicated field is used to store a mapping relationship between extension fields, and at the same time, the chain cabin dedicated field is also used to store transmission parameter values corresponding to the application layer and product layer extension fields. For example, the extension field is set to "com.abc.xxx.yyy", and the transmission parameter value corresponding to the extension field is set to 1.
Optionally, the dedicated field of the chain cabin is used for identifying a service logic chain and a function expansion point of the middle platform sharing service steady state, delivering the function expansion point to a product layer, and decoupling a development version rhythm between the product layer and an application layer while ensuring service safety and stability, so that function expansion is realized.
Step S103, under the condition that the first interface is consistent with the target interface and the configuration parameters of the interface document are first preset parameters, generating a target message according to the target field.
In step S103, the first interface is an interface actually invoked by the product layer, the target interface is an interface defined by using a first field, the first preset parameter is used for representing that an association relationship exists between the target message and the first field and the second field, and the target message is used for representing message information received by the application layer.
Optionally, the generating system may add a CMC (Chassis Management Controller, computer management and control) configuration switch to the middle platform, and the generating system controls the on/off state of the configuration switch through a configuration parameter, where a parameter value of the configuration parameter may be set to true (corresponding to a first preset parameter) or false (corresponding to a second preset parameter).
As can be seen from the above, the mapping relationship between the expansion fields in the product layer and the application layer (i.e. the mapping relationship between the first field and the second field) is stored in the common field (i.e. the target field) corresponding to the interface document, and then the configuration parameters are set for the interface document to be used, so that the purpose of generating the target message through the target field and the configuration parameters is achieved, and the purpose of calling the interface between the product layer and the application layer is achieved through the target message. Compared with the prior art, under the condition of facing to user demand change, the method for synchronously modifying the codes of the product layer, the codes of the application layer and the interface document is needed, the method and the device only need to modify the codes of the product layer and the application layer, and store the corresponding relation of the expansion fields in the product layer and the application layer to the target field, so that the labor cost and the time cost generated by synchronously modifying the interface document are avoided.
Therefore, the method and the device realize the purpose of ensuring that the interface corresponding to the newly added function can be called between the application layer and the product layer under the condition that the code of the product layer and the code of the application layer are inconsistent with the preset edition release period of the interface document by storing the corresponding relation of the expansion field in the product layer and the application layer to the target field, realize the technical effect of improving the generation efficiency of the interface message between the application layer and the product layer, and further solve the technical problem of low generation efficiency of the interface message caused by inconsistent update period of the code and the interface document in the development process.
In an alternative embodiment, the generating system firstly determines the first field according to the new code corresponding to the product layer, secondly determines the second field according to the new code corresponding to the application layer, then the generating system creates a corresponding relation between the first field and the second field, and then the generating system takes the corresponding relation between the first field and the second field as a mapping relation between the first field and the second field.
Optionally, after obtaining the mapping relationship between the first field and the second field, the generating system may generate a first field mapping instruction or a second field mapping instruction according to the mapping relationship between the first field and the second field, where the first field mapping instruction is used to convert the first field into the second field, and the second field mapping instruction is used to convert the second field into the first field, and then the generating system implements conversion between the first field and the second field through the mapping instruction.
Optionally, a table or entity class of the memory of the intermediate station is generated, and a mapping relationship between the first field and the second field is stored in the memory of the intermediate station.
In an alternative embodiment, the generating system firstly obtains a first identifier and a second identifier corresponding to the target interface, wherein the first identifier is an identifier corresponding to a developer of the target interface, the second identifier is an identifier corresponding to the target interface, secondly, the generating system obtains a third identifier and a fourth identifier corresponding to the first interface, wherein the third identifier is an identifier corresponding to the developer of the first interface, the fourth identifier is an identifier corresponding to the first interface, and then the generating system determines a matching state corresponding to the first interface and the target interface according to the first identifier, the second identifier, the third identifier and the fourth identifier, wherein the matching state is a success state or a failure state, the success state is used for representing that the first interface is consistent with the target interface, and the failure state is used for representing that the first interface is inconsistent with the target interface.
Optionally, the generating system determines a switch format of the configuration switch according to the first identifier and the second identifier, for example, the first identifier is "tenant 1", the second identifier is "interface10", and then the current configuration development corresponds to the switch format of "tenant 1_interface10", and then, after actually calling an interface between the product layer and the application layer, the generating system determines whether field conversion is required to be performed on a message corresponding to the interface according to a matching result between a third identifier and a fourth identifier corresponding to the interface being called and the switch format corresponding to the configuration switch.
In an alternative embodiment, the generating system determines that the matching states corresponding to the first interface and the target interface are successful states when the first identifier is the same as the third identifier and the second identifier is the same as the fourth identifier; and under the condition that the first identifier is different from the third identifier and/or the second identifier is different from the fourth identifier, the generating system determines that the matching state corresponding to the first interface and the target interface is a failure state.
Optionally, the generating system splices the first identifier and the second identifier to obtain a first test identifier, then the generating system splices the third identifier and the fourth identifier to obtain a second test identifier, then the generating system calculates the similarity between the first test identifier and the second test identifier, and the generating system determines the matching state corresponding to the first interface and the target interface through the similarity between the first test identifier and the second test identifier.
In an alternative embodiment, after the generating system determines that the matching states corresponding to the first interface and the target interface are successful states, fig. 2 is a flowchart of an alternative method for determining the target packet according to an embodiment of the present application, as shown in fig. 2:
Step S201, determining whether the configuration parameter is a first preset parameter or a second preset parameter, where the second preset parameter is used to characterize that there is no association between the target message and the first field and the second field.
Step S202, generating prompt information under the condition that the configuration parameters are parameters other than the first preset parameters and the second preset parameters, wherein the prompt information is used for representing that the configuration parameters need to be updated.
Step S203, under the condition that the configuration parameter is the first preset parameter, generating a target message according to the target field and the interface information corresponding to the first interface.
Step S204, under the condition that the configuration parameters are second preset parameters, converting the interface information corresponding to the first interface into a first message according to preset rules, and determining the first message as a target message.
Optionally, under the condition that the configuration parameters are parameters other than the first preset parameters and the second preset parameters, the generating system sends the prompt information to the corresponding technicians or operation and maintenance personnel in a short message or language broadcasting mode.
Optionally, under the condition that the matching state corresponding to the first interface and the target interface is a successful state and the configuration parameter is a first preset parameter, the generating system firstly converts interface information corresponding to the first interface into a first message, and then, performs second conversion on the first message according to the target field to obtain the target message; under the condition that the matching state corresponding to the first interface and the target interface is a successful state and the configuration parameter is a second preset parameter, the generating system only needs to perform one-time conversion on the interface information corresponding to the first interface.
In an optional embodiment, after determining that the matching state corresponding to the first interface and the target interface is a failure state, the generating system converts interface information corresponding to the first interface into a first message according to a preset rule, and determines the first message as the target message.
Optionally, when the generating system determines that the matching state corresponding to the first interface and the target interface is a failure state, that is, the relevant interface information of the first interface that is currently called does not have a field (that is, a first field and a second field) that needs to be converted, the generating system directly determines the first message as the target message.
In an alternative embodiment, the generating system firstly converts interface information corresponding to the first interface into a first message according to a preset rule, then updates the first field in the first message into a second field according to a mapping relationship between the first field and the second field stored in the target field, and finally takes the updated first message as the target message.
Optionally, the generating system converts the first field and the second field through the target field, and compared with the mode of realizing conversion between the first field and the second field according to the updated interface document in the prior art, the technical scheme of the application can avoid synchronous modification of the interface document by a technician after the code of the product layer and the code of the application layer are modified by the technician under the condition that the user demand is changed or the user demand is increased, and only the mapping relationship between the first field and the second field exists to the target field corresponding to the interface document.
In the application, a mapping relation between a first field and a second field is obtained first, wherein the first field is a newly added field in codes corresponding to a product layer, the second field is a newly added field in codes corresponding to an application layer, the codes corresponding to the application layer are used for realizing product functions corresponding to interfaces called by the product layer, then the mapping relation between the first field and the second field is stored in a target field corresponding to an interface document, then a target message is generated according to the target field under the conditions that the first interface is consistent with the target interface and configuration parameters of the interface document are first preset parameters, the first interface is an interface actually called by the product layer, the target interface is an interface defined by using the first field, the first preset parameters are used for representing the association relation between the target message and the first field and the second field, and the target message is used for representing message information received by the application layer.
As can be seen from the above, the mapping relationship between the expansion fields in the product layer and the application layer (i.e. the mapping relationship between the first field and the second field) is stored in the common field (i.e. the target field) corresponding to the interface document, and then the configuration parameters are set for the interface document to be used, so that the purpose of generating the target message through the target field and the configuration parameters is achieved, and the purpose of calling the interface between the product layer and the application layer is achieved through the target message. Compared with the prior art, under the condition of facing to user demand change, the method for synchronously modifying the codes of the product layer, the codes of the application layer and the interface document is needed, the method and the device only need to modify the codes of the product layer and the application layer, and store the corresponding relation of the expansion fields in the product layer and the application layer to the target field, so that the labor cost and the time cost generated by synchronously modifying the interface document are avoided.
Therefore, the method and the device realize the purpose of ensuring that the interface corresponding to the newly added function can be called between the application layer and the product layer under the condition that the code of the product layer and the code of the application layer are inconsistent with the preset edition release period of the interface document by storing the corresponding relation of the expansion field in the product layer and the application layer to the target field, realize the technical effect of improving the generation efficiency of the interface message between the application layer and the product layer, and further solve the technical problem of low generation efficiency of the interface message caused by inconsistent update period of the code and the interface document in the development process.
According to an embodiment of the present application, there is further provided an embodiment of an interface message generating device, and fig. 3 is a schematic diagram of an alternative interface message generating device according to an embodiment of the present application, where, as shown in fig. 3, the interface message generating device includes: a first acquisition unit 301, a storage unit 302, and a generation unit 303.
Optionally, a first obtaining unit is configured to obtain a mapping relationship between a first field and a second field, where the first field is an added field in a code corresponding to a product layer, and the second field is an added field in a code corresponding to an application layer, and the code corresponding to the application layer is used to implement a product function corresponding to an interface called by the product layer; the storage unit is used for storing the mapping relation between the first field and the second field to the target field corresponding to the interface document; the generating unit is used for generating a target message according to the target field under the condition that the first interface is consistent with the target interface and the configuration parameters of the interface document are first preset parameters, wherein the first interface is an interface actually called by the product layer, the target interface is an interface defined by using the first field, the first preset parameters are used for representing that the target message has an association relationship with the first field and the second field, and the target message is used for representing message information received by the application layer.
In an alternative embodiment, the first acquisition unit comprises: a first determination subunit, a second determination subunit, a creation subunit, and a third determination subunit.
Optionally, the first determining subunit is configured to determine the first field according to a new code corresponding to the product layer; the first determining subunit is used for determining a second field according to the newly added code corresponding to the application layer; a creating subunit, configured to create a correspondence between the first field and the second field; and the third determination subunit is used for taking the corresponding relation between the first field and the second field as the mapping relation between the first field and the second field.
In an optional embodiment, the generating device of the interface message further includes: the second acquisition unit, the third acquisition unit and the first determination unit.
Optionally, the second obtaining unit is configured to obtain a first identifier and a second identifier corresponding to the target interface, where the first identifier is an identifier corresponding to a developer of the target interface, and the second identifier is an identifier corresponding to the target interface; the third acquisition unit is used for acquiring a third identifier and a fourth identifier corresponding to the first interface, wherein the third identifier is an identifier corresponding to a developer of the first interface, and the fourth identifier is an identifier corresponding to the first interface; the first determining unit is configured to determine a matching state corresponding to the first interface and the target interface according to the first identifier, the second identifier, the third identifier and the fourth identifier, where the matching state is a success state or a failure state, where the success state is used to represent that the first interface is consistent with the target interface, and the failure state is used to represent that the first interface is inconsistent with the target interface.
In an alternative embodiment, the first determining unit comprises: a fourth determination subunit and a fifth determination subunit.
Optionally, the fourth determining subunit is configured to determine that the matching states corresponding to the first interface and the target interface are successful states when the first identifier is the same as the third identifier and the second identifier is the same as the fourth identifier; and the fifth determining subunit is used for determining that the matching state corresponding to the first interface and the target interface is a failure state when the first identifier is different from the third identifier and/or the second identifier is different from the fourth identifier.
In an optional embodiment, the generating device of the interface message further includes: the device comprises a judging unit, a first generating unit, a second generating unit and a second determining unit.
Optionally, the judging unit is configured to judge whether the configuration parameter is a first preset parameter or a second preset parameter, where the second preset parameter is used to characterize that no association relationship exists between the target packet and the first field and the second field; the first generation unit is used for generating prompt information under the condition that the configuration parameters are parameters except the first preset parameters and the second preset parameters, wherein the prompt information is used for representing that the configuration parameters need to be updated; the second generating unit is used for generating a target message according to the target field and the interface information corresponding to the first interface under the condition that the configuration parameter is a first preset parameter; the second determining unit is configured to convert interface information corresponding to the first interface into a first message according to a preset rule and determine the first message as a target message when the configuration parameter is a second preset parameter.
In an optional embodiment, the generating device of the interface message further includes: a first conversion unit.
Optionally, the converting unit is configured to convert interface information corresponding to the first interface into a first packet according to a preset rule, and determine the first packet as the target packet.
In an alternative embodiment, the second generating unit comprises: a second conversion unit, an updating unit and a third determination unit.
Optionally, the second conversion unit is configured to convert interface information corresponding to the first interface into a first message according to a preset rule; the updating unit is used for updating the first field in the first message into the second field according to the mapping relation between the first field and the second field stored in the target field; and the third determining unit is used for taking the updated first message as a target message.
In the application, a mapping relation between a first field and a second field is obtained first, wherein the first field is a newly added field in codes corresponding to a product layer, the second field is a newly added field in codes corresponding to an application layer, the codes corresponding to the application layer are used for realizing product functions corresponding to interfaces called by the product layer, then the mapping relation between the first field and the second field is stored in a target field corresponding to an interface document, then a target message is generated according to the target field under the conditions that the first interface is consistent with the target interface and configuration parameters of the interface document are first preset parameters, the first interface is an interface actually called by the product layer, the target interface is an interface defined by using the first field, the first preset parameters are used for representing the association relation between the target message and the first field and the second field, and the target message is used for representing message information received by the application layer.
As can be seen from the above, the mapping relationship between the expansion fields in the product layer and the application layer (i.e. the mapping relationship between the first field and the second field) is stored in the common field (i.e. the target field) corresponding to the interface document, and then the configuration parameters are set for the interface document to be used, so that the purpose of generating the target message through the target field and the configuration parameters is achieved, and the purpose of calling the interface between the product layer and the application layer is achieved through the target message. Compared with the prior art, under the condition of facing to user demand change, the method for synchronously modifying the codes of the product layer, the codes of the application layer and the interface document is needed, the method and the device only need to modify the codes of the product layer and the application layer, and store the corresponding relation of the expansion fields in the product layer and the application layer to the target field, so that the labor cost and the time cost generated by synchronously modifying the interface document are avoided.
Therefore, the method and the device realize the purpose of ensuring that the interface corresponding to the newly added function can be called between the application layer and the product layer under the condition that the code of the product layer and the code of the application layer are inconsistent with the preset edition release period of the interface document by storing the corresponding relation of the expansion field in the product layer and the application layer to the target field, realize the technical effect of improving the generation efficiency of the interface message between the application layer and the product layer, and further solve the technical problem of low generation efficiency of the interface message caused by inconsistent update period of the code and the interface document in the development process.
According to another aspect of the embodiments of the present application, there is further provided a computer readable storage medium, where the computer readable storage medium includes a stored computer program, where when the computer program is executed, the device on which the computer readable storage medium is located is controlled to execute the method for generating the interface packet according to any one of the above.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of generating an interface message of any of the above via execution of the executable instructions.
Fig. 4 is a schematic diagram of an alternative electronic device according to an embodiment of the present application, and as shown in fig. 4, the embodiment of the present application provides an electronic device, where the electronic device includes a processor, a memory, and a program stored on the memory and capable of running on the processor, and the processor implements a method for generating an interface packet according to any one of the foregoing when executing the program.
Alternatively, the following steps may be implemented when the processor executes the program: obtaining a mapping relation between a first field and a second field, wherein the first field is an newly added field in codes corresponding to a product layer, the second field is an newly added field in codes corresponding to an application layer, and the codes corresponding to the application layer are used for realizing product functions corresponding to interfaces called by the product layer; storing the mapping relation between the first field and the second field to a target field corresponding to the interface document; and under the condition that the first interface is consistent with the target interface and the configuration parameters of the interface document are first preset parameters, generating a target message according to the target field, wherein the first interface is an interface actually called by a product layer, the target interface is an interface defined by using the first field, the first preset parameters are used for representing that the target message has an association relationship with the first field and the second field, and the target message is used for representing message information received by an application layer.
Alternatively, the following steps may be implemented when the processor executes the program: determining a first field according to the new added code corresponding to the product layer; determining a second field according to the newly added code corresponding to the application layer; creating a correspondence between the first field and the second field; and taking the corresponding relation between the first field and the second field as the mapping relation between the first field and the second field.
Alternatively, the following steps may be implemented when the processor executes the program: acquiring a first identifier and a second identifier corresponding to a target interface, wherein the first identifier is an identifier corresponding to a developer of the target interface, and the second identifier is an identifier corresponding to the target interface; acquiring a third identifier and a fourth identifier corresponding to the first interface, wherein the third identifier is the identifier corresponding to the developer of the first interface, and the fourth identifier is the identifier corresponding to the first interface; and determining a matching state corresponding to the first interface and the target interface according to the first identifier, the second identifier, the third identifier and the fourth identifier, wherein the matching state is a success state or a failure state, the success state is used for representing that the first interface is consistent with the target interface, and the failure state is used for representing that the first interface is inconsistent with the target interface.
Alternatively, the following steps may be implemented when the processor executes the program: under the condition that the first identifier is the same as the third identifier and the second identifier is the same as the fourth identifier, determining that the matching state corresponding to the first interface and the target interface is a successful state; and under the condition that the first identifier is different from the third identifier and/or the second identifier is different from the fourth identifier, determining that the matching state corresponding to the first interface and the target interface is a failure state.
Alternatively, the following steps may be implemented when the processor executes the program: judging whether the configuration parameters are first preset parameters or second preset parameters, wherein the second preset parameters are used for representing that no association relation exists between the target message and the first field and the second field; generating prompt information under the condition that the configuration parameters are parameters except the first preset parameters and the second preset parameters, wherein the prompt information is used for representing that the configuration parameters need to be updated; generating a target message according to the target field and interface information corresponding to the first interface under the condition that the configuration parameter is a first preset parameter; under the condition that the configuration parameters are second preset parameters, converting interface information corresponding to the first interface into a first message according to preset rules, and determining the first message as a target message.
Alternatively, the following steps may be implemented when the processor executes the program: and converting interface information corresponding to the first interface into a first message according to a preset rule, and determining the first message as a target message.
Alternatively, the following steps may be implemented when the processor executes the program: converting interface information corresponding to the first interface into a first message according to a preset rule; updating the first field in the first message to the second field according to the mapping relation between the first field and the second field stored in the target field; and taking the updated first message as a target message.
In the application, a mapping relation between a first field and a second field is obtained first, wherein the first field is a newly added field in codes corresponding to a product layer, the second field is a newly added field in codes corresponding to an application layer, the codes corresponding to the application layer are used for realizing product functions corresponding to interfaces called by the product layer, then the mapping relation between the first field and the second field is stored in a target field corresponding to an interface document, then a target message is generated according to the target field under the conditions that the first interface is consistent with the target interface and configuration parameters of the interface document are first preset parameters, the first interface is an interface actually called by the product layer, the target interface is an interface defined by using the first field, the first preset parameters are used for representing the association relation between the target message and the first field and the second field, and the target message is used for representing message information received by the application layer.
As can be seen from the above, the mapping relationship between the expansion fields in the product layer and the application layer (i.e. the mapping relationship between the first field and the second field) is stored in the common field (i.e. the target field) corresponding to the interface document, and then the configuration parameters are set for the interface document to be used, so that the purpose of generating the target message through the target field and the configuration parameters is achieved, and the purpose of calling the interface between the product layer and the application layer is achieved through the target message. Compared with the prior art, under the condition of facing to user demand change, the method for synchronously modifying the codes of the product layer, the codes of the application layer and the interface document is needed, the method and the device only need to modify the codes of the product layer and the application layer, and store the corresponding relation of the expansion fields in the product layer and the application layer to the target field, so that the labor cost and the time cost generated by synchronously modifying the interface document are avoided.
Therefore, the method and the device realize the purpose of ensuring that the interface corresponding to the newly added function can be called between the application layer and the product layer under the condition that the code of the product layer and the code of the application layer are inconsistent with the preset edition release period of the interface document by storing the corresponding relation of the expansion field in the product layer and the application layer to the target field, realize the technical effect of improving the generation efficiency of the interface message between the application layer and the product layer, and further solve the technical problem of low generation efficiency of the interface message caused by inconsistent update period of the code and the interface document in the development process.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory. The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.
Claims (10)
1. The method for generating the interface message is characterized by comprising the following steps:
obtaining a mapping relation between a first field and a second field, wherein the first field is a newly added field in codes corresponding to a product layer, the second field is a newly added field in codes corresponding to an application layer, and the codes corresponding to the application layer are used for realizing product functions corresponding to interfaces called by the product layer;
storing the mapping relation between the first field and the second field to a target field corresponding to an interface document;
generating a target message according to the target field under the conditions that a first interface is consistent with a target interface and the configuration parameters of the interface document are first preset parameters, wherein the first interface is an interface actually called by the product layer, the target interface is an interface defined by using the first field, the first preset parameters are used for representing that the target message has an association relationship with the first field and the second field, and the target message is used for representing message information received by the application layer.
2. The method for generating an interface message according to claim 1, wherein obtaining the mapping relationship between the first field and the second field comprises:
Determining a first field according to the new code corresponding to the product layer;
determining a second field according to the newly added code corresponding to the application layer;
creating a correspondence between the first field and the second field;
and taking the corresponding relation between the first field and the second field as the mapping relation between the first field and the second field.
3. The method for generating an interface message according to claim 1, wherein after storing the mapping relationship between the first field and the second field in a target field corresponding to an interface document, the method for generating an interface message further comprises:
acquiring a first identifier and a second identifier corresponding to the target interface, wherein the first identifier is an identifier corresponding to a developer of the target interface, and the second identifier is an identifier corresponding to the target interface;
acquiring a third identifier and a fourth identifier corresponding to the first interface, wherein the third identifier is an identifier corresponding to a developer of the first interface, and the fourth identifier is an identifier corresponding to the first interface;
and determining a matching state corresponding to the first interface and the target interface according to the first identifier, the second identifier, the third identifier and the fourth identifier, wherein the matching state is a success state or a failure state, the success state is used for representing that the first interface is consistent with the target interface, and the failure state is used for representing that the first interface is inconsistent with the target interface.
4. The method for generating an interface packet according to claim 3, wherein determining the matching states corresponding to the first interface and the target interface according to the first identifier, the second identifier, the third identifier, and the fourth identifier includes:
determining that the matching state corresponding to the first interface and the target interface is the successful state when the first identifier is the same as the third identifier and the second identifier is the same as the fourth identifier;
and determining that the matching state corresponding to the first interface and the target interface is the failure state under the condition that the first identifier is different from the third identifier and/or the second identifier is different from the fourth identifier.
5. The method for generating an interface packet according to claim 4, wherein after determining that the matching state corresponding to the first interface and the target interface is the successful state, the method for generating an interface packet further comprises:
judging whether the configuration parameter is the first preset parameter or the second preset parameter, wherein the second preset parameter is used for representing that no association relation exists between the target message and the first field and the second field;
Generating prompt information under the condition that the configuration parameters are parameters except the first preset parameters and the second preset parameters, wherein the prompt information is used for representing that the configuration parameters need to be updated;
generating the target message according to the target field and interface information corresponding to the first interface under the condition that the configuration parameter is the first preset parameter;
and under the condition that the configuration parameters are the second preset parameters, converting interface information corresponding to the first interface into a first message according to preset rules, and determining the first message as the target message.
6. The method for generating an interface packet according to claim 5, wherein after determining that the matching state corresponding to the first interface and the target interface is the failure state, the method for generating an interface packet further comprises:
and converting interface information corresponding to the first interface into the first message according to the preset rule, and determining the first message as the target message.
7. The method for generating an interface message according to claim 5, wherein generating the target message according to the target field and the interface information corresponding to the first interface comprises:
Converting interface information corresponding to the first interface into the first message according to the preset rule;
updating a first field in the first message to a second field according to a mapping relation between the first field and the second field stored in the target field;
and taking the updated first message as the target message.
8. An interface message generating device, which is characterized by comprising:
the first acquisition unit is used for acquiring a mapping relation between a first field and a second field, wherein the first field is a newly added field in codes corresponding to a product layer, the second field is a newly added field in codes corresponding to an application layer, and the codes corresponding to the application layer are used for realizing product functions corresponding to interfaces called by the product layer;
the storage unit is used for storing the mapping relation between the first field and the second field to a target field corresponding to the interface document;
the generating unit is configured to generate a target message according to the target field when the first interface is consistent with the target interface and the configuration parameter of the interface document is a first preset parameter, where the first interface is an interface actually called by the product layer, the target interface is an interface defined by using the first field, the first preset parameter is used to represent that an association relationship exists between the target message and the first field and between the target message and the second field, and the target message is used to represent message information received by the application layer.
9. A computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and when the computer program runs, the computer readable storage medium is controlled to execute the method for generating the interface message according to any one of claims 1 to 7.
10. An electronic device comprising one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of generating interface messages of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410052320.5A CN117850869A (en) | 2024-01-12 | 2024-01-12 | Interface message generation method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410052320.5A CN117850869A (en) | 2024-01-12 | 2024-01-12 | Interface message generation method and device, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117850869A true CN117850869A (en) | 2024-04-09 |
Family
ID=90534290
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410052320.5A Pending CN117850869A (en) | 2024-01-12 | 2024-01-12 | Interface message generation method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117850869A (en) |
-
2024
- 2024-01-12 CN CN202410052320.5A patent/CN117850869A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111399840B (en) | Module development method and device | |
CN112947934A (en) | Method, device and medium for dynamically transforming business logic | |
CN113867719A (en) | Third-party library function disassembling and calling method and system for software platform | |
CN110764930B (en) | Request or response processing method and device based on message mode | |
CN115525534A (en) | Test case generation method and platform based on swagger interface test | |
CN111240987B (en) | Method and device for detecting migration program, electronic equipment and computer readable storage medium | |
CN117850869A (en) | Interface message generation method and device, storage medium and electronic equipment | |
CN115776515A (en) | Software service providing method, device and equipment | |
CN114968800A (en) | Micro-service test method and device | |
CN114791884A (en) | Test environment construction method and device, storage medium and electronic equipment | |
CN110971664B (en) | Interface service management system | |
CN111625866A (en) | Authority management method, system, equipment and storage medium | |
CN118567776B (en) | Interface docking method and device, equipment, storage medium, software and program product | |
CN112000366B (en) | System parameter configuration method and device based on code generator | |
CN116560722B (en) | Operation and maintenance flow processing method and device, electronic equipment and storage medium | |
CN115134397B (en) | Method, device and equipment for realizing self-adaptive transaction baffle plate platform | |
CN114398073B (en) | Application updating method and device based on RN | |
CN117992028A (en) | Code generation method, device and medium based on configuration file | |
CN117667066A (en) | Application program code generation method and device and electronic equipment | |
CN117311676A (en) | Service generation method, server and storage medium | |
CN115328537A (en) | Version management method of configuration management system and configuration version management system | |
CN116827789A (en) | Automatic generation method, equipment and storage medium of Nginx configuration file | |
CN113687973A (en) | Method, device and medium for controlling dynamic output of logs | |
CN117424949A (en) | API service calling method, device, equipment and storage medium | |
CN118093072A (en) | Method, device, electronic equipment and storage medium for processing component |
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 |