Parameter verification method, device, computer equipment and storage medium

By generating and storing parameter verification dictionary on the front-end server, the back-end server querys the corresponding rules from the database for verification, solving the problem of inconsistent verification of front-end and back-end data, and achieving a more efficient and accurate verification process.

CN114003432BActive Publication Date: 2025-03-21JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111141845.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-28
Publication Date
2025-03-21
Estimated Expiration
2041-09-28

AI Technical Summary

Technical Problem

In a system with a separate architecture of front-end and back-end, the front-end and the back-end perform parameter verification respectively, resulting in inconsistent data verification, which increases labor cost and verification complexity.

Method used

By receiving the user on the front-end server to set the verification rules for the interface's verification objects, a parameter verification dictionary is generated and stored in the database. After receiving the client's data verification request, the back-end server querys the corresponding parameter verification rules from the database for verification.

Benefits of technology

Ensure that the calibration results of front and back end parameters are consistent, avoid back end calibration omissions, improve the accuracy and efficiency of calibration, and save labor costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114003432B_ABST
    Figure CN114003432B_ABST
Patent Text Reader

Abstract

The present application relates to a parameter verification method, device, computer equipment and storage medium, the method comprising: receiving a data verification request sent by a client, determining the interface name and interface parameters corresponding to the requested call interface according to the data verification request; querying the parameter verification rules in the parameter verification dictionary corresponding to the interface from the database according to the interface name; wherein the parameter verification dictionary is generated by the front-end server receiving the user's verification rule setting for at least one verification object of the interface, and stored in the corresponding database; verifying the interface parameters according to the parameter verification rules to obtain the parameter verification results. The use of this method can ensure the consistency of the front-end and back-end verification results and improve the accuracy of the back-end parameter verification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of parameter verification technology, and in particular to a parameter verification method, device, computer equipment and storage medium. Background Art

[0002] In most scenarios, parameter verification is an essential process in program development. In a system with a front-end and back-end separation architecture, in order to ensure the accuracy of the data, it is often necessary to verify the data separately on the front-end and back-end of the system.

[0003] At present, during the system development process, developers usually develop the front-end and back-end of the system separately, using different codes and logics to perform front-end verification and back-end verification of data respectively. However, due to the frequent changes in the front-end interface style, back-end verification is prone to omissions, which easily leads to inconsistent front-end and back-end data verification. In addition, the front-end and back-end require manpower for verification respectively, which also increases labor costs. Summary of the invention

[0004] Based on this, it is necessary to provide a parameter verification method, device, computer equipment and storage medium that can ensure consistency in front-end and back-end parameter verification results in response to the above technical problems.

[0005] In a first aspect, the present application provides a parameter verification method, which is applied to a backend server, and the method comprises:

[0006] Receive a data verification request sent by the client, and determine the interface name and interface parameters corresponding to the requested calling interface according to the data verification request;

[0007] According to the interface name, query the parameter verification rules in the parameter verification dictionary corresponding to the interface from the database; wherein the parameter verification dictionary is generated by the front-end server receiving the verification rule setting of at least one verification object of the interface by the user, and stored in the corresponding database;

[0008] The interface parameters are verified according to the parameter verification rules to obtain parameter verification results.

[0009] In a possible implementation, the step of querying a parameter verification dictionary corresponding to the interface from a database according to the interface name for a parameter verification rule includes:

[0010] According to the interface name, query the parameter verification dictionary corresponding to the interface name from the database;

[0011] The parameter verification dictionary is traversed to determine the parameter value of the verification object corresponding to the interface name, and the parameter verification rule for performing parameter verification on the interface is determined according to the parameter value.

[0012] In a possible implementation, the step of determining a parameter verification rule for performing parameter verification on the interface according to the parameter value includes:

[0013] Determine at least one check item included in the parameter value by using a segmentation symbol preset in the parameter value;

[0014] Determine a parameter verification rule corresponding to parameter verification of the interface according to the configuration parameters corresponding to the verification item.

[0015] In a possible implementation, the parameter verification rule includes a regular verification rule;

[0016] The step of determining the parameter verification rule corresponding to the parameter verification of the interface according to the configuration parameters corresponding to the verification item comprises:

[0017] The regular verification rules corresponding to the interface parameters are determined from a pre-configured regular configuration management module according to the configuration parameters corresponding to the verification items; wherein the regular configuration management module is obtained by integrating multiple regular verification rules corresponding to multiple interface parameters, and the regular verification rules include at least one of a regular expression name, a regular expression content and a regular expression description information.

[0018] In a possible implementation, the parameter verification rule includes a common parameter verification rule;

[0019] The step of querying the parameter verification rules in the parameter verification dictionary corresponding to the interface from the database includes:

[0020] According to the name of the verification object corresponding to the interface, it is determined that the interface parameter to be verified is a common parameter, and the common parameter verification rule corresponding to the common parameter is obtained by querying from the database; wherein the common parameter verification rule is set based on the verification rules corresponding to at least two verification objects with the same or similar attributes.

[0021] In a possible implementation manner, the step of verifying the interface parameters according to the parameter verification rule includes:

[0022] According to the parameter verification rules corresponding to each interface parameter, determine whether the interface parameter meets the corresponding parameter conditions in the parameter verification rules;

