CN112416784A - Interface checking method, system and device based on configuration center and storage medium - Google Patents

Interface checking method, system and device based on configuration center and storage medium Download PDF

Info

Publication number
CN112416784A
CN112416784A CN202011355685.3A CN202011355685A CN112416784A CN 112416784 A CN112416784 A CN 112416784A CN 202011355685 A CN202011355685 A CN 202011355685A CN 112416784 A CN112416784 A CN 112416784A
Authority
CN
China
Prior art keywords
interface
verification
parameter
rule
request
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
CN202011355685.3A
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 Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011355685.3A priority Critical patent/CN112416784A/en
Publication of CN112416784A publication Critical patent/CN112416784A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming

Abstract

The invention relates to interface verification, and provides a method, a system and a device for interface verification based on a configuration center, wherein the method comprises the following steps: parameter configuration is carried out on parameter verification data of each interface in a local system so as to generate a corresponding verification rule; the parameter verification data and the corresponding verification rules are transferred to a preset configuration center so as to decouple the parameter verification data from the service data in the local system; inquiring a preset configuration center through request parameters of a real-time interface request to obtain a check rule of interface check data corresponding to the real-time interface request, and recording the check rule as a rule to be checked; and performing parameter verification on the request parameters requested by the real-time interface through the rule to be verified. The technical scheme provided by the invention can solve the problems that the existing parameter check code redundancy influences the development and maintenance service of a developer.

Description

