Movatterモバイル変換


[0]ホーム

URL:


CN113641359A - Data processing method and device - Google Patents

Data processing method and device
Download PDF

Info

Publication number
CN113641359A
CN113641359ACN202111003656.5ACN202111003656ACN113641359ACN 113641359 ACN113641359 ACN 113641359ACN 202111003656 ACN202111003656 ACN 202111003656ACN 113641359 ACN113641359 ACN 113641359A
Authority
CN
China
Prior art keywords
data
processed
abnormal
target
data structure
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111003656.5A
Other languages
Chinese (zh)
Other versions
CN113641359B (en
Inventor
张亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Wodong Tianjun Information Technology Co LtdfiledCriticalBeijing Wodong Tianjun Information Technology Co Ltd
Priority to CN202111003656.5ApriorityCriticalpatent/CN113641359B/en
Publication of CN113641359ApublicationCriticalpatent/CN113641359A/en
Application grantedgrantedCritical
Publication of CN113641359BpublicationCriticalpatent/CN113641359B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The invention discloses a data processing method and device, and relates to the technical field of computers. The specific implementation mode of the method comprises the following steps: receiving data to be processed returned by the back end; determining first data and/or second data from the data to be processed according to a preset data structure corresponding to the front end; the first data are matched with the data structure, and the second data are unmatched with the data structure; in the case where the second data is present in the data to be processed: converting the second data into target data matched with the data structure; and sending the first data and/or the target data to the front end, so that the front end renders the page according to the first data and/or the target data. This embodiment can take out data structure processing logic from the front end for the front end can be absorbed in self business development, has reduced the development cost of front end, prevents frequent unusual error reporting phenomenon, promotes user experience, has improved the stability of front end.

Description

Data processing method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data processing method and apparatus.
Background
When the front end processes the data object, if the obtained data is abnormal, the data usually needs to be subjected to fault-tolerant processing, so that the front end can normally respond to the user.
When fault-tolerant processing is performed on data, a bottom-pocketing scheme is usually configured in advance, so that when the data is abnormal, the front end renders and displays error data through the bottom-pocketing scheme, for example, feedback information is displayed when the error data occurs on a page, and the situations of blank screen, no response and the like are avoided.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
when the data structure is more and more complex, the existing front end needs to process mass data, the difficulty of fault-tolerant processing and the amount of rendering data are more and more high, so that the development cost of the front end is more and more high, and if all abnormal data cannot be responded in time, the front end is extremely easy to crash, so that the user experience is poor.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data processing method and apparatus, which can convert data into a preset data structure before a front end obtains the data, and extract a data structure processing logic from the front end, so that the front end can concentrate on its service development, and perform fault-tolerant processing on mass data without paying attention to data structure abnormality, thereby reducing the development cost of the front end, preventing frequent abnormal error reporting, improving user experience, and improving the stability of the front end.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a data processing method including:
receiving data to be processed returned by the back end;
determining first data and/or second data from the data to be processed according to a preset data structure corresponding to a front end; wherein the first data is data matched with the data structure, and the second data is data unmatched with the data structure;
in the presence of the second data in the data to be processed: converting the second data into target data matched with the data structure;
and sending the first data and/or the target data to the front end, so that the front end renders a page according to the first data and/or the target data.
Optionally, the converting the second data into target data matched with the data structure includes:
determining whether data content of the second data is abnormal;
reporting abnormal data to the back end under the condition that the data content of the second data is abnormal, so that the back end corrects the abnormal data;
receiving corrected abnormal data sent by the back end;
and converting the corrected abnormal data into target data matched with the data structure.
Optionally, when the number of consecutive reports of the abnormal data is greater than a preset number threshold, preset reference data is used as the target data, so that the front end renders a prompt page according to the reference data.
Optionally, in a case that the data content of the second data is normal, the second data is converted into target data matching the data structure.
Optionally, the determining, according to a preset data structure corresponding to a front end, first data and/or second data from the first data determined according to the number to be processed includes:
and checking whether the data to be processed is matched with the data structure according to the data type, the data value and/or the range of the data value and/or the existence attribute corresponding to the data to be processed so as to determine the first data and/or the second data from the data to be processed.
Optionally, the data structure is in a Json data format.
Optionally, the anomaly data comprises any one or more of: the hierarchical structure, data field, interface name of the data to be processed, and the IP, browser information and operating system information corresponding to the front end.
According to still another aspect of an embodiment of the present invention, there is provided a data processing apparatus including:
the receiving module is used for receiving the data to be processed returned by the rear end;
the judging module is used for determining first data and/or second data from the data to be processed according to a preset data structure corresponding to the front end; wherein the first data is data matched with the data structure, and the second data is data unmatched with the data structure;
a data processing module, configured to, in a case that the second data exists in the to-be-processed data: converting the second data into target data matched with the data structure;
and the sending module is used for sending the first data and/or the target data to the front end, so that the front end renders a page according to the first data and/or the target data.
According to another aspect of an embodiment of the present invention, there is provided an electronic device for data processing, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method provided by the present invention.
According to still another aspect of embodiments of the present invention, there is provided a computer-readable medium on which a computer program is stored, the program, when executed by a processor, implementing the data processing method provided by the present invention.
One embodiment of the above invention has the following advantages or benefits: because a data structure written according to JSON Schema rules is adopted, the data to be processed returned by the back-end interface is converted into target data which accords with a preset Json data format, and the front end renders a page according to the target data which accords with an expected value; and reporting abnormal data to the back end under the condition that the data content has abnormal data, and returning the abnormal data after correction to the front end after receiving the abnormal data after correction, so that the front end renders a page according to the abnormal data after correction, thereby overcoming the technical problems that the existing front end has higher and higher development cost, the front end is easy to crash and the user experience is poor, further achieving the purposes of converting the data into a preset data structure before the front end acquires the data, extracting the data structure processing logic from the front end, leading the front end to be capable of focusing on self service development, not paying attention to the abnormal data structure, carrying out fault-tolerant processing on mass data, reducing the development cost of the front end, preventing frequent abnormal error reporting, improving the user experience and improving the technical effect of the stability of the front end.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of a main flow of a data processing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of a method for provisioning data formats according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a main flow of a method for reporting abnormal data according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of the main modules of a data processing apparatus according to an embodiment of the present invention;
FIG. 5 illustrates an exemplary system architecture diagram of a data processing method or data processing apparatus suitable for application with embodiments of the present invention;
fig. 6 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Json Schema: the Json mode refers to a self-defined or agreed Json data format, comprises members, structures, types, constraints and the like, and can be used for verifying the Json data format; the Json Schema in the invention is a Json data format agreed by the back end and the front end. The JSON Schema is in the JSON format and is only used for describing another JSON data, so that the JSON Schema can be used for performing code verification and can also be used as a code document for front-end and back-end development and use.
Fig. 1 is a schematic diagram of a main flow of a data processing method according to an embodiment of the present invention, and as shown in fig. 1, the data processing method of the present invention includes:
and step S101, receiving the data to be processed returned by the back end.
In the embodiment of the invention, the intermediate server receives the data to be processed returned by the back end, processes the data to be processed and returns the processed data to the front end.
Step S102, determining first data and/or second data from the data to be processed according to a preset data structure corresponding to a front end; the first data is data matched with the data structure, and the second data is data unmatched with the data structure.
In the embodiment of the invention, whether the data to be processed is matched with the data structure is checked according to the data type, the data value and/or the range of the data value and/or the existence attribute corresponding to the data to be processed, so as to determine the first data and/or the second data from the data to be processed.
In the embodiment of the present invention, the data to be processed may be multi-level data, and when the data to be processed is verified, the multi-level data to be processed needs to be verified step by step.
In the embodiment of the invention, the data structure is in a Json data format. The preset data structure corresponding to the front end may be a Json Schema rule agreed in advance by the back end and the front end. Specifically, when the front end and the back end communicate through data in the Json data format, the rules of the data structure, including the data type, the range of the value, the default value, the necessity, description, title, and the like, are determined according to the convention of the Json Schema.
In the embodiment of the present invention, as shown in fig. 2, the data format agreement method of the present invention includes the following steps:
step S201, the back end creates an API interface corresponding to the front end.
In the embodiment of the present invention, in order to transmit data according to the agreed data format, the back end is responsible for creating an API interface corresponding to one or more front ends for transmitting data to the front ends.
And S202, writing JSON Schema rules by the back end or the front end.
In the embodiment of the invention, developers at the back end or the front end write JSON Schema rules, so that the back end and the front end transmit data according to an agreed JSON data format.
In the embodiment of the present invention, the JSON Schema rule may be:
Figure BDA0003236393550000061
accordingly, the required object data is:
Figure BDA0003236393550000062
Figure BDA0003236393550000071
wherein, the data type of the name is string, namely a character string; the data type of "price" is "number", i.e., number; the data type of the child is "array", namely an array; the range of data values for "price" includes: the minimum value is 0; "name", "price", "children" all belong to the mandatory fields, corresponding to the presence attribute of the data format.
Step S203, determining the JSON data format.
In the embodiment of the invention, the rear end or the front end determines the JSON data format according to the written JSON Schema rule.
And step S204, outputting a JSON Schema.
In the embodiment of the present invention, the back end or the front end responsible for writing the JSON Schema rule outputs the JSON Schema, for example, the JSON Schema is output in an interface or document form, so that a developer at the back end or the front end can update or correct abnormal data according to a specific usage scenario.
Further, if the API interface needs to be adjusted, the JSON Schema rule can be rewritten.
In the embodiment of the invention, the data format convention method of the data format can clearly describe the interactive data format of the front end and the back end, and clearly determines that the expected data of the interaction of the front end and the back end accords with the convention JSON Schema rule, so that the back end outputs data according to the convention data format, and the front end receives the data according to the convention data format of both sides.
In the embodiment of the present invention, for example, the data to be processed that the intermediate server receives the back end return is:
Figure BDA0003236393550000072
the method comprises the steps of verifying David according to a data type string corresponding to a name, determining that the data type of the David is string, matching with a data structure, and determining that the name is the first data; checking null according to the data type number corresponding to the price, determining that the data type of null is not the number and is not matched with the data structure, wherein the price is the second data; the 'children' is used as an essential field, data corresponding to the 'children' field does not exist in the data to be processed, and the existence attribute of the 'children' is abnormal.
Step S103, when the second data exists in the data to be processed: and converting the second data into target data matched with the data structure.
In the embodiment of the invention, the second data is data which does not match with the data structure, and the intermediate server converts the second data into target data which matches with the data structure under the condition that the intermediate server determines that the second data exists in the data to be processed. However, in the process of converting the second data, there may be situations that the conversion cannot be performed, or abnormal data that does not conform to the preset data structure exists after the conversion, and therefore, it is necessary to report the data content corresponding to such abnormal data to the back end, so that a developer at the back end can correct the abnormal data, and the corrected data content conforms to the preset data structure.
In the embodiment of the present invention, as shown in fig. 3, the method for reporting abnormal data of the present invention includes the following steps:
step S301, determining whether the data content of the second data is abnormal; if yes, go to step S302; if not, go to step S310.
In the embodiment of the present invention, the intermediate server may automatically check whether the data content of the second data meets the expected value. For example, the data to be processed that the intermediate server receives the back end returns is:
Figure BDA0003236393550000081
wherein, the data content null corresponding to the "price" is abnormal; the data content of the 'children' is abnormal due to the lack of the data corresponding to the 'children' field.
Step S302, determining abnormal data.
Step S303, judging whether the continuous reporting times of the abnormal data are greater than a preset time threshold value, if so, turning to step S304; if not, go to step S305.
Step S304, when the continuous reporting times of the abnormal data are larger than a preset time threshold, taking preset reference data as the target data, and enabling the front end to render a prompt page according to the reference data.
In the embodiment of the present invention, the front end performs fault tolerance processing on the abnormal data, where the fault tolerance processing refers to displaying the abnormal data through a bottom-pocketing scheme, for example, the front end page renders an object name obj. The front end can process "undefined" into { }, and then process obj.name into "", that is, an empty string, that is, a corresponding bottom-of-pocket scheme, so that the front end renders a page according to the empty string to prevent an abnormal error report phenomenon, or the front end can render abnormal data into an error prompt page (for example, "error", or x picture, etc.).
In the embodiment of the invention, reference data can be preset, when the continuous reporting times of the abnormal data are more than the threshold value of the preset times, the abnormal data are corrected to be the reference data, the reference data are used as target data and sent to the front end, and the front end renders a prompt page according to the reference data; the reference data is bottom data, for example, ".
Step S305, reporting the abnormal data to the back end, so that the back end corrects the abnormal data.
In the embodiment of the present invention, the exception data may be a hierarchical structure of the data to be processed, a data field, a numerical value corresponding to the data field, an interface name, and an IP, browser information, or operating system information corresponding to the front end. The abnormal data can be sent to the back end in a message mode, so that the back end analyzes the message and determines the abnormal data. The reporting service, the parameter format and the like of the abnormal data are not limited, and the data analysis mode can be determined according to the rear end of the reporting system.
For example, the backend corrects the data content corresponding to "price" to "10", and supplements the "children" field and its corresponding data content.
In the embodiment of the invention, the abnormal data can be reported by calling the report callback function.
And step S306, increasing the reporting times of the abnormal data.
Step S307, receiving the corrected abnormal data sent by the backend.
In the embodiment of the invention, under the condition that the data content of the abnormal data after being corrected is normal, the abnormal data after being corrected is taken as the target data, and the target data is sent to the front end.
Step S308, determining whether the data content of the corrected abnormal data is abnormal; if yes, go to step S302; if not, go to step S309.
Step S309, converting the corrected abnormal data into target data matched with the data structure.
In the embodiment of the invention, the target data is sent to the front end, so that the front end renders the page according to the corrected abnormal data matched with the data structure.
Step S310, converting the second data into target data matched with the data structure.
In the embodiment of the invention, under the condition that the data content of the second data is normal, the second data is taken as the target data, and the target data is sent to the front end, so that the front end renders the page according to the second data matched with the data structure.
In the embodiment of the invention, through the reporting method of the abnormal data, on one hand, the back end can determine the abnormal data according to the reported information, and help developers to quickly locate data problems including but not limited to API addresses, request parameters, front end information and the like; on the other hand, when abnormal data is reported, errors cannot be reported on a front-end page, so that a user cannot feel the abnormal data, and the user experience is improved; on the other hand, the front end only needs to perform rendering, development and the like according to the data which accord with the preset data structure, and data structure judgment is not needed, so that developers at the front end do not need to pay excessive attention to the data structure, development of business logic can be concentrated, development efficiency is improved, and abnormal error reporting of the program is reduced.
In the embodiment of the present invention, the intermediate server may pre-configure the reporting service (for example, the reporting callback function) and the agreed data structure, and encapsulate the reporting service and the agreed data structure into one component.
Further, the intermediate server may select to turn on or turn off the reporting service, select to report or not report the abnormal data, and may send the abnormal data to the front end as the target data under the condition that the abnormal data is not reported, so that the front end renders a prompt page according to the abnormal data or corrects the abnormal data to be the reference data, and sends the reference data to the front end as the target data, so that the front end renders the page according to the reference data.
In the embodiment of the invention, the intermediate server can convert the second data by introducing the conversion module, and report the abnormal data which do not conform to the expected value. For example, the conversion module converts the data into convert according to the Json schema, and reports abnormal data in the data which do not conform to the expected value.
Step S104, sending the first data and/or the target data to the front end, so that the front end renders a page according to the first data and/or the target data.
In the embodiment of the invention, the data to be processed returned by the back end is received; determining first data and/or second data from the data to be processed according to a preset data structure corresponding to a front end; wherein the first data is data matched with the data structure, and the second data is data unmatched with the data structure; in the presence of the second data in the data to be processed: converting the second data into target data matched with the data structure; the first data and/or the target data are sent to the front end, so that the front end renders pages according to the first data and/or the target data, and the like, the data can be converted into a preset data structure before the front end acquires the data, and data structure processing logic is extracted from the front end, so that the front end can be concentrated in self service development, the data structure abnormity does not need to be concerned, fault-tolerant processing is carried out on mass data, the development cost of the front end is reduced, frequent abnormal error reporting is prevented, the user experience is improved, and the stability of the front end is improved.
Fig. 4 is a schematic diagram of main blocks of a data processing apparatus according to an embodiment of the present invention, and as shown in fig. 4, adata processing apparatus 400 of the present invention includes:
the receivingmodule 401 is configured to receive data to be processed returned by the back end.
In the embodiment of the present invention, the receivingmodule 401 of the intermediate server receives the data to be processed returned by the back end, processes the data to be processed, and returns the processed data to the front end.
A determiningmodule 402, configured to determine first data and/or second data from the data to be processed according to a preset data structure corresponding to a front end; the first data is data matched with the data structure, and the second data is data unmatched with the data structure.
In this embodiment of the present invention, according to a data type, a data value and/or a range of the data value, and/or an existence attribute corresponding to the data to be processed, the determiningmodule 402 checks whether the data to be processed matches with the data structure, so as to determine the first data and/or the second data from the data to be processed.
In the embodiment of the present invention, the data to be processed may be multi-level data, and when the data to be processed is verified, the multi-level data to be processed needs to be verified step by step.
In the embodiment of the invention, the data structure is in a Json data format. The preset data structure corresponding to the front end may be a Json Schema rule agreed in advance by the back end and the front end. Specifically, when the front end and the back end communicate through data in the Json data format, the rules of the data structure, including the data type, the range of the value, the default value, the necessity, description, title, and the like, are determined according to the convention of the Json Schema.
Adata processing module 403, configured to, in a case that the second data exists in the data to be processed: and converting the second data into target data matched with the data structure.
In this embodiment of the present invention, the second data is data that does not match the data structure, and thedata processing module 403 of the intermediate server converts the second data into target data that matches the data structure when determining that the second data exists in the data to be processed. However, in the process of converting the second data, there may be situations that the conversion cannot be performed, or abnormal data that does not conform to the preset data structure exists after the conversion, and therefore, it is necessary to report the data content corresponding to such abnormal data to the back end, so that a developer at the back end can correct the abnormal data, and the corrected data content conforms to the preset data structure.
A sendingmodule 404, configured to send the first data and/or the target data to the front end, so that the front end renders a page according to the first data and/or the target data.
In the embodiment of the invention, the data can be converted into the preset data structure by the modules such as the receiving module, the judging module, the data processing module and the sending module before the front end acquires the data, and the data structure processing logic is extracted from the front end, so that the front end can concentrate on self service development, the data structure abnormity does not need to be concerned, the fault tolerance processing is carried out on mass data, the development cost of the front end is reduced, the frequent abnormal error reporting phenomenon is prevented, the user experience is improved, and the stability of the front end is improved.
Fig. 5 shows an exemplary system architecture diagram of a data processing method or a data processing apparatus suitable for application to an embodiment of the present invention, and as shown in fig. 5, the exemplary system architecture of the data processing method or the data processing apparatus of the embodiment of the present invention includes:
as shown in fig. 5, thesystem architecture 500 may includeterminal devices 501, 502, 503, anetwork 504, anintermediate server 505, and aserver 506. Thenetwork 504 is used to provide a medium for communication links between theterminal devices 501, 502, 503 and theintermediate server 505, and between theintermediate server 505 and theserver 506.Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use theterminal devices 501, 502, 503 to interact with theserver 506 over thenetwork 504 to receive or send messages or the like. Theterminal devices 501, 502, 503 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
Theterminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
Theserver 506 may be a server providing various services, such as a background management server providing support for web browser-like websites browsed by the user using theterminal devices 501, 502, 503. The background management server may analyze and perform other processing on the received data query request, and feed back a processing result (e.g., to-be-processed data) to theintermediate server 505.
Theintermediate server 505 may be a server providing data processing, for example, a background management server providing support for performing data format conversion on the data to be processed returned by theserver 506. The backend management server may analyze and otherwise process the received data format conversion request and the like, and feed back a processing result (for example, target data conforming to a preset data format) to theterminal device 501, 502, 503.
It should be noted that the data processing method provided by the embodiment of the present invention is generally executed by theintermediate server 505, and accordingly, the data processing apparatus is generally disposed in theintermediate server 505.
It should be understood that the number of terminal devices, networks, intermediate servers, and servers in fig. 5 are merely illustrative. There may be any number of terminal devices, networks, intermediate servers, and servers, as desired for implementation.
Fig. 6 is a schematic structural diagram of a computer system suitable for implementing the terminal device or the server according to the embodiment of the present invention, and as shown in fig. 6, thecomputer system 600 of the terminal device or the server according to the embodiment of the present invention includes:
a Central Processing Unit (CPU)601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from astorage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of thesystem 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via abus 604. An input/output (I/O)interface 605 is also connected tobus 604.
The following components are connected to the I/O interface 605: aninput portion 606 including a keyboard, a mouse, and the like; anoutput portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; astorage section 608 including a hard disk and the like; and acommunication section 609 including a network interface card such as a LAN card, a modem, or the like. Thecommunication section 609 performs communication processing via a network such as the internet. Thedriver 610 is also connected to the I/O interface 605 as needed. Aremovable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on thedrive 610 as necessary, so that a computer program read out therefrom is mounted in thestorage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through thecommunication section 609, and/or installed from theremovable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprises a receiving module, a judging module, a data processing module and a sending module. The names of these modules do not in some cases constitute a limitation to the module itself, and for example, a data processing module may also be described as a "module that converts second data into target data that matches a data structure".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: receiving data to be processed returned by the back end; determining first data and/or second data from the data to be processed according to a preset data structure corresponding to a front end; wherein the first data is data matched with the data structure, and the second data is data unmatched with the data structure; in the presence of the second data in the data to be processed: converting the second data into target data matched with the data structure; and sending the first data and/or the target data to the front end, so that the front end renders a page according to the first data and/or the target data.
The existing front end usually processes object data in a data fault-tolerant manner, and when the data hierarchy of the object data returned by an interface in the front-end and back-end interaction processes is too deep (for example, more than three levels), the front end needs to continuously perform fault-tolerant processing on the data. However, as the frequency of update iteration of the front-end technology is continuously increased, the page interaction of the front end and the back end is more complex, the data complexity is higher and higher in the face of object data with too deep hierarchy, the front end faces great challenges when processing page rendering data and performing fault-tolerant processing, and fault-tolerant processing is required to be performed every time data is acquired or modified, so that the development cost of the front end is higher and higher, the data is extremely easy to lose control, and unpredictable errors occur.
According to the technical scheme of the embodiment of the invention, the data to be processed returned by the back-end interface is automatically converted into the target data which accords with the expected data structure through the data structure compiled according to the JSON Schema rule, the front end does not need to continuously perform fault-tolerant processing in the process of acquiring data or modifying data, the development cost of the front end is reduced, meanwhile, the abnormal data which does not accord with the expected value is reported, the problem data can be quickly positioned and corrected, so that a user does not feel the abnormal data, and the user experience is greatly improved.
According to the technical scheme of the embodiment of the invention, before the front end acquires the data, the data is converted into the preset data structure, and the data structure processing logic is extracted from the front end, so that the front end can concentrate on self service development, the data structure abnormity does not need to be concerned, fault-tolerant processing is carried out on mass data, the development cost of the front end is reduced, frequent abnormal error reporting is prevented, the user experience is improved, and the stability of the front end is improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

Translated fromChinese
1.一种数据处理方法,其特征在于,包括:1. a data processing method, is characterized in that, comprises:接收后端返回的待处理数据;Receive the pending data returned by the backend;根据预置的与前端对应的数据结构,从所述待处理数据中确定第一数据和/或第二数据;其中,所述第一数据为与所述数据结构相匹配的数据,所述第二数据为与所述数据结构不匹配的数据;Determine first data and/or second data from the data to be processed according to a preset data structure corresponding to the front end; wherein, the first data is data matching the data structure, and the first data The second data is data that does not match the data structure;在所述待处理数据中存在所述第二数据的情况下:将所述第二数据转换为与所述数据结构相匹配的目标数据;In the case where the second data exists in the data to be processed: converting the second data into target data matching the data structure;将所述第一数据和/或目标数据发送给所述前端,使得所述前端根据所述第一数据和/或目标数据对页面进行渲染。Sending the first data and/or target data to the front end, so that the front end renders a page according to the first data and/or the target data.2.根据权利要求1所述的方法,其特征在于,所述将所述第二数据转换为与所述数据结构相匹配的目标数据,包括:2. The method according to claim 1, wherein the converting the second data into target data matching the data structure comprises:确定所述第二数据的数据内容是否异常;determining whether the data content of the second data is abnormal;在所述第二数据的数据内容异常的情况下,向所述后端上报异常数据,使得所述后端对所述异常数据进行更正;When the data content of the second data is abnormal, reporting the abnormal data to the backend, so that the backend corrects the abnormal data;接收所述后端发送的更正后的异常数据;receiving the corrected abnormal data sent by the backend;将所述更正后的异常数据转换为与所述数据结构相匹配的目标数据。Converting the corrected abnormal data into target data matching the data structure.3.根据权利要求2所述的方法,其特征在于,3. The method of claim 2, wherein在所述异常数据的连续上报次数大于预设次数阈值的情况下,将预置的基准数据作为所述目标数据,使得所述前端根据所述基准数据渲染提示页面。When the number of consecutive reports of the abnormal data is greater than the preset number of times threshold, the preset benchmark data is used as the target data, so that the front end renders a prompt page according to the benchmark data.4.根据权利要求2所述的方法,其特征在于,4. The method according to claim 2, wherein在所述第二数据的数据内容正常的情况下,将所述第二数据转换为与所述数据结构相匹配的目标数据。When the data content of the second data is normal, the second data is converted into target data matching the data structure.5.根据权利要求1所述的方法,其特征在于,所述根据预置的与前端对应的数据结构,从确定与所述待处理数第一数据中确定第一数据和/或第二数据,包括:5. The method according to claim 1, wherein, according to the preset data structure corresponding to the front end, the first data and/or the second data are determined from the first data determined and the number to be processed ,include:根据所述待处理数据对应的数据类型、数据值和/或数据值的范围、和/或存在属性,校验所述待处理数据是否与所述数据结构相匹配,以从所述待处理数据中确定所述第一数据和/或所述第二数据。According to the corresponding data type, data value and/or data value range, and/or existence attribute of the data to be processed, it is checked whether the data to be processed matches the data structure, so as to obtain the data from the data to be processed. to determine the first data and/or the second data.6.根据权利要求1-5中任一所述的方法,其特征在于,6. The method according to any one of claims 1-5, characterized in that,所述数据结构为Json数据格式。The data structure is Json data format.7.根据权利要求2-3中任一所述的方法,其特征在于,7. The method according to any one of claims 2-3, characterized in that,所述异常数据包括以下任意一个或多个:所述待处理数据的层级结构、数据字段、接口名称、以及与所述前端对应的IP、浏览器信息、操作系统信息。The abnormal data includes any one or more of the following: the hierarchical structure of the data to be processed, data fields, interface names, and IP, browser information, and operating system information corresponding to the front end.8.一种数据处理装置,其特征在于,包括:8. A data processing device, comprising:接收模块,用于接收后端返回的待处理数据;The receiving module is used to receive the pending data returned by the backend;判断模块,用于根据预置的与前端对应的数据结构,从所述待处理数据中确定第一数据和/或第二数据;其中,所述第一数据为与所述数据结构相匹配的数据,所述第二数据为与所述数据结构不匹配的数据;The judgment module is used to determine the first data and/or the second data from the data to be processed according to the preset data structure corresponding to the front end; wherein, the first data is matched with the data structure data, the second data is data that does not match the data structure;数据处理模块,用于在所述待处理数据中存在所述第二数据的情况下:将所述第二数据转换为与所述数据结构相匹配的目标数据;a data processing module, configured to convert the second data into target data matching the data structure in the case that the second data exists in the data to be processed;发送模块,用于将所述第一数据和/或目标数据发送给所述前端,使得所述前端根据所述第一数据和/或目标数据对页面进行渲染。A sending module, configured to send the first data and/or target data to the front end, so that the front end renders a page according to the first data and/or the target data.9.一种数据处理电子设备,其特征在于,包括:9. A data processing electronic device, characterized in that, comprising:一个或多个处理器;one or more processors;存储装置,用于存储一个或多个程序,storage means for storing one or more programs,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-7中任一所述的方法。The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.10.一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现如权利要求1-7中任一所述的方法。10. A computer-readable medium on which a computer program is stored, characterized in that, when the program is executed by a processor, the method according to any one of claims 1-7 is implemented.
CN202111003656.5A2021-08-302021-08-30Data processing method and deviceActiveCN113641359B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202111003656.5ACN113641359B (en)2021-08-302021-08-30Data processing method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202111003656.5ACN113641359B (en)2021-08-302021-08-30Data processing method and device

Publications (2)

Publication NumberPublication Date
CN113641359Atrue CN113641359A (en)2021-11-12
CN113641359B CN113641359B (en)2025-03-18

Family

ID=78424447

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202111003656.5AActiveCN113641359B (en)2021-08-302021-08-30Data processing method and device

Country Status (1)

CountryLink
CN (1)CN113641359B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114564276A (en)*2022-03-232022-05-31杭州每刻科技有限公司Method and system for reducing front-end white screen
CN115525271A (en)*2022-09-292022-12-27国网甘肃省电力公司经济技术研究院 A data processing method for front-end projects based on hierarchical thinking

Citations (17)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107168971A (en)*2016-03-072017-09-15阿里巴巴集团控股有限公司The data processing method and device of web application
CN108153663A (en)*2016-12-022018-06-12阿里巴巴集团控股有限公司Page data processing method and device
US20180232348A1 (en)*2017-02-152018-08-16LAWPRCT, Inc.Document annotation system
US20190302974A1 (en)*2018-04-032019-10-03Palantir Technologies Inc.Multi-stage data page rendering
CN110909055A (en)*2019-11-182020-03-24中移(杭州)信息技术有限公司Data processing method, data processing device, electronic equipment and storage medium
CN111198859A (en)*2018-11-162020-05-26北京微播视界科技有限公司Data processing method and device, electronic equipment and computer readable storage medium
CN111552619A (en)*2020-04-292020-08-18深圳市道旅旅游科技股份有限公司Log data display method and device, computer equipment and storage medium
CN111611518A (en)*2020-05-252020-09-01南京南瑞信息通信科技有限公司 Automatic publishing method and system of visual display page based on Html5
CN111796983A (en)*2020-06-232020-10-20中体彩科技发展有限公司System and method for monitoring abnormal transaction request of sportsbook
CN111984888A (en)*2019-05-242020-11-24阿里巴巴集团控股有限公司Page rendering method and device, electronic equipment and computer readable medium
CN112241300A (en)*2019-07-192021-01-19北京京东尚科信息技术有限公司Application page loading method and loading device
CN112433799A (en)*2020-11-252021-03-02平安普惠企业管理有限公司Page generation method, device, equipment and medium
CN112527258A (en)*2020-12-162021-03-19平安国际智慧城市科技股份有限公司Page component development method, system, terminal and computer readable storage medium
CN112540763A (en)*2020-12-242021-03-23贵阳货车帮科技有限公司Front-end page generation method and device, platform equipment and storage medium
CN112685667A (en)*2020-12-292021-04-20浪潮软件科技有限公司Data interaction method and device, computer readable medium and interaction server
CN112818267A (en)*2019-11-152021-05-18北京沃东天骏信息技术有限公司Data processing method and device, computer readable storage medium and electronic equipment
CN113159970A (en)*2021-05-142021-07-23中国工商银行股份有限公司Data format conversion method, device, system, electronic equipment and storage medium

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107168971A (en)*2016-03-072017-09-15阿里巴巴集团控股有限公司The data processing method and device of web application
CN108153663A (en)*2016-12-022018-06-12阿里巴巴集团控股有限公司Page data processing method and device
US20180232348A1 (en)*2017-02-152018-08-16LAWPRCT, Inc.Document annotation system
US20190302974A1 (en)*2018-04-032019-10-03Palantir Technologies Inc.Multi-stage data page rendering
CN111198859A (en)*2018-11-162020-05-26北京微播视界科技有限公司Data processing method and device, electronic equipment and computer readable storage medium
CN111984888A (en)*2019-05-242020-11-24阿里巴巴集团控股有限公司Page rendering method and device, electronic equipment and computer readable medium
CN112241300A (en)*2019-07-192021-01-19北京京东尚科信息技术有限公司Application page loading method and loading device
CN112818267A (en)*2019-11-152021-05-18北京沃东天骏信息技术有限公司Data processing method and device, computer readable storage medium and electronic equipment
CN110909055A (en)*2019-11-182020-03-24中移(杭州)信息技术有限公司Data processing method, data processing device, electronic equipment and storage medium
CN111552619A (en)*2020-04-292020-08-18深圳市道旅旅游科技股份有限公司Log data display method and device, computer equipment and storage medium
CN111611518A (en)*2020-05-252020-09-01南京南瑞信息通信科技有限公司 Automatic publishing method and system of visual display page based on Html5
CN111796983A (en)*2020-06-232020-10-20中体彩科技发展有限公司System and method for monitoring abnormal transaction request of sportsbook
CN112433799A (en)*2020-11-252021-03-02平安普惠企业管理有限公司Page generation method, device, equipment and medium
CN112527258A (en)*2020-12-162021-03-19平安国际智慧城市科技股份有限公司Page component development method, system, terminal and computer readable storage medium
CN112540763A (en)*2020-12-242021-03-23贵阳货车帮科技有限公司Front-end page generation method and device, platform equipment and storage medium
CN112685667A (en)*2020-12-292021-04-20浪潮软件科技有限公司Data interaction method and device, computer readable medium and interaction server
CN113159970A (en)*2021-05-142021-07-23中国工商银行股份有限公司Data format conversion method, device, system, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李志秀;张军;陈光;杨丽红: "JQuery Ajax异步处理JSON数据在项目管理系统中的应用", 云南大学学报(自然科学版), vol. 33, no. 2, 15 December 2011 (2011-12-15), pages 247 - 250*

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114564276A (en)*2022-03-232022-05-31杭州每刻科技有限公司Method and system for reducing front-end white screen
CN115525271A (en)*2022-09-292022-12-27国网甘肃省电力公司经济技术研究院 A data processing method for front-end projects based on hierarchical thinking

Also Published As

Publication numberPublication date
CN113641359B (en)2025-03-18

Similar Documents

PublicationPublication DateTitle
US9015532B2 (en)System and method to test executable instructions
CN110109979B (en)Form option configuration method and device
CN113031946A (en)Method and device for rendering page component
CN111881392A (en)Page display method and device
CN110858202A (en) Generating method and generating device of where clause in database query statement
CN109284198A (en)A kind of method and apparatus verifying data
CN114528044B (en)Interface calling method, device, equipment and medium
CN110704200A (en) Methods and devices for converting invocation interfaces
CN113641359B (en)Data processing method and device
EP3872630A2 (en)Request processing method and apparatus, electronic device, and computer storage medium
CN110795135A (en) A method and apparatus for realizing annotated configuration
CN110377273B (en)Data processing method, device, medium and electronic equipment
CN114648012A (en) A bill processing method, device, electronic device and computer readable medium
CN113590243A (en)Energy enterprise project creation method and device, computer equipment and medium
CN116561013B (en) Test methods, devices, electronic equipment and media based on the target service framework
US10599610B2 (en)Programmatic self-learning of inter-system document processing configurations
CN112596729B (en) Target application interface generation method and device, readable medium and electronic device
CN114461302A (en)Parameter checking method, checking template generating method and storage medium
CN115328324A (en)Method and device for inputting characters at mobile terminal
CN111460020B (en)Method, device, electronic equipment and medium for resolving message
CN114448703A (en) Request processing method, device, electronic device and storage medium
CN110909269B (en)Log reporting method and device
CN113779018A (en) A data processing method and device
CN108170557B (en)Method and apparatus for outputting information
CN108076067B (en)Method and system for authorized crawler configuration simulation login

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp