CN113641359A - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN113641359A
CN113641359A CN202111003656.5A CN202111003656A CN113641359A CN 113641359 A CN113641359 A CN 113641359A CN 202111003656 A CN202111003656 A CN 202111003656A CN 113641359 A CN113641359 A CN 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.)
Pending
Application number
CN202111003656.5A
Other languages
Chinese (zh)
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 Ltd filed Critical Beijing Wodong Tianjun Information Technology Co Ltd
Priority to CN202111003656.5A priority Critical patent/CN113641359A/en
Publication of CN113641359A publication Critical patent/CN113641359A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0793Remedial or corrective actions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages

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, a data processing apparatus 400 of the present invention includes:
the receiving module 401 is configured to receive data to be processed returned by the back end.
In the embodiment of the present invention, the receiving module 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 determining module 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 determining module 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.
A data 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 the data 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 sending module 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, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, an intermediate server 505, and a server 506. The network 504 is used to provide a medium for communication links between the terminal devices 501, 502, 503 and the intermediate server 505, and between the intermediate server 505 and the server 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 the terminal devices 501, 502, 503 to interact with the server 506 over the network 504 to receive or send messages or the like. The terminal 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.
The terminal 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.
The server 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 the terminal 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 the intermediate server 505.
The intermediate 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 the server 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 the terminal 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 the intermediate server 505, and accordingly, the data processing apparatus is generally disposed in the intermediate 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, the computer 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 a storage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage 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 the communication section 609, and/or installed from the removable 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)

1. A data processing method, comprising:
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.
2. The method of claim 1, wherein transforming the second data into target data that matches the data structure comprises:
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.
3. The method of claim 2,
and under the condition that the continuous reporting times of the abnormal data are greater 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.
4. The method of claim 2,
and converting the second data into target data matched with the data structure under the condition that the data content of the second data is normal.
5. The method according to claim 1, wherein the determining first data and/or second data from the first data corresponding to the number to be processed according to a preset data structure corresponding to a front end comprises:
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.
6. The method according to any one of claims 1 to 5,
the data structure is in a Json data format.
7. The method according to any one of claims 2 to 3,
the anomaly data includes 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.
8. A data processing apparatus, comprising:
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.
9. An electronic device for data processing, comprising:
one or more processors;
a storage device for storing 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. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202111003656.5A 2021-08-30 2021-08-30 Data processing method and device Pending CN113641359A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111003656.5A CN113641359A (en) 2021-08-30 2021-08-30 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111003656.5A CN113641359A (en) 2021-08-30 2021-08-30 Data processing method and device

Publications (1)

Publication Number Publication Date
CN113641359A true CN113641359A (en) 2021-11-12

Family

ID=78424447

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111003656.5A Pending CN113641359A (en) 2021-08-30 2021-08-30 Data processing method and device

Country Status (1)

Country Link
CN (1) CN113641359A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114564276A (en) * 2022-03-23 2022-05-31 杭州每刻科技有限公司 Method and system for reducing front-end white screen

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114564276A (en) * 2022-03-23 2022-05-31 杭州每刻科技有限公司 Method and system for reducing front-end white screen

Similar Documents

Publication Publication Date Title
CN113031946B (en) Method and device for rendering page component
CN112184367A (en) Order processing method and device
CN110377273B (en) Data processing method, device, medium and electronic equipment
CN113076153A (en) Interface calling method and device
CN113641359A (en) Data processing method and device
CN110865797A (en) Method and device for processing dynamic attributes of services
CN116700907B (en) Service call demand document storage method, device, electronic equipment and readable medium
CN113779004A (en) Data verification method and device
CN113778725A (en) Data verification method and device
CN113807056B (en) Document name sequence error correction method, device and equipment
CN112487765B (en) Method and device for generating notification text
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN114374686A (en) File processing method, device and equipment based on browser
CN113590243A (en) Energy enterprise project creation method and device, computer equipment and medium
CN114218313A (en) Data management method, device, electronic equipment, storage medium and product
CN113779018A (en) Data processing method and device
CN108170557B (en) Method and apparatus for outputting information
CN108076067B (en) Method and system for authorized crawler configuration simulation login
CN112433752A (en) Page parsing method, device, medium and electronic equipment
CN111835804A (en) Method, device and system for data transmission between internal network and external network
CN112287097B (en) Method and device for analyzing markup language text, storage medium and electronic equipment
CN109376023B (en) Method and equipment for generating calling information and issuing return code group
CN111736805B (en) Method and device for processing Excel table
CN112688863B (en) Gateway data processing method and device and electronic equipment
CN111562909B (en) Class-based application implementation method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination