A data processing method, device and storage medium

By comparing the response status of the application program interface and database data in the data processing device, and automatically determining the virtual data, the problem of manually modifying the data structure in the prior art is solved, and data processing intelligence and development efficiency are improved.

CN114579419BActive Publication Date: 2025-03-18CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011371994.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-30
Publication Date
2025-03-18
Estimated Expiration
2040-11-30

AI Technical Summary

Technical Problem

In the prior art, when using a virtual data processing device during front-end development and testing, it is necessary to manually modify the local json database or javascript script library to cope with changes in the interface data structure, resulting in a decrease in data processing intelligence.

Method used

By implementing a data processing method in the data processing device, receiving data requests using an application program interface (API), determining the response status, and finding relevant data in the database of the simulated data service system. The attribute parameters of the first response data are compared with the attribute parameters of the second response data, and the virtual data is determined to be the first response data or the second response data based on the comparison result.

Benefits of technology

It improves the intelligence of data processing devices, reduces the need for R&D personnel to manually modify data structures, and improves development efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114579419B_ABST
    Figure CN114579419B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a data processing method and device, and a storage medium, including: when a data request is received, determining the response status of an application program interface; the network address of the application program interface points to a simulated data service system; when the response status is a first response status, receiving first response data through the application program interface, and searching for second response data related to the data request in a database of the simulated data service system; the first response status is a status in which the data request is successfully processed; when the second response data is found, determining a first attribute parameter of the first response data and a second attribute parameter of the second response data; comparing the first attribute parameter with the second attribute parameter to obtain a comparison result; according to the comparison result, determining whether the virtual data corresponding to the data request is the second response data or the first response data, thereby improving the intelligence of the data processing device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of front-end development and testing technology, and in particular to a data processing method and device, and a storage medium. Background Art

[0002] During the simultaneous development of the front-end and back-end, the back-end data has not yet been released. The front-end can create virtual data and use the created virtual data to develop and test the front-end.

[0003] In the prior art, a data processing device edits hard-coded virtual data into data in json format or fragmented javascript script data, retrieves data through requests, performs business logic processing, and renders it into a document object model (DOM). When the interface data structure changes, such as adding fields or modifying field names, front-end developers need to find the corresponding data structure in a local json database or javascript script library and make corresponding modifications to the data structure, which reduces the intelligence of the data processing device. Summary of the invention

[0004] In order to solve the above technical problems, the embodiments of the present invention are intended to provide a data processing method and device, and a storage medium, which improve the intelligence of the data processing device.

[0005] The technical solution of the present invention is achieved in this way:

[0006] In a first aspect, an embodiment of the present invention provides a data processing method, the data processing method comprising:

[0007] In case of receiving a data request, determining a response status of an application program interface, wherein the network address of the application program interface points to a simulated data service system;

[0008] In the case where the response status is a first response status, first response data is received through the application program interface, and second response data related to the data request is searched in the database of the simulation data service system; the first response status is a status in which the data request is successfully processed;

[0009] In case the second response data is found, determining a first attribute parameter of the first response data and a second attribute parameter of the second response data;

[0010] Comparing the first attribute parameter with the second attribute parameter to obtain a comparison result;

[0011] According to the comparison result, it is determined that the virtual data corresponding to the data request is the second response data or the first response data.

[0012] In a second aspect, an embodiment of the present invention provides a data processing device, the device comprising:

[0013] a determination unit, configured to determine, upon receiving a data request, a response state of an application program interface; wherein the network address of the application program interface points to a simulated data service system; and, upon finding second response data, determine a first attribute parameter of the first response data and a second attribute parameter of the second response data; and, based on a comparison result, determine whether the virtual data corresponding to the data request is the second response data or the first response data;

[0014] a search unit, configured to receive the first response data through the application program interface and search for the second response data related to the data request in a database of the simulation data service system when the response status is a first response status; the first response status is a status in which the data request is successfully processed;

[0015] A comparing unit is used to compare the first attribute parameter with the second attribute parameter to obtain the comparison result.

[0016] In a third aspect, an embodiment of the present invention provides a data processing device, the device comprising:

[0017] A memory, a processor and a communication bus, wherein the memory communicates with the processor via the communication bus, and the memory stores a data processing program executable by the processor. When the data processing program is executed, the data processing method described above is executed by the processor.

[0018] In a fourth aspect, an embodiment of the present invention provides a storage medium having a computer program stored thereon, which is applied to a data processing device and is characterized in that the computer program implements a data processing method when executed by a processor.

[0019] The embodiment of the present invention provides a data processing method, device and storage medium. The data processing method includes: determining the response status of an application program interface when a data request is received; the network address of the application program interface points to a simulated data service system; receiving first response data through the application program interface when the response status is a first response status, and searching for second response data related to the data request in the database of the simulated data service system; the first response status is a status in which the data request is successfully processed; determining the first attribute parameter of the first response data and the second attribute parameter of the second response data when the second response data is found; comparing the first attribute parameter with the second attribute parameter to obtain a comparison result; determining, according to the comparison result, whether the virtual data corresponding to the data request is the second response data or the first response data. Using the above data processing method, when the data processing device receives a data request, the data processing device compares the first attribute parameter of the first response data received through the application program interface with the second attribute parameter of the second response data stored in the database, and determines, according to the comparison result, whether the virtual data corresponding to the data request is the first response data or the second response data, without the need for R&D personnel to modify the data in the database, thereby improving the intelligence of the data processing device. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 A flow chart of a data processing method provided by an embodiment of the present invention;

[0021] Figure 2 An exemplary data processing method provided by the embodiment of the present invention Figure 1 ;

[0022] Figure 3 An exemplary data processing method provided by the embodiment of the present invention Figure 2 ;

[0023] Figure 4 A schematic diagram of the structure of a data processing device provided in an embodiment of the present invention Figure 1 ;

[0024] Figure 5 A schematic diagram of the structure of a data processing device provided in an embodiment of the present invention Figure 2 . DETAILED DESCRIPTION

[0025] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0026] A decision tree is a supervised learning algorithm (with a predefined target variable) that is mainly applied to classification problems. Decision trees are applicable to both categorical and continuous input and output variables. Decision trees are used to divide a population or sample into two or more homogeneous sets (or subpopulations) based on the most significant separators / differentiators among the input variables.

[0027] Mock data refers to when the front-end and back-end are being developed simultaneously, but the data of the back-end interface has not yet been obtained, the front-end can mock fake data to simulate development and testing. Using mock data, you can work in parallel. The front-end and back-end only need to define the interface documents to start working in parallel, without affecting each other, and only interact closely in the final joint debugging stage. Using mock data, you can start the test-driven development mode. When the interface is defined, you can create a Mock, add the interface to the automated testing environment, and create tests in advance. Using mock data, you can also isolate the system. It does not pollute the data in the database. In addition, mock data can be used to demonstrate and shield sensitive information.

[0028] To implement mock data, you can hardcode data directly on the page, and then change it to dynamic after the interface is in place. You can also declare variables directly in high-level programming languages ​​(javascript, js), assign values ​​to variables, use them in logic scripts, and render them to the Document Object Model (DOM). To implement mock data, you can edit the simulated data into high-level programming object notation (JavaScript Object Notation, JSON) data or fragmented js scripts, retrieve data through requests, perform business logic processing, and render them to the DOM. In addition, after the requirements are decomposed, the front-end and back-end need to define the application programming interface (Application Programming Interface, API), including: request uniform resource locator (URL) (project prefix + specific interface name), request method, request parameters, and data response; the front-end personnel simulate the request to return the corresponding data according to the interface agreement and complete the corresponding interaction; the back-end personnel complete the corresponding API according to the interface agreement and complete the corresponding self-test; after the back-end personnel deliver the interface API, the front-end personnel directly modify the interface project prefix, switch to the corresponding environment, and enter the project test.

[0029] Existing mock data implementation scheme. Whether it is hard-coded data or directly declaring variables in js, the code is highly invasive. This will affect the business code. The common practice is to annotate the original code logic and change it to the code of the simulated data for the test, which undoubtedly increases the developer's understanding cost and modification risk for subsequent cooperative development. If the simulated data is edited into json data or fragmented js scripts, the data is retrieved through requests, and business logic processing is performed and rendered to dom, the problem of high code invasiveness can be solved, but there will be a problem of delayed updates. When the back-end interface data structure changes, fields are added, and field names are modified, the front-end needs to find the corresponding ones in the local json database or js script library and make corresponding modifications, which reduces development efficiency and increases the risk of errors. Moreover, since json data itself has no programming ability, it is not easy to simulate the interface response time; it is not easy to generate various types of simulated data such as email addresses and mobile phone numbers, which increases the cost of developing and testing user interfaces (UI) in different states (such as UI under normal circumstances, UI when data is wrong, and UI when data is empty).

[0030] The problems existing in the prior art can be specifically solved by the method in embodiment 1.

[0031] Embodiment 1

[0032] The embodiment of the present invention provides a data processing method. Figure 1 A data processing method provided by the embodiment of the present invention Figure 1 ,like Figure 1 As shown, the data processing method may include:

[0033] S101. When a data request is received, determine the response status of the application program interface; the network address of the application program interface points to the integrated simulation data service system.

[0034] A data processing method provided by an embodiment of the present invention is applied to a scenario in which a data processing device, upon receiving a data request, obtains virtual data corresponding to the data request from an application program interface.

[0035] In the embodiments of the present application, the data processing device may be implemented in various forms. For example, the data processing device described in the present application may include devices such as mobile phones, watches, tablet computers, laptop computers, PDAs, portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, and devices such as digital TVs and desktop computers.

[0036] In an embodiment of the present application, the application program interface can be connected to the server by modifying the address of the application program interface. The network address of the application program interface points to the simulated data service system, so that the server can process the data request to obtain virtual data corresponding to the data request.

