Data acquisition method, device, electronic device and storage medium
The target service layer is generated by the client and the controller and interface information are used to obtain simulated data, which solves the problem of high communication costs between the front-end and back-end, realizes parallel development, and improves development efficiency.
Patent Information
- Application Number
- CN202110738292.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-30
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2041-06-30
AI Technical Summary
In application component model management, the communication cost between the front-end and the back-end is high, which affects the efficiency of project development. Front-end development needs to wait until the back-end interface development is completed before it can be carried out, resulting in serial development.
The client directly generates the target service layer, based on the controller information and interface information, uses the target service layer to obtain simulated data, reduce the communication costs between the server and the client, and realize parallel development.
By reducing the communication costs between servers and clients, improving development efficiency, and achieving parallel development and testing of front-end and back-end.
Smart Images

Figure CN113467780B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Internet technology, and in particular to a data acquisition method, device, electronic device, and storage medium. Background Art
[0002] Currently, managing an application's component model is a crucial aspect of the entire application. This model primarily consists of two parts: the data-driven rendering state of the frontend, which is primarily maintained by the frontend; and the backend's business model, which is primarily responsible for the backend's business model. Specifically, the backend encapsulates the service layer of various applications that meet architectural constraints and principles, providing access to these services for the frontend. Based on the above description, it can be seen that the roles of data users and maintainers are distinct, leading to significant communication costs.
[0003] At the same time, in business projects, front-end development depends on back-end data. If the front-end needs to wait until the back-end interface development is completed before starting serial development during the project development process, it may affect the efficiency of the entire project. Summary of the Invention
[0004] The present disclosure provides a data acquisition method, device, electronic device, and storage medium. The technical solutions of the present disclosure are as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a data acquisition method is provided, including:
[0006] Sending a data request corresponding to the target application requirement; the data request includes identification information corresponding to the target application requirement;
[0007] Send the data request to the target service layer on the client corresponding to the target application requirement; the target service layer is generated based on the controller information and interface information; the controller information and interface information are fed back by the server based on the received interface document request;
[0008] Use the target service layer to obtain simulated data of the return data corresponding to the identification information.
[0009] In some possible embodiments, the method further includes:
[0010] Send an interface document request to the server; the interface document request includes the interface address;
[0011] Receive the interface document based on the interface address fed back by the server;
[0012] Parse the interface document to obtain the controller information and the interface information corresponding to the controller information;
[0013] Determine the controller information and interface information corresponding to the target application requirements;
[0014] Generate the target service layer based on the controller information and interface information corresponding to the target application requirements.
[0015] In some possible embodiments, the method further includes:
[0016] Determine interface output parameter information from the interface information;
[0017] Use the target service layer to generate simulated data of the return data based on the interface output parameter information.
[0018] In some possible embodiments, the method further includes:
[0019] Receive document update instructions sent by the server;
[0020] Send an interface document request to the server; the interface document request includes the interface address;
[0021] The updated interface document obtained based on the interface address is received from the server.
[0022] In some possible embodiments, generating simulated data of return data based on interface output parameter information using the target service layer includes:
[0023] The target service layer is used to generate simulated data of the return data based on the type information in the interface output parameter information.
[0024] In some possible embodiments, sending the data request to the target service layer corresponding to the target application requirement includes:
[0025] Use the middleware module to obtain data requests;
[0026] Forward the data request to the target service layer corresponding to the target application requirements.
[0027] According to a second aspect of an embodiment of the present disclosure, there is provided a data acquisition device, including:
[0028] The data request sending module is configured to execute and send a data request corresponding to the target application requirement; the data request includes identification information corresponding to the target application requirement;
[0029] The data request forwarding module is configured to execute the data request and send it to the target service layer located on the client corresponding to the target application requirement; the target service layer is generated based on the controller information and interface information; the controller information and interface information are fed back by the server based on the received interface document request;
[0030] The simulation data acquisition module is configured to execute simulation data of obtaining return data corresponding to identification information using the target service layer.
[0031] In some possible embodiments, the device further includes:
[0032] The interface document request sending module is configured to execute sending an interface document request to the server; the interface document request includes an interface address;
[0033] An interface document receiving module is configured to receive an interface document obtained based on an interface address fed back by a server;
[0034] The document parsing module is configured to parse the interface document to obtain controller information and interface information corresponding to the controller information;
[0035] An information determination module is configured to determine controller information and interface information corresponding to target application requirements;
[0036] The service layer generation module is configured to generate a target service layer based on the controller information and interface information corresponding to the target application requirements.
[0037] In some possible embodiments, the device further includes:
[0038] An interface output parameter information determination module is configured to determine interface output parameter information from interface information;
[0039] The simulation data generation module is configured to execute simulation data of generating return data based on the interface output parameter information using the target service layer.
[0040] In some possible embodiments, the device further includes an update instruction receiving module:
[0041] An update instruction receiving module, configured to execute a document update instruction sent by a receiving server;
[0042] The interface document request sending module is configured to execute sending an interface document request to the server; the interface document request includes an interface address;
[0043] The interface document receiving module is configured to receive the updated interface document fed back by the server and obtained based on the interface address.
[0044] In some possible embodiments, the simulation data generation module is configured to execute: generating simulation data of the return data based on type information in the interface output parameter information by using the target service layer.
[0045] In some possible embodiments, the data request forwarding module includes:
[0046] The transfer module is configured to execute a request to obtain data using the middleware module;
[0047] The data request forwarding submodule is configured to forward the data request to the target service layer corresponding to the target application requirement.
[0048] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement a method as described in any one of the first aspects above.
[0049] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any one of the methods in the first aspect of the embodiment of the present disclosure.
[0050] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes a computer program, the computer program is stored in a readable storage medium, and at least one processor of a computer device reads and executes the computer program from the readable storage medium, so that the computer device performs any one of the methods in the first aspect of the embodiment of the present disclosure.
[0051] The technical solutions provided by the embodiments of the present disclosure bring at least the following beneficial effects:
[0052] The embodiment of the present application sends a data request corresponding to the target application requirement; the data request contains identification information corresponding to the target application requirement, and the data request is sent to the target service layer located on the client corresponding to the target application requirement; the target service layer is generated based on the controller information and interface information; the controller information and interface information are fed back by the server based on the received interface document request, and the target service layer is used to obtain simulated data of the return data corresponding to the identification information. In the embodiment of the present disclosure, the client directly generates the target service layer based on the controller information and interface information, reducing the communication cost between the server and the client, and at the same time, can ensure the parallel development of the server and the client based on the simulated data of the returned data, thereby improving development efficiency.
[0053] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute an improper limitation of the present disclosure.
[0055] Figure 1 is a schematic diagram showing an application environment according to an exemplary embodiment;
[0056] Figure 2is a flow chart showing a data acquisition method according to an exemplary embodiment;
[0057] Figure 3 is a flow chart showing a method for generating a service layer according to an exemplary embodiment;
[0058] Figure 4 is a flow chart showing a method for generating simulation data according to an exemplary embodiment;
[0059] Figure 5 is a flow chart showing a method for updating a current interface document according to an exemplary embodiment;
[0060] Figure 6 is a framework diagram of a data acquisition device according to an exemplary embodiment;
[0061] Figure 7 is a block diagram of a data acquisition device according to an exemplary embodiment;
[0062] Figure 8 It is a block diagram of an electronic device for data acquisition according to an exemplary embodiment. DETAILED DESCRIPTION
[0063] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0064] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar first objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with certain aspects of the present disclosure as detailed in the appended claims.
[0065] The data involved in this disclosure may be data authorized by the user or fully authorized by all parties.
[0066] See also Figure 1 , Figure 1 is a schematic diagram showing an application environment of a data acquisition method according to an exemplary embodiment. Figure 1 As shown, the application environment may include a server 01 and a client 02 .
[0067] In some possible embodiments, server 01 may be a server that, after receiving an interface document request sent by client 02, feeds back the current interface document to client 02 based on the back-end interface address contained in the interface document request. Optionally, the server may include an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0068] In some possible embodiments, the client 02 sends a data request corresponding to the target application requirement, the data request includes identification information corresponding to the target application requirement, and sends the data request to the target service layer located on the client corresponding to the target application requirement; the target service layer is generated based on the controller information and interface information; the controller information and interface information are the simulated data of the return data corresponding to the identification information obtained by the server based on the received interface document request. Among them, the client can include but is not limited to smartphones, desktop computers, tablet computers, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices and other types of devices. It can also be software running on the above devices, such as applications, applets, etc. Optionally, the operating system running on the device can include but is not limited to Android, IOS, Linux, Windows, Unix, etc.
[0069] In some possible embodiments, the client 02 and the server 01 may be connected via a wired link or a wireless link.
[0070] Figure 2 is a flow chart showing a data acquisition method according to an exemplary embodiment. Figure 2 As shown, the data acquisition method can be applied to the client or other nodes, including the following steps:
[0071] In step S201, a data request corresponding to a target application requirement is sent; the data request includes identification information corresponding to the target application requirement.
[0072] In the embodiment of the present disclosure, the client that executes the above-mentioned step S201 and sends the data request corresponding to the target application requirement can be a front-end device in the front-end and back-end architecture. Since one of the goals of this application is that the client can directly generate the target service layer based on the controller information and interface information to reduce the communication cost between the server and the client and improve the development efficiency, and at the same time can ensure the parallel development of the server and the client based on the simulation data of the returned data, the front-end device can be the device used by the front-end developer. It can be obtained that when the client is the device of the front-end developer, the data request corresponding to the target application requirement sent by it is to the device used by the back-end developer, such as the terminal or server of the back-end developer. For the sake of convenience of explanation below, the client and server will refer to the two side devices respectively.
[0073] In the disclosed embodiments, the target application requirement can be any requirement, such as a component development requirement for a web page on a client, a component testing requirement for an application on a client, etc. The component can be a table, dialog box, button, etc. on a web page. Specifically, after operating a component, user information or a user list can be returned.
[0074] In the disclosed embodiment, in order to achieve the goal that the client (front-end client) and the server (back-end server) can be developed or tested in parallel, instead of waiting for the server (back-end server) to complete the development of all interfaces before the client (front-end client) can develop based on the interfaces, or the server (back-end server) has completed the testing of the components to be tested before the client (front-end client) can further test based on the components. Before sending a data request corresponding to the target application requirements to obtain simulated data of the final return data, the client (front-end client) can first establish a virtual server in the local service of the client (front-end client) based on the current interface document provided by the server (back-end server), so that the client and server, that is, the front-end client and the back-end server, can be developed or tested in parallel.
[0075] Figure 3 is a flow chart showing a method for generating a service layer according to an exemplary embodiment. Figure 3 As shown, the following steps are included:
[0076] In step S2001: an interface document request is sent to the server; the interface document request includes an interface address.
[0077] In the embodiment of the present disclosure, the client can send an interface document request to the server, and the interface document request can include an interface address. Optionally, the interface document request can be a request based on the HTTP protocol.
[0078] Optionally, the above interface address may be provided by a server, that is, a backend server. Therefore, the interface address may also be referred to as a backend interface address.
[0079] In some possible embodiments, the interface address may be an access path. After the server packages the defined interface and generates an interface document, the server may store the interface document in a storage space on the server and generate an access path based on the storage space where the interface document is stored, so that the client can access the interface document based on the access path.
[0080] In some optional embodiments, the interface address, i.e., the access path, does not change. That is, whether it is the first time the server generates an interface document or the defined interface, there may be some subsequent updates, and it is necessary to repackage and generate the interface document based on the updated defined interface, and store the repackaged interface document in the above-mentioned fixed storage space. Based on the above situation, when the client obtains the interface document based on the interface address, it only needs to directly obtain it based on the interface address agreed upon by the client and the server. Ultimately, the update of the defined interface will not excessively affect the beneficial effects of the client.
[0081] In the embodiment of the present disclosure, the interface document may include all interfaces defined by the server (backend server), or may include some interfaces defined by the backend server. The specific interfaces included may be determined based on the application requirements of the current client.
[0082] For example, suppose the client's application requirement for the backend server is mainly to obtain a table of information with certain parameters. Certain parameters may include information A, information B, and information C. Optionally, the server can determine the three interface objects corresponding to the three parameters based on the above content (interface 1 corresponding to information A, interface 2 corresponding to information B, and interface 3 corresponding to information C). Optionally, perhaps because of the closeness of these three parameters, there is a possibility of being reused by different application requirements. Therefore, the server can define these three parameters as an interface object, which includes the three parameters. Optionally, the backend interface address contained in the interface document request corresponding to the table information with certain parameters can be expressed as " / rest / userinform".
[0083] In step S2002: receiving the interface document obtained based on the interface address fed back by the server.
[0084] Continuing with the above example, in the disclosed embodiment, upon receiving an interface document request, the server can parse the request to obtain the backend interface address " / rest / userinform", retrieve the interface document from the storage space based on the backend interface address " / rest / userinform", and send the interface document to the client. Correspondingly, the client can receive the interface document retrieved based on the interface address from the server.
[0085] In some possible embodiments, the current interface document is a JSON type of data.
[0086] In step S2003: the interface document is parsed to obtain a plurality of controller information and interface information corresponding to the controller information.
[0087] In an embodiment of the present disclosure, the client can parse the interface document to obtain multiple controller information and interface information corresponding to each controller information. If, according to the above example, each parameter corresponds to an interface object, then information A can correspond to controller information 1 and interface information 1, information B can correspond to controller information 2 and interface information 2, and information C can correspond to controller information 3 and interface information 3.
[0088] In some possible embodiments, each piece of interface information may include interface identification information, interface input parameter information, and interface output parameter information of the interface corresponding to the interface information.
[0089] In step S2004: determining the controller information and interface information corresponding to the target application requirements.
[0090] In the embodiment of the present disclosure, since the client has different application requirements when performing development or testing tasks, the client can first determine the controller information and interface information corresponding to each application requirement. That is, the client can determine different controller information and interface information according to the form of data assembly, and then prepare for the subsequent generation of different service layers based on the determined controller information and interface information.
[0091] If the target application requirement in step S2004 is to obtain parameters in a table information with certain parameters, then what is determined from the current interface information is controller information 1, interface information 1, controller information 2, interface information 2, controller information 3 and interface information 3.
[0092] In step S2005: a target service layer is generated based on the controller information and interface information corresponding to the target application requirements.
[0093] In the embodiment of the present disclosure, since the above steps have determined the controller information and interface information corresponding to the target application requirements, the client can directly generate the target service layer based on the controller information and interface information (interface identification information, interface input parameter information and interface output parameter information) corresponding to the target application requirements, that is, generate code representing the target service layer.
[0094] Optionally, the above example only illustrates the target application requirements. As for how to determine the controller information and interface information for other application requirements, and then generate the corresponding service layer based on the determined controller information and interface information, please refer to the content of the above target application requirements. I will not repeat it here.
[0095] In this way, the embodiment of the present disclosure directly generates the target service layer through the interface document provided by the server. Since the code of the service layer is consistent with the data of the interface document, if the data of the interface document changes, the code of the service layer will change. In this way, in the embodiment of the present application, the communication cost between the client and the server can be reduced and the development efficiency can be improved.
[0096] Figure 4 is a flow chart of a method for generating simulation data according to an exemplary embodiment. Figure 4 As shown, in Figure 3 Based on this, the following steps may be included:
[0097] In step 2006, the interface output parameter information is determined from the interface information.
[0098] In some possible embodiments, since the simulation data of the return data is returned to the client by the virtual server in the client involved in the above content, and since the simulation data of the return data in the virtual server is the interface output parameter data in the actual server, as long as the interface output parameter data is determined from the interface information, preparations can be made for generating the simulation data of the return data.
[0099] In step S2007, the target service layer is used to generate simulated data of the return data based on the interface output parameter information.
[0100] In an embodiment of the present application, the client may also obtain interface output parameter information in the interface information, and generate simulated data of the return data based on the interface output parameter information.
[0101] In an optional embodiment, the client can generate simulated data of the return data required by the target application based on the interface parameter information, store the simulated data of the return data in a constructed folder, and generate identification information corresponding to the folder. Optionally, after the identification information is generated, it can be linked to the target application requirement and the target service layer. When a data request corresponding to the target application requirement is sent, the identification information in the data request is the identification information corresponding to the above folder. This identification information can enable the client to locate the target service layer, and then the target service layer can take out the simulated data of the return data in the folder and return it to the client.
[0102] Optionally, the above identification information may be a Uniform Resource Locator (URL) information.
[0103] In this way, front-end developers or testers can develop applications directly using simulated data returned without considering the impact of the server on the client before the server is fully developed, allowing the client and server to be developed in parallel, thereby improving development efficiency.
[0104] In some optional embodiments, the generated target service layer includes a service layer generated based on the Typescript scripting language or a service layer generated based on the Javascript scripting language. If the generated target service layer includes a service layer generated based on the Typescript scripting language, the client can generate simulated data for the return data based on type information in the interface output parameter information, where the type information includes floating point type and integer type.
[0105] In this way, the embodiments of the present disclosure can provide different scripting languages for different types of clients or different developers, making the technical methods of the embodiments of the present disclosure more practical and easier to promote.
[0106] As mentioned above, the server may generate an interface document for the first time, or it may need to repackage and generate the interface document based on the updated defined interface because the defined interface may be updated later. Then, if the defined interface is updated later, and the interface document needs to be repackaged and generated based on the updated defined interface, the client is still using the service layer generated by the previous current interface device or the simulated data of the returned data for development or testing, which will inevitably lead to inconsistency in data usage between the client and the server. In order to solve the above problem, the embodiment of the present disclosure provides a method for updating the current interface document in the client.
[0107] Figure 5 is a flow chart showing a method for updating a current interface document according to an exemplary embodiment. Figure 5As shown, the following steps may be included:
[0108] In step S501, a document update instruction sent by a server is received.
[0109] In the embodiment of the present disclosure, when the server detects that a defined interface has changed, such as changing a certain interface input parameter data from "information A" to "information A+", and adding an interface input parameter data "information A++", the interface document can be repackaged and generated based on the updated defined interface, and the previous interface document can be replaced with the updated interface document.
[0110] In some possible embodiments, when the server determines that the updated interface document has replaced the previous interface document, it can send a document update instruction to the client, which can inform the client that the interface document has changed and needs to be retrieved again.
[0111] In step S503, an interface document request is sent to the server; the interface document request includes the interface address.
[0112] In step S505, an updated interface document obtained based on the interface address and fed back by the server is received.
[0113] In the embodiment of the present disclosure, the implementation of steps S503-S505 specifically refers to the contents of steps S2001-S2002, which will not be repeated here. After obtaining the updated interface document, the client can generate simulation data of the updated target service layer and updated return data according to steps S2003-S2006.
[0114] In step S203, the client sends the data request to the target service layer located on the client corresponding to the target application requirement; the target service layer is generated based on the controller information and interface information, and the controller information and interface information are fed back by the server based on the received interface document request.
[0115] In some possible embodiments, when the front-end client sends a data request corresponding to the target application requirement to the back-end server, the front-end client may autonomously send the data request to the target service layer corresponding to the target application requirement located on the client.
[0116] In some possible embodiments, when the client sends a data request corresponding to the target application requirement to the backend server, the client can use the middleware module to intercept the data request and send the data request to the target service layer corresponding to the target application requirement through the middleware module.
[0117] In an embodiment of the present application, when the client is able to use the data acquisition method of the present application, a configuration or device corresponding to the method is installed, and the configuration can provide a middleware module. This is because after the target service layer is generated, the target service layer is a virtual backend (virtual server) that replaces the backend for the target application requirements. Since the front-end client and the back-end server are developed synchronously, this solution can send data requests to the virtual server created by the front-end client during actual application. Therefore, a middleware module needs to be set up to transfer the data request and send the data request to the front-end client.
[0118] In an embodiment of the present application, as mentioned above, the identification information in the interface request is mapped to the target service layer and the corresponding folder. Therefore, when the middleware receives the data request, it can obtain the identification information from the data request and locate the target service layer through the identification information. Thus, the interface request can be sent to the target service layer corresponding to the target application requirements.
[0119] In step S205, the target service layer is used to obtain simulation data of the return data corresponding to the identification information.
[0120] In an optional embodiment, the client can use the target service layer to obtain the interface input parameter information and the simulated data of the return data corresponding to the identification information. In this embodiment, the identification information, such as the URL information, includes the interface input parameter information, such as "information A = XXXX", but the target server does not parse the URL information. It only takes out the interface input parameter information and the simulated data of the return data from the folder through the target server, such as "information A = XXXX, information B = YYYY", where "information A = XXXX" is the interface input parameter information and "information B = YYYY" is the simulated data of the return data. Of course, it can also be "information A = XXXXX, information B = YYYYY", that is, it is not necessary to obtain the simulated data of the corresponding return data based on the interface input parameter information in the URL information. Because this is the application requirement of the client, it meets the requirement as long as the simulated data of the return data fed back by the target server is normal data.
[0121] Figure 6 This is a framework diagram of a data acquisition device according to an exemplary embodiment. Figure 6 Optionally, the client sends an interface document request to the server, which includes the interface address given by the server to the client. Based on the interface address, the client accesses the interface document stored in a storage space on the server, i.e. Figure 6The interface document on the left can include controller information and interface information (interface identification information, interface input parameter information, and interface output parameter information). Model parameters can be a collection of various interface identification information, interface input parameter information, and interface output parameter information. Model parameters can provide different interface information for each application requirement required by the client. In addition, the interface document can also include access paths.
[0122] exist Figure 6 The middle part shows that the server can use the code generator to generate a service layer corresponding to different application requirements based on the interface document. Among them, the server can generate a service layer based on the first scripting language or based on the second scripting language. The first scripting language and the second scripting language can both be processed based on a custom generation template (references, calls between modules, etc.). Specifically, the first scripting language needs to generate a service layer in combination with the defined types and interface layer code. Optionally, the first scripting language can be a Typescript scripting language. The second scripting language generates a service layer based on the interface layer code. Optionally, the second scripting language can be a Javascript scripting language. Typescript scripting language and Javascript scripting language are only two optional scripting languages in the embodiment of the present application. In the actual application process, other scripting languages are also possible.
[0123] exist Figure 6 The right side of the diagram shows how, after receiving a data request intercepted by the middleware module, the client uses the target service layer to obtain simulated data corresponding to the return data identified by the target service layer. This data is then returned to the client through the service's simulated middle layer. The middle and right sides together form the entire process of how the client obtains simulated data from the return data.
[0124] In summary, in the embodiment of the present application, before the client sends a data request corresponding to the target application requirements to obtain the simulated data of the final return data, it can first establish a virtual server in the client's local service based on the current interface document provided by the backend, so that the frontend and backend can be developed or tested in parallel. At the same time, the current interface document is repackaged and generated by the interface defined after the update, so that the client does not still use the service layer generated by the previous current interface device or the simulated data of the return data for development or testing, so that the frontend and backend data usage remain consistent.
[0125] Figure 7 FIG. 1 is a block diagram of a data acquisition device according to an exemplary embodiment. Figure 7 The device includes a data request sending module 701, a data request forwarding module 702 and a simulation data acquisition module 703.
[0126] The data request sending module 701 is configured to execute and send a data request corresponding to a target application requirement; the data request includes identification information corresponding to the target application requirement;
[0127] The data request forwarding module 702 is configured to execute the data request and send it to the target service layer located on the client corresponding to the target application requirement; the target service layer is generated based on the controller information and interface information; the controller information and interface information are fed back by the server based on the received interface document request;
[0128] The simulation data acquisition module 703 is configured to execute simulation data of acquiring return data corresponding to the identification information using the target service layer.
[0129] In some possible embodiments, the device further includes:
[0130] The interface document request sending module is configured to execute sending an interface document request to the server; the interface document request includes an interface address;
[0131] An interface document receiving module is configured to receive an interface document obtained based on an interface address fed back by a server;
[0132] The document parsing module is configured to parse the interface document to obtain controller information and interface information corresponding to the controller information;
[0133] An information determination module is configured to determine controller information and interface information corresponding to target application requirements;
[0134] The service layer generation module is configured to generate a target service layer based on the controller information and interface information corresponding to the target application requirements.
[0135] In some possible embodiments, the device further includes:
[0136] An interface output parameter information determination module is configured to determine interface output parameter information from interface information;
[0137] The simulation data generation module is configured to execute simulation data of generating return data based on the interface output parameter information using the target service layer.
[0138] In some possible embodiments, the device further includes an update instruction receiving module:
[0139] An update instruction receiving module, configured to execute a document update instruction sent by a receiving server;
[0140] The interface document request sending module is configured to execute sending an interface document request to the server; the interface document request includes an interface address;
[0141] The interface document receiving module is configured to receive the updated interface document fed back by the server and obtained based on the interface address.
[0142] In some possible embodiments, the simulation data generation module is configured to execute: generating simulation data of the return data based on type information in the interface output parameter information by using the target service layer.
[0143] In some possible embodiments, the data request forwarding module includes:
[0144] The transfer module is configured to execute a request to obtain data using the middleware module;
[0145] The data request forwarding submodule is configured to forward the data request to the target service layer corresponding to the target application requirement.
[0146] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0147] Figure 8 is a block diagram of an electronic device 800 for data acquisition according to an exemplary embodiment.
[0148] The electronic device can be a server or a terminal device, and its internal structure can be as follows: Figure 8 As shown. The electronic device includes a processor, a memory, and a network interface connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a data acquisition method is implemented.
[0149] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0150] In an exemplary embodiment, an electronic device is further provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the data acquisition method in the embodiment of the present disclosure.
[0151] In an exemplary embodiment, a computer-readable storage medium is further provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data acquisition method in the embodiment of the present disclosure.
[0152] In an exemplary embodiment, a computer program product is also provided, which includes a computer program stored in a readable storage medium. At least one processor of a computer device reads and executes the computer program from the readable storage medium, so that the computer device performs the data acquisition method of the embodiment of the present disclosure.
[0153] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, which can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0154] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.
[0155] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A data acquisition method, characterized in that: Applied to the client, including: Sending a data request corresponding to a target application requirement; the data request includes identification information corresponding to the target application requirement; the target application requirement is any requirement of the client; there is a mapping relationship between the target application requirement and the identification information; Obtaining the data request using a middleware module; the middleware module is located on the client; The data request is sent to the target service layer located in the client local service corresponding to the target application requirement based on the identification information; the target service layer is generated based on the controller information and interface information in the interface document; the controller information and the interface information are fed back by the server based on the received interface document request; the interface information includes interface output parameter information; the interface document can be updated based on the document update instruction sent by the server; the target service layer is one of a plurality of different service layers; different service layers are generated by different controller information and interface information in the form of data assembly to form different interface documents; Utilizing the target service layer to obtain the interface output parameter information corresponding to the identification information; The target service layer is used to generate simulated data of the return data based on the interface output parameter information.
2. The data acquisition method according to claim 1, characterized in that: The method further comprises: Sending the interface document request to the server; the interface document request includes an interface address; Receiving the interface document obtained based on the interface address fed back by the server; Parsing the interface document to obtain controller information and interface information corresponding to the controller information; Determine controller information and interface information corresponding to the target application requirements; The target service layer is generated based on the controller information and interface information corresponding to the target application requirements.
3. The data acquisition method according to claim 2, characterized in that: The method further comprises: Determine interface output parameter information from the interface information.
4. The data acquisition method according to claim 2, wherein: The method further comprises: receiving a document update instruction sent by the server; Sending the interface document request to the server; the interface document request includes the interface address; Receive the updated interface document fed back by the server that is obtained based on the interface address.
5. The data acquisition method according to claim 3, characterized in that: The generating of the simulated data of the return data based on the interface output parameter information by using the target service layer includes: The target service layer is used to generate simulation data of the return data based on the type information in the interface output parameter information.
6. A data acquisition device, characterized in that: Applied to the client, including: a data request sending module configured to execute and send a data request corresponding to a target application requirement; the data request includes identification information corresponding to the target application requirement; the target application requirement is any requirement of the client; and there is a mapping relationship between the target application requirement and the identification information; A data request forwarding module is configured to execute the acquisition of the data request by a middleware module; the middleware module is located at the client; based on the identification information, the data request is sent to a target service layer located in a local service of the client corresponding to the target application requirement; the target service layer is generated based on the controller information and interface information in the interface document; the controller information and the interface information are fed back by the server based on the received interface document request; the interface information includes interface output parameter information; the interface document can be updated based on the document update instruction sent by the server; the target service layer is one of a plurality of different service layers; different service layers are generated by different controller information and interface information in the form of data assembly to form different interface documents; The simulation data acquisition module is configured to use the target service layer to obtain the interface output parameter information corresponding to the identification information; and use the target service layer to generate simulation data of return data based on the interface output parameter information.
7. The data acquisition device according to claim 6, characterized in that: The device further comprises: An interface document request sending module is configured to execute sending the interface document request to the server; the interface document request includes an interface address; An interface document receiving module, configured to receive an interface document fed back by the server and obtained based on the interface address; A document parsing module is configured to parse the interface document to obtain controller information and interface information corresponding to the controller information; An information determination module is configured to determine controller information and interface information corresponding to the target application requirements; The service layer generation module is configured to generate the target service layer based on the controller information and interface information corresponding to the target application requirements.
8. The data acquisition device according to claim 7, characterized in that: The device further comprises: The interface output parameter information determination module is configured to determine the interface output parameter information from the interface information.
9. The data acquisition device according to claim 7, characterized in that: The device also includes an update instruction receiving module: The update instruction receiving module is configured to execute and receive the document update instruction sent by the server; The interface document request sending module is configured to send the interface document request to the server; the interface document request includes the interface address; The interface document receiving module is configured to receive the updated interface document fed back by the server and obtained based on the interface address.
10. The data acquisition device according to claim 8, characterized in that: The simulation data generation module is configured to execute: using the target service layer to generate simulation data of the return data based on the type information in the interface output parameter information.
11. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the data acquisition method according to any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data acquisition method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method of improving software integration system based on analog ports and related devices
CN110309048A
Client testing method and device based on simulation server response and electronic equipment
CN110806970A