CN112637254A - Data processing method and device, electronic equipment and computer readable storage medium - Google Patents

Data processing method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN112637254A
CN112637254A CN201910907657.9A CN201910907657A CN112637254A CN 112637254 A CN112637254 A CN 112637254A CN 201910907657 A CN201910907657 A CN 201910907657A CN 112637254 A CN112637254 A CN 112637254A
Authority
CN
China
Prior art keywords
preset
data
address
network request
server
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.)
Granted
Application number
CN201910907657.9A
Other languages
Chinese (zh)
Other versions
CN112637254B (en
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.)
Rajax Network Technology Co Ltd
Original Assignee
Rajax Network Technology 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 Rajax Network Technology Co Ltd filed Critical Rajax Network Technology Co Ltd
Priority to CN201910907657.9A priority Critical patent/CN112637254B/en
Publication of CN112637254A publication Critical patent/CN112637254A/en
Application granted granted Critical
Publication of CN112637254B publication Critical patent/CN112637254B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the disclosure discloses a data processing method, a data processing device, electronic equipment and a computer readable storage medium, wherein the data processing method comprises the steps of intercepting a network request to be sent; when the destination address of the network request is matched with a preset address, preset target data associated with the preset address is obtained from a target server, wherein the target server comprises a Mock server; and taking the preset target data as return data of the network request, and returning the preset target data. According to the technical scheme, the problem of data leakage caused by the use of a third-party desktop version packet capturing tool is avoided, the operation flow of a user is simplified, the response efficiency of a network request is improved, and meanwhile, the problems that preset target data are stored in a rear-end server, the storage space of the rear-end server is occupied, and data are not easy to store and manage are solved.

Description

