Parameter verification method and device, electronic equipment and storage medium

By configuring the central platform and custom annotations to determine the target version configuration interval and applying verification rules, the problem of unification of parameter verification of different versions requested parameters is solved, and parameter verification and processing of users of different versions is realized, which improves the system's reusability and robustness.

CN119621522APending Publication Date: 2025-03-14BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311175647.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-12
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

The prior art cannot perform unified verification of request parameters of different versions, resulting in low version users being unable to use them normally.

Method used

By receiving user requests, determine the version number and request fields in the request parameters, and configure the target version configuration interval based on the configuration center platform and custom annotations, and apply the corresponding verification rules to verify the request parameters.

Benefits of technology

It realizes unified verification of request parameters of different versions, avoids software system problems caused by parameter entry errors, such as SQL injection and system crashes, and improves system reusability and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621522A_ABST
    Figure CN119621522A_ABST
Patent Text Reader

Abstract

The invention provides a parameter verification method and device, electronic equipment and a computer readable storage medium, and relates to the technical field of computers. The method comprises the steps of configuring at least one target version configuration interval based on a configuration center platform and a user-defined annotation; the target version configuration interval comprises a full path of a field, a field identifier, a minimum version number compatible with the field, a maximum version number compatible with the field, a verification rule, a version interval compatible with the field and / or annotation information; receiving a user request, and determining a version number and a request field corresponding to the user request; determining one or more target version configuration intervals suitable for the user request version corresponding to the request parameter; verifying the request parameter based on one or more verification rules corresponding to the target version configuration interval and generating a verification result; according to the embodiment of the invention, unified verification can be carried out on different versions of request parameters, and risks caused by parameter entering errors are avoided in advance.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] Parameter verification is an essential part of the software system development process. It can make judgments in advance before the user request enters the system business logic, identify some problems or risks, and terminate the user's request in advance to avoid the software system facing various problems such as SQL (Structured Query Language) injection and system crashes due to user request input errors.

[0003] With the continuous iteration of system versions, parameters and parameter verification logic are constantly changing; related technologies cannot uniformly control or verify interface input parameters of different versions; for example, if a required parameter is added in a higher version, we have no way to perform unified verification, because there are multiple versions of the APP (application) side in use at the same time. Once the required verification is added, many versions between the low version and the high version of the APP side will be verified, which will cause low-version users to be unable to use it normally.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] The present disclosure provides a parameter verification method, device, electronic device and computer-readable storage medium, which at least to a certain extent overcome the problem in the related art that request parameters of different versions cannot be uniformly verified.

[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0007] According to one aspect of the present disclosure, a parameter verification method is provided, including: receiving a user request, determining a request parameter corresponding to the user request; wherein the request parameter includes: a version number, a request field; determining one or more target version configuration intervals corresponding to the request parameter; and verifying the request parameter based on one or more verification rules corresponding to the target version configuration interval and generating a verification result.

[0008] In one embodiment of the present disclosure, it also includes: configuring the target version configuration interval based on at least one of the configuration center platform and the custom annotation; wherein the target version configuration interval includes: the full path of the field, the field identifier, the minimum version number compatible with the field, the maximum version number compatible with the field, the verification rule, the version interval compatible with the field, and at least one of the annotation information.

[0009] In one embodiment of the present disclosure, determining one or more target version configuration intervals corresponding to the request parameters according to the request parameters includes: determining the full path corresponding to the request field based on reflection technology; and determining the target version configuration interval according to the version number and the full path.

[0010] In one embodiment of the present disclosure, determining one or more target version configuration intervals corresponding to the request parameters according to the request parameters includes: determining annotation information corresponding to the request field based on reflection technology; and determining the target version configuration interval according to the version number and the annotation information.

[0011] In one embodiment of the present disclosure, the method further includes: when the request field is a composite type field, processing the request field to generate a basic type field.

[0012] In one embodiment of the present disclosure, determining one or more target version configuration intervals corresponding to the request parameters according to the request parameters includes: when the request field is available and the field attribute value of the request field is not empty, determining one or more target version configuration intervals corresponding to the request parameters according to the request parameters.

[0013] In one embodiment of the present disclosure, it also includes:

[0014] When at least one of the following conditions is met, the request field is left blank:

[0015] The version number is not within the target version configuration range;

[0016] The requested field is not available;