Interface checking method, system and device based on configuration center and storage medium
Technical Field
The present invention relates to the field of interface verification technologies, and in particular, to a method, a system, an apparatus, and a storage medium for interface verification based on a configuration center.
Background
With the rise of mobile internet, information transmission between systems is more and more frequent, when data transmission is performed between systems, the correctness of input parameters of each interface in the system is very important, if some parameters do not accord with agreed rules, the processing of a program flow is abnormal, even the whole system is crashed, and therefore relevant parameter verification is performed at the entrance of each interface.
In the conventional application system, corresponding parameter checks are performed at the entry of each interface, including the required filling of parameter fields, the length of fields, the format of fields, and some checks with service logic. Furthermore, some systems also interface with different third parties, possibly with special parameter checks for the difference of the third access parties.
Therefore, it is necessary for the developer to write the code for parameter validity judgment at the interface entry, and there is additional judgment logic for different access parties although it is the same interface. However, after a long time of development and maintenance of the system, it is found that each interface of the system is full of parameter verification, and this phenomenon causes the following problems:
1. code redundancy, repeated writing of similar check codes;
2. the non-main service logic codes are more in correction, and the code reading interference is large;
3. time cost is high, and a developer writes codes for each butt joint party of each interface to check;
4. when the check rule needs to be modified, the code needs to be modified and a new version is released.
Based on the above technical problems, a code verification method is urgently needed to reduce the influence of parameter verification codes on the development services of developers.
Disclosure of Invention
The invention provides an interface checking method, an interface checking system, an electronic device and a computer storage medium based on a configuration center, and mainly aims to solve the problem that the existing parameter checking code redundancy influences the development and maintenance service of a developer.
In order to achieve the above object, the present invention provides an interface verification method based on a configuration center, which comprises the following steps:
parameter configuration is carried out on parameter verification data of each interface in a local system so as to generate a corresponding verification rule;
the parameter verification data and the corresponding verification rules are transferred to a preset configuration center so as to decouple the parameter verification data from the service data in the local system;
inquiring the preset configuration center through request parameters of a real-time interface request to obtain a check rule of interface check data corresponding to the real-time interface request, and recording the check rule as a rule to be checked;
and performing parameter verification on the request parameters requested by the real-time interface through the rule to be verified.
Optionally, the parameter verification data includes interface information, dockee information, and field information, and the verification rule includes a code verification rule, a dockee code verification rule, and a field format verification rule; the configuring parameters of the parameter verification data of each interface in the local system to generate a corresponding verification rule includes:
configuring corresponding interface codes, butt party codes and field formats for the interface information, the butt party information and the field information respectively;
and generating corresponding interface code check rules, corresponding interface code check rules and corresponding field format check rules through the interface codes, the butt party codes and the field formats.
Optionally, storing the parameter verification data and the corresponding verification rules thereof in the preset configuration center in the form of an XML format file; element nodes are preset in the XML format file, and corresponding attribute nodes are preset in each element node; and the number of the first and second electrodes,
the element node is used for storing the parameter checking data, and the attribute node is used for storing the checking rule corresponding to the parameter checking data.
Optionally, the process of storing the parameter verification data and the corresponding verification rule thereof in the preset configuration center in the form of an XML format file includes:
analyzing element nodes and attribute nodes of the XML format file in the preset configuration center;
configuring corresponding element nodes for each check rule respectively, and taking the code combination of the interface code and the butt party code corresponding to each check rule as the key value of the element node;
and storing each parameter check data into the corresponding element node, and storing the check rule corresponding to the parameter check data into the corresponding attribute node.
Optionally, each interface in the local system is configured with a corresponding implementation class; the parameter verification data further includes implementation class information corresponding to the implementation class, and the parameter configuration of the parameter verification data of each interface in the local system to generate a corresponding verification rule further includes;
configuring a corresponding implementation class format for the implementation class information;
and generating a corresponding self-defined check rule through the implementation type format.
Optionally, the preset configuration center is queried through a request parameter of a real-time interface request to obtain a verification rule of interface verification data corresponding to the real-time interface request, and the process of marking as a rule to be verified includes:
analyzing the request parameters of the real-time interface request to acquire request interface codes, request butt joint party codes and request field data in the request parameters;
inquiring a key value list of an XML format file in the preset configuration center through the code combination of the request interface code and the request butt party code to acquire a key value corresponding to the code combination of the request interface code and the request butt party code;
determining corresponding element nodes through the key values;
and acquiring a check rule in the attribute node of the element node corresponding to the key value, and recording the check rule as the rule to be checked.
Optionally, the process of performing parameter verification on the request parameter requested by the real-time interface through the rule to be verified includes:
sequentially executing the rules to be verified, and performing parameter verification on the request parameters requested by the real-time interface; and the number of the first and second electrodes,
if the request parameter passes the verification of all rules to be verified, judging that the request parameter is legal; and if the request parameters do not pass the verification of all rules to be verified, judging that the request parameters are illegal.
In another aspect, the present invention further provides an interface verification system based on a configuration center, where the system includes:
the parameter configuration unit is used for carrying out parameter configuration on the parameter verification data of each interface in the local system so as to generate a corresponding verification rule;
the data storage unit is used for transferring the parameter verification data and the corresponding verification rules thereof into a preset configuration center so as to decouple the parameter verification data from the service data in the local system;
the query unit is used for querying the preset configuration center through request parameters of a real-time interface request so as to obtain a check rule of interface check data corresponding to the real-time interface request, and the check rule is marked as a rule to be checked;
and the checking unit is used for carrying out parameter checking on the request parameters of the real-time interface request through the rule to be checked.
In addition, the present invention also provides an electronic apparatus, including: the system comprises a memory, a processor and a configuration center-based interface verification program stored in the memory and capable of running on the processor, wherein when the configuration center-based interface verification program is executed by the processor, the system realizes the following steps:
parameter configuration is carried out on parameter verification data of each interface in a local system so as to generate a corresponding verification rule;
the parameter verification data and the corresponding verification rules are transferred to a preset configuration center so as to decouple the parameter verification data from the service data in the local system;
inquiring the preset configuration center through request parameters of a real-time interface request to obtain a check rule of interface check data corresponding to the real-time interface request, and recording the check rule as a rule to be checked;
and performing parameter verification on the request parameters requested by the real-time interface through the rule to be verified.
In addition, the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores an interface verification program based on a configuration center, and when the interface verification program based on the configuration center is executed by a processor, the steps of the configuration center-based interface verification method are implemented.
According to the interface verification method based on the configuration center, the electronic device and the computer readable storage medium, the decoupling between the parameter verification in the interface and the conventional service logic can be facilitated by providing the interface parameter configuration verification, and the code of the parameter verification is not mixed with the code of the conventional service; developers do not write excessive verification codes any more, but focus on writing business logic more, and unnecessary labor cost consumption is reduced; each user-defined check implementation class only focuses on realizing a certain check rule, and parameterizes an individual case, so that the check class can support more service scenes, the codes of the whole class are clearer and simpler, and repeated writing of similar check classes is reduced; the relevant configuration of the interface parameter verification is placed in a preset configuration center, compared with the traditional code verification, the method has the advantage that the configuration is updated immediately and immediately, and the verification rule is changed without restarting an application system.
Drawings
FIG. 1 is a flow chart of an embodiment of a configuration center based interface verification method according to the present invention;
FIG. 2 is a schematic structural diagram of an electronic device according to an embodiment of the invention;
fig. 3 is a schematic diagram of internal logic of an interface verification procedure based on a configuration center according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
In the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of one or more embodiments. It may be evident, however, that such embodiment(s) may be practiced without these specific details.
Specific embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Example 1
For explaining the interface verification method based on the configuration center provided by the present invention, fig. 1 shows a flow of the interface verification method based on the configuration center provided by the present invention.
As shown in fig. 1, the interface verification method based on a configuration center provided by the present invention includes:
s110: and carrying out parameter configuration on the parameter verification data of each interface in the local system to generate a corresponding verification rule.
Specifically, parameter verification data of a local system is obtained first, and corresponding parameter configuration is performed on the parameter verification data. It should be noted that the parameter verification data of the local system related here is mainly information used for interface verification, and the parameter verification data specifically includes interface information, dockee information, and field information, and the verification rule includes a coding verification rule, a dockee coding verification rule, and a field format verification rule; and, the process of configuring the parameter for the parameter verification data includes: configuring corresponding interface codes, butt party codes and field formats for the interface information, the butt party information and the field information respectively; and generating corresponding interface code check rules, corresponding interface code check rules and corresponding field format check rules through the interface codes, the butt party codes and the field formats.
More specifically, in the process of performing corresponding parameter configuration on the parameter verification data, an interface code needs to be defined for each interface of the local system according to interface information (such as an interface name, etc.), and an interface code needs to be defined for each interface of the local system according to interface party information (such as an interface name, etc.); and then configuring the check rule. The specific configuration process is as follows: configuring corresponding check rules by taking the sequence of the interface information, the butt-joint party information (corresponding to various butt-joint parties) and the fields as the reference; for example, whether the interface codes are the same, whether the dockee codes are the same, whether the field formats are the same, and so on
It should be noted that, in the actual use process, different interfaces correspond to different interface codes, and different dockees correspond to different dockee codes, where the codes play a role of identification, for example, each interface or each dockee has a corresponding ID, and may use the respective ID as the corresponding code, or use the respective ID + interface name serial number as the code.
Regarding the order of the interface information, the dockee information (corresponding to various dockees), and the fields as references: the interface information includes information such as an interface name (e.g., RS-232 port, etc.), an interface ID, etc., the dockee information includes a dockee name, dockee ID information (represented by dockee code), etc., and the field information generally refers to data code field information (e.g., a code string, etc.) related to interface verification. Therefore, it is generally considered that the interface information, the dockee information (corresponding to various dockees), and the field information all include corresponding digital sequences or code sequences, and the sequence of data in these sequences represents internal implicit information (such as RS-232 ports, that is, which interface corresponds to the dockee), so that the corresponding check rules can be configured according to the sequence of the sequence information in these information;
the verification rule specifically refers to: whether the request information contained in the interface parameters of the interface request is the same as the interface code (i.e. the sequence of the internal number sequence) of the interface to be requested, the same as the dockee code of the dockee to be requested, the same as the field format of the field information corresponding to the local interface to be requested or the dockee to be requested, and so on. It should be noted that, if the interface is requested by the later-stage interface request, the request parameter naturally includes the request information corresponding to the interface code, and if the interface is requested by the dockee, the request parameter naturally includes the request information corresponding to the dockee code.
Further, the method can be divided into common rules and custom rules according to the common degree of the check rules (for example, if the number of calls of the local system exceeds 30 times in a working day, the local system is the common rules, otherwise, the local system is marked as the custom rules).
The purpose here is to classify the verification rules primarily according to their degree of use (represented by the number of calls), so as to facilitate later configuration management of the verification rules and understanding of the difference between the verification rules provided by the present invention and the existing verification rules, which generally use only the common rules.
Specifically, the common rules are generally conventional check rules that are relatively common, and include whether a field mandatory item exists, whether a field length is within a threshold range or exceeds a preset threshold, whether a field format is a preset value, and the like.
In the actual use process, the common rules can be presented in the form of label attributes (namely, various attribute values), so that the configuration process can be simpler and the working efficiency can be improved.
For custom rules, the main objective is to implement verification of the specified interface. For example, for some more important interfaces, the security is very important, and the verification strength of the interface needs to be strengthened. At this time, a corresponding implementation class (having an implementation class name) may be configured for the interface, and corresponding configuration may be performed for a parameter of the implementation class, and the custom rule may be set according to such configuration information, for example, to verify whether the type of information is previously configured information. In addition, corresponding error information can be configured, and flexibility is increased through verification of the error information.
The step of dividing the check rule into a conventional rule and a self-defined rule is to further configure the check rule, the configuration of the previous check rule is preliminary configuration, the configured check rule is a part of the conventional rule, and the step is mainly to further configure the self-defined rule and classify the check rule.
In addition, for self-defined rules, in order to further improve the rule checking precision, the checking parameters can be divided into static parameters and dynamic parameters, so that the checking effect of the checking rules is improved. The corresponding static parameters are generally preset fixed parameters, and these parameters are invariable during the operation of the system, such as: interface codes, platform codes, and the like or combinations of various parameters. In the later verification process, if the corresponding parameters in the request parameters are the same as the preset fixed parameters, the static parameter verification is judged to be passed. Because the static parameters are preset fixed parameters, in order to increase flexibility, support of dynamic parameters can be added, and more fields are served by changing the dynamic parameters, so that values of some fields can be conveniently obtained from system request parameters.
It should be noted that the dynamic parameter only needs to be set in the format of @ Map [ xxx ] when the parameter is defined, and at this time, a flag of the dynamic parameter is automatically marked, so that the corresponding parameter is automatically obtained from the Http request parameter in real time during later inspection, and the inspection is performed.
S120: and transferring the parameter verification data and the corresponding verification rules thereof into a preset configuration center so as to decouple the parameter verification data from the service data in the local system.
It should be noted that, taking part in the verification data: namely, the related data used for interface verification in the system, and the service data refers to the service data information of the related service realized by the interface or the platform in the system. Because the parameter verification data and the service data (both code data) in the existing system are stored in the system and mixed together, the parameter verification data and the service data can be separated by reconfiguring the parameter verification data and independently storing the parameter verification data and the service data into the preset configuration center, and the decoupling of the parameter verification data and the service data is realized.
Specifically, the parameter verification data and the corresponding verification rules thereof are stored in the preset configuration center in the form of an XML format file; element nodes are preset in the XML format file, and corresponding attribute nodes are preset in each element node; and the number of the first and second electrodes,
the element node is used for storing the parameter checking data, and the attribute node is used for storing the checking rule corresponding to the parameter checking data.
More specifically, the process of storing the parameter verification data and the corresponding verification rules thereof in the preset configuration center in the form of an XML format file includes:
analyzing element nodes and attribute nodes of the XML format file in the preset configuration center;
configuring corresponding element nodes for each check rule respectively, and taking the code combination of the interface code and the butt party code corresponding to each check rule as the key value of the element node;
and storing each parameter check data into the corresponding element node, and storing the check rule corresponding to the parameter check data into the corresponding attribute node.
In addition, each interface in the local system is configured with a corresponding implementation class; the parameter verification data also comprises implementation class information corresponding to the implementation class; the step of configuring parameters of the parameter verification data of each interface in the local system to generate corresponding verification rules further includes;
configuring a corresponding implementation class format for the implementation class information;
and generating a corresponding self-defined check rule through the implementation type format.
Specifically, in order to decouple the parameter verification data from the service data, a preset configuration center may be set in the system memory of the body system in advance, and the parameter information such as the interface code and the platform code verification rule generated in step S110 may be stored through the preset configuration center.
In addition, the configuration content may be stored using an XML formatted file for which each component in the XML document is a node. That is, the entire document is a document node, each XML tag is an element node, the text contained in the XML element is a text node, and each XML attribute is an attribute node. Based on the structural characteristics of the XML-formatted file, the various types of information configured in step S110 can be classified and stored in the XML-formatted file. For example, for a common rule, since it can be presented in the form of tag attributes (i.e. various attribute values), it can be stored in the attribute nodes of the XML format file. For the self-defined rule, the rule verification in the interface aspect and the verification of various types of information of the lower-level implementation class exist, so that the self-defined rule can be stored in a document node and a text node below the document node respectively. By the aid of the configuration storage mode, the relationship between the interface, the platform, the field and the check rule can be more clearly presented, and the working efficiency can be remarkably improved in the early data storage process and the later data pushing process.
The process of storing the parameter configuration information into the preset configuration center of the local system comprises the following steps:
reading the storage configuration content of the whole preset XML file in a preset configuration center;
analyzing each node in the XML file according to the read storage configuration content of the XML file, defining one node in all the nodes as all objects of an object A for storing interface codes, platform codes, fields and corresponding check rules, and then taking the interface codes + the platform codes as keys and the object A as values. The mapping relation of various objects can be stored in the system memory through the setting, so that the inspection efficiency is improved.
S130: and inquiring the preset configuration center through the request parameters of the real-time interface request to obtain a check rule of interface check data corresponding to the real-time interface request, and recording the check rule as a rule to be checked.
Specifically, the process of querying the preset configuration center through the request parameter of the real-time interface request to obtain the check rule of the interface check data corresponding to the real-time interface request includes:
analyzing the request parameters of the real-time interface request to acquire request interface codes, request butt joint party codes and request field data in the request parameters;
inquiring a key value list of an XML format file in the preset configuration center through the code combination of the request interface code and the request butt party code to acquire a key value corresponding to the code combination of the request interface code and the request butt party code;
determining corresponding element nodes through the key values;
and acquiring a check rule in the attribute node of the element node corresponding to the key value, and recording the check rule as the rule to be checked.
More specifically, the process of querying the preset configuration center through the request parameter of the real-time interface request to obtain the check rule of the interface check data corresponding to the real-time interface request includes:
performing preliminary parameter analysis on the interface request acquired in real time to acquire interface codes and platform codes to be accessed in request parameters of the interface request; the step is the extraction of the data information in the request parameter of the interface request, which is the existing data information extraction process.
And inquiring the preset configuration center based on the interface code and the platform code so as to obtain a verification rule related to the interface code or the platform code in the preset configuration center.
The node in the preset configuration center is used for storing the corresponding check rule, and the key value of the node is set by using the interface code or the platform code, so that the corresponding check rule can be quickly found from the preset configuration center through the interface code or the platform code extracted from the interface parameters.
Furthermore, as shown in step S120, the check rule is stored in the preset configuration center in the form of an XML format file, so that in the process of acquiring the check rule related to the interface code and the platform code in the preset configuration center:
and acquiring an object A (one element node) corresponding to the interface code and the platform code from a key value list of the element node in the initialized XML format file, and acquiring a check field needing to be checked and a corresponding rule object (namely a check rule) based on the object A.
It should be noted that, for all the obtained customized rules related to the interface request, it is generally necessary to further perform verification parameter configuration for the respective definition rules according to the specific request parameters of the interface request, so as to form the final customized rule. Specifically, whether the attribute format of the custom rule object is a dynamic attribute is judged, if so, parameters corresponding to the check field are automatically obtained from the request parameters requested by the interface based on @ Map [ xxx ], and corresponding custom check rule check parameters are configured according to the corresponding parameters. And if the attribute is static, directly configuring the corresponding calibration parameters of the self-defined calibration rule.
And performing parameter verification on the interface request according to all acquired verification rules (including common rules and custom rules after verification parameter configuration) related to the interface code and the platform code interface request.
Specifically, in the process of verifying the interface request through the verification rules, corresponding logic judgment is sequentially executed through each verification rule, and if the verification of the verification rule is passed, the next verification rule is continuously called for verification until all the verification rules are verified.
In the verification process of each verification rule, corresponding parameters or fields are obtained from request parameters requested by an interface, and then the parameters or the fields are verified through the verification rules.
It should be noted that the request parameters include: the device id, the user credential, the terminal type id, the calling information and the like, for data sequence type parameters such as the device id and the terminal type id, the pre-configured conventional rule is usually used for verification, and for field type parameters such as the user credential and the calling information, the pre-configured custom rule is usually used for verification. It should be noted that, the specific verification process is introduced in the setting process of the verification rule, and is not described herein again. In addition, the verification speed of the conventional rule is higher than that of the custom rule, so that the verification of the conventional rule can be performed firstly, and then the verification of the custom rule can be performed, and the verification efficiency is improved.
S140: and performing parameter verification on the request parameters requested by the real-time interface through the verification rules.
Specifically, the process of performing parameter verification on the request parameter requested by the real-time interface through the rule to be verified includes:
sequentially executing the rules to be verified, and performing parameter verification on the request parameters requested by the real-time interface; and the number of the first and second electrodes,
if the request parameter passes the verification of all rules to be verified, judging that the request parameter is legal and configuring an interface or a butt-joint party platform corresponding to the request parameter for the interface request; and if the request parameters do not pass the verification of all rules to be verified, judging that the request parameters are illegal.
It should be noted that, for an interface request, it can be determined that the interface request passes verification only when all verification rules in the preset configuration center pass verification, and at this time, a corresponding interface or a dockee platform can be configured for the interface request.
If one check rule is not passed in the checking process, the interface request is judged to be not passed in the checking, at this moment, subsequent checking of the check rule is not needed, the whole checking process is stopped, and only the error information and the error code related to the check rule need to be returned subsequently, so that the worker can manually detect the error information and the error code. Through the arrangement, verification processes can be further reduced, and the verification work efficiency is improved.
According to the technical scheme, the interface verification method based on the configuration center can help to decouple parameter verification in the interface from conventional service logic by providing interface parameter configuration verification, and codes of the parameter verification are not mixed with codes of the conventional service any more; developers do not write excessive verification codes any more, but focus on writing business logic more, and unnecessary labor cost consumption is reduced; each user-defined check implementation class only focuses on realizing a certain check rule, and parameterizes an individual case, so that the check class can support more service scenes, the codes of the whole class are clearer and simpler, and repeated writing of similar check classes is reduced; the relevant configuration of the interface parameter verification is placed in a preset configuration center, compared with the traditional code verification, the method has the advantage that the configuration is updated immediately and immediately, and the verification rule is changed without restarting an application system.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Example 2
Corresponding to the method, the application also provides an interface verification system based on the configuration center, and the system comprises:
the parameter configuration unit is used for carrying out parameter configuration on the parameter verification data of each interface in the local system so as to generate a corresponding verification rule;
the data storage unit is used for transferring the parameter verification data and the corresponding verification rules thereof into a preset configuration center so as to decouple the parameter verification data from the service data in the local system;
the query unit is used for querying the preset configuration center through request parameters of a real-time interface request so as to obtain a check rule of interface check data corresponding to the real-time interface request, and the check rule is marked as a rule to be checked;
and the checking unit is used for carrying out parameter checking on the request parameters of the real-time interface request through the rule to be checked.
Example 3
The present invention also provides an electronic device 70. Referring to fig. 2, a schematic structural diagram of an electronic device 70 according to a preferred embodiment of the invention is shown.
In the embodiment, the electronic device 70 may be a terminal device having a computing function, such as a server, a smart phone, a tablet computer, a portable computer, or a desktop computer.
The electronic device 70 includes: a processor 71 and a memory 72.
The memory 72 includes at least one type of readable storage medium. At least one type of readable storage medium may be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card-type memory, and the like. In some embodiments, the readable storage medium may be an internal storage unit of the electronic device 70, such as a hard disk of the electronic device 70. In other embodiments, the readable storage medium may be an external memory of the electronic device 1, such as a plug-in hard disk provided on the electronic device 70, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like.
In the present embodiment, the readable storage medium of the memory 72 is generally used for storing the configuration center-based interface verification program 73 installed in the electronic device 70. The memory 72 may also be used to temporarily store data that has been output or is to be output.
The processor 72 may be, in some embodiments, a Central Processing Unit (CPU), microprocessor or other data Processing chip for running program code stored in the memory 72 or Processing data, such as a configuration center based interface verification program 73.
In some embodiments, the electronic device 70 is a terminal device of a smartphone, tablet, portable computer, or the like. In other embodiments, the electronic device 70 may be a server.
Fig. 2 only shows the electronic device 70 with components 71-73, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
Optionally, the electronic device 70 may further include a user interface, which may include an input unit such as a Keyboard (Keyboard), a voice input device such as a microphone (microphone) or other devices with voice recognition function, a voice output device such as a sound box, a headset, etc., and optionally may also include a standard wired interface, a wireless interface.
Optionally, the electronic device 70 may further include a display, which may also be referred to as a display screen or a display unit. In some embodiments, the display device may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-Emitting Diode (OLED) touch device, or the like. The display is used for displaying information processed in the electronic device 70 and for displaying a visualized user interface.
Optionally, the electronic device 70 may further include a touch sensor. The area provided by the touch sensor for the user to perform touch operation is referred to as a touch area. Further, the touch sensor here may be a resistive touch sensor, a capacitive touch sensor, or the like. The touch sensor may include not only a contact type touch sensor but also a proximity type touch sensor. Further, the touch sensor may be a single sensor, or may be a plurality of sensors arranged in an array, for example.
The area of the display of the electronic device 70 may be the same as or different from the area of the touch sensor. Optionally, the display is stacked with the touch sensor to form a touch display screen. The device detects touch operation triggered by a user based on the touch display screen.
Optionally, the electronic device 70 may further include a Radio Frequency (RF) circuit, a sensor, an audio circuit, and the like, which are not described in detail herein.
In the apparatus embodiment shown in fig. 2, the memory 72, which is a kind of computer storage medium, may include therein an operating system, and a configuration center-based interface verification program 73; the processor 71, when executing the configuration center based interface verification program 73 stored in the memory 72, performs the following steps:
parameter configuration is carried out on parameter verification data of each interface in a local system so as to generate a corresponding verification rule;
the parameter verification data and the corresponding verification rules are transferred to a preset configuration center so as to decouple the parameter verification data from the service data in the local system;
inquiring the preset configuration center through request parameters of a real-time interface request to obtain a check rule of interface check data corresponding to the real-time interface request, and recording the check rule as a rule to be checked;
and performing parameter verification on the request parameters requested by the real-time interface through the rule to be verified.
In this embodiment, fig. 3 is a schematic diagram of the internal logic of the interface verification program based on the configuration center according to the embodiment of the present invention, and as shown in fig. 3, the interface verification program 73 based on the configuration center may also be divided into one or more modules, and one or more modules are stored in the memory 72 and executed by the processor 71, so as to complete the present invention. The modules referred to herein are referred to as a series of computer program instruction segments capable of performing specified functions. Referring to fig. 3, a block diagram of a preferred embodiment of the configuration center based interface verification process 73 of fig. 2 is shown. The configuration center based interface verification program 73 may be divided into: a parameter configuration module 74, a data storage module 75, a query module 76, and a verification module 77. The functions or operational steps performed by the modules 74-77 are similar to those described above and will not be described in detail herein, for example, where:
a parameter configuration module 74, configured to perform parameter configuration on the parameter verification data of each interface in the local system, so as to generate a corresponding verification rule;
the data storage module 75 is configured to transfer the parameter verification data and the corresponding verification rule thereof to a preset configuration center, so as to decouple the parameter verification data from the service data in the local system;
the query module 76 is configured to query the preset configuration center through a request parameter of a real-time interface request, so as to obtain a calibration rule of interface calibration data corresponding to the real-time interface request, and record the calibration rule as a rule to be calibrated;
and the checking module 77 is configured to perform parameter checking on the request parameter requested by the real-time interface through the rule to be checked.
Example 4
The present invention further provides a computer-readable storage medium, in which the configuration center-based interface verification program 73 is stored, and when executed by a processor, the configuration center-based interface verification program 73 implements the following operations:
parameter configuration is carried out on parameter verification data of each interface in a local system so as to generate a corresponding verification rule;
the parameter verification data and the corresponding verification rules are transferred to a preset configuration center so as to decouple the parameter verification data from the service data in the local system;
inquiring the preset configuration center through request parameters of a real-time interface request to obtain a check rule of interface check data corresponding to the real-time interface request, and recording the check rule as a rule to be checked;
and performing parameter verification on the request parameters requested by the real-time interface through the rule to be verified.
The specific implementation of the computer-readable storage medium provided by the present invention is substantially the same as the specific implementation of the configuration center-based interface verification method and the electronic device, and is not described herein again.
It should be noted that the blockchain in the present invention is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It is further noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method 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, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments. Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only an alternative embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. An interface verification method based on a configuration center is applied to an electronic device, and is characterized in that the method comprises the following steps:
parameter configuration is carried out on parameter verification data of each interface in a local system so as to generate a corresponding verification rule;
the parameter verification data and the corresponding verification rules are transferred to a preset configuration center so as to decouple the parameter verification data from the service data in the local system;
inquiring the preset configuration center through request parameters of a real-time interface request to obtain a check rule of interface check data corresponding to the real-time interface request, and recording the check rule as a rule to be checked;
and performing parameter verification on the request parameters requested by the real-time interface through the rule to be verified.
2. The interface verification method based on the configuration center according to claim 1, wherein the parameter verification data includes interface information, dockee information and field information, and the verification rules include a code verification rule, a dockee code verification rule and a field format verification rule; the configuring parameters of the parameter verification data of each interface in the local system to generate a corresponding verification rule includes:
configuring corresponding interface codes, butt party codes and field formats for the interface information, the butt party information and the field information respectively;
and generating a corresponding code check rule, a corresponding dockee code check rule and a corresponding field format check rule through the interface code, the dockee code and the field format.
3. The configuration center-based interface verification method according to claim 2, wherein the parameter verification data and the corresponding verification rules thereof are stored in the preset configuration center in an XML format file; element nodes are preset in the XML format file, and corresponding attribute nodes are preset in each element node; and the number of the first and second electrodes,
the element node is used for storing the parameter checking data, and the attribute node is used for storing the checking rule corresponding to the parameter checking data.
4. The configuration center-based interface verification method according to claim 3, wherein the step of storing the parameter verification data and the corresponding verification rules thereof in the preset configuration center in an XML format file comprises:
analyzing element nodes and attribute nodes of the XML format file in the preset configuration center;
configuring corresponding element nodes for each check rule respectively, and taking the code combination of the interface code and the butt party code corresponding to each check rule as the key value of the element node;
and storing each parameter check data into the corresponding element node, and storing the check rule corresponding to the parameter check data into the corresponding attribute node.
5. The configuration center-based interface verification method according to claim 4, wherein each interface in the local system is configured with a corresponding implementation class, the parameter verification data further includes implementation class information corresponding to the implementation class, and the performing parameter configuration on the parameter verification data of each interface in the local system to generate a corresponding verification rule further includes;
configuring a corresponding implementation class format for the implementation class information;
and generating a corresponding self-defined check rule through the implementation type format.
6. The interface verification method based on the configuration center according to claim 4, wherein the preset configuration center is queried according to a request parameter of a real-time interface request to obtain a verification rule of interface verification data corresponding to the real-time interface request, and the process of marking as the rule to be verified includes:
analyzing the request parameters of the real-time interface request to acquire request interface codes, request butt joint party codes and request field data in the request parameters;
inquiring a key value list of an XML format file in the preset configuration center through the code combination of the request interface code and the request butt party code to acquire a key value corresponding to the code combination of the request interface code and the request butt party code;
determining corresponding element nodes through the key values;
and acquiring a check rule in the attribute node of the element node corresponding to the key value, and recording the check rule as the rule to be checked.
7. The configuration center-based interface verification method according to claim 6, wherein the process of performing parameter verification on the request parameter of the real-time interface request through the rule to be verified includes:
sequentially executing the rules to be verified, and performing parameter verification on the request parameters requested by the real-time interface; and the number of the first and second electrodes,
if the request parameter passes the verification of all rules to be verified, judging that the request parameter is legal; and if the request parameters do not pass the verification of all rules to be verified, judging that the request parameters are illegal.
8. An interface verification system based on a configuration center, the system comprising:
the parameter configuration unit is used for carrying out parameter configuration on the parameter verification data of each interface in the local system so as to generate a corresponding verification rule;
the data storage unit is used for transferring the parameter verification data and the corresponding verification rules thereof into a preset configuration center so as to decouple the parameter verification data from the service data in the local system;
the query unit is used for querying the preset configuration center through request parameters of a real-time interface request so as to obtain a check rule of interface check data corresponding to the real-time interface request, and the check rule is marked as a rule to be checked;
and the checking unit is used for carrying out parameter checking on the request parameters of the real-time interface request through the rule to be checked.
9. An electronic device, comprising: the system comprises a memory, a processor and a configuration center-based interface verification program stored in the memory and capable of running on the processor, wherein when the configuration center-based interface verification program is executed by the processor, the system realizes the following steps:
parameter configuration is carried out on parameter verification data of each interface in a local system so as to generate a corresponding verification rule;
the parameter verification data and the corresponding verification rules are transferred to a preset configuration center so as to decouple the parameter verification data from the service data in the local system;
inquiring the preset configuration center through request parameters of a real-time interface request to obtain a check rule of interface check data corresponding to the real-time interface request, and recording the check rule as a rule to be checked;
and performing parameter verification on the request parameters requested by the real-time interface through the rule to be verified.
10. A computer-readable storage medium, wherein a configuration center-based interface verification program is stored in the computer-readable storage medium, and when the configuration center-based interface verification program is executed by a processor, the steps of the configuration center-based interface verification method according to any one of claims 1 to 7 are implemented.
CN202011355685.3A 2020-11-27 2020-11-27 Interface checking method, system and device based on configuration center and storage medium Pending CN112416784A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011355685.3A CN112416784A (en) 2020-11-27 2020-11-27 Interface checking method, system and device based on configuration center and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011355685.3A CN112416784A (en) 2020-11-27 2020-11-27 Interface checking method, system and device based on configuration center and storage medium