[0023] If so, it is determined that the interface parameter check has passed; otherwise, it is determined that the interface parameter check has failed.

[0024] In a possible implementation manner, after the step of verifying the interface parameters according to the parameter verification rule, the method further includes:

[0025] The verification result is returned to the client and displayed through the display interface of the client.

[0026] In a second aspect, the present application further provides a parameter verification device, which is applied to a backend server, and the device comprises:

[0027] A verification request receiving module is used to receive a data verification request sent by a client, and determine the interface name and interface parameters corresponding to the interface called by the request according to the data verification request;

[0028] A verification rule determination module, used to query the parameter verification rule in the parameter verification dictionary corresponding to the interface from the database according to the interface name; wherein the parameter verification dictionary is generated by the front-end server receiving the user's parameter verification rule setting for at least one verification object of the interface, and stored in the corresponding database;

[0029] The verification result obtaining module is used to verify the interface parameters according to the parameter verification rules to obtain parameter verification results.

[0030] In a third aspect, the present application further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method mentioned in the first aspect when executing the computer program.

[0031] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method mentioned in the first aspect.

[0032] The above-mentioned parameter verification method, device, computer equipment and storage medium generate a parameter verification dictionary corresponding to the interface by receiving verification rules for at least one verification object of the interface from the user through the front-end server in advance, and store it in the corresponding database. When the back-end server receives the data verification request sent by the client, it determines the interface name and interface parameters corresponding to the interface called by the client, queries the parameter verification rules in the parameter verification dictionary corresponding to the interface from the database according to the interface name, and verifies the interface parameters according to the parameter verification rules, so that the rules used for the back-end parameter verification are consistent with the front-end verification, avoiding the omission problem of the back-end parameter verification, improving the accuracy and verification efficiency of the back-end verification, and saving labor costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 An application environment diagram of a parameter verification method provided by an embodiment;

[0034] Figure 2A flow chart of a parameter verification method provided by an embodiment;

[0035] Figure 3 A flowchart of a method for determining parameter verification rules provided by an embodiment;

[0036] Figure 4 Another schematic diagram of a flow chart of a parameter verification method provided by an embodiment;

[0037] Figure 5 A structural block diagram of a parameter verification device provided by an embodiment;

[0038] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0040] The parameter verification method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the client 102 communicates with the server 104 through the network through the network. The user can make relevant operations through the client 102, such as input operations and login operations. The client 102 responds to the operation made by the user and sends a data verification request to the server to call the relevant interface. For example, the user makes a login operation and enters relevant identity information, such as mobile phone number, email address, ID card number, user nickname, age and gender, etc. The client 102 will initiate a data verification request to the server 104 according to the login operation made by the user to request the server to perform the corresponding verification operation. The server 104 will perform parameter verification on the relevant parameters sent by the client 102, such as the interface name requested to be called and its corresponding parameters according to the data verification request. If the data verification passes, the corresponding interface call can be made. If the verification fails, the result of the verification failure is returned, and the client displays relevant information according to the verification result to prompt the user that the verification fails or prompts the user to make the correct operation. Among them, the client 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented with an independent server or a server cluster composed of multiple servers.

[0041] In related technologies, the front-end and back-end of the system are developed separately. The front-end will use form verification to verify parameters during system development, and often add a lot of logic processing and regular verification to verify the form information to ensure that the form information meets the requirements. At the same time, in order to prevent attackers from hijacking and modifying parameter information to attack interfaces with lax parameter verification, back-end verification is required to prevent the interface from being called privately and causing damage to the system.

[0042] Generally, in order to improve the stability and maintainability of the system, during the system development process, the parameters of the request need to be checked at the front and back ends. In this embodiment, the server 104 may further include a front-end server and a back-end server. The front-end server performs the parameter check of the front end according to the pre-configured front-end parameter check rules, and the back-end server performs the parameter check of the back end according to the pre-configured back-end parameter check rules.

[0043] During the front-end and back-end data verification process, the front-end and back-end use different codes and logics to perform parameter verification respectively. Due to the same business rules for the data, the front-end and back-end sometimes have different logical expressions. In addition, the frequent changes in the front-end interface style lead to a large number of additional parameter verifications, which easily lead to omissions in the back-end data verification, resulting in inconsistent front-end and back-end data verification results, affecting the stability of the system.

[0044] The parameter verification method, device, computer equipment and storage medium provided in the present application can unify the front-end and back-end data verification results, improve the stability of the system, and solve the above technical problems of the prior art.

[0045] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0046] The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0047] Figure 2 This is a parameter verification method provided by an embodiment, which is executed by a server. In this embodiment, the application to a backend server is used as an example for explanation.

[0048] like Figure 2 As shown, the parameter verification method may include the following steps:

[0049] S210: Receive a data verification request sent by the client, and determine the interface name and interface parameters corresponding to the interface requested to be called according to the data verification request.

[0050] The client receives an operation triggered by the user, such as the login, open, select, and delete operations input by the user on the client's display interface. The client initiates a corresponding data verification request to the backend server according to the operation triggered by the user, so as to request the backend server to perform the corresponding verification operation. For example, if the client receives a login operation triggered by the user, the client sends a login data verification request to the server. If the client receives an open operation from the user, the client sends an open data verification request to the server. Different operations correspond to different calling interfaces, and the interfaces that the client requests to verify from the server and the corresponding interface parameters are also different.

[0051] The backend server receives the data verification request sent by the client, and parses the data verification request to determine the interface called for the data verification, including the interface name and the interface parameters corresponding to the interface. Each interface call request corresponds to a unique interface name.

[0052] For example, the client receives a user's login operation, and the client initiates a data verification request to the back-end server based on the user's login operation to verify the interface that needs to be called for the login operation and the interface parameters carried by the user's login operation, such as user name, age, gender, login time, etc.

[0053] S220. Query the parameter verification rules in the parameter verification dictionary corresponding to the interface from the database according to the interface name; wherein the parameter verification dictionary is generated by the front-end server receiving the user's verification rule setting for at least one verification object of the interface, and the interface name corresponding to the interface is stored in the corresponding database.

[0054] The database may be a library for storing data and information. In this embodiment, the database may store codes and information such as parameter configurations.

[0055] The parameter verification dictionary refers to a set of verification rules for multiple verification items corresponding to a certain interface. In this embodiment, before the back-end server performs parameter verification on the interface, the front-end server generates a parameter verification dictionary corresponding to the interface and stores it in the database.

[0056] A user, such as a front-end developer, pre-configures at least one parameter verification rule through the parameter verification configuration interface. The front-end server receives the verification rule setting of at least one verification object of the interface by the user in the parameter verification configuration interface. The verification rule configuration is used to record at least one verification object corresponding to various types of interfaces and its attribute information, including identification, attributes and attribute values, etc. Optionally, the verification objects include: user name, age, gender, email address, telephone number, etc., and the verification rules include whether it is a required item, maximum value, minimum value, single choice / multiple choice, regular expression content, parameter name, etc.

[0057] In this embodiment, one interface may correspond to one or more verification objects, that is, one interface may correspond to one or more interface parameters. Optionally, parameter verification may be classified according to interface type, and corresponding parameter verification rules may be set according to the category.

[0058] After the user sets the verification rules on the parameter verification configuration page, the front-end server generates a parameter verification dictionary according to the verification rule settings on the parameter verification configuration page through setting operations, such as triggering the parameter verification setting file generation button. For the parameter verification dictionary, it refers to a file set containing the interface name and its corresponding parameter verification rules. For example, for the data verification of the login operation, the calling interface corresponding to the data verification is the "login interface", and its corresponding interface name is login. The generated parameter verification dictionary may include dictionary files such as {"login":{"name":"required:true;pattern:regular name"}}. Optionally, in this embodiment, the parameter verification dictionary of the interface may also include dictionary files such as {"regular name":"regular expression"}, which are used to query the regular expression used in regular verification. Further, the front-end server transfers the parameter verification dictionary to the corresponding database for storage. Optionally, the database can be a persistent database. For the parameter verification rules of the same interface, the newly generated parameter verification rules will overwrite the parameter verification rules generated last time to update the parameter verification rules of the interface.

[0059] The parameter verification dictionary generated by the front-end server can be obtained by the verification rule setting of the front-end developer when performing the front-end parameter verification. The front-end server can send the generated parameter verification dictionary to the database in real time, or when the back-end server receives the data verification request, it can send an interface call request to the front-end server through the database, and the front-end server sends the parameter verification rule corresponding to the interface name to the database, so that the back-end server can query the parameter verification rule corresponding to the interface call request from the database.

[0060] In this embodiment, the back-end server queries the parameter verification dictionary corresponding to the interface from the database according to the interface name of the interface and the correspondence between the interface name and the parameter verification dictionary, and determines the parameter verification rules for performing parameter verification on the interface according to the fields of the parameter verification dictionary.

[0061] S230. Verify the interface parameters according to the parameter verification rule to obtain a parameter verification result.

[0062] The back-end server verifies the interface parameters sent by the client according to the obtained parameter verification rules. If the interface parameters meet the rule conditions set by the parameter verification rules, the interface parameter verification is determined to have passed. If the interface parameters do not meet the rule conditions set by the parameter verification rules, the interface parameter verification is determined to have failed.

[0063] In order to more clearly illustrate the present technical solution, the parameter verification method mentioned above is illustrated by an example. The developer configures the parameter verification rules of the front-end parameter verification through the parameter verification configuration page, including the interface name, field attributes, rule expressions and version number of the parameter verification. The front-end server generates a parameter verification dictionary with the configured interface name and its parameter verification rules and stores it in the database for back-end verification. When the user sends a data verification request through the client to request an interface call, the back-end server obtains the interface name and interface parameters according to the data verification request, and queries the parameter verification dictionary corresponding to the interface name from the database, obtains the parameter verification rules from the parameter verification dictionary, and performs parameter verification on the interface parameters according to the parameter verification rules corresponding to at least one verification item of the interface, thereby obtaining the parameter verification results.