[0017] The field attribute value of the request field is empty;

[0018] The version number mentioned is not available;

[0019] The field attribute value of the version number is empty.

[0020] In one embodiment of the present disclosure, the verification rule includes at least one of the following: non-empty verification, string length verification, and mobile phone number regular verification.

[0021] According to another aspect of the present disclosure, there is also provided a parameter verification device, comprising:

[0022] A parameter determination module receives a user request and determines a request parameter corresponding to the user request; wherein the request parameter includes: a version number and a request field;

[0023] A configuration determination module determines one or more target version configuration intervals corresponding to the request parameters;

[0024] The verification generation module verifies the request parameters based on one or more verification rules corresponding to the target version configuration interval and generates a verification result.

[0025] According to another aspect of the present disclosure, an electronic device is also provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any one of the above-mentioned parameter verification methods by executing the executable instructions.

[0026] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the parameter verification method described in any one of the above is implemented.

[0027] The parameter verification method, device, electronic device and computer-readable storage medium provided by the embodiments of the present disclosure configure a target version configuration interval based on at least one of a configuration center platform and a custom annotation; wherein the target version configuration interval includes: the full path of the field, the field identifier, the minimum version number compatible with the field, the maximum version number compatible with the field, the verification rule, the version interval compatible with the field, and / or the annotation information; receive a user request and determine the request parameters corresponding to the user request; wherein the request parameters include: the version number, the request field; determine one or more target version configuration intervals applicable to the user requested version corresponding to the request parameters; perform a unified verification on the request fields based on one or more verification rules corresponding to the target version configuration interval and generate a verification result, and then process the requests that pass the verification, so as to perform a unified verification on the request parameters of different versions, make a judgment in advance before the user request enters the system business logic, identify some problems or risks, and terminate the user request in advance, so as to avoid problems such as SQL injection and system crash caused by the user request due to input errors.

[0028] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0030] Figure 1 A flow chart of a parameter verification method in an embodiment of the present disclosure is shown;

[0031] Figure 2A flow chart of a method for determining a target version configuration interval in an embodiment of the present disclosure is shown;

[0032] Figure 3 A flow chart of a method for verifying user request parameters in an embodiment of the present disclosure is shown;

[0033] Figure 4 A flow chart of a version control parameter checking method according to an embodiment of the present disclosure is shown;

[0034] Figure 5 A schematic diagram of a version number configuration service in an embodiment of the present disclosure is shown;

[0035] Figure 6 A schematic diagram of a parameter verification rule service in an embodiment of the present disclosure is shown;

[0036] Figure 7 A schematic diagram of a parameter verification device in an embodiment of the present disclosure is shown; and

[0037] Figure 8 A structural block diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0038] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0039] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0040] For ease of understanding, several terms involved in the present disclosure are explained below:

[0041] JSR 303: JSR303 is a standard framework provided by Java for Bean data validity verification. It has been included in JavaEE6.0. JSR303 specifies verification rules by marking standard annotations such as @NotNull@Max in Bean properties, and verifies Beans through standard verification interfaces.

[0042] JSR 380: JSR 380 is a Java API specification for Bean Validation, part of JavaEE and JavaSE, using annotations such as @NotNull, @Min, @Max to ensure that Bean properties meet certain conditions. It is an upgraded version of JSR-303.

[0043] Custom annotation: Annontation is a new feature introduced in Java5, and its Chinese name is annotation. A custom annotation is an annotation specially defined according to the business requirements within the system. This application will define the custom annotation as: @CheckParamByVersion.

[0044] JSON format: JSON (JavaScript Object Notation) is a lightweight data exchange format. It is easy for humans to read and write, and can exchange data between multiple languages.

[0045] The present exemplary implementation is described in detail below with reference to the accompanying drawings and embodiments.

[0046] First, a parameter verification method is provided in an embodiment of the present disclosure, and the method can be executed by any electronic device with computing and processing capabilities.

[0047] Figure 1 A flow chart of a parameter verification method in an embodiment of the present disclosure is shown as follows: Figure 1 As shown, the parameter verification method provided in the embodiment of the present disclosure includes the following steps:

[0048] S102, receiving a user request and determining a request parameter corresponding to the user request.

[0049] In one embodiment, the request parameters include, but are not limited to, version number, request field, version verification code and other data.

[0050] In one embodiment, in response to a user request from the front end for requesting a back end service, request parameters are obtained; it should be noted that the version number can be parsed by the front end and sent to the back end, or the back end can parse the user request to obtain the version number.

[0051] S104, determining one or more target version configuration intervals corresponding to the request parameters;

[0052] In one embodiment, the target version configuration interval is configured based on at least one of the configuration center platform and custom annotations; the target version configuration interval is the configuration of different versions and different verification rule services; the target version configuration interval includes but is not limited to: the full path of the field, the field identifier, the minimum version number compatible with the field, the maximum version number compatible with the field, the verification rule, the version interval compatible with the field, and at least one of the custom annotation information.

[0053] In one embodiment, the configuration center platform includes but is not limited to: Disconf (Distributed Configuration Management Platform), Spring Cloud Config, Apollo, Nacos, etc.

[0054] In one embodiment, when multiple target version configuration intervals corresponding to request parameters are determined based on request parameters, verification rules corresponding to the multiple target version configuration intervals can be executed; or corresponding target version configuration intervals can be executed based on preset priorities; for example, the target version configuration interval based on the configuration center platform and the target version configuration interval based on the custom annotation configuration corresponding to the request parameters are determined based on the request parameters; if the priority of the configuration center platform configuration is higher than the priority of the custom annotation configuration by default, the target version configuration interval based on the configuration center platform is executed to implement emergency intervention in the production environment, which is used to deal with temporary sudden problems.

[0055] In one embodiment, if the priority of the configuration center platform configuration is higher than the priority of the custom annotation configuration by default, when a user request comes in, all request fields in the Java class are obtained through Java reflection, and then the request fields are traversed one by one. When a certain request field is traversed, the configured version configuration interval information is first obtained from the configuration center platform based on the full path of the Java class where the current request field is located. If it is not obtained, the custom annotation configured on the current request field is obtained through Java reflection, and the configured version configuration interval information is obtained from the custom annotation.

[0056] In one embodiment, when the request field is available and the field attribute value of the request field is not empty, one or more target version configuration intervals corresponding to the request parameter are determined according to the request parameter.

[0057] In one embodiment, the first version configuration interval corresponding to the version number can be determined according to the version number, and then the target version configuration interval corresponding to the request field is obtained according to the request field in the first version configuration interval, and then the verification rule corresponding to the target version configuration interval is obtained.

[0058] In one embodiment, the second version configuration interval corresponding to the request field can be determined according to the request field, and then the target version configuration interval corresponding to the version number is obtained according to the version number in the second version configuration interval, and then the verification rule corresponding to the target version configuration interval is obtained.

[0059] In one embodiment, when the request field is a composite type field, the request field is processed to generate a basic type field; specifically, the request parameters are parsed to obtain an object array, the object array is traversed, and the composite type field in the object array is forcibly converted to a basic type field; then the target version configuration interval is determined based on the basic type field, which can improve the efficiency of determining the verification rules corresponding to the target version configuration interval based on the request field.

[0060] In one embodiment, the composite type field includes but is not limited to at least one of the following: list type, set type, map type, etc. The basic type field may be of object type, but is not limited to this type, and one or more basic types may be set according to user needs.

[0061] In one embodiment, the full path corresponding to the request field is determined based on reflection technology; and the target version configuration interval is determined according to the version number and the full path.

[0062] In one embodiment, the annotation information corresponding to the request field is determined based on reflection technology; and the target version configuration interval is determined according to the version number and the annotation information.

[0063] In one embodiment, the request field is left blank when at least one of the following conditions is met:

[0064] The version number is not in the target version configuration range;

[0065] The requested field is not available;

[0066] The field attribute value of the requested field is empty;

[0067] Version number is not available;

[0068] The field attribute value of the version number is empty, etc.

[0069] By leaving the request field empty, the field value can be ignored. At this time, the parameter value passed in the user request will be invalid, so the related logic will no longer be executed. This can help find problems early during the test process, so that each front-end uses the same processing logic.

[0070] S106: Verify the request parameters based on one or more verification rules corresponding to the target version configuration interval and generate a verification result.

[0071] In one embodiment, the verification rules include but are not limited to at least one of the following: non-empty verification, string length verification, mobile phone number regular verification, etc.

[0072] In one embodiment, the verification rules may be executed in sequence according to a preset verification priority to verify the request parameters and generate a verification result.

[0073] In one embodiment, the verification results include but are not limited to: pass prompts, error prompts, error causes, etc.; corresponding operations are performed according to the verification results. For example, when the request parameters do not pass at least one verification rule, an error prompt is directly returned to the user; when the request parameters pass the verification rules, the business logic continues to be executed.

[0074] In one embodiment, the request parameters may be verified based on the JSR 303 or JSR 380 standard architecture.

[0075] In the related technology, for example, a field is supported and used normally in a lower version, but needs to be discarded in a higher version. In this case, due to the compatibility logic in the system, the front end (PC, Android, iOS) can still use the lower version of the field even if it is a higher version. So, which version will be compatible and discarded? The back-end system depends on the highest version no longer used by the front end. In this case, users of the same version of PC, Android, and iOS may use different versions of the compatibility logic of the back end, which will result in different data or styles displayed on the three ends. A field that needs to be supported and required in a lower version but needs to be discarded in a higher version will cause the required verification logic of the lower version to make it unusable for users of the higher version. A field is newly added and required in a higher version, but the lower version of the APP has been released to the application market and the user has installed it on the phone, so intervention cannot be made and only compatibility logic processing can be performed. The above situations cannot be verified uniformly and can only be verified for different versions.

[0076] In the above embodiment, a compatible version configuration interval is configured for each field. For user requests of different versions, when the system is running, the configured version configuration interval is obtained, and then compared with the version number used by the client to determine the matching version configuration interval, and the corresponding verification rules are obtained to verify the field, so as to achieve unified parameter verification and processing for users of different versions for different fields and applicable versions, which greatly improves the reusability and robustness of the system, greatly reduces the subsequent maintenance costs, and improves the system's R&D cycle and delivery cycle.

[0077] Figure 2 A flow chart of a method for determining a target version configuration interval in an embodiment of the present disclosure is shown. Figure 2 As shown, the target version configuration interval determination method provided in the embodiment of the present disclosure includes the following steps:

[0078] S202, determining the full path corresponding to the request field based on reflection technology;

[0079] Reflection technology means that in the running state, for any class, all the properties and methods of this class can be known; for any object, any of its methods and properties can be called; this function of dynamically obtaining information and dynamically calling object methods is called reflection technology of Java language.

[0080] In order to be compatible with identifying any Java class, when using Java reflection, the full path of the Java class can be obtained based on the Java class information, that is, the full path of the Java class. The Java class used may exist in Java class A, and the field names defined in Java class B may be repeated, for example, both may have id field names. Therefore, in order to distinguish whether the controlled id is the id in Java class A or the id in Java class B, the full path of the Java class and the id field name are concatenated together as the only distinguishing identifier, that is, class full path#field name.

[0081] S204, determining the target version configuration interval according to the version number and the full path.

[0082] In one embodiment, the configuration methods of the target version configuration interval include but are not limited to: configuration center platform, custom annotations, etc. Different configuration methods can be set according to user needs, and the mapping information corresponding to the field can be determined accordingly, such as the full path, annotation information, etc.

[0083] In one embodiment, the two configuration methods of configuration center platform and custom annotation are introduced as examples. From the version configuration service selector, all version number configuration services implemented by the developer can be obtained, such as the configuration center platform version configuration service and the custom annotation version configuration service, and then the version configuration services are executed one by one until the configuration information is obtained; the version configuration interval information configured in the configuration center platform can be determined from the configuration center platform version configuration service based on the version number and the full path.

[0084] S206, determining annotation information corresponding to the request field based on reflection technology;

[0085] The annotation information of the Java class and the id field name of the request field are combined as a unique distinguishing identifier, that is, class annotation information#field name. When using Java reflection, the annotation information set on the field in the Java class can be determined based on the obtained Java class information. S208, determine the target version configuration interval based on the version number and the annotation information.

[0086] In one embodiment, it is determined whether the configured version configuration interval information can be obtained from the custom annotation configuration service based on the version number and the full path.

[0087] In one embodiment, it is possible to determine whether the version configuration interval information configured in the configuration center platform can be obtained from the configuration center platform version configuration service, and whether the configured version configuration interval information can be obtained from the custom annotation configuration service, and then decide which version configuration interval information to execute based on the priority; it is also possible to first determine whether the version configuration interval information configured in the configuration center platform can be obtained from the configuration center platform version configuration service based on the priority, or first determine whether the configured version configuration interval information can be obtained from the custom annotation configuration service, and directly perform verification if the version configuration interval information can be obtained, and no longer match to obtain another version configuration interval information, or it is possible to determine whether to match to obtain another version configuration interval information based on the priority.

[0088] In the above embodiment, all version number configuration services implemented by the developer can be obtained from the version configuration service selector, such as the configuration center platform version configuration service and the custom annotation version configuration service. Then, the version configuration services are executed one by one until the configuration information is obtained, and parameter verification is performed to achieve unified parameter verification and processing for users of different versions for different fields and applicable versions.

[0089] Figure 3 A flow chart of a method for verifying user request parameters in an embodiment of the present disclosure is shown as follows: Figure 3 As shown, the user request parameter verification method provided in the embodiment of the present disclosure includes the following steps:

[0090] S302, developing the business code logic related to the parameter verification rule service; configuring the version number and the corresponding verification rule service for the request parameters in the interface.

[0091] S304, when the user request enters the interface, the configured version number and the corresponding verification rules are obtained according to the request parameters, and the parameters are verified one by one;

[0092] S306: When the request parameter fails to pass at least one verification rule, an error prompt is directly returned to the user.

[0093] S308: When the request parameters pass all verification rules, the business logic continues to be executed.

[0094] In the above embodiment, if the input parameter requested by the user is not within the applicable version range, the input parameter is discarded. If it is within the applicable version range, parameter verification is performed. If all verifications pass, the business logic continues to be executed to achieve unified parameter verification and processing for users of different versions for different fields and applicable versions.

[0095] Figure 4 A flow chart of a version control parameter verification method in an embodiment of the present disclosure is shown as follows: Figure 4 As shown, the version control parameter verification method provided in the embodiment of the present disclosure includes the following steps:

[0096] S402, traversing the request fields in the object array corresponding to the request parameters;

[0097] S404, determine whether the requested field is empty or a basic type field; if so, traverse the fields in the next object array; otherwise, proceed to the next step.

[0098] S406, determine whether the request field is of list type; if so, convert it to a basic type field; otherwise, proceed to the next step.

[0099] S408, determine whether the request field is of set type; if so, convert it to a basic type field; otherwise, proceed to the next step.

[0100] S410, determine whether the requested field is of map type; if so, convert it to a basic type field; otherwise, proceed to the next step.

[0101] S412, traversing the requested fields in the basic type field array;

[0102] S414, obtaining version number configuration and parameter verification rule configuration;

[0103] 1) Figure 5 A schematic diagram of a version number configuration service in an embodiment of the present disclosure is shown; Figure 5 As shown: The version configuration service selector can obtain the configuration center platform configuration implementation class and the custom annotation configuration implementation class based on the version configuration unified service interface.

[0104] Different versions and verification rule services can be flexibly configured for different fields.

[0105] In one embodiment, it can be configured through custom annotations, such as @CheckParamByVersion, or using the configuration center platform. The priority of the configuration center platform configuration is higher than the custom annotation configuration by default. If there is a special configuration processing method, it can be implemented by the developer's customized extension.

[0106] In one embodiment, the configuration center platform configures the version configuration interval information in the following manner:

[0107] Configure according to the json format:

[0108] com.AAA: The full path of the Java class where the configured field name is located is AAA.

[0109] minVersion: 1.0.0; the minimum version number compatible with the current field is 1.0.0.

[0110] maxVersion: 2.0.0; the maximum version number compatible with the current field is 2.0.0.

[0111] checkRuleList: paramNotNullCheckServiceImpl; within the version number range compatible with the current field, the check rule that needs to be executed is paramNotNullCheckServiceImpl.

[0112] In one embodiment, the custom annotation configuration version configuration interval information method is:

[0113] private Long addressId: a parameter field defined in the Java class.

[0114] @CheckParamByVersion: custom annotation;

[0115] minVersion: 1.0.0; the minimum version number compatible with the current field is 1.0.0.

[0116] maxVersion: 2.0.0; the maximum version number compatible with the current field is 2.0.0.

[0117] checkRuleList: paramNotNullCheckServiceImpl; within the version number range compatible with the current field, the check rule that needs to be executed is paramNotNullCheckServiceImpl.

[0118] It should be noted that the minimum version number compatible with the current field is 1.0.0, the maximum version number compatible with the current field is 2.0.0, and the full path of the Java class where the configured field name is located is AAA. These are examples and are not limited to these.

[0119] 2) Figure 6 A schematic diagram of a parameter verification rule service in an embodiment of the present disclosure is shown; Figure 6As shown: The verification rule service selector can obtain the non-empty verification implementation class, string length verification, mobile phone number regular verification, etc. based on the verification rule unified service interface.

[0120] It should be noted that the processing of commonly used parameter validation rule services has been implemented and can be directly configured to the required fields; if there is special validation logic, it can be customized by the developer and then configured to the required fields.

[0121] In one embodiment, a parameter can be configured with multiple verification rules, for example, the parameter cannot be empty, and the parameter needs to satisfy the verification of the ID card number; when there are multiple parameter verification rules, the verification priority can be specified.

[0122] S416, determine whether the version number and the request field are available; for example, the APP version used by a user is an old version, such as 5.3.0; the configured compatible version range is a minimum of 1.0.0 and a maximum of 5.3.0, then the user's version is within the compatible range; the configured compatible version range is a minimum of 1.0.0 and a maximum of 5.2.9, then the user's version is not within the compatible range.

[0123] When a user request comes in, all request fields in the Java class are obtained through Java reflection. Then the request fields are traversed one by one. When a request field is traversed, the configuration version and configuration interval information is obtained from the configuration center platform according to the full path of the Java class where the current request field is located. If it is not obtained, the custom annotation configured on the current request field is obtained through Java reflection, and the configuration version and configuration interval information is obtained from the custom annotation.

[0124] From the version configuration service selector, you can obtain all the version number configuration services implemented by the developer, such as the configuration center platform version configuration service and the custom annotation version configuration service, and then execute the version configuration services one by one until the configuration information is obtained; for example, obtain the version configuration interval information configured in the configuration center platform from the configuration center platform version configuration service, and terminate when the configuration information is obtained; if it cannot be obtained, continue to execute and obtain the configured version configuration interval information from the custom annotation configuration service, and so on.

[0125] S418, when the version number or the request field is not available, reset the request field to empty, and determine whether the request field traversal is completed. If the request field traversal is completed, return to the previous level of recursion. If the request field traversal is not completed, traverse the request field again;

[0126] S420, when the version number and request field are available, obtain the request field attribute value and determine whether the request field attribute value is not empty; when the request field attribute value is empty, determine whether the request field traversal is completed, if the request field traversal is completed, return to the previous level of recursion, if the request field traversal is not completed, traverse the request field again; when the request field attribute value is not empty, obtain the corresponding parameter verification rule service from the verification rule selector to determine whether the request field verification passes; when the request field verification fails, throw an exception to terminate the process; when the request field verification passes, determine whether the request field traversal is completed, if the request field traversal is completed, continue to determine the attribute value type and traverse, if the request field traversal is not completed, continue to obtain the corresponding parameter verification rule service from the verification rule selector.

[0127] In the above embodiment, based on the processing scheme combining the version number with the parameter verification logic, the input parameters, the applicable version range, and the verification rules within the version range are obtained through reflection technology. If the input parameters requested by the user are not within the applicable version range, the input parameters are discarded. If they are within the applicable version range, parameter verification processing is performed to achieve unified parameter verification and processing for users of different versions for different fields and different applicable versions, which greatly improves the reusability and robustness of the system, greatly reduces the subsequent maintenance costs, and improves the system's R&D cycle and delivery cycle.

[0128] Based on the same inventive concept, the present disclosure also provides a parameter verification device, such as the following embodiment. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.

[0129] Figure 7 A schematic diagram of a parameter verification device in an embodiment of the present disclosure is shown. Figure 7 As shown, the parameter verification device 7 includes: a parameter determination module 701, a configuration determination module 702 and a verification generation module 703;

[0130] The parameter determination module 701 receives a user request and determines a request parameter corresponding to the user request; wherein the request parameter includes: a version number and a request field;

[0131] Configuration determination module 702, determining one or more target version configuration intervals corresponding to the request parameters;

[0132] In one embodiment, the configuration determination module 702 includes a first determination module, which can first determine a first version configuration interval corresponding to the version number based on the version number, and then obtain a target version configuration interval corresponding to the request field based on the request field in the first version configuration interval, and then obtain a verification rule corresponding to the target version configuration interval.