Publications (1)

Publication Number Publication Date
CN112416784A true CN112416784A (en) 2021-02-26

Family

ID=74843360

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011355685.3A Pending CN112416784A (en) 2020-11-27 2020-11-27 Interface checking method, system and device based on configuration center and storage medium

Country Status (1)

Country Link
CN (1) CN112416784A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113608913A (en) * 2021-08-05 2021-11-05 上海微盟企业发展有限公司 Parameter checking method, system, device and storage medium
CN115145587A (en) * 2022-07-22 2022-10-04 中国农业银行股份有限公司 Product parameter checking method and device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113608913A (en) * 2021-08-05 2021-11-05 上海微盟企业发展有限公司 Parameter checking method, system, device and storage medium
CN115145587A (en) * 2022-07-22 2022-10-04 中国农业银行股份有限公司 Product parameter checking method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN108292231B (en) Method and system for generating applications from data
CN107967135B (en) Calculation engine implementation method, electronic device and storage medium
CN110601880B (en) Cloud platform, service processing method, command interface and computer equipment
CN112416784A (en) Interface checking method, system and device based on configuration center and storage medium
CN112364083A (en) Data dictionary management method, system and storage medium based on configuration file
CN107066591A (en) A kind of method and device handled business
WO2021151347A1 (en) Ios application-based reinforcement method, apparatus, device, and storage medium
CN105760450A (en) Form file analyzing method and device
CN112631557A (en) Method, device and storage medium for generating interface code and/or interface document
CN112328486A (en) Interface automation test method and device, computer equipment and storage medium
CN113434542B (en) Data relationship identification method and device, electronic equipment and storage medium
CN109840120B (en) Decoupling micro-service release method, electronic device and computer readable storage medium
CN113434582B (en) Service data processing method and device, computer equipment and storage medium
CN112363997B (en) Data version management method, device and storage medium
CN111142863B (en) Page generation method and device
CN112817935A (en) Data processing method, device and equipment based on field type and storage medium
CN110443072B (en) Data signature method, data verification device and storage medium
CN111639903A (en) Review processing method for architecture change and related equipment
CN112434506A (en) Electronic protocol signing processing method, device, computer equipment and medium
CN111324645B (en) Block chain data processing method and device
CN108171063A (en) Method, terminal and the computer readable storage medium of access safety element
JP2017033351A (en) Enterprise information matching apparatus and program for enterprise information matching
CN112685304A (en) Front-end information standard checking method, system, device and storage medium
CN114614972A (en) Data alignment method, system, electronic device and storage 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