[0037] It should be noted that the server can be a server that integrates a mock system service, or a server that can create virtual data. The specific server can be determined based on actual conditions, and the embodiments of the present application do not limit this.

[0038] It should be noted that the address of the application program interface can be modified by modifying the prefix of the application program interface using the network address of the server.

[0039] For example, if the network address of the server is http: / / 192.168.1.1 / api / mock, the prefix of the application interface can be set to http: / / 192.168.1.1 / api / mock, thereby modifying the address of the application interface to the network address of the server.

[0040] S102. When the response status is a first response status, first response data is received through an application program interface, and second response data related to the data request is searched in a database of the simulated data service system. The first response status is a status in which the data request is successfully processed.

[0041] In an embodiment of the present application, when the data processing device determines the response status of the application program interface, the data processing device judges the response status. When the data processing device determines that the response status is the first response status, the data processing device receives the first response data through the application program interface and searches for the second response data related to the data request in the database of the simulated data service system.

[0042] In the embodiment of the present application, the status code corresponding to the first response status may be 200, and the first response status is a status in which the data request is processed successfully.

[0043] In the embodiment of the present application, the first response data may be response data generated after the data processing device successfully processes the data request.

[0044] In an embodiment of the present application, the database of the simulation data service system may be a JSON file library in a data processing device.

[0045] In the embodiment of the present application, the second response data may be response data in a database of the simulation data service system corresponding to the data request and the first response status.

[0046] In the embodiment of the present application, after the data processing device determines the response status of the application program interface, if the data processing device determines that the response status is the second response status, the data processing device searches for the third response data related to the data request in the storage area of ​​the local simulation data service system; if the data processing device finds the third response data in the storage area of ​​the local simulation data service system, the data processing device determines that the virtual data is the third response data. If the data processing device does not find the third response data in the storage area of ​​the local simulation data service system, the data processing device uses the local simulation data service system to determine the request path corresponding to the data request; after the data processing device uses the local simulation data service system to determine the request path corresponding to the data request, the data processing device compares the request path with the preset request path. If the data processing device determines that the request path is the same as the preset request path, the data processing device uses the response data corresponding to the preset request path as the response data corresponding to the request path, and returns the response data corresponding to the request path.

[0047] In the embodiment of the present application, the status code corresponding to the second response status may be 404, and the second response status is a status in which the data request is not processed successfully.

[0048] In the embodiment of the present application, the first response data may be response data generated when the data processing device fails to successfully process the data request.

[0049] In an embodiment of the present application, when the data processing device determines that the virtual data is the third response data, the data processing device returns the third response data to the front-end business. When the data processing device determines that the virtual data is the response data corresponding to the request path, the data processing device returns the response data corresponding to the request path to the front-end business.

[0050] In an embodiment of the present application, the process of the data processing device determining the response data corresponding to the request path according to the request path can also be: the data processing device uses the routing matching logic, and when the data processing device matches the request path, the data processing device returns the response data generated when the request path is matched; when the data processing device does not match the request path, the data processing device returns the response status and response data generated when the request path is not matched.

[0051] In an embodiment of the present application, after the data processing device determines the response status of the application program interface, when the data processing device determines that the response status is the third response status, the data processing device determines the response data corresponding to the third response status; after the data processing device determines the response data corresponding to the third response status, the data processing device returns the third response status and the response data corresponding to the third response status.

[0052] In the embodiment of the present application, the third response state is a response state other than the first response state and the second response state.

[0053] It should be noted that the third response status may be a status caused by reasons such as parameter transmission error, missing transmission, authentication expiration, etc., which can be specifically determined according to actual conditions and is not limited in this embodiment of the present application.

[0054] In an embodiment of the present application, when the data processing device determines that the response status is the third response status, the data processing device returns the third response status and the response data corresponding to the third response status to the front-end business for the front-end joint debugging to troubleshoot the fault problem corresponding to the third response status.

[0055] S103: If the second response data exists in the database, determine a first attribute parameter of the first response data and a second attribute parameter of the second response data.

[0056] In an embodiment of the present application, the data processing device receives the first response data through the application program interface, and after searching for the second response data related to the data request in the database of the simulated data service system, when the data processing device determines that the second response data exists in the database, the data processing device determines the first attribute parameters of the first response data and the second attribute parameters of the second response data.

[0057] In an embodiment of the present application, the first attribute parameter includes a first status code, first information and a first data entity, and the second attribute parameter includes a second status code, second information and a second data entity.

[0058] It should be noted that the response data with a status code of 200 is generally a binary file stream or a string that can be converted into JSON data. For a binary file stream, it can be directly returned to the front-end business by the interface. For a string that can be converted into JSON data, after conversion to JSON, the root attributes are generally status code (code), information (msg), and data entity (data).

