A data feedback method and system for front-end code and related device
Patent Information
- Application Number
- CN202211718483.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2042-12-29
AI Technical Summary
然而现有技术中大部分都是通过人工维护特定的mock规则来对后端设备的接口数据进行模拟和使用,数据调用的效率较低,影响前后端开发效率
[0008]通过上述方案,本申请的有益效果是:通过将后端接口模块反馈的后端接口数据拦截并在模拟接口模块中进行备份,能够应对开发过程中后端接口模块的真实业务数据不能轻易更改的情形,无需人工参与配置模拟接口数据,根据实际应用需求直接修改并调用模拟接口模块中存储的备份数据,从而在保证后端接口模块中的真实业务数据不受影响的同时,大大提高模拟接口数据收集及调用的效率与场景适用性,并且能够减少人工成本。而且,通过响应于不同的资源请求,即第一资源请求或第二资源请求,能够自定义选择收集模拟接口数据或者调用模拟接口数据,使得模拟接口数据的调用与管理更加灵活。此外,在后端接口数据为多个时,还能够同时实现后端接口数据的批量录入,进一步节省数据录入时间,提高模拟接口数据的收集效率。
Smart Images

Figure CN116126701B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a data feedback method, system, and related equipment for front-end code. Background Technology
[0002] In the mainstream front-end / back-end separation development model, front-end devices obtain and update back-end data by sending requests. However, since front-end development usually progresses faster than back-end API development, front-end devices typically need to wait for the back-end APIs to be successfully implemented before they can perform normal integration testing. Therefore, to minimize the impact of back-end API development on front-end device development, current methods decouple front-end and back-end devices during development. This involves simulating API calls to the back-end devices to ensure normal debugging of the front-end code under various development scenarios. However, most existing technologies rely on manually maintaining specific mock rules to simulate and use back-end device API data, resulting in low data retrieval efficiency and impacting both front-end and back-end development efficiency. Summary of the Invention
[0003] This application provides a data feedback method, system, and related equipment for front-end code, which can improve the efficiency of data collection and invocation of simulated interfaces.
[0004] To solve the above technical problems, the technical solution adopted in this application is: to provide a data feedback method for front-end code, the method comprising: obtaining back-end interface data fed back by the back-end interface module in response to a first resource request of the front-end code; adding the back-end interface data to a simulated interface module to form simulated interface data; and feeding back corresponding simulated interface data from the simulated interface module in response to a second resource request of the front-end code.
[0005] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a back-end device, which includes a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the data feedback method of the front-end code in the above-mentioned technical solution.
[0006] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a front-end and back-end interaction system, which includes interconnected front-end devices and back-end devices. The front-end devices are used to store front-end code and output a first resource request or a second resource request of the front-end code. The back-end devices include at least interconnected back-end interface modules and simulation interface modules. The back-end devices are used to implement the data feedback method of the front-end code in the above technical solution.
[0007] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a computer-readable storage medium for storing a computer program, which, when executed by a processor, is used to implement the data feedback method of the front-end code in the above-mentioned technical solution.
[0008] The beneficial effects of this application through the above solution are as follows: By intercepting the backend interface data fed back by the backend interface module and backing it up in the simulated interface module, it can address situations where the real business data of the backend interface module cannot be easily changed during development. No manual intervention is required to configure the simulated interface data; the backup data stored in the simulated interface module can be directly modified and called according to actual application needs. This ensures that the real business data in the backend interface module remains unaffected while significantly improving the efficiency and applicability of simulated interface data collection and retrieval, and reducing labor costs. Furthermore, by responding to different resource requests, i.e., the first resource request or the second resource request, the collection or retrieval of simulated interface data can be customized, making the retrieval and management of simulated interface data more flexible. In addition, when there are multiple backend interface data sets, batch entry of backend interface data can be achieved simultaneously, further saving data entry time and improving the efficiency of simulated interface data collection. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:
[0010] Figure 1 This is a flowchart illustrating an embodiment of the data feedback method for front-end code provided in this application;
[0011] Figure 2 This is a flowchart illustrating another embodiment of the data feedback method for the front-end code provided in this application;
[0012] Figure 3 This is the data display interface of the simulation interface module provided in this application;
[0013] Figure 4 This is a schematic diagram of the structure of an embodiment of the backend device provided in this application;
[0014] Figure 5 This is a schematic diagram of the structure of an embodiment of the front-end and back-end interaction system provided in this application;
[0015] Figure 6 This is a schematic diagram of another embodiment of the front-end and back-end interaction system provided in this application;
[0016] Figure 7 This is an interactive flowchart of the backend device initiating collection instructions provided in this application;
[0017] Figure 8 This is an interactive flowchart of the front-end device initiating collection instructions provided in this application;
[0018] Figure 9 This is a schematic diagram of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation
[0019] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be particularly noted that the following embodiments are for illustrative purposes only and do not limit the scope of the application. Similarly, the following embodiments are only some, not all, embodiments of the present application, and all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the present application.
[0020] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0021] It should be noted that the terms "first," "second," and "third" in this application are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0022] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the data feedback method for front-end code provided in this application. The method includes:
[0023] Step 11: Obtain the backend interface data returned by the backend interface module in response to the first resource request from the frontend code.
[0024] The backend interface module receives the backend interface data in response to the first resource request from the frontend code. Specifically, the frontend code is stored in the frontend device, and the backend device may include a backend interface module and a simulated interface module. The frontend code generates a corresponding first resource request in response to user operations and sends it to the backend interface module in the backend device (i.e., the backend business system). This causes the backend interface module to send corresponding backend interface data to the frontend device in response to the first resource request from the frontend code, so that the frontend device receives the backend interface data. In this embodiment, "interface" refers to the path for resource communication between the frontend device and the backend device.
[0025] Understandably, backend devices and frontend devices can communicate via Hypertext Transfer Protocol (HTTP) or Remote Procedure Call (RPC), without limitation.
[0026] Step 12: Add the backend interface data to the simulated interface module to form simulated interface data.
[0027] After obtaining the backend interface data returned by the backend interface module in response to the first resource request from the frontend code, the backend interface data is added to the mock interface module to form mock interface data. The backend interface data is the real business data stored in the backend interface module, while the mock interface data is a backup of the backend interface data added to the mock interface module, i.e., simulated business data. In other words, the backend interface data returned by the backend interface module and the mock interface data stored in the mock interface module have the same data content.
[0028] By intercepting the backend interface data fed back by the backend interface module and backing it up in the simulated interface module, it is possible to deal with situations where the real business data of the backend interface module cannot be easily changed during development. The simulated interface data stored in the simulated interface module can be modified and called according to actual application needs. This can greatly improve the efficiency and scenario applicability of simulated interface data collection and calling while ensuring that the real business data in the backend interface module is not affected.
[0029] In one implementation, data adjustment instructions from the front-end code can be obtained; then, in response to the data adjustment instructions, the simulated interface data stored in the simulated interface module can be adjusted. The data adjustment may include, but is not limited to, operations such as deletion or modification.
[0030] In one specific implementation, the front-end code can generate one, two, or more first resource requests in response to user operations. When the front-end code generates two or more first resource requests, the back-end interface module can respond to the two or more first resource requests by feeding back two or more corresponding back-end interface data. In this case, two or more back-end interface data fed back by the back-end interface module can be obtained at the same time, and then all back-end interface data can be added to the simulated interface module, which can realize the batch entry operation of back-end interface data, thereby greatly improving the data collection efficiency.
[0031] Step 13: In response to the second resource request from the front-end code, the corresponding simulated interface data is fed back from the simulated interface module.
[0032] In response to the second resource request from the front-end code, the simulation interface module feeds back the corresponding simulation interface data. Specifically, in one embodiment, the front-end code may generate a corresponding first resource request or a second resource request in response to a user operation. The first resource request and the second resource request may carry different attribute identifiers. Alternatively, in other embodiments, the front-end code may generate a corresponding resource request in response to a user operation, while the user inputs a selection command through the front-end device to determine whether the resource request is the first resource request or the second resource request based on the selection command. This is not limited here.
[0033] This embodiment intercepts backend interface data fed back from the backend interface module and backs it up in the simulated interface module. This addresses situations where the real business data of the backend interface module cannot be easily modified during development. No manual configuration of the simulated interface data is required; the backup data stored in the simulated interface module can be directly modified and called according to actual application needs. This significantly improves the efficiency and applicability of simulated interface data collection and retrieval while ensuring that the real business data in the backend interface module remains unaffected, and also reduces labor costs. Furthermore, by responding to different resource requests (i.e., the first resource request or the second resource request), the collection or retrieval of simulated interface data can be customized, making the retrieval and management of simulated interface data more flexible. In addition, when there are multiple backend interface data sets, batch entry of backend interface data can be achieved simultaneously, further saving data entry time and improving the efficiency of simulated interface data collection.
[0034] Please see Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the data feedback method for front-end code provided in this application. The method includes:
[0035] Step 21: Obtain the mode selection instructions and resource requests from the front-end code.
[0036] The process involves obtaining the mode selection command and resource request from the front-end code. Specifically, the mode selection command can be customized by the user through the front-end device, and the front-end code can generate corresponding resource requests based on the user's operation. The mode selection command can be used to indicate whether the resource request is a first resource request or a second resource request, and the mode selection command can be used to determine whether the resource request is a first resource request or a second resource request. In other words, the mode selection command can be used to indicate whether to enter the simulated interface data collection mode or the data source selection mode (the data source includes simulated interface data and back-end interface data). After determining whether the resource request is a first resource request or a second resource request, the process then enters the simulated interface data collection mode or the data source selection mode. The simulated interface data collection mode is the operation in step 22 below, and the data source selection mode is the operation in step 23 below, which will not be described in detail here.
[0037] In one embodiment, when the simulation interface module is in its initial state, i.e., when the simulation interface module has not stored simulation interface data, it can directly respond to resource requests and enter the simulation interface data collection mode. That is, before determining whether the resource request is a first resource request or a second resource request based on the mode selection instruction, it can first be determined whether the simulation interface data stored in the simulation interface module is empty. If the simulation interface data stored in the simulation interface module is empty, then the resource request is taken as the first resource request, and the steps of obtaining the backend interface data fed back by the backend interface module in response to the first resource request from the frontend code and adding the backend interface data to the simulation interface module are executed. If the simulation interface data stored in the simulation interface module is not empty, then the step of determining whether the resource request is a first resource request or a second resource request based on the mode selection instruction is executed.
[0038] The steps for determining whether a resource request is the first or second resource request based on the mode selection instruction are described below, as shown in steps 22-23.
[0039] Step 22: In response to the mode selection instruction being set to the first mode, the resource request is set as the first resource request, and the steps of obtaining the backend interface data fed back by the backend interface module in response to the first resource request of the frontend code and adding the backend interface data to the simulated interface module are executed.
[0040] In response to the mode selection instruction being set to the first mode, the resource request is treated as the first resource request, and the steps of obtaining the backend interface data fed back by the backend interface module in response to the first resource request of the frontend code and adding the backend interface data to the simulated interface module are executed, that is, entering the simulated interface data collection mode.
[0041] Specifically, both the first and second resource requests include at least a resource path identifier, which is a unique string. Simulated interface data and backend interface data can be identified using this unique resource path identifier. When adding backend interface data to the simulated interface module, the corresponding resource path identifier can also be added to the simulated interface module to establish a correspondence between the simulated interface data and the resource path identifier. This ensures that the data stored in the simulated interface module includes at least the resource path identifier and the simulated interface data corresponding to that resource path identifier. It can be understood that since the simulated interface data is a backup of the backend interface data, the backend interface data and the backup-formed simulated interface data correspond to the same resource path identifier. In other words, each resource path identifier corresponds to a unique backend interface data and a unique simulated interface data.
[0042] In one implementation, such as Figure 3 As shown, the simulation interface module can also store the interface name corresponding to the resource path identifier. Each resource path identifier also corresponds to a unique interface name. The simulation interface module can be used to display and manage all simulation interface names, resource path identifiers and simulation interface data in a list format. Data management includes, but is not limited to, deletion, modification or retrieval.
[0043] In one embodiment, the scheme of adding backend interface data to the simulated interface module to form simulated interface data may include:
[0044] Determine whether the resource path identifier from the first resource request already exists in the simulated interface module. If the resource path identifier from the first resource request already exists in the simulated interface module, then in response to the inconsistency between the simulated interface data corresponding to the resource path identifier stored in the simulated interface module and the backend interface data returned by the backend interface module (i.e., the backend interface data returned by the backend interface module or the simulated interface data stored in the simulated interface module has been updated), the backend interface data returned by the backend interface module will overwrite the simulated interface data corresponding to the resource path identifier stored in the simulated interface module to form new simulated interface data; in response to the consistency between the simulated interface data corresponding to the resource path identifier stored in the simulated interface module and the backend interface data returned by the backend interface module, no operation will be performed. If the resource path identifier from the first resource request does not exist in the simulated interface module, then the backend interface data corresponding to the resource path identifier will be directly added to the simulated interface module to form simulated interface data.
[0045] In one embodiment, before executing the steps of obtaining the backend interface data returned by the backend interface module in response to the first resource request of the frontend code and adding the backend interface data to the simulated interface module, access authentication of the first resource request can be performed first to verify the security and accessibility of the first resource request. If the access authentication is successful, the steps of obtaining the backend interface data returned by the backend interface module in response to the first resource request of the frontend code and adding the backend interface data to the simulated interface module are executed. If the access authentication fails, an error message is returned to the frontend device and the step of receiving the first resource request or the second resource request of the frontend code is returned.
[0046] In one embodiment, the backend device can initiate a collection command for simulated interface data to perform the steps of obtaining backend interface data fed back by the backend interface module in response to the first resource request from the frontend code and adding the backend interface data to the simulated interface module. Specifically, when the backend interface module receives the first resource request from the frontend code, it can execute the step of obtaining the backend interface data fed back by the backend interface module in response to the collection command from the backend interface module. It is understood that in response to the first resource request from the frontend code, the backend device can simultaneously initiate the collection command and the backend interface data, or the backend device can send the backend interface data first and then send the collection command; this is not limited here.
[0047] In another embodiment, the front-end device may initiate a collection instruction for simulated interface data to perform the steps of obtaining the back-end interface data fed back by the back-end interface module in response to the first resource request of the front-end code and adding the back-end interface data to the simulated interface module; specifically, when the back-end interface module feeds back the back-end interface data in response to the first resource request of the front-end code, the collection instruction of the front-end code may be executed to obtain the back-end interface data fed back by the back-end interface module in response to the first resource request of the front-end code.
[0048] Step 23: In response to the mode selection instruction being set to the second mode, the resource request is treated as the second resource request, and the corresponding simulated interface data is fed back from the simulated interface module in response to the second resource request in the front-end code.
[0049] In response to the mode selection instruction being set to the second mode, the resource request is treated as a second resource request, and the corresponding simulated interface data is selectively executed from the simulated interface module in response to the second resource request in the front-end code. Specifically, the simulated interface module can search its stored data for and return the simulated interface data corresponding to the resource path identifier in the second resource request in response to the second resource request.
[0050] In one embodiment, the data stored in the simulation interface module may further include an enable identifier corresponding to the resource path identifier. The enable identifier is used to identify whether the simulation interface data is available, and the enable identifier can be customized by the user.
[0051] Before the step of responding to the second resource request from the front-end code by feeding back the corresponding simulated interface data from the simulated interface module, the method further includes: determining whether the resource path identifier in the second resource request exists in the simulated interface module; if the resource path identifier in the second resource request does not exist in the simulated interface module, then responding to the second resource request from the front-end code by feeding back the corresponding back-end interface data from the back-end interface module; if the resource path identifier in the second resource request exists in the simulated interface module, then further selecting to feed back the corresponding back-end interface data from the back-end interface module or feed back the corresponding simulated interface data from the simulated interface module based on the enable identifier corresponding to the resource path identifier.
[0052] Specifically, it can be determined whether the enable flag corresponding to the resource path identifier is a preset flag. If the enable flag corresponding to the resource path identifier is a preset flag, the corresponding simulated interface data is fed back from the simulated interface module in response to the second resource request from the front-end code. If the enable flag corresponding to the resource path identifier is not a preset flag, the corresponding back-end interface data is fed back from the back-end interface module in response to the second resource request from the front-end code. The preset flag content can be set according to the actual situation and is not limited here.
[0053] This embodiment establishes a correspondence between resource path identifiers and their corresponding simulated interface data by storing the resource path identifiers and the simulated interface data in the simulated interface module. This allows for real-time updates of the simulated interface data and selection of data sources using the resource path identifiers, significantly improving the quality and efficiency of the simulated interface data and enhancing its applicability across various application scenarios. Furthermore, it can determine whether a resource request is a first or second resource request based on the mode selection instruction, enabling autonomous switching between simulated interface data collection and data source selection modes. In data source selection mode, it can switch data sources based on the enable flag in the simulated interface module, meeting the need for different data sources for different business scenarios and demonstrating strong flexibility.
[0054] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an embodiment of the backend device provided in this application. The backend device 40 includes a memory 41 and a processor 42 that are interconnected. The memory 41 is used to store computer programs. When the computer programs are executed by the processor 42, they are used to implement the data feedback method of the frontend code in the above embodiment.
[0055] Please see Figure 5, Figure 5 This is a schematic diagram of the structure of an embodiment of the front-end and back-end interaction system provided in this application. The front-end and back-end interaction system 50 includes a front-end device 51 and a back-end device 52 that are interconnected. The front-end device 51 is used to store front-end code and output a first resource request or a second resource request of the front-end code. The back-end device 52 includes at least a back-end interface module 521 and a simulation interface module 522 that are interconnected. The back-end device 52 is used to implement the data feedback method of the front-end code in the above embodiment.
[0056] like Figure 6 As shown, this is a schematic diagram of another embodiment of the front-end and back-end interaction system. The front-end and back-end interaction system 60 includes a front-end device 61 and a back-end device 62 that are interconnected. The back-end device 62 includes a back-end interface module 621 and a simulation interface module 622 that are interconnected. The simulation interface module 622 includes a simulation interface platform 6221 and an interface data collection service 6222.
[0057] This implementation divides the simulated interface module 622 into two parts: a simulated interface platform 6221 and an interface data collection service 6222. The simulated interface platform 6221 is responsible for managing the simulated interface data, including but not limited to modification, deletion, or retrieval. The interface data collection service 6222 is responsible for collecting the simulated interface data. The interface data collection service 6222 can be used to receive collection instructions from the backend device 62 / frontend device 61, thereby storing the backend interface data fed back by the backend interface module 621 in response to the first resource request and the resource path identifier of the first resource request together in the simulated interface platform 6221. For specific procedures, please refer to... Figure 7 The diagram shows the interaction flow of the backend device 62 initiating the collection command. Figure 8 The interactive flowchart of the front-end device 61 initiating the collection command shown is not described in detail here. Understandably, the simulated interface data can be stored in the database of the simulated interface platform 6221, and it can be stored as a file, list, or other data format, which is not limited here.
[0058] Backend device 62 may also include request distribution module 623, which is used to selectively execute the step of responding to the second resource request of the frontend code by feeding back the corresponding simulated interface data from the simulated interface module 622. This step can be specifically referred to step 23 in the above embodiment, and will only be briefly described here.
[0059] After receiving a second resource request from the front-end code, the request distribution module 623 can select to send the second resource request to either the simulation interface platform 6221 or the back-end interface module 621 based on the resource path identifier in the second resource request. Specifically, the request distribution module 623 can maintain a storage data internally, and can periodically pull the currently stored data from the simulation interface platform 6221. The stored data may include the resource path identifier, the simulation interface data corresponding to the resource path identifier, and the enable identifier stored in the simulation interface platform 6221. The request distribution module 623 can first determine whether the resource path identifier in the second resource request exists in the simulation interface module 622. If the resource path identifier in the second resource request does not exist in the simulation interface module 622, the second resource request of the front-end code is sent to the back-end interface module 621 so that the back-end interface module 621 can return the corresponding back-end interface data. If the resource path identifier in the second resource request exists in the simulation interface module 622, the second resource request is sent to the simulation interface platform 6221 or the back-end interface module 621 based on the enable identifier corresponding to the resource path identifier, so that the corresponding back-end interface data is returned from the back-end interface module 621 or the corresponding simulation interface data is returned from the simulation interface module 622. This will not be described in detail here.
[0060] This embodiment addresses situations where the real business data in the backend interface module cannot be easily modified during development. It utilizes the interface data collection service to intercept and back up backend interface data from the backend interface module, thus significantly improving the efficiency and applicability of simulated interface data collection and invocation while reducing labor costs. Furthermore, the request distribution module can select to send a second resource request to either the simulated interface platform or the backend interface module based on the resource path identifier in the second resource request, enabling data source switching. This flexibility allows for the use of different data sources for different business scenarios.
[0061] Please see Figure 9 , Figure 9 This is a schematic diagram of an embodiment of a computer-readable storage medium provided in this application. The computer-readable storage medium 90 is used to store a computer program 91. When the computer program 91 is executed by a processor, it is used to implement the data feedback method of the front-end code in the above embodiment.
[0062] The computer-readable storage medium 90 can be any medium capable of storing program code, such as a server, USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0063] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0064] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0065] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0066] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A data feedback method for front-end code, characterized in that, The method includes: Obtain the mode selection instructions and resource requests from the front-end code; In response to the mode selection instruction being the first mode, the resource request is taken as the first resource request, and the backend interface data fed back by the backend interface module in response to the first resource request of the frontend code is obtained; wherein, the first resource request includes at least a resource path identifier; The backend interface data is added to the simulated interface module to form simulated interface data; In response to the mode selection instruction being the second mode, the resource request is treated as the second resource request, and based on whether the resource path identifier in the second resource request exists in the simulation interface module, the second resource request responding to the front-end code is selectively executed to feed back the corresponding simulation interface data from the simulation interface module. The data stored in the simulation interface module includes at least a resource path identifier and simulation interface data corresponding to the resource path identifier. The step of adding the backend interface data to the simulation interface module to form simulation interface data includes: Determine whether the resource path identifier in the first resource request already exists in the simulated interface module; If so, in response to the inconsistency between the simulated interface data corresponding to the resource path identifier stored in the simulated interface module and the backend interface data fed back by the backend interface module, the simulated interface data corresponding to the resource path identifier stored in the simulated interface module is overwritten with the backend interface data fed back by the backend interface module to form new simulated interface data. If not, the backend interface data corresponding to the resource path identifier is added to the simulation interface module to form simulation interface data.
2. The data feedback method for front-end code according to claim 1, characterized in that, The second resource request includes at least a resource path identifier. The data stored in the simulation interface module includes at least the resource path identifier, simulation interface data corresponding to the resource path identifier, and an enable identifier. The step of selectively executing the second resource request in response to the front-end code and feeding back the corresponding simulation interface data from the simulation interface module based on whether the resource path identifier in the second resource request exists in the simulation interface module includes: Determine whether the resource path identifier in the second resource request exists in the simulated interface module; If not, in response to the second resource request of the front-end code, the corresponding back-end interface data is fed back from the back-end interface module; If so, based on the enable identifier corresponding to the resource path identifier, select to feed back the corresponding backend interface data from the backend interface module or the corresponding simulation interface data from the simulation interface module.
3. The data feedback method for front-end code according to claim 2, characterized in that, The step of selecting whether to receive corresponding backend interface data from the backend interface module or corresponding simulated interface data from the simulated interface module based on the enable identifier corresponding to the resource path identifier includes: Determine whether the enable identifier corresponding to the resource path identifier is a preset identifier content; If so, then in response to the second resource request of the front-end code, the corresponding simulated interface data is fed back from the simulated interface module; If not, the corresponding backend interface data is fed back from the backend interface module in response to the second resource request of the frontend code.
4. The data feedback method for front-end code according to claim 1, characterized in that, Prior to the step of treating the resource request as a first resource request in response to the mode selection instruction being in the first mode, or treating the resource request as a second resource request in response to the mode selection instruction being in the second mode, the method includes: Determine whether the simulated interface data stored in the simulated interface module is empty; If so, the resource request is taken as the first resource request, and the steps of obtaining the backend interface data fed back by the backend interface module in response to the first resource request of the frontend code and adding the backend interface data to the simulated interface module are executed. If not, then execute the step of responding to the mode selection instruction as the first mode and treating the resource request as the first resource request, or responding to the mode selection instruction as the second mode and treating the resource request as the second resource request.
5. The data feedback method for front-end code according to claim 1, characterized in that, The method further includes: Get data adjustment instructions from the front-end code; The analog interface data stored in the analog interface module is adjusted in response to the data adjustment command.
6. The data feedback method for front-end code according to claim 1, characterized in that, Before the step of obtaining the backend interface data returned by the backend interface module in response to the first resource request of the frontend code, the following steps are included: When the backend interface module receives the first resource request from the frontend code, it executes the step of obtaining the backend interface data fed back by the backend interface module in response to the first resource request from the frontend code, in response to the collection instruction of the backend interface module.
7. The data feedback method for front-end code according to claim 1, characterized in that, Before the step of obtaining the backend interface data returned by the backend interface module in response to the first resource request of the frontend code, the following steps are included: When the backend interface module responds to the first resource request of the frontend code and sends backend interface data, the step of obtaining the backend interface data sent back by the backend interface module in response to the first resource request of the frontend code is executed in response to the collection instruction of the frontend code.
8. A backend device, characterized in that, It includes an interconnected memory and a processor, wherein the memory is used to store a computer program, which, when executed by the processor, is used to implement the data feedback method of the front-end code according to any one of claims 1-7.
9. A front-end and back-end interactive system, characterized in that, The device includes interconnected front-end devices and back-end devices. The front-end devices are used to store front-end code and output a first resource request or a second resource request of the front-end code. The back-end devices include at least interconnected back-end interface modules and simulation interface modules. The back-end devices are used to implement the data feedback method of the front-end code according to any one of claims 1-7.
10. A computer-readable storage medium for storing a computer program, characterized in that, When the computer program is executed by the processor, it is used to implement the data feedback method of the front-end code according to any one of claims 1-7.
Citation Information
Patent Citations
Interface mock method and interface test method
CN107179984A
Data processing method, apparatus and device, and storage medium
CN108345543A
Mock automatic operation method and device, computer equipment and storage medium
CN111478941A