Data processing method and device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of computer application technologies, and in particular, to a data processing method and apparatus, an electronic device, and a computer-readable storage medium.
Background
With the development of internet technology, technical developers and/or testers of mobile Application (APP) on the mobile terminal need to perform interface display under different data, and the data displayed on the APP interface depends on the data returned when making a network request to the backend server. In the prior art, different data are generated by modifying data in a database by a back-end server generally, but the modified different data are not easy to store and manage, and communication and time cost between a mobile terminal and a server terminal worker are increased.
Disclosure of Invention
In order to solve the problems in the related art, embodiments of the present disclosure provide a data processing method and apparatus, an electronic device, and a computer-readable storage medium.
In a first aspect, an embodiment of the present disclosure provides a data processing method.
Specifically, the data processing method includes:
intercepting a network request to be sent;
when the destination address of the network request is matched with a preset address, preset target data associated with the preset address is obtained from a target server, wherein the target server comprises a Mock server;
and taking the preset target data as return data of the network request, and returning the preset target data.
With reference to the first aspect, in a first implementation manner of the first aspect, the present disclosure further includes:
and when the destination address of the network request is not matched with a preset address, the network request is sent to the destination address.
With reference to the first aspect, in a second implementation manner of the first aspect, the present disclosure further includes:
receiving a preset address configured by a user;
and adding the preset address into a preset address list.
With reference to the second implementation manner of the first aspect, in a third implementation manner of the first aspect, the present disclosure further includes:
receiving at least one preset data configured by a user aiming at the preset address;
and establishing an incidence relation between the preset address and at least one preset datum.
With reference to the third implementation manner of the first aspect, in a fourth implementation manner of the first aspect, the present disclosure further includes:
receiving a data validation configuration request of a user for the preset address;
and setting one preset data selected by the user in the data validation configuration request as the preset target data which is associated with the preset address and is currently validated.
With reference to the fourth implementation manner of the first aspect, in a fifth implementation manner of the first aspect, the obtaining preset target data associated with the preset destination address from a target server includes:
and acquiring the preset target data which is associated with the preset address and is currently effective from a target server, wherein the target server stores the preset address list and the preset target data.
With reference to the fifth implementation manner of the first aspect, in a sixth implementation manner of the first aspect, the obtaining preset target data associated with the preset address from a target server includes:
sending the network request to the target server;
and receiving the preset target data matched with the preset address returned by the target server.
In a second aspect, a data processing apparatus is provided in an embodiment of the present disclosure.
Specifically, the data processing apparatus includes:
an interception module configured to intercept a network request to be sent;
the acquisition module is configured to acquire preset target data associated with a preset address from a target server when a destination address of the network request is matched with the preset address, wherein the target server comprises a Mock server;
and the return module is configured to take the preset target data as return data of the network request and return the preset target data.
With reference to the second aspect, in a first implementation manner of the second aspect, the present disclosure further includes:
the sending module is configured to send the network request to a destination address when the destination address of the network request is not matched with a preset address.
With reference to the second aspect, in a second implementation manner of the second aspect, the present disclosure further includes:
the first receiving module is configured to receive a preset address configured by a user;
and the adding module is configured to add the preset address into a preset address list.
With reference to the second implementation manner of the second aspect, in a third implementation manner of the second aspect, the present disclosure further includes:
the second receiving module is configured to receive at least one preset data configured by a user aiming at the preset address;
the establishing module is configured to establish an association relationship between the preset address and at least one preset datum.
With reference to the third implementation manner of the second aspect, in a fourth implementation manner of the second aspect, the present disclosure further includes:
the third receiving module is configured to receive a data validation configuration request of a user for the preset address;
and the setting module is configured to set one of the preset data selected by the user in the data validation configuration request as the preset target data which is associated with the preset address and is currently validated.
With reference to the fourth implementation manner of the second aspect, in a fifth implementation manner of the second aspect, the obtaining module is configured to:
and acquiring the preset target data which is associated with the preset address and is currently effective from a target server, wherein the target server stores the preset address list and the preset target data.
With reference to the fifth implementation manner of the second aspect, in a sixth implementation manner of the second aspect, the obtaining module is configured to:
sending the network request to the target server;
and receiving the preset target data matched with the preset address returned by the target server.
In a third aspect, the disclosed embodiments provide an electronic device comprising a memory and a processor, wherein the memory is configured to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the following method steps:
intercepting a network request to be sent;
when the destination address of the network request is matched with a preset address, preset target data associated with the preset address is obtained from a target server, wherein the target server comprises a Mock server;
and taking the preset target data as return data of the network request, and returning the preset target data.
With reference to the third aspect, the present disclosure provides in a first implementation manner of the third aspect, wherein the one or more computer instructions are further executed by the processor to implement the following method steps:
and when the destination address of the network request is not matched with a preset address, the network request is sent to the destination address.
With reference to the third aspect, the present disclosure provides in a second implementation manner of the third aspect, wherein the one or more computer instructions are further executed by the processor to implement the following method steps:
receiving a preset address configured by a user;
and adding the preset address into a preset address list.
With reference to the second implementation manner of the third aspect, in a third implementation manner of the third aspect, the one or more computer instructions are further executed by the processor to implement the following method steps:
receiving at least one preset data configured by a user aiming at the preset address;
and establishing an incidence relation between the preset address and at least one preset datum.
With reference to the third implementation manner of the third aspect, in a fourth implementation manner of the third aspect, the one or more computer instructions are further executed by the processor to implement the following method steps:
receiving a data validation configuration request of a user for the preset address;
and setting one preset data selected by the user in the data validation configuration request as the preset target data which is associated with the preset address and is currently validated.
With reference to the fourth implementation manner of the third aspect, in a fifth implementation manner of the third aspect, the obtaining, from the target server, preset target data associated with the preset destination address includes:
and acquiring the preset target data which is associated with the preset address and is currently effective from a target server, wherein the target server stores the preset address list and the preset target data.
With reference to the fifth implementation manner of the third aspect, in a sixth implementation manner of the third aspect, the obtaining, from a target server, preset target data associated with the preset address includes:
sending the network request to the target server;
and receiving the preset target data matched with the preset address returned by the target server.
In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having stored thereon computer instructions, which, when executed by a processor, implement the method according to the first aspect, or any one of the first to sixth implementation manners of the first aspect.
According to the technical scheme provided by the embodiment of the disclosure, the network request to be sent by the local application is intercepted through the SDK, when the destination address of the network request is matched with the preset address, the preset target data associated with the destination address is obtained, the preset target data is used as the return data of the network request and returned to the local application, the problem of data leakage caused by using a third-party desktop version packet capturing tool is avoided, the operation flow of a user is simplified, the response efficiency of the network request is improved, and meanwhile, the problems that the preset target data is stored in a back-end server, the storage space of the back-end server is occupied, and data is difficult to store and manage are avoided.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
Other features, objects, and advantages of the present disclosure will become more apparent from the following detailed description of non-limiting embodiments when taken in conjunction with the accompanying drawings. In the drawings:
FIG. 1 shows a flow diagram of a data processing method according to an embodiment of the present disclosure;
FIG. 2 shows a flow diagram of a data processing method according to an embodiment of the present disclosure;
FIG. 3 illustrates a schematic diagram of adding preset addresses to a preset address list according to an embodiment of the present disclosure;
FIG. 4 shows a flow diagram of a data processing method according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram illustrating an association relationship between a preset address and at least one preset datum according to an embodiment of the disclosure;
FIG. 6 shows a flow diagram of a data processing method according to an embodiment of the present disclosure;
fig. 7 is a schematic diagram illustrating that one of preset data selected by a user in a data validation configuration request is set as preset target data associated with a preset address and currently validated according to an embodiment of the present disclosure;
FIG. 8 illustrates a flow chart for obtaining preset target data associated with the preset address from a target server according to an embodiment of the disclosure;
FIG. 9 shows a schematic diagram of an application scenario of data processing according to an embodiment of the present disclosure;
fig. 10 shows a block diagram of a data processing apparatus 1000 according to an embodiment of the present disclosure;
FIG. 11 shows a block diagram of an electronic device according to an embodiment of the present disclosure;
fig. 12 shows a schematic structural diagram of a computer system suitable for implementing a data processing method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. Also, for the sake of clarity, parts not relevant to the description of the exemplary embodiments are omitted in the drawings.
In the present disclosure, it is to be understood that terms such as "including" or "having," etc., are intended to indicate the presence of the disclosed features, numbers, steps, behaviors, components, parts, or combinations thereof, and are not intended to preclude the possibility that one or more other features, numbers, steps, behaviors, components, parts, or combinations thereof may be present or added.
It should be further noted that the embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
As described above, in order to solve the problem caused by modifying the database by means of the backend server to generate different data, the prior art intercepts the network request sent by the mobile terminal to the backend server by using desktop version package capturing tools, such as Charles and postman, and immediately modifies the data returned by the intercepted network request into the responsive data. According to the technical scheme, a third-party desktop version packet capturing tool is needed, the risk of data leakage exists, meanwhile, a network agent and a breakpoint need to be set when a network request is intercepted, the operation process is complex, and the modified data can only be stored in a mobile terminal in a file form, so that the cost of data management and maintenance is high.
The present disclosure is made to solve, at least in part, the problems in the prior art that the inventors have discovered.
Fig. 1 shows a flow diagram of a data processing method according to an embodiment of the present disclosure. As shown in fig. 1, the data processing method includes the following steps S101 to S103:
in step S101, a network request to be sent is intercepted;
in step S102, when a destination address of the network request matches a preset address, obtaining preset target data associated with the preset address from a target server, where the target server includes a Mock server;
in step S103, the preset target data is used as the return data of the network request, and the preset target data is returned.
According to the embodiment of the disclosure, when a user sends a network request to a backend server through a mobile terminal APP, the network request to be sent may be intercepted through a Software Development Kit (SDK) installed locally, where the network request may include a request parameter, such as a destination address. For example, if the destination address of the web page request is the corresponding address of the backend server, under normal conditions, the web page request is sent to the backend server, and the backend server returns the requested web page; in some special cases, for example, when a response of a backend server is simulated, a locally generated network request may be intercepted, the network request is not sent to a destination address carried by the network request, but the network request is sent to a target server, for example, a Mock server, and data preset on the target server is used as return data of the network request. The network request to be sent means that the network request is generated by the mobile terminal APP but is not sent out through the network port; the interception means that after detecting a network request, the SDK installed in the local area temporarily does not send the network request to the backend server. The mobile terminal may be a handheld terminal, a notebook computer, a cellular phone, a smart phone, a wireless data card, a personal digital assistant computer, a tablet computer, a cordless phone, an internet of things device (IOT device), or other terminal that can access a network, and is not limited in this disclosure. The APP may be software installed on the mobile terminal, such as a communication program, a game program, an entertainment program, a social program, or a life utility program, and is not particularly limited in the present disclosure.
Embodiments of the present disclosure are directed to situations where a network request needs to be sent to a target server, i.e., preset data is used as return data of a part of the network request. The user can set a part of network requests to be sent to the real back-end server and send the other part of network requests to the target server. The number of target servers is not particularly limited in the present disclosure, and may be one or more. Although the present disclosure is described by taking the target server as a Mock server as an example, the present disclosure is not limited thereto, but is also applicable to other target servers, the Mock server may be a local server for storing preset target data, the preset target data may refer to return data simulated by a user, that is, network request data returned by a back-end server is replaced by network request data set by the user, and in one scenario, the user may simulate the return data according to the needs of the user and store the simulated return data on the Mock server, so as to view the effect of the simulated return data. For example, in the development process, in order to adapt to interface display under various different data, a developer may temporarily store the returned data on the Mock server, and since the Mock server is a local server, problems such as resource consumption and the like caused by the need of storing and managing data corresponding to different interface displays through a database of the backend server and the need of modifying the database of the backend server every time can be avoided. Therefore, in the embodiment of the disclosure, a user can preset one or more addresses which need to be intercepted and sent to the Mock server according to actual requirements, and meanwhile, the user can also preset target data corresponding to the one or more addresses. The SDK intercepts a network request generated by a local application, analyzes a destination address in the network request, compares the destination address with a preset address, and returns the preset address to the application generating the network request as a return address of the network request after the analyzed destination address is matched with the preset address. The matching of the destination address and the preset address means that the destination address is consistent with the preset address; and when the destination address is inconsistent with the preset address, the destination address is not matched with the preset address. It is to be understood that although the present disclosure is illustrated with a representation in which the destination address is a Uniform Resource Locator (URL), the present disclosure is not so limited and is applicable to other representations as well. For example, when a user sets http:// xxx.xx/login as a preset address, if the destination address of the network request is http:// xxx.xx/login, the destination address of the network request is matched with the preset address; if the destination address of the network request is http:// xxx. xx/logout, the destination address of the network request does not match the preset address.
According to the embodiment of the present disclosure, when the destination address of the network request matches the preset address, preset target data associated with the preset address may be further acquired, where the preset target data may be data that is freely defined as needed. After the preset target data is obtained, the preset target data may be used as return data of the current network request, and the preset target data is returned to the application that generated the network request.
According to the technical scheme provided by the embodiment of the disclosure, a network request to be sent of a local application is intercepted through an SDK, and when a destination address of the network request is matched with a preset address, preset target data associated with the preset address is obtained from a target server, wherein the target server comprises a Mock server, the preset target data is used as return data of the network request and is returned to the local application, so that the problem of data leakage caused by using a third-party desktop version packet capturing tool is solved, the operation process of a user is simplified, the response efficiency of the network request is improved, and meanwhile, the problems that the preset target data is stored in a back-end server, the storage space of the back-end server is occupied, and the data is difficult to store and manage are solved.
According to the embodiment of the disclosure, when the destination address of the network request is not matched with the preset address, the network request is sent to the destination address. When the SDK matches the destination address of the network request with the preset address, if the two addresses are not matched, the network request does not need to be sent to the target server, the network request can be directly sent to the back-end server corresponding to the destination address, and the back-end server returns the response data. For example, when a user sets http:// xxx.xx/login as a preset address, if a destination address of a network request is http:// xxx.xx/logout, the destination address of the network request is not matched with the preset address, and at this time, the network request may be sent to the destination address of the back-end server, http:// xxx.xx/logout, so as to obtain data from the back-end server.
Fig. 2 shows a flow diagram of a data processing method according to an embodiment of the present disclosure. As shown in fig. 2, the data processing method further includes the following steps S201 to S202:
in step S201, receiving a preset address configured by a user;
in step S202, the preset address is added to a preset address list.
According to the embodiment of the disclosure, a user can configure the preset address in advance as required, and the SDK receives the preset address configured by the user and adds the configured preset address into the preset address list. In the following, a preset address is taken as an address that a user needs to replace with the required preset target data, and the preset address takes the representation form of a URL as an example for explanation, but the disclosure is not limited thereto.
Fig. 3 illustrates a schematic diagram of adding a preset address to a preset address list according to an embodiment of the present disclosure. As shown in fig. 3, when the user needs to configure the preset address, the SDK may display a configuration interface of the response according to the request of the user, and the SDK may further display a preset address list, that is, a URL list, in the configuration interface, when there is no preset address http:// xxx.xx/login that the user currently configures in the displayed preset address list, the user may create a new preset address URL, that is, http:// xxx.xx/login, through an add button on the configuration interface, and the SDK may add the currently configured http:// xxx.xx/login to the preset address list.
Fig. 4 shows a flow chart of a data processing method according to an embodiment of the present disclosure. As shown in fig. 4, the data processing method further includes the following steps S401 to S402:
in step S401, receiving at least one preset data configured by a user for the preset address;
in step S402, an association relationship between the preset address and at least one preset datum is established.
According to the embodiment of the disclosure, the user can also configure the preset data corresponding to the preset address through the SDK, and give a preset data name to the preset data. One preset address may correspond to a plurality of preset data, and different preset data may correspond to different preset data names, but at the same time, the user can only configure one preset data as effective data, that is, the effective data is preset target data currently corresponding to the preset address. Because one preset address can only correspond to one effective data, the user can select one preset data corresponding to the preset address to be the effective data according to the need through the page configured by the SDK. The preset address is an address that the user needs to replace with the required preset data, and the preset address is expressed by a URL, but the disclosure is not limited thereto.
Fig. 5 is a schematic diagram illustrating an association relationship between a preset address and at least one preset datum according to an embodiment of the disclosure. As shown in FIG. 5, when a user configures a preset address http:// xxx.xx/login on a primary interface, preset data names Mock-data-1 and Mock-data-2 can be configured on a secondary interface, then preset data corresponding to the preset data name Mock-data-1 is edited as { "foo": bar "} on a tertiary interface, and simultaneously preset data corresponding to the preset data name Mock-data-2 is edited as {" foo ": space" } on the tertiary interface. Then according to the actual application requirement, the preset data corresponding to the preset address http:// xxx.xx/login and the preset data name Mock-data-1 is { "foo": bar "}, or the preset data corresponding to the preset address http:// xxx.xx/login and the preset data name Mock-data-2 is {" foo ": space" }, so that the currently effective data is configured to be the preset data corresponding to Mock-data-1 or Mock-data-2.
Fig. 6 shows a flow chart of a data processing method according to an embodiment of the present disclosure. As shown in fig. 6, the data processing method further includes the following steps S601 to S602:
in step S601, receiving a data validation configuration request of a user for the preset address;
in step S602, one of the preset data selected by the user in the data validation configuration request is set as the preset target data associated with the preset address and currently validated.
According to the embodiment of the disclosure, a user can configure one preset data in a plurality of preset data corresponding to the preset address as effective data according to actual needs. The user can request configuration effective data through a configuration page provided by the SDK, can also select preset data to be configured into effect currently, and sends out a data effective configuration request, and the SDK can process according to the request after receiving the data effective configuration request of the user about the preset address. The data validation configuration request at least includes the preset address and valid preset data selected by the user, and the SDK may set the valid preset data selected by the user, which is carried in the data validation configuration request, as preset target data associated with the preset address, that is, currently valid data.
The preset address is an address where the user needs to obtain data from a target server (e.g., a Mock server), and the preset address is expressed as a URL, but the disclosure is not limited thereto. Fig. 7 is a schematic diagram illustrating that one of preset data selected by a user in a data validation configuration request is set as preset target data associated with a preset address and currently validated according to an embodiment of the present disclosure. As shown in fig. 7, assuming that a user requests one preset data { "foo": bar "} as a preset target data for a preset address http:// xxx.xx/logic, firstly opening a primary interface where the preset address http:// xxx.xx/logic is located, then validating a preset data name Mock-data-1 corresponding to the preset data {" foo ": bar" } at the secondary interface according to the association relationship between the preset address and the preset data (the validation button is moved to the right to represent validation), and then validating a preset data { "foo": bar "} corresponding to the preset data name Mock-data-1 at a tertiary interface (the validation button is moved to the right to represent validation), through the above operation, one preset data {" bar ": selected by the user in accordance with the data validation configuration request is set to be associated with the preset address http {/xxx .
According to an embodiment of the present disclosure, the acquiring preset target data associated with the preset address from the target server in step S102 includes: and acquiring the preset target data which is associated with the preset address and is currently effective from a target server, wherein the target server stores the preset address list and the preset target data.
In this embodiment, one or more target servers may be provided, and the preset address list and the preset data associated with the preset addresses in the preset address list may be stored on the target servers. The target server can be specially used for storing the preset address list and the preset target data, so that the problems that the preset target data are stored in the back-end server, the storage space of the back-end server is occupied, and the data are not easy to store and manage can be avoided.
Since the preset address list includes a plurality of preset addresses, and each preset address has preset target data associated therewith and currently valid, each preset address and its associated preset target data may be stored on the target server together, and the specific form of storage is not specifically limited in the present disclosure, which will be illustrated below in the form of constructing a table, but the present disclosure is not limited thereto, and as described in table 1, the preset address list and the preset target data are stored on the target server according to the embodiment of the present disclosure:
serial number Preset address Presetting target data
1 http://xxx.xx/login {“foo”:“bar”}
2 http://xxx.xx/logout {“foo”:“space”}
…… …… ……
In this embodiment, one preset address may correspond to a plurality of preset data, and only one preset data currently in effect is available, so that after the destination address matches the preset data, the preset destination data associated with the preset address and currently in effect may be obtained from the destination server, and the preset destination data may be used as the return data of the network request. For example, assuming that preset target data { "foo": bar "} associated with the preset address http:// xxx.xx/logic and currently in effect is set according to the data validation configuration request, if the target address of the network request is http:// xxx.xx/logic, the destination address of the network request matches with the preset address, and the preset target data {" foo ": bar" } associated with the preset address http:// xxx.xx/logic and currently in effect can be further acquired from the target server (Mock server).
Fig. 8 shows a flowchart for acquiring preset target data associated with the preset address from a target server according to an embodiment of the present disclosure. As shown in fig. 8, the step S102 of acquiring preset target data associated with the preset address from the target server includes the following steps S801-S802:
in step S801, the network request is sent to the target server;
in step S802, the preset target data matched with the preset address returned by the target server is received.
According to the embodiment of the disclosure, when the SDK detects that the destination address of the network request matches the preset address, the network request may be sent to a target server, for example, a Mock server, and then the target server returns the preset target data associated with the preset address. For example, assuming that the destination address of the network request is http:// xxx.xx/login, according to the preset address list and the preset target data (for example, table 1) stored in the target server, the destination address http:// xxx.xx/login of the network request matches with the preset address http:// xxx.xx/login, the target server returns preset target data { "foo": bar "} corresponding to the preset address http:// xxx.xx/login, and then the SDK uses the preset target data {" foo ": bar" } returned by the target server as the response data of the network request.
Fig. 9 shows a schematic diagram of an application scenario of data processing according to an embodiment of the present disclosure. As shown in fig. 9, the application scenario includes a mobile terminal 901, a backend server 902, and a Mock server 903, for convenience of description, only two mobile terminals 901, one backend server 902, and one Mock server 903 are drawn in the application scenario of fig. 9, and the mobile terminal 901 is a smartphone, it should be understood that this example is used only as an example, and is not a limitation to the present disclosure, and the number and the types of the mobile terminal 901, the backend server 902, and the Mock server 903 in the present disclosure may be set according to actual needs, which is not specifically limited by the present disclosure.
The address of the back-end server 902 is http:// xxx.xx, and the web pages corresponding to the network addresses of http:// xxx.xx/clocks and the like are stored. Under normal conditions, a user can send a network request to the backend server 902 by operating the APP1 on the mobile terminal 901, wherein the destination address of the network request is http:// xxx. xx/rings, and requests a web page stored on the backend server, and after receiving the network request of the mobile terminal, the backend server 902 can return the stored corresponding web page (for example, a clothing picture C1) to the APP1 on the mobile terminal 901, and display the web page (clothing picture C1) on the APP 1.
Assuming that a user needs to view a display page of self-simulated data (for example, a shoe picture S1) on the APP1, a preset address is set to http:// xxx.xx/shoes through a front-end setting page provided by the SDK in the embodiment of the present disclosure, and corresponding preset target data is set to data simulated by the user himself, that is, the shoe picture S1, and the set preset address and the preset target data are stored in the Mock server 903 in an associated manner. At this time, when the destination address of the network request sent by the user operation APP1 is http:// xxx.xx/shoes, the SDK intercepts the network request, detects that the destination address of the network request is matched with a preset address, sends the network request to the Mock server 903, obtains preset target data associated with the preset address http:// xxx.xx/shoes from the Mock server 903, namely a shoe picture S1, and returns the shoe picture S1 to the APP1 generating the network request as return data of the network request.
Fig. 10 shows a block diagram of a data processing apparatus 1000 according to an embodiment of the present disclosure. The apparatus may be implemented as part or all of an electronic device through software, hardware, or a combination of both. As shown in fig. 10, the data processing apparatus includes an intercepting module 1001, an acquiring module 1002, and a returning module 1003.
The intercepting module 1001 is configured to intercept a network request to be sent;
the obtaining module 1002 is configured to obtain preset target data associated with a preset address from a target server when a destination address of the network request matches the preset address, where the target server includes a Mock server;
the returning module 1003 is configured to use the preset target data as the return data of the network request, and return the preset target data.
According to an embodiment of the present disclosure, the data processing apparatus further includes:
a sending module 1004 configured to send the network request to a destination address of the network request when the destination address does not match a preset address.
According to an embodiment of the present disclosure, the data processing apparatus further includes:
a first receiving module 1005 configured to receive a preset address configured by a user;
a adding module 1006 configured to add the preset address into a preset address list.
According to an embodiment of the present disclosure, the data processing apparatus further includes:
a second receiving module 1007 configured to receive at least one preset data configured by a user for the preset address;
an establishing module 1008 configured to establish an association relationship between the preset address and at least one preset datum.
According to an embodiment of the present disclosure, the data processing apparatus further includes:
a third receiving module 1009, configured to receive a data validation configuration request of the user for the preset address;
a setting module 1010 configured to set, according to one of the preset data selected by the user in the data validation configuration request, the preset target data that is associated with the preset address and is currently validated.
According to an embodiment of the present disclosure, the obtaining module 1002 is configured to:
and acquiring the preset target data which is associated with the preset address and is currently effective from a target server, wherein the target server stores the preset address list and the preset target data.
According to an embodiment of the present disclosure, the obtaining module 1002 is configured to:
sending the network request to the target server;
and receiving the preset target data matched with the preset address returned by the target server.
The data processing apparatus in the embodiment of the present disclosure corresponds to the data processing method described in the embodiment and the related embodiment shown in fig. 1, and for specific details, reference is made to the data processing method shown in fig. 1, which is not described herein again.
The present disclosure also discloses an electronic device, and fig. 11 shows a block diagram of the electronic device according to an embodiment of the present disclosure.
As shown in fig. 11, the electronic device 1100 includes a memory 1101 and a processor 1102; wherein the content of the first and second substances,
the memory 1101 is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor 1102 to implement the method steps of:
intercepting a network request to be sent;
when the destination address of the network request is matched with a preset address, preset target data associated with the preset address is obtained from a target server, wherein the target server comprises a Mock server;
and taking the preset target data as return data of the network request, and returning the preset target data.
According to an embodiment of the present disclosure, the one or more computer instructions are further executable by the processor to implement the method steps of:
and when the destination address of the network request is not matched with a preset address, the network request is sent to the destination address.
According to an embodiment of the present disclosure, the one or more computer instructions are further executable by the processor to implement the method steps of:
receiving a preset address configured by a user;
and adding the preset address into a preset address list.
According to an embodiment of the present disclosure, the one or more computer instructions are further executable by the processor to implement the method steps of:
receiving at least one preset data configured by a user aiming at the preset address;
and establishing an incidence relation between the preset address and at least one preset datum.
According to an embodiment of the present disclosure, the one or more computer instructions are further executable by the processor to implement the method steps of:
receiving a data validation configuration request of a user for the preset address;
and setting one preset data selected by the user in the data validation configuration request as the preset target data which is associated with the preset address and is currently validated.
According to an embodiment of the present disclosure, acquiring preset target data associated with the preset destination address from a target server includes:
and acquiring the preset target data which is associated with the preset address and is currently effective from a target server, wherein the target server stores the preset address list and the preset target data.
According to an embodiment of the present disclosure, acquiring preset target data associated with the preset address from a target server includes:
sending the network request to the target server;
and receiving the preset target data matched with the preset address returned by the target server.
Fig. 12 shows a schematic structural diagram of a computer system suitable for implementing a data processing method according to an embodiment of the present disclosure.
As shown in fig. 12, the computer system 1200 includes a Central Processing Unit (CPU)1201, which can execute various processes in the above-described embodiments according to a program stored in a Read Only Memory (ROM)1202 or a program loaded from a storage section 1208 into a Random Access Memory (RAM) 1203. In the RAM1203, various programs and data necessary for the operation of the system 1200 are also stored. The CPU1201, ROM1202, and RAM1203 are connected to each other by a bus 1204. An input/output (I/O) interface 1205 is also connected to bus 1204.
The following components are connected to the I/O interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output portion 1207 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 1208 including a hard disk and the like; and a communication section 1209 including a network interface card such as a LAN card, a modem, or the like. The communication section 1209 performs communication processing via a network such as the internet. A driver 1210 is also connected to the I/O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive 1210 as necessary, so that a computer program read out therefrom is mounted into the storage section 1208 as necessary.
In particular, the above described methods may be implemented as computer software programs according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the above-described object class determination method. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 1209, and/or installed from the removable medium 1211.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present disclosure may be implemented by software or by programmable hardware. The units or modules described may also be provided in a processor, and the names of the units or modules do not in some cases constitute a limitation of the units or modules themselves.
As another aspect, the present disclosure also provides a computer-readable storage medium, which may be a computer-readable storage medium included in the electronic device or the computer system in the above embodiments; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present disclosure.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is possible without departing from the inventive concept. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (10)

1. A data processing method, comprising:
intercepting a network request to be sent;
when the destination address of the network request is matched with a preset address, preset target data associated with the preset address is obtained from a target server, wherein the target server comprises a Mock server;
and taking the preset target data as return data of the network request, and returning the preset target data.
2. The method of claim 1, further comprising:
and when the destination address of the network request is not matched with a preset address, the network request is sent to the destination address.
3. The method of claim 1, further comprising:
receiving a preset address configured by a user;
and adding the preset address into a preset address list.
4. The method of claim 3, further comprising:
receiving at least one preset data configured by a user aiming at the preset address;
and establishing an incidence relation between the preset address and at least one preset datum.
5. The method of claim 4, further comprising:
receiving a data validation configuration request of a user for the preset address;
and setting one preset data selected by the user in the data validation configuration request as the preset target data which is associated with the preset address and is currently validated.
6. The method of claim 5, wherein obtaining the preset target data associated with the preset destination address from the target server comprises:
and acquiring the preset target data which is associated with the preset address and is currently effective from a target server, wherein the target server stores the preset address list and the preset target data.
7. The method of claim 6, wherein obtaining preset target data associated with the preset address from a target server comprises:
sending the network request to the target server;
and receiving the preset target data matched with the preset address returned by the target server.
8. A data processing apparatus, comprising:
an interception module configured to intercept a network request to be sent;
the acquisition module is configured to acquire preset target data associated with a preset address from a target server when a destination address of the network request is matched with the preset address, wherein the target server comprises a Mock server;
and the return module is configured to take the preset target data as return data of the network request and return the preset target data.
9. An electronic device comprising a memory and a processor; wherein the memory is to store one or more computer instructions, wherein the one or more computer instructions are to be executed by the processor to implement the method steps of any one of claims 1-7.
10. A computer-readable storage medium having stored thereon computer instructions, characterized in that the computer instructions, when executed by a processor, carry out the method steps of any of claims 1-7.
CN201910907657.9A 2019-09-24 2019-09-24 Data processing method and device, electronic equipment and computer readable storage medium Active CN112637254B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910907657.9A CN112637254B (en) 2019-09-24 2019-09-24 Data processing method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910907657.9A CN112637254B (en) 2019-09-24 2019-09-24 Data processing method and device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN112637254A true CN112637254A (en) 2021-04-09
CN112637254B CN112637254B (en) 2023-04-07

Family

ID=75282895

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910907657.9A Active CN112637254B (en) 2019-09-24 2019-09-24 Data processing method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112637254B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115208951A (en) * 2022-06-28 2022-10-18 平安银行股份有限公司 Request processing method and device, electronic equipment and computer readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102148759A (en) * 2011-04-01 2011-08-10 许旭 Method for saving export bandwidth of backbone network by cache acceleration system
CN102984173A (en) * 2012-12-13 2013-03-20 迈普通信技术股份有限公司 Network access control method and system
CN107135249A (en) * 2017-04-06 2017-09-05 腾讯科技(深圳)有限公司 Data download method and device
CN107277025A (en) * 2017-06-28 2017-10-20 维沃移动通信有限公司 A kind of Secure Network Assecc method, mobile terminal and computer-readable recording medium
CN107623722A (en) * 2017-08-21 2018-01-23 云宏信息科技股份有限公司 A kind of remote data caching method, electronic equipment and storage medium
CN108418780A (en) * 2017-02-10 2018-08-17 阿里巴巴集团控股有限公司 Filter method and device, system, the dns server of IP address
CN109788019A (en) * 2017-11-13 2019-05-21 重庆华龙艾迪信息技术有限公司 A kind of data processing method and proxy server

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102148759A (en) * 2011-04-01 2011-08-10 许旭 Method for saving export bandwidth of backbone network by cache acceleration system
CN102984173A (en) * 2012-12-13 2013-03-20 迈普通信技术股份有限公司 Network access control method and system
CN108418780A (en) * 2017-02-10 2018-08-17 阿里巴巴集团控股有限公司 Filter method and device, system, the dns server of IP address
CN107135249A (en) * 2017-04-06 2017-09-05 腾讯科技(深圳)有限公司 Data download method and device
CN107277025A (en) * 2017-06-28 2017-10-20 维沃移动通信有限公司 A kind of Secure Network Assecc method, mobile terminal and computer-readable recording medium
CN107623722A (en) * 2017-08-21 2018-01-23 云宏信息科技股份有限公司 A kind of remote data caching method, electronic equipment and storage medium
CN109788019A (en) * 2017-11-13 2019-05-21 重庆华龙艾迪信息技术有限公司 A kind of data processing method and proxy server

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115208951A (en) * 2022-06-28 2022-10-18 平安银行股份有限公司 Request processing method and device, electronic equipment and computer readable storage medium
CN115208951B (en) * 2022-06-28 2024-03-15 平安银行股份有限公司 Request processing method, request processing device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN112637254B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
CN109542427B (en) System customization method and device, electronic equipment and storage medium
CN109726108B (en) Front-end code testing method, device, system and medium based on analog data
US20170017480A1 (en) Method and apparatus for updating an application in a user terminal
CN110795343B (en) Test system, test method and computing device
CN110377440B (en) Information processing method and device
CN110851170A (en) Software multi-channel publishing method and related equipment
CN112637254B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN112887451B (en) Domain name resolution method and device and computer equipment
WO2017020778A1 (en) Method and device for displaying app on app wall
CN111414191A (en) Gray scale publishing method and device for small program
US10621627B2 (en) Running client experiments based on server-side user segment data
CN113691618B (en) Message notification method, device, message center and storage medium
CN112732547B (en) Service testing method and device, storage medium and electronic equipment
CN104735079A (en) Payment verification method and device based on domain name system (DNS)
CN114489603A (en) Code generation method, apparatus, electronic device, medium, and product
CN114302207A (en) Bullet screen display method, device, system, equipment and storage medium
CN108494982B (en) Method and apparatus for generating information
CN111124907A (en) Mobile phone game testing method and device and server
US11140724B2 (en) Systems and methods for enabling sharing between devices
CN113760715A (en) Method and device for testing system
CN111880773A (en) Data processing method and device, electronic equipment and storage medium
EP3306898A2 (en) Information processing method and device
CN113590913B (en) Data resource display method and device, storage medium and electronic device
CN105677453B (en) Task processing method and device for task platform
CN114285743B (en) Method, device, electronic equipment and storage medium for updating configuration information

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
GR01 Patent grant
GR01 Patent grant