CN115878670A - Dynamic parameter matching mock processing method, device, equipment and storage medium - Google Patents

Dynamic parameter matching mock processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN115878670A
CN115878670A CN202211613356.3A CN202211613356A CN115878670A CN 115878670 A CN115878670 A CN 115878670A CN 202211613356 A CN202211613356 A CN 202211613356A CN 115878670 A CN115878670 A CN 115878670A
Authority
CN
China
Prior art keywords
dynamic parameter
matching
parameter
dynamic
key value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211613356.3A
Other languages
Chinese (zh)
Inventor
罗维练
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202211613356.3A priority Critical patent/CN115878670A/en
Publication of CN115878670A publication Critical patent/CN115878670A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for processing dynamic parameter matching mock, wherein a dynamic parameter matching rule is configured, a second target parameter field of a user and a dynamic parameter preset value corresponding to the dynamic parameter preset value are automatically stored in a login state of the user, the second target parameter field, the corresponding dynamic parameter actual value and the dynamic parameter actual value are sequentially matched with the dynamic parameter matching rule, the dynamic parameter preset value and the dynamic parameter preset value in a login state carried in a request message when the user actually sends the request message, and whether the mock is needed or not is judged, so that the technical problem that the parameter matching mode in the existing mock service can only meet the pre-configured parameter matching rule, but the dynamic parameters which are inconsistent in each request, such as sessionin/token and the like, can not be judged in the existing parameter matching mode is solved.

Description