[0059] It should also be noted that msg depends on code, and code depends on the response status. In the case of a response status corresponding to a response status code of 200, the value of code is likely to be in the enumerable set. If the code coefficient is 0.2 and the data coefficient is 0.8, there is a 20% probability that code will change or be updated, and a 10% probability that the data type of data will change. The Gini of code and data is calculated as follows:

[0060] code:0.2*0.2*20%=0.008

[0061] data:0.8*0.8*10%=0.064

[0062] Since 0.064>0.008, it can be concluded that the Gini value of data is much larger than that of code. The less concentrated the data is, that is, the lower the purity is, the greater the impact is, so we need to give priority to updating and changing the data.

[0063] It should be noted that the enumerable collection includes: correct results, new fields, missing fields, value changes, and value type changes.

[0064] S104: Compare the first attribute parameter with the second attribute parameter to obtain a comparison result.

[0065] In the embodiment of the present application, after the data processing device determines the first attribute parameter of the first response data and the second attribute parameter of the second response data, the data processing device can compare the first attribute parameter with the second attribute parameter to obtain a comparison result.

[0066] In an embodiment of the present application, the data processing device compares the first attribute parameter with the second attribute parameter to obtain a comparison result, including: the data processing device determines the intervention trust status of the second response data, and when the intervention trust status is distrust and the intervention error correction status of the second response data is non-error correction, the data processing device compares the first attribute parameter with the second attribute parameter to obtain a comparison result.

[0067] It should be noted that the intervention error correction state is the error correction state of the second response data.

[0068] In the embodiment of the present application, if some pre-trust states are true, the intervention trust state is trust; if some pre-trust states are not true, the intervention trust state is distrust.

[0069] In the embodiment of the present application, if some pre-error correction states are true, the intervention error correction state is error correction; if some pre-error correction states are not true, the intervention error correction state is no error correction.

[0070] In an embodiment of the present application, after the data processing device determines the intervention trust status of the second response data, when the data processing device determines that the intervention trust status is trusted, the data processing device determines that the virtual data is the second response data; when the data processing device determines that the intervention trust status is untrusted and the intervention error correction status is error correction, the data processing device determines that the virtual data is the first response data.

[0071] It is understandable that the manual intervention trust / error correction function is set with logic front and high priority. When the API of the same path is requested next time, the trusted response data can be directly returned and the error correction response data can be directly updated.

[0072] In the embodiment of the present application, the comparison results include correct results, newly added fields, missing fields, value changes, and value type changes.

[0073] S105. Determine, according to the comparison result, whether the virtual data corresponding to the data request is the second response data or the first response data.

[0074] In an embodiment of the present application, the data processing device compares the first attribute parameter with the second attribute parameter, and after obtaining the comparison result, the data processing device determines whether the virtual data corresponding to the data request is the second response data or the first response data based on the comparison result.

[0075] It can be understood that when the data processing device receives a data request, the data processing device compares the first attribute parameter of the first response data obtained through the application program interface with the second attribute parameter of the second response data corresponding to the data request stored in the database of the simulation data service system, thereby obtaining virtual data that best meets the actual business at the front end, thereby improving the accuracy of the data processing device in obtaining virtual data according to the data request.

[0076] In an embodiment of the present application, the number of comparison results is at least one, and the process in which the data processing device determines whether the virtual data corresponding to the data request is the second response data or the first response data based on the comparison results includes the data processing device determining the sum of the comparison results based on at least one comparison result and a preset influence coefficient; after the data processing device determines the sum of the comparison results based on at least one comparison result and a preset influence coefficient, when the data processing device determines the sum of the comparison results and the comparison result threshold, the data processing device determines that the virtual data is the first response data, and updates the database with the first response data at the position of the second response data in the database; when the data processing device determines that the sum of the comparison results is less than or equal to the comparison result threshold, the data processing device determines that the virtual data is the second response data.

[0077] In an embodiment of the present application, before determining that the virtual data is the first response data, the data processing device will also determine the update ratio based on the number of historical update requests and the total number of requests; when the update ratio does not meet the preset update ratio range, the data processing device adjusts the initial comparison result adjustment threshold until the update ratio meets the preset update ratio range, thereby obtaining the comparison result threshold.

[0078] It should be noted that the total number of requests is the total number of historical data requests received; the number of historical update requests is the number of times the database is updated when a historical data request is received.

[0079] In an embodiment of the present application, the process of the data processing device determining the update ratio based on the number of historical update requests and the total number of requests includes: the data processing device obtains the update ratio by dividing the number of historical update requests by the total number of requests; the data processing device can also obtain the update ratio by subtracting the total number of requests from the number of historical update requests; the data processing device can also obtain the update ratio based on other calculation methods formed between the number of historical update requests and the total number of requests. The specific method can be determined based on actual conditions, and the embodiment of the present application is not limited to this.

[0080] In an embodiment of the present application, the preset update ratio range can be a ratio range configured in the data processing device, or a ratio range determined by the data processing device based on a received data instruction, or a ratio range obtained by the data processing device in other ways. The specific ratio range can be determined based on actual conditions, and the embodiment of the present application does not limit this.