[0064] The parameter verification method provided in this embodiment is applied to a back-end server. The front-end server receives a parameter verification dictionary generated by a user setting verification rules for at least one verification object of an interface and stores it in a corresponding database. When the back-end server receives a data verification request sent by a client, it queries the database to obtain the parameter verification rules in the parameter verification dictionary corresponding to the interface, and performs parameter verification according to the parameter verification rules. There is no need for back-end personnel to reconfigure the parameter verification rules, thus saving the verification workload of developers. At the same time, the parameter verification rules of the back-end are consistent with the parameter verification rules of the front-end, thus avoiding problems such as verification omissions, ensuring the uniformity of the front-end and back-end parameter verification results, and improving the processing efficiency and accuracy of data verification.

[0065] In order to more clearly illustrate the present application scheme, multiple implementation steps of the present application are described in detail below.

[0066] Figure 3 A flow chart of a method for determining parameter verification rules provided by an embodiment, such as Figure 3 As shown, in one embodiment, querying the parameter verification rules in the parameter verification dictionary corresponding to the interface from the database according to the interface name in step S220 may include the following steps:

[0067] S2201. Query a parameter verification dictionary corresponding to the interface name from a database according to the interface name.

[0068] It should be noted that the parameter verification dictionary corresponds to the interface name corresponding to the interface one by one, and the corresponding parameter verification dictionary file can be quickly found from the database according to the interface name. In this embodiment, the back-end server queries the parameter verification dictionary corresponding to the interface from the database according to the interface name of the interface and the corresponding relationship between the interface name and the parameter verification dictionary.

[0069] S2202: traverse the parameter verification dictionary to determine the parameter value corresponding to the interface name, and determine a parameter verification rule for performing parameter verification on the interface according to the parameter value.

[0070] The parameter verification dictionary includes multiple fields and special symbols. The parameter value corresponding to the interface name can be determined according to the special symbol or the position of the special character. For example, if the parameter verification dictionary is {"login":{"name":"required:true;pattern:regular name"}}, it can be determined that the interface name is "login", the content after the colon of the interface name is the verification object "name", and the content after the colon of the verification object "name" is the parameter value, that is, the parameter value is "required:true;pattern:regular name". Among them, the parameter value includes at least one verification item and the parameter verification rule corresponding to the verification item.

[0071] In one embodiment, determining a parameter verification rule for performing parameter verification on the interface according to the parameter value in step S2202 may include the following steps:

[0072] S201. Determine at least one check item included in the parameter value by using a segmentation symbol preset in the parameter value.

[0073] The parameter value in the parameter check dictionary includes multiple check items, each of which is divided by a preset segmentation symbol. At least one check item included in the parameter value is determined by identifying the preset segmentation symbol in the parameter value.

[0074] For example, the parameter value is "required:true; pattern:regular name", and the preset separator is a semicolon ";". By identifying the semicolon of the parameter value, it can be determined that it includes two check items "required:true" and "pattern:regular name".

[0075] S202: Determine a parameter verification rule corresponding to parameter verification of the interface according to the configuration parameters corresponding to the verification item.

[0076] Continuing with the above example, check whether the corresponding interface parameter is not empty based on whether the configuration parameter of the check item "required" is true, query the corresponding regular expression based on whether the check item "pattern: regular expression name" has a pattern, and then perform regular check on the interface parameter.

[0077] In other embodiments, parameter verification may also be performed on other verification objects of the "login" interface name, such as "age" and other verification objects, by configuring corresponding parameter verification rules.

[0078] In this embodiment, the corresponding parameter verification rule is determined according to the configuration parameters in the verification item, and at least one interface parameter is uniformly verified according to the parameter verification rule, rather than performing logical verification in the processing method of each interface, thereby improving the efficiency of back-end parameter verification.

[0079] In the present technical solution, the parameter verification rules may be multiple verification rules based on different interface parameters or different interface types. Different interface parameters or interface types have different parameter verification rules. For example, the parameter verification rules include regular verification rules, common parameter verification rules, etc., to verify different interface parameters.

[0080] In one embodiment, if the parameter verification rule is a regular verification rule, then determining the parameter verification rule corresponding to the parameter verification of the interface according to the configuration parameter corresponding to the verification item in step S302 may include the following steps:

[0081] S401. Determine the regular check rule corresponding to the interface parameter from a pre-configured regular check management module according to the configuration parameter corresponding to the check item.

[0082] The regular expression configuration management module is obtained by integrating a plurality of regular expression verification rules corresponding to a plurality of interface parameters, and the regular expression verification rules include at least one of a regular expression name, a regular expression content and a regular expression description information.

[0083] In this embodiment, at least one regular verification rule involved in parameter verification can be configured in advance through the relevant regular expression configuration page, such as mobile phone number verification, email format verification, user name verification, password strength verification, legal URL verification, etc., and multiple regular verification rules can be integrated to obtain a regular configuration management module. Each regular verification rule includes one or more of a regular expression name, a regular expression content, and a regular expression description information, wherein the regular expression name, the regular expression content, and the regular expression description information have a one-to-one correspondence.

[0084] For example, the username regular validation rule is used to verify the username, requiring the username to be 8 to 12 characters long and not contain spaces; the email registration regular validation rule verifies the email address, requiring the email address to be 6 to 12 word characters long, the suffix name to be 2 to 10 word characters long, and finally the domain name.

