Data processing method and device
By detecting and correcting the received data, it solves the problem of client crash or crash caused by data type differences in C/S data communication, realizes effective conversion and monitoring of data, and improves the stability of the client and data quality.
Patent Information
- Application Number
- CN202110083088.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-21
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2041-01-21
AI Technical Summary
In C/S data communication, differences in data types and default value expressions caused by different environments lead to data escape errors and client crashes or crashes. It is difficult to completely solve this problem with existing technology.
By detecting the received preset format data, deserializing and recursively traversing the object data table, it determines whether the object value meets the preset type and requirements, corrects the non-compliant data, replaces the preset type of object data, and outputs error messages. and reported to the data monitoring system.
It effectively avoids client crashes or crashes caused by preset type data, improves client quality, reduces manual intervention and business logic development requirements through full detection and automated processing, and improves data effectiveness and robustness.
Smart Images

Figure CN112783581B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method and device. Background Art
[0002] There are a lot of C / S (server-client) data communications in current applications, and the data exchange format used in these data communications is generally the JSON model. In the process of data communication, due to the different environments used by the client and the server (for example, the server uses the Java virtual machine environment (JVM), and the client uses the iOS environment), in the process of data communication, due to the different data types and default values of the data in different environments, errors often occur when escaping data between different systems, which in turn causes the client to crash or flash back.
[0003] In the prior art, in order to solve this problem, the following two methods are generally used:
[0004] Method 1: Use human and protocol communication constraints to try to issue unified data content.
[0005] Method 2: When using specific data, the client verifies the data one by one according to the object fields.
[0006] However, the inventors found that when the first solution is adopted, in actual scenarios, due to factors such as changes in the development of the server and client manpower, it is impossible to maintain effective and long-term constraint specifications; when the second solution is adopted, the client will verify the type of the object field, which is a strong check and can ensure data accuracy. However, the client does not verify every field, especially the data transmission part, which makes it impossible to completely solve the escape error and still causes the client to crash or flash back. Summary of the invention
[0007] In view of this, a data processing method, apparatus, computer device and computer-readable storage medium are now provided to solve the problem in the prior art that the client crashes or flashes back due to problems with escape.
[0008] The present application provides a data processing method, comprising:
[0009] Detecting the received data in a preset format, and when detecting that there is no data in the data in the preset format that does not conform to a preset verification rule, deserializing the data in the preset format to obtain an object data table, wherein the object data table includes at least one object data, and each object data includes an object attribute and an object value;
[0010] Detecting whether there is object data of a preset type in the object data table;
[0011] If there is object data of a preset type in the object data table, obtaining correction data corresponding to the object data of the preset type;
[0012] The corrected data is used to replace the preset type of object data to obtain corrected object data.
[0013] Optionally, the detecting whether there is object data of a preset type in the object data table includes:
[0014] Recursively traverse the object data in the object data table, and use the traversed object data as target object data, and perform the following target object data detection operation on each target object data:
[0015] It is determined whether object data of the preset type exists based on the object value in the target object data.
[0016] Optionally, the determining whether there is object data of the preset type based on the object value in the target object data includes:
[0017] Determining whether the type of the object value in the target object data is a preset type;
[0018] If the type of the object value in the target object data is the preset type, determine whether the object value meets the preset requirements, and determine whether there is object data of the preset type based on the determination result, wherein when the determination result is that the object value does not meet the preset requirements, determine that there is object data of the preset type.
[0019] Optionally, determining whether the object value meets a preset requirement includes:
[0020] If the type of the object value is an array type, traverse each element in the object value, and determine whether the object value meets the preset requirements based on each element obtained by the traversal;
[0021] If the type of the object value is a dictionary type, traverse each object data in the object value, and determine whether the object value meets the preset requirements based on each object data obtained through the traversal;
[0022] If the type of the object value is a basic type, it is directly determined that the object value meets the preset requirements.
[0023] Optionally, after the step of judging whether the object value meets the preset requirement based on each element obtained by traversal, the method further includes:
[0024] If it is determined that the traversed elements do not meet the preset requirements, the elements that do not meet the preset requirements are deleted;
[0025] After the step of judging whether the object value meets the preset requirements based on each object data obtained through traversal, the method further includes:
[0026] If it is determined that the traversed object data does not meet the preset requirements, the object data that does not meet the preset requirements will be deleted.
[0027] Optionally, the method further comprises:
[0028] When it is detected that data in the preset format does not conform to the preset verification rule, an error message is output.
[0029] Optionally, the method further comprises:
[0030] When it is detected that there is object data of a preset type in the object data table, the object data of the preset type is reported to the data monitoring system.
[0031] The present application also provides a data processing device, comprising:
[0032] a receiving module, configured to detect the received data in a preset format, and when detecting that there is no data in the data in the preset format that does not conform to a preset verification rule, deserialize the data in the preset format to obtain an object data table, wherein the object data table includes at least one object data, and each object data includes an object attribute and an object value;
[0033] A detection module, used for detecting whether there is object data of a preset type in the object data table;
[0034] an acquisition module, configured to acquire correction data corresponding to the object data of the preset type if there is object data of the preset type in the object data table;
[0035] The replacement module is used to replace the object data of the preset type with the correction data to obtain the corrected object data.
[0036] The present application also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above method when executing the computer program.
[0037] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0038] Beneficial effects of the above technical solution:
[0039] In an embodiment of the present application, by detecting the received data of a preset format, and when it is detected that there is no data in the data of the preset format that does not comply with the preset verification rules, the data of the preset format is deserialized to obtain an object data table, the object data table includes at least one object data, each object data includes object attributes and object values; detecting whether there is object data of a preset type in the object data table; if there is object data of a preset type in the object data table, obtaining correction data corresponding to the object data of the preset type; replacing the object data of the preset type with the correction data to obtain the corrected object data. In an embodiment of the present application, by correcting the object data when it is detected that there is object data of a preset type in the object data table, the object data is corrected so that the final object data does not contain the data of the preset type, thereby avoiding the crash or flashback of the client due to the presence of the data of the preset type, thereby improving the quality of the client. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 An environmental schematic diagram of a data processing method according to an embodiment of the present application;
[0041] Figure 2 A flowchart of an embodiment of the data processing method described in the present application;
[0042] Figure 3 A schematic diagram of a detailed flow chart of the steps of determining whether there is object data of the preset type based on the object value in the target object data in one embodiment of the present application;
[0043] Figure 4 A flowchart of another embodiment of the data processing method described in the present application;
[0044] Figure 5 A program module diagram of an embodiment of the data processing device described in the present application;
[0045] Figure 6 A schematic diagram of the hardware structure of a computer device for executing a data processing method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The advantages of the present application are further described below in conjunction with the accompanying drawings and specific embodiments.
[0047] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0048] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0049] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0050] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation to the present application.
[0051] Figure 1 The framework diagram of the data processing method according to the embodiment of the present application is schematically shown. In an exemplary embodiment, the system of the application environment may include a computer device 10 and a server 20. The computer device 10 and the server 20 form a wireless or wired connection. The computer device 10 can be a mobile phone, an iPAD, a tablet computer, a server, etc. The server 20 can be a rack server, a blade server, a tower server or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc.
[0052] See also Figure 2 , which is a flow chart of a data processing method according to an embodiment of the present application. It is understood that the flow chart in the embodiment of the present method is not used to limit the order of executing the steps. The following is an exemplary description using a computer device as the execution subject. It can be seen from the figure that the data processing method provided in the present embodiment includes:
[0053] Step S20: Detect the received data in a preset format, and when it is detected that there is no data in the data in the preset format that does not comply with preset verification rules, deserialize the data in the preset format to obtain an object data table, wherein the object data table includes at least one object data, and each object data includes object attributes and object values.
[0054] Specifically, when the client installed on the computer device receives data in a preset format transmitted by the server, the client can detect the data in the preset format to detect whether there is data in the data that does not conform to the preset verification rules, and when the data that does not conform to the preset verification rules is detected, the data is processed accordingly. As an example, when the data that does not conform to the preset verification rules is detected, an error message can be output so that the server can retransmit the data to the client, wherein the error message can be that the current data is illegal, or the current data is wrong, etc.
[0055] The preset format is a data transmission format agreed upon by the client and the server, for example, the preset format is a json format, a ProtoBuf format, etc. In this embodiment, for ease of description, the preset format is described in the following embodiments using the json format as an example.
[0056] It should be noted that JSON is a lightweight data exchange format. ProtoBuf (Google ProtocolBuffer) is a serial structured data format used by Google for data exchange. It has cross-platform, cross-language, and extensible features. It is similar to the commonly used XML and JSON, but has a smaller transmission volume and higher encoding and decoding capabilities. It is particularly suitable for fields with high requirements for storage volume and real-time performance, such as data storage and network data transmission.
[0057] The preset verification rules are data verification rules set in advance according to actual conditions. The preset verification rules can be used to determine whether there is empty data in the data in the preset format (generally indicating that the data is unknown, inapplicable, or data will be added later), and / or to determine whether there is data of the wrong type in the data in the preset format. For example, the data in the preset format is JSON data. When the JSON data contains the following 6 types of data that do not belong to the default JSON data supported, it can be determined that there is data of the wrong type in the JSON data.
[0058] Among them, JSON data supports the following 6 types: (1) bool, for JSON booleans, that is, Boolean values, logical values; (2) float64, for JSON numbers, that is, numbers, including integers and floating-point numbers; (3) string, for JSON strings, that is, strings; (4) [] interface {}, for JSON arrays, that is, arrays; (5) map [string] interface}, for JSON objects, that is, JSON objects; (6) nil, for JSON nul1, that is, null value.
[0059] Deserialization refers to converting data in a first preset format into an object data table in a data format required by the client to perform a business. For example, data in JSON format transmitted by the server is converted into an object Model required by the IOS client, where the object Model is a specific data object format required by the client to perform a business. As an example, YYModel can be used to deserialize data. YYModel is one of the efficient components of YYKit, which is used to use models for data processing.
[0060] In this embodiment, an object data table can be obtained after deserialization, wherein the object data table includes at least one object data, and each object data can represent the object attributes and object values of the object data in the form of a key-value pair, or can represent the object attributes and object values of the object data in the form of an attribute name and an attribute value, which is not limited in this embodiment.
[0061] Step S21, detecting whether there is object data of a preset type in the object data table.
[0062] Specifically, the preset type is a preset type that will cause a transfer error after deserialization processing. For example, when JSON data is deserialized into Model data, the preset type may be an NSNull type.
[0063] Among them, NSNull type refers to an empty object. NSNull inherits from NSObject. NSNull object has a valid memory address and can be used as a container for empty values. It cannot accept messages, otherwise it will crash.
[0064] In an exemplary embodiment, step S21 may include the following steps:
[0065] Recursively traverse the object data in the object data table, and use the traversed object data as target object data, and perform the following target object data detection operation on each target object data: determine whether there is object data of the preset type based on the object value in the target object data.
[0066] Specifically, when detecting the object data in the object data table, since the object data in the object data table is in a form similar to a "nesting doll", it is necessary to adopt a recursive traversal method to detect, that is, start detecting from the outermost object data in the object data table, and recursively detect the inner data in the object data table in turn until all the object data are detected.
[0067] During the detection process, each object data obtained by traversal is used as target object data, and then the target object data is detected in turn, that is, it is determined whether the preset type of object data exists based on the object value in the target object data.
[0068] In an exemplary embodiment, referring to Figure 3 The step of determining whether there is object data of the preset type based on the object value in the target object data includes steps S30-S31, wherein:
[0069] Step S30, determining whether the type of the object value in the target object data is a preset type.
[0070] Specifically, an object value type acquisition instruction may be executed to acquire the type of the object value. After acquiring the type of the object value, the acquired type may be compared with the preset type to determine whether the object value type is the preset type.
[0071] As an example, if the preset type is the NSNull type, when the type of the object value is not the NSNull type, it can be determined that the type of the object value is not the preset type.
[0072] Step S31, if the type of the object value in the target object data is the preset type, determine whether the object value meets the preset requirements, and determine whether there is object data of the preset type based on the judgment result, wherein when the judgment result is that the object value does not meet the preset requirements, it is determined that there is object data of the preset type.
[0073] Specifically, the preset requirement is set in advance according to actual conditions. For example, when the preset type is NSNull type, the preset requirement is that the object value is a null value (nil), where nil is a pointer to a non-existent object, that is, there is no data in the memory space corresponding to the object pointer.
[0074] In an exemplary implementation, different types of object values have different ways of determining whether the object values meet preset requirements.
[0075] As an example, when the type of the object value is an array type (Array type), each element in the object value is traversed, and based on each element obtained by the traversal, it is determined whether the object value meets the preset requirements.
[0076] Specifically, when the object value data is of array type, it means that the object value includes multiple elements, and each element can be traversed in turn, and after traversing each element, the element is judged to determine whether the object value meets the preset requirements.
[0077] It should be noted that, during the determination process, the object value is determined to meet the preset requirements only when all elements contained in the object value meet the preset requirements.
[0078] It is understandable that during the determination process, the traversed element may be a dictionary type element. The dictionary type element can then be used as a target object data, and then the object value in the target object data is obtained for determination to determine whether the dictionary type element meets the preset requirements.
[0079] In an exemplary implementation, if it is determined that the traversed elements do not meet the preset requirements, the elements that do not meet the preset requirements can be deleted. For example, if the traversed elements are as follows:
[0080] "site":["Google","Runoob",null,"Taobao"]
[0081] The traversed elements contain the character "null", however, the character "null" is not a data that meets the preset requirements, so "null" can be deleted to obtain the following elements:
[0082] "site":["Google","Runoob","Taobao"]. As an example, if the type of the object value is a dictionary type, each object data in the object value is traversed, and based on each object data obtained through the traversal, it is determined whether the object value meets the preset requirements.
[0083] Specifically, if the type of the object value is a dictionary type, each object data is first traversed to find it, and then the object attributes (such as key values) of all the object data are used as the scope of the poll, and the object value (such as Value value) corresponding to each object attribute is used as the basis for judgment. When judging the Value value, if the Value value is not a null value (nil), it can be determined that the object value meets the preset requirements, and the next object data is judged until all objects are judged; if the Value value is judged to be a null value (nil), it can be determined that the object value does not meet the preset requirements.
[0084] It should be noted that, during the determination process, if the object data is of an array type or a dictionary type, a recursive call may be made once to perform a determination operation on the array type or the dictionary type object data.
[0085] In an exemplary implementation, if it is determined that the traversed object data does not meet the preset requirements, the object data that does not meet the preset requirements can be deleted. For example, if the traversed object data is as follows:
[0086] "type1":null,
[0087] "type2":{
[0088] "key1":null,
[0089] "key2":"O2"}
[0090] In the data obtained by the traversal, there are object data "type1":null and object data "key1":null. However, these two object data do not meet the preset requirements. Therefore, in this embodiment, when such object data is found to exist, such object data can be deleted to obtain the object data shown below:
[0091] "type2":{"key2":"O2"}.
[0092] As an example, if the type of the object value is a basic type, it is directly determined that the object value meets the preset requirements.
[0093] Specifically, the basic type includes other types except array type and dictionary type. For example, if the object data is Model data, the basic type may include NSString, NSNumber, etc.
[0094] In this embodiment, when the object value is of a basic type, it can be directly determined that the object value meets the preset requirements without performing any processing operations.
[0095] Step S22: if there is object data of a preset type in the object data table, then obtain correction data corresponding to the object data of the preset type.
[0096] Specifically, the correction data is data used to replace the object data of the preset type. In this embodiment, a mapping table can be pre-established to store the correspondence between the object data of the preset type and the correction data, so that when it is determined that the object data of the preset type exists in the object data table, the correction data can be directly obtained from the mapping table to replace the data.
[0097] As an example, the correction data in this embodiment is a null value (nil).
[0098] Step S23: using the revised data to replace the preset type of object data to obtain revised object data.
[0099] Specifically, when the modified data is used to replace the data of the preset type, all the object data contained in the object data table can be placed in a newly created object data table, and then when the object data of the preset type is found, the object data of the preset type is replaced, so that an object data table without the object data of the preset type can be obtained. At this time, the object data table will no longer include content data of the NSNull type.
[0100] In the embodiment of the present application, by detecting the received data in a preset format, and when it is detected that there is no data that does not conform to the preset verification rule in the data in the preset format, the data in the preset format is deserialized to obtain an object data table, the object data table includes at least one object data, each object data includes an object attribute and an object value; detecting whether there is object data of a preset type in the object data table; if there is object data of a preset type in the object data table, obtaining the correction data corresponding to the object data of the preset type; using the correction data to replace the object data of the preset type, to obtain the corrected object data. In the embodiment of the present application, when it is detected that there is object data of a preset type in the object data table, the object data is corrected, so that the object data finally obtained does not contain the data of the preset type, thereby avoiding the crash or flashback of the client due to the presence of the data of the preset type, and improving the quality of the client. In addition, since the detection of the target data to be executed each time in this embodiment is full, there is no omission due to reasons such as transparent transmission data. In the entire detection process, no manual intervention is required, no understanding of the transparent transmission data is required, and the business logic does not need to perform additional development work for the data part. The data obtained after the entire test can effectively improve the effectiveness and robustness of the data after it enters the business logic process.
[0101] In an exemplary embodiment, referring to Figure 4 , the data processing method comprises:
[0102] Step S40, detecting the received data in a preset format, and when detecting that there is no data in the data in the preset format that does not conform to a preset verification rule, deserializing the data in the preset format to obtain an object data table, wherein the object data table includes at least one object data, and each object data includes an object attribute and an object value;
[0103] Step S41, detecting whether there is object data of a preset type in the object data table;
[0104] Step S42, if there is object data of a preset type in the object data table, obtaining correction data corresponding to the object data of the preset type;
[0105] Step S43: using the revised data to replace the preset type of object data to obtain revised object data.
[0106] Specifically, the above steps S40-S43 are the same as steps S20-S23 in the above embodiment, and are not repeated in this embodiment.
[0107] Step S44: when it is detected that there is object data of a preset type in the object data table, the object data of the preset type is reported to the data monitoring system.
[0108] Specifically, the data monitoring system is a system for monitoring object data of a preset type. The system can effectively record and analyze the object data of the preset type so that the data robustness of the server can be effectively verified, thereby reversely promoting the server to improve data quality.
[0109] In this embodiment, by reporting object data of preset types to the data monitoring system, data anomalies found in the online environment, whether ordinary data or data with transparent transmission, can be recorded, which can provide data basis for subsequent data analysis and governance, promote the server and client to jointly improve the quality of research and development and reduce the occurrence of errors.
[0110] It should be noted that transparent data refers to data sent by the server to the client by itself. The client does not understand its content and does not make any adjustments. Instead, it follows the business processing flow and, when making necessary requests to the server, it returns the data directly to the server with the data attached, and leaves it to the server for subsequent processing.
[0111] See also Figure 5 , which is a program module diagram of an embodiment of a data processing device 50 of the present application.
[0112] In this embodiment, the data processing device 50 includes a series of computer program instructions stored in a memory. When the computer program instructions are executed by a processor, the data processing functions of each embodiment of the present application can be implemented. In some embodiments, based on the specific operations implemented by each part of the computer program instructions, the data processing device 50 can be divided into one or more modules. For example, in Figure 5 In the embodiment, the data processing device 50 can be divided into a receiving module 51, a detection module 52, an acquisition module 53, and a replacement module 54.
[0113] The receiving module 51 is used to detect the received data in the preset format, and when it is detected that there is no data in the data in the preset format that does not conform to the preset verification rule, deserialize the data in the preset format to obtain an object data table, wherein the object data table includes at least one object data, and each object data includes an object attribute and an object value;
[0114] A detection module 52, used to detect whether there is object data of a preset type in the object data table;
[0115] An acquisition module 53, configured to acquire correction data corresponding to the object data of the preset type if there is object data of the preset type in the object data table;
[0116] The replacement module 54 is used to replace the object data of the preset type with the correction data to obtain the corrected object data.
[0117] In an exemplary embodiment, the detection module 52 is further configured to recursively traverse the object data in the object data table, and use the traversed object data as target object data, and perform the following target object data detection operation on each target object data:
[0118] It is determined whether object data of the preset type exists based on the object value in the target object data.
[0119] In an exemplary embodiment, the detection module 52 is further configured to determine whether the type of the object value in the target object data is a preset type;
[0120] If the type of the object value in the target object data is the preset type, determine whether the object value meets the preset requirements, and determine whether there is object data of the preset type based on the determination result, wherein when the determination result is that the object value does not meet the preset requirements, determine that there is object data of the preset type.
[0121] In an exemplary embodiment, the detection module 52 is further configured to, if the type of the object value is an array type, traverse each element in the object value, and determine whether the object value meets a preset requirement based on each element obtained by the traversal;
[0122] If the type of the object value is a dictionary type, traverse each object data in the object value, and determine whether the object value meets the preset requirements based on each object data obtained through the traversal;
[0123] If the type of the object value is a basic type, it is directly determined that the object value meets the preset requirements.
[0124] In an exemplary embodiment, the data processing device 50 further includes a deletion module.
[0125] The deleting module is used to delete the elements that do not meet the preset requirements if it is determined that the traversed elements do not meet the preset requirements.
[0126] The deleting module is further configured to delete the object data that does not meet the preset requirements if it is determined that the traversed object data does not meet the preset requirements.
[0127] In an exemplary embodiment, the data processing device 50 further includes an output module.
[0128] The output module is used to output error information when detecting that data in the preset format does not conform to the preset verification rule.
[0129] In an exemplary implementation, the data processing device 50 further includes a reporting module.
[0130] The reporting module is configured to report the preset type of object data to the data monitoring system upon detecting that the preset type of object data exists in the object data table.
[0131] In the embodiment of the present application, by detecting the received data in a preset format, and when it is detected that there is no data that does not conform to the preset verification rule in the data in the preset format, the data in the preset format is deserialized to obtain an object data table, the object data table includes at least one object data, each object data includes an object attribute and an object value; detecting whether there is object data of a preset type in the object data table; if there is object data of a preset type in the object data table, obtaining the correction data corresponding to the object data of the preset type; using the correction data to replace the object data of the preset type, to obtain the corrected object data. In the embodiment of the present application, when it is detected that there is object data of a preset type in the object data table, the object data is corrected, so that the object data finally obtained does not contain the data of the preset type, thereby avoiding the crash or flashback of the client due to the presence of the data of the preset type, and improving the quality of the client. In addition, since the detection of the target data to be executed each time in this embodiment is full, there is no omission due to reasons such as transparent transmission data. In the entire detection process, no manual intervention is required, no understanding of the transparent transmission data is required, and the business logic does not need to perform additional development work for the data part. The data obtained after the entire test can effectively improve the effectiveness and robustness of the data after it enters the business logic process.
[0132] Figure 6 The hardware architecture diagram of a computer device 10 suitable for implementing a data processing method according to an embodiment of the present application is schematically shown. In this embodiment, the computer device 10 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. For example, it can be a tablet computer, a laptop computer, a desktop computer, a rack server, a blade server, a tower server or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Figure 6As shown, the computer device 10 includes at least but is not limited to: a memory 120, a processor 121, and a network interface 123 that can communicate with each other through a system bus. Among them:
[0133] The memory 120 includes at least one type of computer-readable storage medium, which may be volatile or non-volatile. Specifically, the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 120 may be an internal storage module of the computer device 10, such as a hard disk or memory of the computer device 10. In other embodiments, the memory 120 may also be an external storage device of the computer device 10, such as a plug-in hard disk equipped on the computer device 10, a smart memory card (Smart MediaCard, referred to as SMC), a secure digital (Secure Digital, referred to as SD) card, a flash card, etc. Of course, the memory 120 may also include both the internal storage module of the computer device 10 and its external storage device. In this embodiment, the memory 120 is generally used to store an operating system and various application software installed on the computer device 10, such as program codes of data processing methods, etc. In addition, the memory 120 can also be used to temporarily store various data that have been output or are to be output.
[0134] In some embodiments, the processor 121 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 121 is generally used to control the overall operation of the computer device 10, such as performing control and processing related to data interaction or communication with the computer device 10. In this embodiment, the processor 121 is used to run the program code stored in the memory 120 or process data.
[0135] The network interface 123 may include a wireless network interface or a wired network interface, and the network interface 123 is generally used to establish a communication link between the computer device 10 and other computer devices. For example, the network interface 123 is used to connect the computer device 10 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10 and the external terminal. The network can be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0136] It should be pointed out that Figure 6 Only a computer device having components 120 - 122 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may be implemented instead.
[0137] In this embodiment, the data processing method stored in the memory 120 can be divided into one or more program modules and executed by one or more processors (processor 121 in this embodiment) to complete the present application.
[0138] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the data processing method in the embodiment are implemented.
[0139] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart MediaCard, referred to as SMC), a secure digital (Secure Digital, referred to as SD) card, a flash card, etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the data processing method in the embodiment, etc. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.
[0140] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on at least two network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiment scheme of the present application. Those of ordinary skill in the art may understand and implement it without creative labor.
[0141] Through the description of the above implementation methods, ordinary technicians in this field can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Ordinary technicians in this field can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A data processing method, characterized in that: include: Detecting the received data in a preset format, and when detecting that there is no data in the data in the preset format that does not conform to a preset verification rule, deserializing the data in the preset format to obtain an object data table, wherein the object data table includes at least one object data, and each object data includes an object attribute and an object value; Detecting whether there is object data of a preset type in the object data table; If there is object data of a preset type in the object data table, obtaining correction data corresponding to the object data of the preset type; Replacing the object data of the preset type with the revised data to obtain revised object data; The detecting whether there is object data of a preset type in the object data table comprises: Recursively traverse the object data in the object data table, and use the traversed object data as target object data, and perform the following target object data detection operation on each target object data: Determining whether the type of the object value in the target object data is a preset type; If the type of the object value in the target object data is the preset type, determining whether the object value meets the preset requirements, and determining whether there is object data of the preset type according to the determination result, wherein when the determination result is that the object value does not meet the preset requirements, determining that there is object data of the preset type; Wherein, judging whether the object value meets the preset requirements includes: If the type of the object value is an array type, traverse each element in the object value, and determine whether the object value meets the preset requirements based on each element obtained by the traversal; If the type of the object value is a dictionary type, traverse each object data in the object value, and determine whether the object value meets the preset requirements based on each object data obtained through the traversal; If the type of the object value is a basic type, it is directly determined that the object value meets the preset requirements.
2. The data processing method according to claim 1, characterized in that: After the step of judging whether the object value meets the preset requirements based on each element obtained by traversal, the method further includes: If it is determined that the traversed elements do not meet the preset requirements, the elements that do not meet the preset requirements are deleted; After the step of judging whether the object value meets the preset requirements based on each object data obtained through traversal, the method further includes: If it is determined that the traversed object data does not meet the preset requirements, the object data that does not meet the preset requirements will be deleted.
3. The data processing method according to any one of claims 1 to 2, characterized in that: The method further comprises: When it is detected that data in the preset format does not conform to the preset verification rule, an error message is output.
4. The data processing method according to any one of claims 1 to 2, characterized in that: The method further comprises: When it is detected that there is object data of a preset type in the object data table, the object data of the preset type is reported to the data monitoring system.
5. A data processing device, characterized in that: include: A receiving module, configured to detect the received data in a preset format, and when detecting that there is no data in the data in the preset format that does not conform to a preset verification rule, deserialize the data in the preset format to obtain an object data table, wherein the object data table includes at least one object data, and each object data includes an object attribute and an object value; A detection module, used for detecting whether there is object data of a preset type in the object data table; an acquisition module, configured to acquire correction data corresponding to the object data of the preset type if there is object data of the preset type in the object data table; A replacement module, used to replace the object data of the preset type with the correction data to obtain the corrected object data; The detection module is further used to recursively traverse the object data in the object data table, and use the traversed object data as target object data, and perform the following target object data detection operation on each target object data: determine whether the type of the object value in the target object data is a preset type; If the type of the object value in the target object data is the preset type, determining whether the object value meets the preset requirements, and determining whether there is object data of the preset type according to the determination result, wherein when the determination result is that the object value does not meet the preset requirements, determining that there is object data of the preset type; The detection module is further used for, if the type of the object value is an array type, traversing each element in the object value, and judging whether the object value meets the preset requirements based on each element obtained through the traversal; if the type of the object value is a dictionary type, traversing each object data in the object value, and judging whether the object value meets the preset requirements based on each object data obtained through the traversal; if the type of the object value is a basic type, directly judging that the object value meets the preset requirements.
6. A computer device, characterized in that: The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the data processing method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 4 are implemented.
8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 4 are implemented.