Dynamic parameter matching mock processing method, device, equipment and storage medium
Technical Field
The present application relates to the field of parameter configuration technologies, and in particular, to a method, an apparatus, a device, and a storage medium for dynamic parameter matching mock processing.
Background
Currently, a match rule of a mock service in a bank for a parameter generally includes three match modes of fuzzy match, precise match and regular match, so that rule matching is performed according to a transmitted parameter, and whether the parameter executes logic of mock is judged.
The parameter matching mode in the existing mock service can only meet the preset parameter matching rule, but for some dynamic parameters which are inconsistent in each request, such as sessionid/token and the like, the existing parameter matching mode cannot be adopted for judgment.
Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for processing dynamic parameter matching mock, which solve the technical problem that the parameter matching mode in the existing mock service can only meet the preset parameter matching rule, but the existing parameter matching mode can not be adopted for judging some dynamic parameters which are inconsistent in each request, such as sessionid/token and the like.
In view of this, a first aspect of the present application provides a method for dynamic parameter matching mock processing, where the method includes:
s1, configuring a dynamic parameter matching rule, wherein the dynamic parameter matching rule comprises a first target parameter field and at least one corresponding dynamic parameter preset key value;
s2, generating an api _ url for storing a dynamic parameter preset value corresponding to the dynamic parameter preset key value;
s3, storing a second target parameter field of the user in a login state and a dynamic parameter preset value corresponding to the dynamic parameter preset key value into a database according to the api _ url;
s4, receiving a request message sent by a user, wherein the request message carries the second target parameter field in a login state, a corresponding dynamic parameter actual key value and a dynamic parameter actual value;
s5, matching the second target parameter field and the corresponding dynamic parameter actual key value with the dynamic parameter matching rule;
s6, if the matching is successful, calling a dynamic parameter preset value corresponding to the actual key value of the dynamic parameter;
and S7, matching the preset value of the dynamic parameter with the actual value of the dynamic parameter, executing mock if the matching is successful, and otherwise, forwarding the request message to a real service.
Optionally, the step S1 further includes:
and configuring a response message, wherein the response message comprises a response key value and a corresponding response value.
Optionally, the step S3 further includes:
and storing a second target parameter field of the user in a login state and a dynamic parameter preset value corresponding to the dynamic parameter preset key value into a redis cache.
Optionally, the step S6 specifically includes:
and if the matching is successful, calling a dynamic parameter preset value corresponding to the dynamic parameter actual key value in the redis cache.
Optionally, the step S5 specifically includes:
s51, matching the second target parameter field with the first target parameter field of the dynamic parameter matching rule, if the matching is successful, executing the step S51, otherwise, executing the step S53;
s52, matching the format of the actual key value of the dynamic parameter with the format of the preset key value of the at least one dynamic parameter, if the matching is successful, executing the step S6, otherwise, executing the step S53;
and S53, forwarding the request message to a real service.
Optionally, the first target parameter field or the second target parameter field is specifically a sessionid field or a token field.
A second aspect of the present application provides a dynamic parameter matching mock processing apparatus, the apparatus comprising:
the device comprises a configuration unit, a processing unit and a processing unit, wherein the configuration unit is used for configuring a dynamic parameter matching rule, and the dynamic parameter matching rule comprises a first target parameter field and at least one corresponding dynamic parameter preset key value;
the generating unit is used for generating an api _ url for storing a dynamic parameter preset value corresponding to the dynamic parameter preset key value;
the storage unit is used for storing a second target parameter field of the user in a login state and a dynamic parameter preset value corresponding to the dynamic parameter preset key value into a database according to the api _ url;
a receiving unit, configured to receive a request packet sent by a user, where the request packet carries the second target parameter field in a login state, a corresponding actual key value of the dynamic parameter, and an actual value of the dynamic parameter;
the first matching unit is used for matching the second target parameter field and the corresponding actual key value of the dynamic parameter with the dynamic parameter matching rule;
the calling unit is used for calling a dynamic parameter preset value corresponding to the actual key value of the dynamic parameter if the matching is successful;
and the second matching unit is used for matching the preset value of the dynamic parameter with the actual value of the dynamic parameter, executing mock if the matching is successful, and otherwise, forwarding the request message to a real service.
Optionally, the configuration unit is further configured to:
and configuring a response message, wherein the response message comprises a response key value and a corresponding response value.
A third aspect of the present application provides a dynamic parameter matching mock processing device, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the steps of the method for dynamic parameter matching mock processing according to the first aspect.
A fourth aspect of the present application provides a computer-readable storage medium for storing program code for performing the method of the first aspect described above.
According to the technical scheme, the embodiment of the application has the following advantages:
the application provides a method, a device, equipment and a storage medium for processing dynamic parameter matching mock, and the method, the device, the equipment and the storage medium are characterized in that a dynamic parameter matching rule is configured, a second target parameter field of a user and a dynamic parameter preset value corresponding to a dynamic parameter preset key value are automatically stored in a user login state, the second target parameter field, the corresponding dynamic parameter actual key value and the dynamic parameter actual value are automatically stored, when the user actually sends a request message, the second target parameter field, the corresponding dynamic parameter actual key value and the dynamic parameter actual value are sequentially matched in a login state carried in the request message, and the dynamic parameter matching rule, the dynamic parameter preset key value and the dynamic parameter preset value are sequentially matched to judge whether the mock is needed or not.
Drawings
FIG. 1 is a flowchart of a method for dynamic parameter matching mock processing according to an embodiment of the present application;
FIG. 2 is a schematic structural diagram of a mock processing device for dynamic parameter matching according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a mock processing device for dynamic parameter matching in an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The application designs a method, a device, equipment and a storage medium for processing dynamic parameter matching mock, and solves the technical problems that the parameter matching mode in the existing mock service can only meet the preset parameter matching rule, but the existing parameter matching mode cannot be adopted for judging the dynamic parameters which are inconsistent in each request, such as sessionid/token and the like.
For convenience of understanding, please refer to fig. 1, in which fig. 1 is a flowchart of a method of a dynamic parameter matching mock processing method in an embodiment of the present application, as shown in fig. 1, specifically:
s1, configuring a dynamic parameter matching rule, wherein the dynamic parameter matching rule comprises a first target parameter field and at least one corresponding dynamic parameter preset key value;
further, step S1 further includes:
and configuring a response message, wherein the response message comprises a response key value and a corresponding response value.
It should be noted that, first, a dynamic parameter matching rule needs to be configured, for example:
{
"sessionid":"${{TrendsMyKey_1}}";
}
the sessionid is a first target parameter field, the { { trends mykey _1} } is a dynamic parameter preset key value, the dynamic parameter preset key value needs to be transmitted by a dynamic request interface and stored, and if a plurality of dynamic parameter preset key values exist, the values can be further set to be { { trends mykey _2} }, { { trends mykey _3} } … … and the like.
In addition, a response message can be configured, and the configured response message is returned after the mock is executed. It can be understood that the test coverage can be improved and the test quality can be ensured by simulating the dynamic request to return the self-defined response message.
S2, generating an api _ url for storing a dynamic parameter preset value corresponding to the dynamic parameter preset key value;
it should be noted that after the dynamic parameter matching rule is configured, an api _ url storing a dynamic parameter preset value corresponding to the dynamic parameter preset key value may be generated, for example: http:// xxx. Xxx: 8080/mocksynamicvalues/addmocksynamicvalues.
S3, storing a second target parameter field and a dynamic parameter preset value corresponding to the dynamic parameter preset key value of the user in a login state into a database according to the api _ url;
further, step S3 further includes:
and storing the second target parameter field of the user in the login state and the dynamic parameter preset value corresponding to the dynamic parameter preset key value into a redis cache.
It should be noted that after the user logs in, the dynamic parameter preset value corresponding to the target parameter field and the dynamic parameter preset key value in the login state may be obtained through the interface based on the api _ url, and stored. The stored table structure content may be:
Figure BDA0004001026780000071
the data can be stored in a redis cache or a database, wherein the redis cache can solve the problem of low database access efficiency caused by frequently acquiring the data.
S4, receiving a request message sent by a user, wherein the request message carries a second target parameter field in a login state, a corresponding dynamic parameter actual key value and a dynamic parameter actual value;
it should be noted that, when receiving a request packet sent by a user, the request packet carries a second target parameter field in a login state, a corresponding actual key value of a dynamic parameter, and an actual value of the dynamic parameter, for example:
POST request message:
Figure BDA0004001026780000072
s5, matching the second target parameter field and the corresponding actual key value of the dynamic parameter with a dynamic parameter matching rule;
specifically, the method comprises the following steps:
s51, matching the second target parameter field with the first target parameter field of the dynamic parameter matching rule, if the matching is successful, executing the step S51, otherwise, executing the step S53;
s52, matching the format of the actual key value of the dynamic parameter with the format of at least one preset key value of the dynamic parameter, if the matching is successful, executing the step S6, otherwise, executing the step S53;
and S53, forwarding the request message to a real service.
S6, if the matching is successful, calling a dynamic parameter preset value corresponding to the actual key value of the dynamic parameter;
specifically, the method comprises the following steps:
and if the matching is successful, calling a dynamic parameter preset value corresponding to the actual key value of the dynamic parameter in the redis cache.
And S7, matching the preset value of the dynamic parameter with the actual value of the dynamic parameter, executing mock if the matching is successful, and otherwise, forwarding the request message to a real service.
Further, the first target parameter field or the second target parameter field is specifically a sessionid field or a token field.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a mock processing device for dynamic parameter matching in an embodiment of the present application, as shown in fig. 2, specifically, the mock processing device includes:
the configuration unit 201 is configured to configure a dynamic parameter matching rule, where the dynamic parameter matching rule includes a first target parameter field and at least one corresponding dynamic parameter preset key value;
the generating unit 202 is configured to generate an api _ url storing a dynamic parameter preset value corresponding to the dynamic parameter preset key value;
the storage unit 203 is configured to store the second target parameter field of the user in the login state and the dynamic parameter preset value corresponding to the dynamic parameter preset key value into the database according to the api _ url;
the receiving unit 204 is configured to receive a request packet sent by a user, where the request packet carries a second target parameter field in a login state, a corresponding actual key value of a dynamic parameter, and an actual value of the dynamic parameter;
the first matching unit 205 is configured to match the second target parameter field and the corresponding actual key value of the dynamic parameter with the dynamic parameter matching rule;
the calling unit 206 is configured to, if matching is successful, call a preset value of the dynamic parameter corresponding to the actual key value of the dynamic parameter;
and a second matching unit 207, configured to match the preset value of the dynamic parameter with the actual value of the dynamic parameter, execute the mock if the matching is successful, and otherwise forward the request packet to the real service.
Further, the configuration unit 201 is further configured to:
and configuring a response message, wherein the response message comprises a response key value and a corresponding response value.
The embodiment of the present application further provides another dynamic parameter matching mock processing device, as shown in fig. 3, for convenience of description, only the parts related to the embodiment of the present application are shown, and details of the specific technology are not disclosed, please refer to the method part of the embodiment of the present application. The terminal may be any terminal device including a mobile phone, a tablet computer, a Personal Digital Assistant (PDA, abbreviated as "Personal Digital Assistant"), a Sales terminal (POS, abbreviated as "Point of Sales"), a vehicle-mounted computer, etc., and the terminal is taken as a mobile phone as an example:
fig. 3 is a block diagram illustrating a partial structure of a mobile phone related to a terminal provided in an embodiment of the present application. Referring to fig. 3, the cellular phone includes: radio Frequency (RF) circuit 1010, memory 1020, input unit 1030, display unit 1040, sensor 1050, audio circuit 1060, wireless fidelity (WiFi) module 1070, processor 1080, and power source 1090. Those skilled in the art will appreciate that the handset configuration shown in fig. 3 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 3:
RF circuit 1010 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, for processing downlink information of a base station after receiving the downlink information to processor 1080; in addition, data for designing uplink is transmitted to the base station. In general, RF circuit 1010 includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (Low Noise Amplifier, LNA), a duplexer, and the like. In addition, the RF circuitry 1010 may communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communications (GSM), general Packet Radio Service (GPRS), code Division Multiple Access (CDMA), wideband Code Division Multiple Access (WCDMA), long Term Evolution (LTE), e-mail, short message Service (Short SMS), and so on.
The memory 1020 can be used for storing software programs and modules, and the processor 1080 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 1020 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 1030 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also referred to as a touch screen, may collect touch operations by a user (e.g., operations by a user on or near the touch panel 1031 using any suitable object or accessory such as a finger, a stylus, etc.) and drive corresponding connection devices according to a preset program. Alternatively, the touch panel 1031 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 1080, and can receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 may be implemented by various types such as resistive, capacitive, infrared, and surface acoustic wave. The input unit 1030 may include other input devices 1032 in addition to the touch panel 1031. In particular, other input devices 1032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a track ball, a mouse, a joystick, or the like.
The display unit 1040 may be used to display information input by a user or information provided to the user and various menus of the cellular phone. The Display unit 1040 may include a Display panel 1041, and optionally, the Display panel 1041 may be configured by a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 1031 can cover the display panel 1041, and when the touch panel 1031 detects a touch operation on or near the touch panel 1031, the touch operation is transmitted to the processor 1080 to determine the type of the touch event, and then the processor 1080 provides a corresponding visual output on the display panel 1041 according to the type of the touch event. Although in fig. 3, the touch panel 1031 and the display panel 1041 are two separate components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 1031 and the display panel 1041 may be integrated to implement the input and output functions of the mobile phone.
The handset may also include at least one sensor 1050, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of ambient light, and the proximity sensor may turn off the display panel 1041 and/or the backlight when the mobile phone moves to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the gesture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
Audio circuitry 1060, speaker 1061, microphone 1062 may provide an audio interface between the user and the handset. The audio circuit 1060 can transmit the electrical signal converted from the received audio data to the speaker 1061, and the electrical signal is converted into a sound signal by the speaker 1061 and output; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1060 and converted into audio data, which is then processed by the audio data output processor 1080 and then sent to, for example, another cellular phone via the RF circuit 1010, or output to the memory 1020 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help the user to send and receive e-mail, browse web pages, access streaming media, etc. through the WiFi module 1070, which provides wireless broadband internet access for the user. Although fig. 3 shows the WiFi module 1070, it is understood that it does not belong to the essential constitution of the handset, and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 1080 is a control center of the mobile phone, connects various parts of the whole mobile phone by using various interfaces and lines, and executes various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 1020 and calling data stored in the memory 1020, thereby integrally monitoring the mobile phone. Optionally, processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor, which primarily handles operating systems, user interfaces, application programs, etc., and a modem processor, which primarily handles wireless communications. It is to be appreciated that the modem processor described above may not be integrated into processor 1080.
The handset also includes a power source 1090 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 1080 via a power management system to manage charging, discharging, and power consumption via the power management system.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which are not described herein.
In the embodiment of the present application, the processor 1080 included in the terminal further has the following functions:
s1, configuring a dynamic parameter matching rule, wherein the dynamic parameter matching rule comprises a first target parameter field and at least one corresponding dynamic parameter preset key value;
s2, generating an api _ url for storing a dynamic parameter preset value corresponding to the dynamic parameter preset key value;
s3, storing a second target parameter field and a dynamic parameter preset value corresponding to the dynamic parameter preset key value of the user in a login state into a database according to the api _ url;
s4, receiving a request message sent by a user, wherein the request message carries a second target parameter field in a login state, a corresponding dynamic parameter actual key value and a dynamic parameter actual value;
s5, matching the second target parameter field and the corresponding actual key value of the dynamic parameter with a dynamic parameter matching rule;
s6, if the matching is successful, calling a dynamic parameter preset value corresponding to the actual key value of the dynamic parameter;
and S7, matching the preset value of the dynamic parameter with the actual value of the dynamic parameter, executing mock if the matching is successful, and otherwise, forwarding the request message to a real service.
The embodiment of the present application further provides a computer-readable storage medium for storing a program code, where the program code is configured to execute any one implementation of the dynamic parameter matching mock processing method described in the foregoing embodiments.
In the embodiment of the application, a method, a device, equipment and a storage medium for processing dynamic parameter matching mock are provided, wherein a dynamic parameter matching rule is configured, a second target parameter field of a user and a dynamic parameter preset value corresponding to a dynamic parameter preset key value are automatically stored in a user login state, the second target parameter field, the corresponding dynamic parameter actual key value and the dynamic parameter actual value are automatically matched in sequence when the user actually sends a request message and the login state carried in the request message is carried, and whether the mock is needed or not is judged.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The terms "first," "second," "third," "fourth," and the like (if any) in the description of the present application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that, in this application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, which are essential or part of the technical solutions contributing to the prior art, or all or part of the technical solutions, may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A dynamic parameter matching mock processing method is characterized by comprising the following steps:
s1, configuring a dynamic parameter matching rule, wherein the dynamic parameter matching rule comprises a first target parameter field and at least one corresponding dynamic parameter preset key value;
s2, generating an api _ url for storing a dynamic parameter preset value corresponding to the dynamic parameter preset key value;
s3, storing a second target parameter field of the user in a login state and a dynamic parameter preset value corresponding to the dynamic parameter preset key value into a database according to the api _ url;
s4, receiving a request message sent by a user, wherein the request message carries the second target parameter field in a login state, a corresponding dynamic parameter actual key value and a dynamic parameter actual value;
s5, matching the second target parameter field and the corresponding dynamic parameter actual key value with the dynamic parameter matching rule;
s6, if the matching is successful, calling a dynamic parameter preset value corresponding to the actual key value of the dynamic parameter;
and S7, matching the preset value of the dynamic parameter with the actual value of the dynamic parameter, executing mock if the matching is successful, and otherwise, forwarding the request message to a real service.
2. The dynamic parameter matching mock processing method according to claim 1, wherein said step S1 further comprises:
and configuring a response message, wherein the response message comprises a response key value and a corresponding response value.
3. The dynamic parameter matching mock processing method according to claim 1, wherein said step S3 further comprises:
and storing a second target parameter field of the user in a login state and a dynamic parameter preset value corresponding to the dynamic parameter preset key value into a redis cache.
4. The dynamic parameter matching mock processing method according to claim 3, wherein the step S6 specifically comprises:
and if the matching is successful, calling a preset value of the dynamic parameter corresponding to the actual key value of the dynamic parameter in the redis cache.
5. The dynamic parameter matching mock processing method according to claim 1, wherein the step S5 specifically comprises:
s51, matching the second target parameter field with the first target parameter field of the dynamic parameter matching rule, if the matching is successful, executing the step S51, otherwise, executing the step S53;
s52, matching the format of the actual key value of the dynamic parameter with the format of the preset key value of the at least one dynamic parameter, if the matching is successful, executing the step S6, otherwise, executing the step S53;
and S53, forwarding the request message to a real service.
6. The dynamic parameter matching mock processing method according to claim 1, wherein said first target parameter field or said second target parameter field is specifically a sessionid field or a token field.
7. A dynamic parameter matching mock processing apparatus, comprising:
the device comprises a configuration unit, a processing unit and a processing unit, wherein the configuration unit is used for configuring a dynamic parameter matching rule, and the dynamic parameter matching rule comprises a first target parameter field and at least one corresponding dynamic parameter preset key value;
the generating unit is used for generating an api _ url for storing a dynamic parameter preset value corresponding to the dynamic parameter preset key value;
the storage unit is used for storing a second target parameter field of the user in a login state and a dynamic parameter preset value corresponding to the dynamic parameter preset key value into a database according to the api _ url;
a receiving unit, configured to receive a request packet sent by a user, where the request packet carries the second target parameter field in a login state, a corresponding actual key value of the dynamic parameter, and an actual value of the dynamic parameter;
the first matching unit is used for matching the second target parameter field and the corresponding actual key value of the dynamic parameter with the dynamic parameter matching rule;
the calling unit is used for calling a dynamic parameter preset value corresponding to the actual key value of the dynamic parameter if the matching is successful;
and the second matching unit is used for matching the preset value of the dynamic parameter with the actual value of the dynamic parameter, executing mock if the matching is successful, and otherwise, forwarding the request message to a real service.
8. The dynamic parameter matching mock processing device according to claim 7, wherein said configuration unit is further configured to:
and configuring a response message, wherein the response message comprises a response key value and a corresponding response value.
9. A dynamic parameter matching mock processing device, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the dynamic parameter matching mock processing method according to any one of claims 1 to 6 according to instructions in the program code.
10. A computer-readable storage medium for storing program code for executing the dynamic parameter matching mock processing method according to any one of claims 1 to 6.
CN202211613356.3A 2022-12-15 2022-12-15 Dynamic parameter matching mock processing method, device, equipment and storage medium Pending CN115878670A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211613356.3A CN115878670A (en) 2022-12-15 2022-12-15 Dynamic parameter matching mock processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211613356.3A CN115878670A (en) 2022-12-15 2022-12-15 Dynamic parameter matching mock processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115878670A true CN115878670A (en) 2023-03-31