[0085] When performing parameter verification, the required regular verification rules are directly obtained from the regular configuration management module. Optionally, the regular verification rules in the regular configuration management module can be modified, added, and deleted to update the regular configuration management module to meet the requirements of parameter verification, so that the corresponding regular expression can be quickly obtained from the regular configuration management module during regular verification, making parameter verification more standardized, saving the workload of developers, and improving the efficiency of parameter verification.

[0086] Exemplarily, the verification item corresponding to an interface is "pattern: regular expression name". According to the existence of "pattern" in its configuration parameters, the regular verification rule corresponding to the "regular expression name" is queried. Specifically, the regular verification rule corresponding to the regular name is queried from the regular configuration management module according to the regular name, and the interface parameters are regularly checked according to the regular expression content and regular expression description in the regular verification rule.

[0087] In one embodiment, if the parameter verification rule is a common parameter verification rule, the step S220 of querying the parameter verification rule in the parameter verification dictionary corresponding to the interface from the database may include the following steps:

[0088] S402: Determine that the interface parameter to be verified is a common parameter according to the name of the verification object corresponding to the interface, and obtain a common parameter verification rule corresponding to the common parameter from a database.

[0089] The common parameter verification rule is set based on verification rules corresponding to at least two verification objects having the same or similar attributes.

[0090] Common parameters refer to multiple verification objects with the same or similar attributes in parameter verification. The parameter verification rules of these multiple verification objects are universal. On different interfaces, the verification rules of common parameters are basically the same.

[0091] In this embodiment, based on the same or similar attributes of at least two verification objects, verification rules that simultaneously satisfy the multiple verification objects for data verification are pre-set. For example, for the verification of verification objects such as amount, age, and user name, the verification methods of such parameters on different interfaces are basically the same, and such parameters are classified as common parameters, and the verification methods of these common parameters are encapsulated into public verification to obtain common parameter verification rules. When configuring the common parameter verification of the interface, the common parameter verification rules are directly queried from the corresponding database to perform interface parameter verification.

[0092] In one embodiment, the verification items of the common parameters can be configured as common factors, and parameter verification rules suitable for verifying multiple common parameters can be set. When it is necessary to verify an interface parameter that belongs to the common parameters, the common parameter verification rules can be directly used for verification. There is no need to additionally configure corresponding verification rules for verification objects with the same or similar properties of various types of interfaces, which simplifies the parameter verification configuration process and improves the efficiency of parameter verification.

[0093] In one embodiment, the checking of the interface parameters according to the parameter checking rule in step S230 may include the following steps:

[0094] S2301. Determine whether the interface parameters meet the corresponding parameter conditions in the parameter verification rules according to the parameter verification rules corresponding to the interface parameters; if so, execute step S2302; otherwise, execute step S2303.

[0095] Parameter conditions refer to the conditions that must be met for the interface parameter verification to pass.

[0096] Optionally, there can be multiple interface parameters, and the parameter verification rules corresponding to each interface parameter can be different. The parameter verification rules can limit the way to perform parameter verification, such as regular verification, etc., and can also limit parameter conditions, such as whether it is empty, the value range, etc.

[0097] S2302: Determine whether the interface parameter verification passes.

[0098] For example, the parameter condition in the parameter verification rule corresponding to a certain interface specifies that "the user identity identifier is not empty and is 6 to 12 digits". If the interface parameter requested for data verification is the user identity representation parameter 0123456, then it is determined that the interface parameter verification passes.

[0099] S2303: Determine whether the interface parameter verification fails.

[0100] For example, the parameter condition in the parameter verification rule corresponding to a certain interface is limited to "the ID number is not empty and the age is greater than 18 years old". If the user logs in, the interface parameter requested for data verification is the ID number, and it is determined based on the ID number that the user's age does not meet the login conditions, then the interface parameter verification is determined to have failed.

[0101] Figure 4 Another flow chart of a parameter verification method provided by an embodiment, such as Figure 4 As shown, in one embodiment, after step S230 verifies the interface parameters according to the parameter verification rule, the following steps may also be included:

[0102] S240: Return the verification result to the client, and display the verification result through the display interface of the client.

[0103] The interface parameter requested for data verification may be one or more. If all the interface parameters pass the verification, a verification result of passing the verification is obtained. If one or more interface parameters fail the verification, a verification result of failing the verification is obtained.

[0104] If the verification is passed, the verification result will be returned to the client. The verification result can be presented in a variety of ways, such as the prompt information of the next step, or refreshing the next screen, etc. If the login operation verification is passed, the client display interface will display "Logging in" and other information, or the login screen will be updated and the next screen will be automatically displayed. If the verification fails, the verification failure result will be returned to the client. The verification failure result can also be presented in a variety of ways, such as displaying a prompt message of "Parameter Abnormal" or prompting the user to enter the correct information, etc.

[0105] For example, the user name parameter in the interface parameter is subject to regular check. The regular check rule requires that the user name must contain 8 to 12 characters and cannot contain spaces. According to the regular check rule, the user name parameter in the interface parameter is matched and prompted. If the match is successful, it prompts that the user name is available; if the match fails, it prompts that the user name contains illegal characters.

[0106] In order to more clearly illustrate the technical solution of the present application, a detailed description is given taking the login operation as an example.