[0081] In an embodiment of the present application, the initial comparison result adjustment threshold may be a threshold configured in the data processing device, or a threshold determined by the data processing device based on a received instruction, or a threshold obtained by the data processing device using other methods. The specific threshold may be determined based on actual conditions, and the embodiment of the present application does not limit this.

[0082] In an embodiment of the present application, the data processing device adjusts the initial comparison result adjustment threshold. After obtaining the comparison result adjustment threshold, the data processing device can compare the sum of the comparison results with the comparison result adjustment threshold. When the data processing device determines that the sum of the comparison results is greater than the comparison result threshold, the data processing device uses the first response data to update the database, obtains a new number of historical update requests and a new total number of requests, and obtains a new update ratio based on the new number of historical update requests and the new total number of requests, so that the new update ratio meets the preset update ratio range.

[0083] In an embodiment of the present application, the data processing device can respectively determine the product of a preset influence coefficient of a data result in each calculation unit and the weight of the comparison result, and then determine the product of a preset influence coefficient of a comparison result corresponding to all calculation units and the weight of the comparison result, and obtain the product of the preset influence coefficient of each comparison result in all calculation units and the weight of the comparison result in the above manner, and determine the corresponding sum of the products of the preset influence coefficient of each comparison result in all calculation units and the weight of the comparison result, so as to obtain the total comparison result.

[0084] In the embodiment of the present application, the method return value can be enumerated, and the enumerated values ​​are as follows: correct result (A), new field added (B), missing field (C), value changed (D), value type changed (E).

[0085] It should be noted that the data types in js are divided into basic data types and reference data types. For basic data types, the equality function (isEqual) can be used to determine whether a change has occurred, and the application mode can adopt a discrete model; for reference types, recursive judgment is performed based on the iterative method implemented or the value is traversed, and the application mode can adopt a continuous variable model. At the same time, when the same type of value undergoes the same type of change, except for the object type, there is no essential impact on the others. It can be agreed that only when the number (Number) changes, the string (String) changes, and the array (Array) length changes, the method returns "the result is correct"; when other non-Object types undergo the same type of change, the method returns "the value has changed"; when the field of the Object type is added or reduced, the method returns "the new field" or "the missing field" first; when the value type changes, the method returns "the value type has changed". When the value is a reference type, it will be recursively judged, and an "influence coefficient μ" will be defined and returned together. Each time it is recursed, the influence coefficient is multiplied by 0.1. Finally, the objects returned by the depth comparison method are weighted and summed to obtain the "sum of influence coefficients".

[0086] Exemplarily, as shown in formula (1), the data processing device can determine the sum of the comparison results according to formula (1).

[0087]

[0088] In an embodiment of the present application, the data processing device can determine the update release ratio based on the number of update requests and the total number of requests; after the data processing device determines the update release ratio, the data processing device can determine the comparison result threshold based on the update release ratio.

[0089] It should be noted that the data processing device may divide the number of update requests by the total number of requests and then multiply the result by 100% to obtain the update release ratio.

[0090] Exemplarily, as shown in formula (2), the data processing device can determine the updated release ratio according to formula (2).

[0091]

[0092] In an embodiment of the present application, the value of the global variable "comparison result threshold" parameter is related to the "update release ratio". When the "sum of influence coefficients" is greater than the "comparison result threshold", the data processing device uses the first response data to update the second response data; when the "sum of influence coefficients" is less than or equal to the "comparison result threshold", the data processing device does not update the second response data.

[0093] It is understandable that by dynamically correcting the "comparison result threshold" parameter through the decision tree algorithm and saving it globally, the "update release ratio" parameter is ensured to be a constant. When the verification model is generated for the first time, the accuracy is low because the number of decisions is small. As the number of judgments increases, the accuracy gradually improves, and the model will be updated more and more accurately.

[0094] In an embodiment of the present application, the data processing device determines that the virtual data is the first response data, and uses the first response data to update the database at the location of the second response data in the database. The process also includes: the data processing device determines whether the second response data is trusted data; if the second response data is trusted data, the data processing device adds a trust mark in the intervention trust state of the second response data.

[0095] It can be understood that the data processing device in the embodiment of the present application has low code intrusion when processing data requests and does not affect the business code. Developers only need to configure different API request path prefixes in the development environment and the production environment.

[0096] For example: a project has 10 pages, each page has 5 interfaces on average, each interface has 50 lines of code on average, the project basic code is assumed to be 1000 lines, the ratio of business code to interface request code is 20:1 (that is, one line of interface request code is in every 20 lines of business code), and the ratio of code written in js for simulation data to interface request code is 1:1. Then the code intrusion rate of the old solution of writing simulation data in js is shown as formula (3):

[0097]

[0098] In this application, the affected code of the entire project is about 3 lines, and the code intrusion rate is shown in formula (4):

[0099]

[0100] There are a total of 26 operation units in this application, of which only 3 operation units of the code route matching part involve manual creation of simulation data, that is, 23 operation units can automatically update the background API response data of the test environment, accounting for 88.5%, which is much higher than 0% of the old solution, and improves the speed of the data processing device to update the database.