[0133] In one embodiment, the configuration determination module 702 includes a second determination module, which can first determine the second version configuration interval corresponding to the request field according to the request field, and then obtain the target version configuration interval corresponding to the version number according to the version number in the second version configuration interval, and then obtain the verification rule corresponding to the target version configuration interval.

[0134] In one embodiment, the configuration determination module 702 includes a third determination module, which processes the request field to generate a basic type field when the request field is a composite type field, and then determines the target version configuration interval according to the basic type field.

[0135] In one embodiment, the configuration determination module 702 includes a fourth determination module, which determines the full path corresponding to the request field based on the reflection technology; and determines the target version configuration interval according to the version number and the full path.

[0136] In one embodiment, the configuration determination module 702 includes a fifth determination module, which determines annotation information corresponding to the request field based on reflection technology; and determines the target version configuration interval according to the version number and the annotation information.

[0137] The verification generation module 703 verifies the request parameters based on one or more verification rules corresponding to the target version configuration interval and generates a verification result.

[0138] In one embodiment, the verification generation module 703 is further configured to execute verification rules in sequence according to a preset verification priority to verify the request parameters and generate a verification result.

[0139] In one embodiment, the parameter verification device 7 also includes a configuration module, which configures the target version configuration interval based on at least one of the configuration center platform and custom annotations; the target version configuration interval is a configuration for different versions and different verification rule services; the target version configuration interval includes but is not limited to: the full path of the field, the field identifier, the minimum version number compatible with the field, the maximum version number compatible with the field, the verification rule, the version interval compatible with the field, and at least one of the custom annotation information.

[0140] In the above embodiment, a compatible version configuration interval is configured for each field. For user requests of different versions, when the system is running, the configured version configuration interval is obtained, and then compared with the version number used by the client to determine the matching version configuration interval, and the corresponding verification rules are obtained to verify the field, so as to achieve unified parameter verification and processing for users of different versions for different fields and applicable versions, which greatly improves the reusability and robustness of the system, greatly reduces the subsequent maintenance costs, and improves the system's R&D cycle and delivery cycle.

[0141] In one embodiment, the system architecture may include terminal devices, a network, and a server.

[0142] The network is a medium used to provide a communication link between terminal devices and servers. It can be a wired network or a wireless network.

[0143] Optionally, the wireless network or wired network described above uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or any combination of a virtual private network). In some embodiments, technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged through the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above data communication technologies.

[0144] The terminal device may be any electronic device, including but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., and may send different versions of user requests.

[0145] Optionally, the client of the application installed in different terminal devices is the same, or the client of the same type of application based on different operating systems. Based on the different terminal platforms, the specific form of the client of the application can also be different, for example, the application client can be a mobile client, a PC client, etc.

[0146] The server can be a server that provides various services, such as a background management server that provides support for the device operated by the user using the terminal device. The background management server can analyze and process the received request and other data, and feed back the processing results to the terminal device. For example, it can respond to the user request of the terminal device; determine one or more target version configuration intervals corresponding to the request parameters according to the request parameters; verify the request parameters based on one or more verification rules corresponding to the target version configuration interval and generate verification results, etc.

[0147] Optionally, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.

[0148] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".

[0149] Refer to the following Figure 8 The electronic device 800 according to this embodiment of the present disclosure is described. Figure 8 The electronic device 800 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0150] like Figure 8 As shown, the electronic device 800 is in the form of a general computing device. The components of the electronic device 800 may include but are not limited to: at least one processing unit 810, at least one storage unit 820, and a bus 830 connecting different system components (including the storage unit 820 and the processing unit 810).

[0151] Among them, the storage unit stores a program code, and the program code can be executed by the processing unit 810, so that the processing unit 810 executes the steps described in the above "Exemplary Method" section of this specification according to various exemplary embodiments of the present disclosure. For example, the processing unit 810 can execute the following steps of the above method embodiment: configure the target version configuration interval based on at least one of the configuration center platform and the custom annotation; the target version configuration interval includes: the full path of the field, the field identifier, the minimum version number compatible with the field, the maximum version number compatible with the field, the verification rule, the version interval compatible with the field, and at least one of the annotation information; determine the version number and request field corresponding to the user request according to the user request; determine one or more target version configuration intervals applicable to the user request version corresponding to the request parameter according to the version number and the request field; verify the request parameter based on one or more verification rules corresponding to the target version configuration interval and generate a verification result.