Family

ID=85767624

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211613356.3A Pending CN115878670A (en) 2022-12-15 2022-12-15 Dynamic parameter matching mock processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115878670A (en)

Similar Documents

Publication Publication Date Title
CN107122761B (en) Fingerprint image processing method and related product
CN106506321B (en) Group message processing method and terminal device
CN108834132B (en) Data transmission method and equipment and related medium product
CN106911848B (en) Method for outputting prompt message and terminal equipment
CN110673770B (en) Message display method and terminal equipment
CN112691363A (en) Cross-terminal switching method and related device for cloud games
CN110602766B (en) Personal hotspot identification method and method for determining association relationship between terminals
CN108966290B (en) Network connection method and related product
CN115794654A (en) Test case distribution processing method, system, equipment and storage medium
CN107094027B (en) Antenna tuning method and mobile terminal
CN108804434B (en) Message query method, server and terminal equipment
CN106777383B (en) File sorting method and intelligent terminal
CN111258476B (en) Message processing method and electronic equipment
CN110109788B (en) Multi-key detection method and device, electronic equipment and storage medium
CN115878670A (en) Dynamic parameter matching mock processing method, device, equipment and storage medium
CN108235047B (en) Audio playing method of live broadcast room and anchor terminal equipment
CN112101215A (en) Face input method, terminal equipment and computer readable storage medium
CN106657278B (en) Data transmission method and device and computer equipment
CN112214699A (en) Page processing method and related device
CN106879046B (en) Network scanning method and terminal equipment
CN110809234A (en) Figure category identification method and terminal equipment
CN109242479A (en) Method and device for getting red envelope based on point system
CN111181871B (en) Message transmission method and related device
CN111954193B (en) Bluetooth equipment connection detection method and device and mobile terminal
CN115775183A (en) Transaction information pushing method, device, equipment and storage medium

Legal Events

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