[0107] The user first configures the data verification rules of the interface requested during the login operation on the parameter verification configuration page. For example, multiple verification items are displayed on the parameter verification configuration page, such as user name, age, gender, etc. Set the corresponding parameter conditions according to the attributes of each verification item, such as the parameter condition of the user name is "not empty", the parameter condition of the age is "between the maximum value of 69 and the minimum value of 18", and the parameter condition of the gender is "unlimited".

[0108] When the user clicks a relevant button on the parameter verification configuration page, such as the "Generate" or "Confirm" button, the server obtains the content set by the user on the parameter verification configuration page, generates a parameter verification dictionary based on at least one verification object and its corresponding attributes and the set parameter conditions, and saves it to the database. The parameter verification dictionary is a code file generated in a predetermined format and includes a series of character strings. Optionally, each parameter verification dictionary has a unique identifier. For example, the interface name can be mapped to the parameter verification dictionary, and the interface name can be used as the unique identifier of the parameter verification dictionary, such as using the keyword "name" of the user name as the unique identifier of a parameter verification dictionary of a certain interface parameter.

[0109] When the client receives the login operation made by the user, it sends a data verification request to the server to request to call the relevant interface. The server determines the interface name and interface parameters based on the data verification request, and searches the database for the corresponding parameter verification dictionary based on the interface name. The parameter verification dictionary is {"login":{"name":"required:true;pattern:regular name"}}.

[0110] Furthermore, according to the identification of the preset segmentation symbol in the parameter verification dictionary, at least one verification object in the parameter verification dictionary and its corresponding parameter verification rule are determined, wherein the parameter verification rule includes a verification item and its corresponding parameter condition, and according to the configuration parameters of the verification item, it can be determined whether to verify the verification object according to the parameter condition of the verification item. If the interface parameters all meet the parameter conditions of each verification item, the verification passes; if one or more verification items of the interface parameters do not meet the corresponding parameter conditions, the verification fails, and the corresponding prompt information is fed back to the client.

[0111] It should be noted that, after the front-end parameter verification is passed according to the preset parameter verification rules, the front-end server generates a parameter verification dictionary according to the parameter verification rules and saves it to the database, and the back-end queries the corresponding parameter verification rules from the parameter verification dictionary in the database to perform parameter verification. Alternatively, the front-end server generates a parameter verification dictionary according to the parameter verification rules of at least one verification object set by the preset settings, and saves the parameter verification dictionary to the database. When performing front-end and back-end parameter verification, the front-end server and the back-end server respectively query the corresponding parameter verification rules from the parameter verification dictionary in the database to perform parameter verification.

[0112] The parameter verification method provided in this embodiment does not require back-end personnel to reconfigure parameter verification rules, so that the front-end and back-end parameter verification can be completed by the same person, saving the workload of developers. At the same time, the parameter verification rules of the back-end are consistent with the parameter verification rules of the front-end, avoiding problems such as verification omissions, ensuring the uniformity of the front-end and back-end parameter verification results, and improving data verification efficiency and accuracy.

[0113] The above examples are only used to assist in explaining the technical solution of the present disclosure, and the illustrated contents and specific processes involved do not constitute a limitation on the usage scenarios of the technical solution of the present disclosure.

[0114] The relevant embodiments of the parameter verification device are described in detail below.

[0115] Figure 5 It is a structural diagram of a parameter verification device provided in an embodiment of the present application. The parameter verification device can be executed on a server, and is described below using a back-end server as an example.

[0116] like Figure 5 As shown, the parameter verification device 200 may include: a verification request receiving module 210, a verification rule determining module 220 and a verification result obtaining module 230;

[0117] The verification request receiving module 210 is used to receive a data verification request sent by a client, and determine the interface name and interface parameters corresponding to the interface requested to be called according to the data verification request;

[0118] The verification rule determination module 220 is used to query the parameter verification rule in the parameter verification dictionary corresponding to the interface from the database according to the interface name; wherein the parameter verification dictionary is generated by the front-end server receiving the user's parameter verification rule setting for at least one verification object of the interface, and stored in the corresponding database;

[0119] The verification result obtaining module 230 is used to verify the interface parameters according to the parameter verification rule to obtain parameter verification results.

[0120] The parameter verification method provided in this embodiment performs interface parameter verification by obtaining corresponding parameter verification rules from a parameter verification dictionary generated by the verification rules configured by the front-end server for receiving user interface call data verification from a database through a back-end server, thereby ensuring consistency in the front-end and back-end verification of the same interface parameters, avoiding problems such as verification omissions, improving the accuracy of parameter verification, and at the same time saving the workload of developers and improving parameter verification efficiency.

[0121] In one possible implementation, the verification rule determination module 220 includes: a verification dictionary query unit and a verification rule determination unit; wherein the verification dictionary query unit is used to query the parameter verification dictionary corresponding to the interface name from the database according to the interface name; the verification rule determination unit is used to traverse the parameter verification dictionary to determine the parameter value of the verification object corresponding to the interface name, and determine the parameter verification rule for performing parameter verification on the interface according to the parameter value.