[0152] The storage unit 820 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 8201 and / or a cache memory unit 8202 , and may further include a read-only memory unit (ROM) 8203 .

[0153] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0154] Bus 830 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0155] The electronic device 800 may also communicate with one or more external devices 840 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 800, and / or communicate with any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 850. Furthermore, the electronic device 800 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 860. As shown, the network adapter 860 communicates with other modules of the electronic device 800 via a bus 830. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0156] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0157] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the above method of the present disclosure is stored thereon. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above “Exemplary Method” section of this specification.

[0158] For example, the program product in the embodiment of the present disclosure implements the following method steps when executed by a processor: configuring a target version configuration interval based on a configuration center platform and at least one custom annotation; the target version configuration interval includes: the full path of the field, the field identifier, the minimum version number compatible with the field, the maximum version number compatible with the field, the verification rule, the version interval compatible with the field, and at least one item of annotation information; determining the version number and request field corresponding to the user request according to the user request; determining one or more target version configuration intervals corresponding to the request parameters and applicable to the user requested version according to the version number and request field; verifying the request parameters based on one or more verification rules corresponding to the target version configuration interval and generating a verification result.

[0159] More specific examples of computer-readable storage media in the present disclosure may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0160] In the present disclosure, a computer readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, wherein a readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0161] Alternatively, the program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0162] In a specific implementation, the program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).

[0163] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0164] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0165] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0166] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.

Claims

1. A parameter verification method, characterized in that: include: Receive a user request and determine request parameters corresponding to the user request; wherein the request parameters include: a version number and a request field; Determine one or more target version configuration intervals corresponding to the request parameters; The request parameters are verified based on one or more verification rules corresponding to the target version configuration interval and a verification result is generated.

2. The parameter verification method according to claim 1, characterized in that: Also includes: Based on at least one of the configuration center platform and the custom annotation, the target version configuration interval is configured; wherein the target version configuration interval includes: the full path of the field, the field identifier, the minimum version number compatible with the field, the maximum version number compatible with the field, the verification rule, the version interval compatible with the field, and at least one of the annotation information.

3. The parameter verification method according to claim 1 or 2, characterized in that: Determining one or more target version configuration intervals corresponding to the request parameters according to the request parameters includes: Determine the full path corresponding to the request field based on reflection technology; The target version configuration interval is determined according to the version number and the full path.

4. The parameter verification method according to claim 1 or 2, characterized in that: Determining one or more target version configuration intervals corresponding to the request parameters according to the request parameters includes: Determine annotation information corresponding to the request field based on reflection technology; The target version configuration interval is determined according to the version number and the annotation information.

5. The parameter verification method according to claim 1, characterized in that: Also includes: When the request field is a composite type field, the request field is processed to generate a basic type field.

6. The parameter verification method according to claim 1 or 2, characterized in that: The determining one or more target version configuration intervals corresponding to the request parameters according to the request parameters includes: when the request field is available and the field attribute value of the request field is not empty, determining one or more target version configuration intervals corresponding to the request parameters according to the request parameters.

7. The parameter verification method according to claim 1, characterized in that: Also includes: When at least one of the following conditions is met, the request field is left blank: The version number is not within the target version configuration range; The requested field is not available; The field attribute value of the request field is empty; The version number mentioned is not available; The field attribute value of the version number is empty.

8. The parameter verification method according to claim 1, characterized in that: The verification rules include at least one of the following: non-empty verification, string length verification, and mobile phone number regularization verification.

9. A parameter verification device, characterized in that: include: A parameter determination module receives a user request and determines a request parameter corresponding to the user request; wherein the request parameter includes: a version number and a request field; A configuration determination module determines one or more target version configuration intervals corresponding to the request parameters; The verification generation module verifies the request parameters based on one or more verification rules corresponding to the target version configuration interval and generates a verification result.

10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the parameter verification method according to any one of claims 1 to 8 by executing the executable instructions.

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

Citation Information

Cited By

  • EDA tool operation parameter configuration management method, electronic equipment and storage medium

    CN121031474A

  • EDA tool running parameter configuration management method, electronic device and storage medium

    CN121031474B