[0101] For example, Figure 2 As shown, the present application embodiment provides an exemplary data processing method flow Figure 1 :

[0102] 20. Upon receiving a data request, the data processing device determines the response status of the application program interface.

[0103] 21. When the response status is the first response status, the data processing device receives the first response data through the application program interface, and searches for the second response data related to the data request in the database of the simulated data service system.

[0104] 22. When the second response data is found, the data processing device determines a first attribute parameter of the first response data and a second attribute parameter of the second response data.

[0105] 23. The data processing device compares the first attribute parameter with the second attribute parameter to obtain a comparison result.

[0106] 24. The data processing device determines, based on the comparison result, whether the virtual data corresponding to the data request is the second response data or the first response data.

[0107] 25. When the response status is the second response status, the data processing device searches for third response data related to the data request in the storage area of ​​the local simulation data service system.

[0108] It should be noted that, after executing step 20 , the data processing device may then execute step 25 , which is a step parallel to step 21 .

[0109] 26a. When the third response data is found, the data processing device determines that the dummy data is the third response data.

[0110] 26b. When the third response data is not found, the data processing device uses the local simulated data service system to determine the request path of the data request.

[0111] It should be noted that after executing step 25, the data processing device may then execute step 26b, which is a step parallel to step 26a.

[0112] 27. When the request path is the same as the preset request path, the data processing device uses the response data corresponding to the preset request path as the response data corresponding to the request path, and returns the response data corresponding to the request path.

[0113] 28. When it is determined that the response state is the third response state, the data processing device determines the response data corresponding to the third response state.

[0114] It should be noted that after executing step 20 , the data processing device may then execute step 28 , which is a step parallel to step 21 and step 25 .

[0115] 29. The data processing device uses the response data corresponding to the third response state as virtual data, and returns the third response state and the response data corresponding to the third response state.

[0116] For example, Figure 3 As shown, the present application embodiment provides an exemplary data processing method flow Figure 2 :

[0117] 31. The data processing device determines the intervention trust status of the second response data.

[0118] 32. When the intervention trust state is distrust and the intervention error correction state is error correction, the data processing device determines the virtual data as the first response data.

[0119] 33. When the intervention trust state is distrust and the intervention error correction state of the second response data is non-error correction, the data processing device determines the sum of the comparison results based on at least one comparison result and a preset influence coefficient.

[0120] It should be noted that after executing step 31 , the data processing device may then execute step 33 , which is a step parallel to step 32 .

[0121] 34. When the sum of the comparison results is greater than the comparison result threshold, the data processing device determines that the virtual data is the first response data, and updates the database with the first response data at the position of the second response data in the database.

[0122] 35. When the sum of the comparison results is less than or equal to the comparison result threshold, the data processing device determines that the virtual data is the second response data.

[0123] It should be noted that after executing step 33 , the data processing device may then execute step 35 , which is a step parallel to step 34 .

[0124] 36. When the intervention trust state is trust, the data processing device determines the virtual data as the second response data.

[0125] It should be noted that after executing step 31 , the data processing device may then execute step 36 , which is a step parallel to step 32 and step 33 .

[0126] It can be understood that when the data processing device receives a data request, the data processing device compares the first attribute parameter of the first response data received through the application program interface with the second attribute parameter of the second response data stored in the database, and determines whether the virtual data corresponding to the data request is the first response data or the second response data based on the comparison result. There is no need for R&D personnel to modify the data in the database, which improves the intelligence of the data processing device.

[0127] Embodiment 2

[0128] Based on the same inventive concept of the first embodiment, the embodiment of the present invention provides a data processing device 1, corresponding to a data processing method; Figure 4 A schematic diagram of the structure of a data processing device provided in an embodiment of the present invention Figure 1 , the data processing device 1 may include:

[0129] The determining unit 11 is used to determine the response status of the application program interface when receiving the data request; the network address of the application program interface points to the simulated data service system; when the second response data is found, determine the first attribute parameter of the first response data and the second attribute parameter of the second response data; according to the comparison result, determine whether the virtual data corresponding to the data request is the second response data or the first response data;

[0130] a search unit 12, configured to receive the first response data through the application program interface and search for the second response data related to the data request in a database of the simulation data service system when the response status is a first response status; the first response status is a status in which the data request is successfully processed;

[0131] The comparison unit 13 is used to compare the first attribute parameter with the second attribute parameter to obtain the comparison result.

[0132] In some embodiments of the present invention, the first attribute parameter includes a first status code, first information and a first data entity; the second attribute parameter includes a second status code, second information and a second data entity.

[0133] In some embodiments of the present invention, the comparison result includes one of the following:

[0134] Results are correct, new fields are added, fields are missing, values ​​have changed, and value types have changed.

[0135] In some embodiments of the present invention, the number of the comparison results is at least one; the device further comprises an updating unit;