[0122] In one possible implementation, the verification rule determination unit includes: a verification item determination subunit and a verification rule determination subunit; wherein the verification item determination subunit is used to determine at least one verification item contained in the parameter value using a preset separation symbol in the parameter value; and the verification rule determination subunit is used to determine a parameter verification rule corresponding to parameter verification of the interface based on the configuration parameters corresponding to the verification item.

[0123] In a possible implementation, the parameter verification rules include regular verification rules; the verification rule determination subunit is specifically used to determine the regular verification rules corresponding to the interface parameters from a pre-configured regular configuration management module according to the configuration parameters corresponding to the verification items; wherein the regular configuration management module is obtained by integrating multiple regular verification rules corresponding to multiple interface parameters, and the regular verification rules include at least one of a regular expression name, a regular expression content, and a regular expression description information.

[0124] In a possible implementation, the parameter verification rule includes a common parameter verification rule; the verification rule determination module 220 includes a common parameter verification rule determination unit, which is used to determine that the interface parameter to be verified is a common parameter according to the name of the verification object corresponding to the interface, and obtain the common parameter verification rule corresponding to the common parameter from a database; wherein the common parameter verification rule is set based on the verification rules corresponding to at least two verification objects with the same or similar attributes.

[0125] In a possible implementation, the verification result obtaining module includes: a parameter condition judgment unit, which is used to judge whether the interface parameters meet the corresponding parameter conditions in the parameter verification rules according to the parameter verification rules corresponding to each interface parameter; if so, it is determined that the interface parameter verification has passed, otherwise it is determined that the interface parameter verification has failed.

[0126] In a possible implementation, the parameter verification device 200 further includes: a verification result returning module, configured to return the verification result to the client and display the verification result through a display interface of the client.

[0127] The parameter verification device of this embodiment can execute the parameter verification method shown in the previous embodiments of this application. The implementation principle is similar and will not be repeated here.

[0128] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the parameter verification dictionary and other data related to parameter verification generated by the front-end server receiving the user to set the verification rules for at least one verification object of the interface. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a parameter verification method is implemented.

[0129] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0130] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0131] Receive a data verification request sent by the client, and determine the interface name and interface parameters corresponding to the requested calling interface according to the data verification request;

[0132] According to the interface name, query the parameter verification rules in the parameter verification dictionary corresponding to the interface from the database; wherein the parameter verification dictionary is generated by the front-end server receiving the verification rule setting of at least one verification object of the interface by the user, and stored in the corresponding database;

[0133] The interface parameters are verified according to the parameter verification rules to obtain parameter verification results.

[0134] In one embodiment, when the processor executes the computer program, the following steps are also implemented: querying a parameter verification dictionary corresponding to the interface name from a database according to the interface name; traversing the parameter verification dictionary to determine the parameter value of the verification object corresponding to the interface name, and determining a parameter verification rule for performing parameter verification on the interface according to the parameter value.

[0135] In one embodiment, when the processor executes the computer program, the following steps are also implemented: using the preset separation symbol in the parameter value to determine at least one check item contained in the parameter value; determining the parameter check rule corresponding to the parameter check of the interface according to the configuration parameters corresponding to the check item.

[0136] In one embodiment, the parameter verification rules include regular verification rules; when the processor executes the computer program, the following steps are also implemented: determining the regular verification rules corresponding to the interface parameters from a pre-configured regular configuration management module according to the configuration parameters corresponding to the verification items; wherein the regular configuration management module is obtained by integrating multiple regular verification rules corresponding to multiple interface parameters, and the regular verification rules include at least one of a regular expression name, a regular expression content, and a regular expression description information.

[0137] In one embodiment, the parameter verification rules include common parameter verification rules; when the processor executes the computer program, the following steps are also implemented: determining that the interface parameter to be verified is a common parameter according to the name of the verification object corresponding to the interface, and obtaining the common parameter verification rules corresponding to the common parameter from a database; wherein the common parameter verification rules are set based on the verification rules corresponding to at least two verification objects with the same or similar attributes.

[0138] In one embodiment, when the processor executes the computer program, the following steps are also implemented: judging whether the interface parameters meet the corresponding parameter conditions in the parameter verification rules according to the parameter verification rules corresponding to the various interface parameters; if so, determining that the interface parameter verification has passed; otherwise, determining that the interface parameter verification has failed.

[0139] In one embodiment, when the processor executes the computer program, the following steps are further implemented: returning the verification result to the client, and displaying the verification result through the display interface of the client.

[0140] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0141] Receive a data verification request sent by the client, and determine the interface name and interface parameters corresponding to the requested calling interface according to the data verification request;

[0142] According to the interface name, query the parameter verification rules in the parameter verification dictionary corresponding to the interface from the database; wherein the parameter verification dictionary is generated by the front-end server receiving the verification rule setting of at least one verification object of the interface by the user, and stored in the corresponding database;

[0143] The interface parameters are verified according to the parameter verification rules to obtain parameter verification results.

[0144] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0145] According to the interface name, a parameter verification dictionary corresponding to the interface name is queried from a database; the parameter verification dictionary is traversed to determine the parameter value of the verification object corresponding to the interface name, and the parameter verification rule for performing parameter verification on the interface is determined according to the parameter value.

[0146] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: using the preset separation symbol in the parameter value to determine at least one check item contained in the parameter value; determining the parameter check rule corresponding to the parameter check of the interface according to the configuration parameters corresponding to the check item.

[0147] In one embodiment, the parameter verification rules include regular verification rules; when the computer program is executed by the processor, the following steps are also implemented: determining the regular verification rules corresponding to the interface parameters from a pre-configured regular configuration management module according to the configuration parameters corresponding to the verification items; wherein the regular configuration management module is obtained by integrating multiple regular verification rules corresponding to multiple interface parameters, and the regular verification rules include at least one of a regular expression name, a regular expression content, and a regular expression description information.

[0148] In one embodiment, the parameter verification rules include common parameter verification rules; when the computer program is executed by the processor, the following steps are also implemented: determining that the interface parameter to be verified is a common parameter according to the name of the verification object corresponding to the interface, and obtaining the common parameter verification rules corresponding to the common parameter from a database; wherein the common parameter verification rules are set based on the verification rules corresponding to at least two verification objects with the same or similar attributes.

[0149] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: judging whether the interface parameters meet the corresponding parameter conditions in the parameter verification rules according to the parameter verification rules corresponding to the various interface parameters; if so, determining that the interface parameter verification has passed, otherwise determining that the interface parameter verification has failed.

[0150] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: returning the verification result to the client, and displaying the verification result through the display interface of the client.

[0151] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM). It should be understood that, although the various steps in the above-mentioned flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0152] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0153] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A parameter verification method, characterized in that: Applied to a backend server, the method comprises: Receive a data verification request sent by the client, and determine the interface name and interface parameters corresponding to the requested calling interface according to the data verification request; According to the interface name, query the parameter verification dictionary corresponding to the interface name from the database; The parameter verification dictionary is traversed to determine the parameter value of the verification object corresponding to the interface name, at least one verification item contained in the parameter value is determined using a preset segmentation symbol in the parameter value, and a parameter verification rule corresponding to the parameter verification of the interface is determined according to the configuration parameter corresponding to the verification item; wherein the parameter verification dictionary is generated by the front-end server receiving the verification rule setting of at least one verification object of the interface by the user, and stored in the corresponding database; The parameter verification rule includes a regular verification rule, and the step of determining the parameter verification rule corresponding to the parameter verification of the interface according to the configuration parameter corresponding to the verification item includes: Determine the regular check rule corresponding to the interface parameter from a pre-configured regular configuration management module according to the configuration parameter corresponding to the check item; wherein the regular configuration management module is obtained by integrating multiple regular check rules corresponding to multiple interface parameters, and the regular check rule includes at least one of a regular expression name, a regular expression content, and a regular expression description information; The interface parameters are verified according to the parameter verification rules to obtain parameter verification results.

2. The method according to claim 1, characterized in that The parameter verification rules include common parameter verification rules; The step of querying the parameter verification rules in the parameter verification dictionary corresponding to the interface from the database includes: According to the name of the verification object corresponding to the interface, it is determined that the interface parameter to be verified is a common parameter, and the common parameter verification rule corresponding to the common parameter is obtained by querying from the database; wherein the common parameter verification rule is set based on the verification rules corresponding to at least two verification objects with the same or similar attributes.

3. The method according to claim 1, characterized in that The step of verifying the interface parameters according to the parameter verification rule comprises: According to the parameter verification rules corresponding to each interface parameter, determine whether the interface parameter meets the corresponding parameter conditions in the parameter verification rules; If so, it is determined that the interface parameter check has passed; otherwise, it is determined that the interface parameter check has failed.

4. The method according to any one of claims 1 to 3, characterized in that: After the step of verifying the interface parameters according to the parameter verification rule, the method further includes: The verification result is returned to the client and displayed on the display interface of the client.

5. A parameter verification device, characterized in that: Applied to a backend server, the device comprises: A verification request receiving module is used to receive a data verification request sent by a client, and determine the interface name and interface parameters corresponding to the interface called by the request according to the data verification request; A verification rule determination module, used to query a parameter verification dictionary corresponding to the interface name from a database according to the interface name, traverse the parameter verification dictionary to determine the parameter value of the verification object corresponding to the interface name, use the preset separation symbol in the parameter value to determine at least one verification item contained in the parameter value, and determine the parameter verification rule corresponding to the parameter verification of the interface according to the configuration parameters corresponding to the verification item; wherein the parameter verification dictionary is generated by a front-end server receiving a user's parameter verification rule setting for at least one verification object of the interface, and stored in a corresponding database; wherein the parameter verification rule includes a regular verification rule, and the verification rule determination module is used to determine the regular verification rule corresponding to the interface parameter from a pre-configured regular configuration management module according to the configuration parameters corresponding to the verification item; wherein the regular configuration management module is obtained by integrating multiple regular verification rules corresponding to multiple interface parameters, and the regular verification rule includes at least one of a regular expression name, a regular expression content, and a regular expression description information; The verification result obtaining module is used to verify the interface parameters according to the parameter verification rules to obtain parameter verification results.

6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Parameter verification method, device, computing device and storage medium

    CN109101812A

  • Interface parameter verification method, apparatus and device, and computer readable storage medium

    CN110674376A