[0136] The determining unit 11 is used to determine the sum of the comparison results according to at least one comparison result and a preset influence coefficient; when the sum of the comparison results is greater than a comparison result threshold, determine the virtual data as the first response data; when the sum of the comparison results is less than or equal to the comparison result threshold, determine the virtual data as the second response data;

[0137] The updating unit is configured to update the database using the first response data at the location of the second response data in the database;

[0138] In some embodiments of the present invention, the device further comprises an adjustment unit;

[0139] The determining unit 11 is used to determine the update ratio according to the number of historical update requests and the total number of requests; the total number of requests is the total number of historical data requests received; the number of historical update requests is the number of times the database is updated when the historical data requests are received;

[0140] The adjustment unit is used to adjust the initial comparison result adjustment threshold when the update ratio does not meet the preset update ratio range, until the update ratio meets the preset update ratio range, so as to obtain the comparison result threshold.

[0141] In some embodiments of the present invention, the device further comprises an adding unit;

[0142] The determining unit 11 is used to determine whether the second response data is trusted data;

[0143] The adding unit is configured to add a trust mark to the intervention trust state of the second response data when the second response data is trust data.

[0144] In some embodiments of the present invention, the determining unit 11 is used to determine the intervention trust status of the second response data;

[0145] The comparison unit 13 is used to compare the first attribute parameter with the second attribute parameter to obtain a comparison result when the intervention trust state is distrust and the intervention error correction state of the second response data is no error correction, and the intervention error correction state is the error correction state of the second response data.

[0146] In some embodiments of the present invention, the determination unit 11 is used to determine that the virtual data is the second response data when the intervention trust state is trusted; and to determine that the virtual data is the first response data when the intervention trust state is untrusted and the intervention error correction state is error correction.

[0147] In some embodiments of the present invention, the search unit 12 is used to search for third response data related to the data request in a storage area of ​​the local simulation data service system when the response status is a second response status, and the second response status is a status in which the data request is not successfully processed;

[0148] The determination unit 11 is used to determine that the virtual data is the third response data when the third response data is found; when the third response data is not found, use the local simulation data service system to determine the request path of the data request; when the request path is the same as the preset request path, use the response data corresponding to the preset request path as the response data corresponding to the request path, and return the response data corresponding to the request path.

[0149] In some embodiments of the present invention, the determination unit 11 is used to determine the response data corresponding to the third response state when it is determined that the response state is a third response state, and the third response state is a response state other than the first response state and the second response state; use the response data corresponding to the third response state as the virtual data, and return the third response state and the response data corresponding to the third response state.

[0150] It should be noted that, in actual applications, the above-mentioned determination unit block 11, search unit 12 and comparison unit 13 can be implemented by a processor 14 on the data processing device 1, specifically a CPU (Central Processing Unit), an MPU (Microprocessor Unit), a DSP (Digital Signal Processing) or a field programmable gate array (FPGA); the above-mentioned data storage can be implemented by a memory 15 on the data processing device 1.

[0151] The embodiment of the present invention further provides a data processing device 1, such as Figure 5 As shown, the data processing device 1 includes: a processor 14, a memory 15 and a communication bus 16. The memory 15 communicates with the processor 14 via the communication bus 16. The memory 15 stores a program executable by the processor 14. When the program is executed, the data processing method described in Example 1 is executed by the processor 14.

[0152] In practical applications, the memory 15 may be a volatile memory, such as a random access memory (RAM); or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor 14.

[0153] The embodiment of the present invention provides a storage medium on which a program is stored. When the program is executed by the processor 14, the data processing method as described in the first embodiment is implemented.

[0154] It can be understood that when the data processing device receives a data request, the data processing device compares the first attribute parameter of the first response data received through the application program interface with the second attribute parameter of the second response data stored in the database, and determines whether the virtual data corresponding to the data request is the first response data or the second response data based on the comparison result. There is no need for R&D personnel to modify the data in the database, which improves the intelligence of the data processing device.

[0155] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.

[0156] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0157] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0158] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0159] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention.

Claims

1. A data processing method, characterized in that: include: Upon receipt of a data request, determining a response status of the application program interface; The network address of the application program interface points to the simulation data service system; In the case where the response status is the first response status, receiving first response data through the application program interface, and searching for second response data related to the data request in the database of the simulation data service system; The first response status is a status in which the data request is processed successfully; In case the second response data is found, determining a first attribute parameter of the first response data and a second attribute parameter of the second response data; Comparing the first attribute parameter with the second attribute parameter to obtain a comparison result; According to the comparison result, determining whether the virtual data corresponding to the data request is the second response data or the first response data; The comparison result includes one of the following: Results are correct, new fields are added, fields are missing, values ​​have changed, and value types have changed; The number of the comparison results is at least one; and determining, according to the comparison results, that the virtual data corresponding to the data request is the second response data or the first response data includes: Determine a sum of comparison results according to at least one comparison result and a preset influence coefficient; the sum of comparison results is a sum corresponding to the product of the preset influence coefficient of each comparison result and the weight of the comparison result; In the case where the sum of the comparison results is greater than the comparison result threshold, determining that the virtual data is the first response data, and updating the database with the first response data at the position of the second response data in the database; When the comparison result sum is less than or equal to the comparison result threshold, the virtual data is determined to be the second response data.

2. The method according to claim 1, characterized in that The first attribute parameters include a first status code, first information and a first data entity; the second attribute parameters include a second status code, second information and a second data entity.

3. The method according to claim 1, characterized in that Before determining that the virtual data is the first response data, the method further includes: Determine the update ratio according to the number of historical update requests and the total number of requests; the total number of requests is the total number of historical data requests received; the number of historical update requests is the number of times the database is updated when the historical data requests are received; When the update ratio does not satisfy the preset update ratio range, adjusting the initial comparison result adjustment threshold until the update ratio satisfies the preset update ratio range, thereby obtaining the comparison result threshold; The adjusting of the initial comparison result adjustment threshold comprises: Adjusting the initial comparison result adjustment threshold to obtain the comparison result adjustment threshold; When it is determined that the sum of the comparison results is greater than the comparison result adjustment threshold, the database is updated using the first response data to obtain a new number of historical update requests and a new total number of requests; A new update ratio is obtained according to the new number of historical update requests and the new total number of requests, so that the new update ratio meets the preset update ratio range.

4. The method according to claim 1, characterized in that: The determining that the virtual data is the first response data and updating the database with the first response data at the location of the second response data in the database further includes: determining whether the second response data is trusted data; In the case where the second response data is trust data, a trust mark is added to the intervention trust state of the second response data.

5. The method according to claim 1 or 4, characterized in that: The comparing the first attribute parameter with the second attribute parameter to obtain a comparison result includes: determining an intervention trust status of the second response data; When the intervention trust state is distrust and the intervention error correction state of the second response data is no error correction, the first attribute parameter is compared with the second attribute parameter to obtain a comparison result, and the intervention error correction state is the error correction state of the second response data.

6. The method according to claim 5, characterized in that After determining the intervention trust status of the second response data, the method further includes: In a case where the intervention trust state is trust, determining the virtual data to be the second response data; When the intervention trust state is distrust and the intervention error correction state is error correction, the virtual data is determined to be the first response data.

7. The method according to claim 1, characterized in that After determining the response status of the application program interface, the method further includes: In the case where the response status is a second response status, searching for third response data related to the data request in a storage area of ​​the local simulation data service system, the second response status being a status in which the data request is not successfully processed; In the case where the third response data is found, determining that the virtual data is the third response data; In the case where the third response data is not found, determining the request path of the data request by using the local simulation data service system; In the case that the request path is the same as the preset request path, the response data corresponding to the preset request path is used as the response data corresponding to the request path, and the response data corresponding to the request path is returned.

8. The method according to claim 7, characterized in that The method further comprises: In the case where it is determined that the response state is a third response state, determining response data corresponding to the third response state, the third response state being a response state other than the first response state and the second response state; The response data corresponding to the third response status is used as the virtual data, and the third response status and the response data corresponding to the third response status are returned.

9. A data processing device, characterized in that: The device comprises: a determination unit, configured to determine, upon receiving a data request, a response state of an application program interface; wherein the network address of the application program interface points to a simulated data service system; and, upon finding second response data, determine a first attribute parameter of the first response data and a second attribute parameter of the second response data; and, based on a comparison result, determine whether the virtual data corresponding to the data request is the second response data or the first response data; a search unit, configured to receive the first response data through the application program interface and search for the second response data related to the data request in a database of the simulation data service system when the response status is a first response status; the first response status is a status in which the data request is successfully processed; A comparing unit, used for comparing the first attribute parameter with the second attribute parameter to obtain the comparison result; The comparison result includes one of the following: Results are correct, new fields are added, fields are missing, values ​​have changed, and value types have changed; The number of the comparison results is at least one; the device further comprises an updating unit; The determination unit is used to determine a sum of comparison results according to at least one comparison result and a preset influence coefficient; the sum of comparison results is a sum corresponding to the product of the preset influence coefficient of each comparison result and the weight of the comparison result; when the sum of the comparison results is greater than a comparison result threshold, the virtual data is determined to be the first response data; when the sum of the comparison results is less than or equal to the comparison result threshold, the virtual data is determined to be the second response data; The updating unit is configured to update the database using the first response data at a location of the second response data in the database.

10. A data processing device, characterized in that: The device comprises: A memory, a processor and a communication bus, wherein the memory communicates with the processor via the communication bus, the memory stores a data processing program executable by the processor, and when the data processing program is executed, the method according to any one of claims 1 to 8 is performed by the processor.

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

Citation Information

Patent Citations

  • Virtual machine room visualization monitoring management system based on B / S architecture and realization method

    CN106647586A

  • Method, client and system of simulating remote procedure call (RPC)

    CN107977316A