CN113821209A - Interactive data processing method and device, electronic equipment and storage medium - Google Patents

Interactive data processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113821209A
CN113821209A CN202111084846.4A CN202111084846A CN113821209A CN 113821209 A CN113821209 A CN 113821209A CN 202111084846 A CN202111084846 A CN 202111084846A CN 113821209 A CN113821209 A CN 113821209A
Authority
CN
China
Prior art keywords
character string
target character
interactive data
display
target
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
CN202111084846.4A
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.)
Gree Electric Appliances Inc of Zhuhai
Zhuhai Lianyun Technology Co Ltd
Original Assignee
Gree Electric Appliances Inc of Zhuhai
Zhuhai Lianyun 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 Gree Electric Appliances Inc of Zhuhai, Zhuhai Lianyun Technology Co Ltd filed Critical Gree Electric Appliances Inc of Zhuhai
Priority to CN202111084846.4A priority Critical patent/CN113821209A/en
Publication of CN113821209A publication Critical patent/CN113821209A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/436Semantic checking

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • User Interface Of Digital Computer (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the disclosure discloses a method and a device for processing interactive data, electronic equipment and a storage medium. The method comprises the following steps: acquiring interactive data sent by a server; determining whether the interactive data comprises character strings in a preset character string set or not; when the interactive data includes a character string in the preset character string set, the character string in the preset character string set included in the interactive data is used as a target character string, a language is generated based on analysis information of the target character string and the rear end of the interactive data, and the target character string is converted into a display character string of the target character string, wherein the display character string is used for displaying the front end of the target character string. The embodiment of the disclosure can convert the target character string into the corresponding display character string based on the analysis information and the back-end generation language, thereby improving the accuracy of conversion of the target character string.

Description

Interactive data processing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for processing interactive data, an electronic device, and a storage medium.
Background
In the prior art, data which cannot be accurately analyzed by terminal equipment may exist in data returned to a terminal by a server, so that page display is not friendly enough.
For example, in the portion of data that the interface returns to the application plug-in, empty arrays, empty objects, keywords, special characters (e.g., "@", "#", "$", "%", "&", "") and the like may appear. At this time, if the terminal device analyzes the data, the friendliness of the content presented on the page of the plug-in is greatly reduced, and it is difficult for the user to understand the specific meaning of the presented content.
Disclosure of Invention
In view of the above, in order to solve some or all of the above technical problems, embodiments of the present disclosure provide a method and apparatus for processing interactive data, an electronic device, and a storage medium.
In a first aspect, an embodiment of the present disclosure provides a method for processing interactive data, where the method includes:
acquiring interactive data sent by a server;
determining whether the interactive data comprises character strings in a preset character string set or not;
when the interactive data includes a character string in the preset character string set, the character string in the preset character string set included in the interactive data is used as a target character string, a language is generated based on analysis information of the target character string and the rear end of the interactive data, and the target character string is converted into a display character string of the target character string, wherein the display character string is used for displaying the front end of the target character string.
Optionally, in a method according to any embodiment of the present disclosure, the generating a language based on the analysis information of the target character string and the back end of the interactive data, and converting the target character string into a display character string of the target character string includes:
if the target character string comprises a null object, a null array or a first character string, converting the target character string into a display character string which is displayed in a blank format and is of the target character string in the rear-end generation language, wherein the use frequency of the first character string is less than or equal to a preset frequency threshold; and/or
And if the target character string comprises a second character string, converting the target character string into a display character string of the target character string in the rear-end generation language, wherein the display character string represents semantic information of the target character string, and the second character is a keyword in an analytic language of the target character string.
Optionally, in the method of any embodiment of the present disclosure, the method further includes:
analyzing the display character string by adopting the analysis language of the target character string;
and displaying an analysis result of analyzing the display character string.
Optionally, in the method according to any embodiment of the present disclosure, the acquiring interactive data sent by the server includes:
acquiring interactive data sent by a server under the condition that a preset fault occurs on a page or equipment for displaying the interactive data; and
the displaying of the analysis result for analyzing the display character string includes:
and displaying an analysis result of analyzing the display character string on the page or the equipment.
Optionally, in the method according to any embodiment of the present disclosure, the acquiring interactive data sent by the server includes:
intercepting data returned by a global interface of a server to acquire interactive data sent by the server; and
the converting the target character string into the display character string of the target character string includes:
and converting the target character string into a display character string of the target character string by adopting an adapter design mode.
Optionally, in a method according to any embodiment of the present disclosure, the generating a language based on the analysis information of the target character string and the back end of the interactive data, and converting the target character string into a display character string of the target character string includes:
and converting the target character string into a display character string of the target character string based on the analysis information of the target character string, the rear-end generation language of the interactive data and the position of the target character string in the interactive data.
Optionally, in the method of any embodiment of the present disclosure, the parsing information includes at least one of: display style, semantic information, data type, parsing language.
Optionally, in the method according to any embodiment of the present disclosure, the interactive data is JSON data or extensible markup language.
In a second aspect, an embodiment of the present disclosure provides an apparatus for processing interactive data, where the apparatus includes:
the acquisition unit is configured to acquire the interactive data sent by the server;
the determining unit is configured to determine whether the interactive data comprises character strings in a preset character string set or not;
a conversion unit configured to, when a character string in the preset character string set is included in the interactive data, take a character string in the preset character string set included in the interactive data as a target character string, convert the target character string into a display character string of the target character string based on analysis information of the target character string and a back-end generation language of the interactive data, wherein the display character string is used for front-end display of the target character string.
Optionally, in an apparatus according to any embodiment of the present disclosure, the conversion unit includes:
a first conversion subunit configured to, if the target character string includes a null object, a null array, or a first character string, convert the target character string into a display character string of the target character string in the backend generation language displayed in a blank format, wherein a frequency of use of the first character string is less than or equal to a preset frequency threshold; and/or
A second conversion subunit configured to, if the target character string includes a second character string, convert the target character string into a display character string of the target character string in the backend generation language that represents semantic information of the target character string, wherein the second character is a keyword in a parsing language of the target character string.
Optionally, in an apparatus according to any embodiment of the present disclosure, the apparatus further includes:
an analysis unit configured to analyze the display character string in an analysis language of the target character string;
and a display unit configured to display an analysis result of analyzing the display character string.
Optionally, in an apparatus according to any embodiment of the present disclosure, the acquiring unit includes:
the acquiring subunit is configured to acquire the interactive data sent by the server under the condition that a preset fault occurs in a page or equipment for displaying the interactive data; and
the display unit includes:
a display subunit configured to display an analysis result of analyzing the display character string on the page or the device.
Optionally, in an apparatus according to any embodiment of the present disclosure, the acquiring unit includes:
the intercepting subunit is configured to intercept data returned by the global interface of the server to acquire interactive data sent by the server; and
the conversion unit includes:
and a third conversion subunit configured to convert the target character string into a display character string of the target character string by using an adapter design mode.
Optionally, in an apparatus according to any embodiment of the present disclosure, the conversion unit includes:
a fourth conversion subunit configured to convert the target character string into a display character string of the target character string based on the analysis information of the target character string, the backend generation language of the interactive data, and the position of the target character string in the interactive data.
Optionally, in an apparatus according to any embodiment of the present disclosure, the parsing information includes at least one of: display style, semantic information, data type, parsing language.
Optionally, in an apparatus according to any embodiment of the present disclosure, the interactive data is JSON data or extensible markup language.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
a memory for storing a computer program;
a processor, configured to execute the computer program stored in the memory, and when the computer program is executed, implement the method of any embodiment of the processing method of the interactive data of the first aspect of the present disclosure.
In a fourth aspect, the disclosed embodiments provide a computer readable medium, and the computer program, when executed by a processor, implements the method of any embodiment of the processing method of the interactive data according to the first aspect.
In a fifth aspect, the disclosed embodiments provide a computer program, which includes computer readable code, when the computer readable code is run on a device, causes a processor in the device to execute instructions for implementing the steps in the method according to any one of the embodiments of the method for processing interactive data according to the first aspect.
In the method for processing interactive data provided by the above embodiment of the present disclosure, interactive data sent by a server is obtained, then, it is determined whether a character string in a preset character string set is included in the interactive data, then, when the character string in the preset character string set is included in the interactive data, a character string in the preset character string set included in the interactive data is used as a target character string, a language is generated based on parsing information of the target character string and a back end of the interactive data, the target character string is converted into a display character string of the target character string, where the display character string is used for front end display of the target character string, so that the target character string can be converted into the display character string of the target character string based on parsing information of the target character string in the interactive data and a back end generation language of the interactive data, therefore, the accuracy of target character string conversion is improved, the friendliness of information displayed on a page is improved, and the occurrence of subsequent conditions of white screen generation, blockage, crash and the like of equipment is reduced.
The technical solution of the present disclosure is further described in detail by the accompanying drawings and examples.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
fig. 1 is an exemplary system architecture diagram of an interactive data processing method or an interactive data processing apparatus according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a method for processing interactive data according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of one application scenario for the embodiment of FIG. 2;
FIG. 4 is a flowchart of another interactive data processing method provided by the embodiments of the present disclosure;
fig. 5 is a schematic structural diagram of an interactive data processing apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure.
Detailed Description
Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of parts and steps, numerical expressions, and values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
It will be understood by those within the art that the terms "first," "second," and the like in the embodiments of the present disclosure are used merely to distinguish one object, step, device, or module from another object, and do not denote any particular technical meaning or logical order therebetween.
It is also understood that in embodiments of the present disclosure, "a plurality" may refer to two or more and "at least one" may refer to one, two or more.
It is also to be understood that any reference to any component, data, or structure in the embodiments of the disclosure, may be generally understood as one or more, unless explicitly defined otherwise or stated otherwise.
In addition, the term "and/or" in the present disclosure is only one kind of association relationship describing an associated object, and means that three kinds of relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in the present disclosure generally indicates that the former and latter associated objects are in an "or" relationship.
It should also be understood that the description of the various embodiments of the present disclosure emphasizes the differences between the various embodiments, and the same or similar parts may be referred to each other, so that the descriptions thereof are omitted for brevity.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is an exemplary system architecture diagram of an interactive data processing method or an interactive data processing apparatus according to an embodiment of the present disclosure.
As shown in fig. 1, the system architecture 100 may include a terminal 101, a server 102, and a network 103, the network 103 may provide a medium for communication links between the terminal 101 and the server 102. Network 103 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The terminal 101 and the server 102 may interact with each other through the network 103 to receive or transmit data (e.g., interactive data) and the like. In general, the terminal 101 may be used as an execution subject of each step in the processing method of the interactive data described in the embodiment of the present disclosure, but in some cases, the terminal 101 and the server 102 may also cooperate with each other to implement the processing method of the interactive data described in the embodiment of the present disclosure.
The terminal 101 may be hardware or software. When the terminal device 101 is hardware, it may be various electronic devices having a display screen and supporting page browsing, including but not limited to a smart phone, a tablet computer, a laptop portable computer, a desktop computer, and the like. When the terminal apparatus 101 is software, it can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 102 may be a server providing various services, such as a background server providing support for pages displayed by the terminal 101. The background server may send the interactive data to the terminal. As an example, the server 102 may be a cloud server.
It should be noted that the server may be hardware or software. When the server is hardware, the server can be implemented as a distributed server cluster formed by a plurality of servers, or can be implemented as a single server. When the server is software, it may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be noted that an execution main body of the method for processing interaction data provided in the embodiment of the present disclosure may be hardware or software, and is not limited specifically herein.
It should be understood that the number of electronic devices and networks in fig. 1 is merely illustrative. There may be any number of terminals, servers, and networks, as desired for an implementation.
Fig. 2 shows a flow 200 of a method for processing interactive data according to an embodiment of the present disclosure. The interactive data processing method comprises the following steps:
step 201, acquiring interactive data sent by a server.
In this embodiment, an execution subject (for example, the terminal shown in fig. 1) of the interactive data processing method may obtain the interactive data sent by the server from other electronic devices or locally in a wired or wireless manner.
The server can be in communication connection with the execution main body. For example, the server may be configured to provide support for pages presented by the execution agent. Through the interactive data sent by the server, the execution main body can present a page on the display, and the content presented by the page can be obtained by analyzing the interactive data and other processing.
In some optional implementation manners of this embodiment, the interaction data is JSON (JavaScript Object Notation) data or XML (Extensible Markup Language) data.
Step 202, determining whether the interactive data includes a character string in a preset character string set.
In this embodiment, the execution subject may determine whether the interactive data acquired in step 201 includes a character string in a preset character string set.
The preset character string set may be a set of predetermined character strings. It should be noted that each element in the preset character string set may be composed of one or more characters. That is, the number of characters included in a single character string in the preset character string set may be one or more, and is not limited herein.
In some cases, the setting of the preset character string set may be applied to one or more types of data. For example, a preset string set may be determined for JSON data or XML data; the preset string set may also be determined for all data (for example, AJAX (Asynchronous JavaScript and XML) data, Session data (data stored in the server and shared among multiple requests of one Session), and the like) that the server interacts with the execution main body.
Step 203, in a case where the interactive data includes a character string in the preset character string set, taking the character string in the preset character string set included in the interactive data as a target character string, and converting the target character string into a display character string of the target character string based on the analysis information of the target character string and the back-end generation language of the interactive data.
In this embodiment, the execution subject may take a character string in the preset character string set included in the interactive data as a target character string when the character string in the preset character string set is included in the interactive data. Then, the execution body may convert the target character string into a display character string of the target character string based on the analysis information of the target character string and a back-end generation language of the interactive data. Wherein the display character string is used for front end display of the target character string.
The backend generation language may be java, c + +, php, or the like, for example.
In practice, the target character string may be converted into a display character string of the target character string by using a regular expression or a place method in JavaScript. For example, backslash (\ or /) or other special characters (such as @, #, $,%, &, # and the like) may be replaced with spaces, horizontal tabs, line breaks, carriage returns, or empty strings using a regular expression or place in JavaScript method for subsequent display in a page.
In some optional implementation manners of this embodiment, the parsing information includes at least one of the following: display style, semantic information, data type, parsing language.
The display style may represent a style of display of the target character string, for example, a display style of the target character string desired by a developer. By way of example, the display styles may include a display style of a space, a display style of a linefeed, a display style of a pagefeed, a display style of a horizontal jump, a display style of a vertical jump, and so forth.
Semantic information, which can characterize the semantics of the target string. As an example, semantic information of the target string "true" may characterize true; further, in the case where the target character string is a keyword, the semantic information of the target character string may be the target character string whose data type is in the form of a character string, for example, if the target character string is a keyword "finalley" in JavaScript, the semantic information of the target character string may be "finallely" in the form of a character string. Optionally, in a case where the target character string is a keyword, the semantic information of the target character string may be a display language of the target character string whose data type is a character string form. The display language may be a language of a page displayed in the execution body, for example: chinese, english, etc. As an example, in the case where the display language is chinese, if the target character string is a keyword "false" in JavaScript, the semantic information of the target character string may be "error" in the form of a character string.
The data type may be boolean "borolean", byte ", integer" int ", etc.
Parsing languages, which may include JavaScript, Jscript, vbscript, typescript, etc.
It is to be understood that, in the above alternative implementation, the display character string of the target character string may be determined based on at least one of the display style, the semantic information, the data type, the parsing language, and the back-end generation language, so that the accuracy of conversion of the display character string may be improved.
In some optional implementation manners of this embodiment, the executing entity may execute the step 203 in a manner that the target character string is converted into a display character string of the target character string based on the parsing information of the target character string and the back-end generation language of the interactive data:
and if the target character string comprises a null object, a null array or a first character string, converting the target character string into a display character string which is displayed in a blank format and is of the target character string in the back-end generation language.
The use frequency of the first character string is less than or equal to a preset frequency threshold. For example, the first string may be a special character defined in the parsing language (e.g., @, #, $,%, &). Blank formats, which may include but are not limited to: space, line feed, page feed, horizontal skip, vertical skip, etc.
Here, different back-ends generate the same target string in the language, whose display strings may be different.
It can be understood that, in the above alternative implementation manner, in the case that the target character string includes a null object, a null array, or a first character string, the target character string may be converted into a display character string of the target character string in the backend generation language, which is displayed in a blank format, so that the friendliness of information displayed on the page is improved, and a user can conveniently know the meaning of the content displayed on the page.
In some optional implementation manners of this embodiment, the executing entity may also execute the step 203 in a manner that converts the target character string into a display character string of the target character string based on the analysis information of the target character string and the back-end generation language of the interactive data:
and if the target character string comprises a second character string, converting the target character string into a display character string of the target character string in the rear-end generation language, wherein the display character string represents semantic information of the target character string.
Wherein the second character is a keyword in the parsing language of the target character string.
It can be understood that, in the above alternative implementation manner, in the case that the target character string includes the second character string, the target character string may be converted into a display character string of the target character string that represents semantic information of the target character string, so that friendliness of information displayed on the page is improved, and a user can conveniently know the meaning of content displayed on the page.
In some optional implementation manners of this embodiment, the executing body may further execute the following steps:
first, the display character string is analyzed using the analysis language of the target character string.
Then, an analysis result of analyzing the display character string is displayed.
It can be understood that, in the above optional implementation manner, since the target character string is converted into the display character string of the target character string, in the process of displaying the analysis result of the analysis of the display character string and the analysis result, the occurrence of the situations of white screen, stuck, dead halt and the like in the subsequent process of the device can be reduced.
In some application scenarios of the above optional implementation, the executing entity may execute step 201 in the following manner: and acquiring the interactive data under the condition that a preset fault occurs in a page or equipment for displaying the interactive data sent by the server.
The preset fault may include, but is not limited to, a white screen, a stuck, a dead halt, and the like. If the predetermined failure is a dead halt, the device may be restarted first, and then step 201 and step 203 are executed,
in addition, the execution body may display an analysis result of analyzing the display character string in the following manner: and displaying an analysis result of analyzing the display character string on the page or the equipment.
It can be understood that in the application scenario, the target character string may be converted into the display character string of the target character string when a preset fault occurs in a page or a device for displaying interactive data sent by the server, so that faults such as a white screen, a stuck state, a dead halt, and the like, which are generated by the device, can be eliminated through the conversion of the character string.
In some optional implementation manners of this embodiment, the executing main body may execute the step 201 in the following manner:
and intercepting data returned by the global interface of the server to acquire the interactive data sent by the server.
On this basis, the execution body may convert the target character string into a display character string of the target character string in the following manner:
and converting the target character string into a display character string of the target character string by adopting an adapter design mode.
Wherein an Adapter Pattern (Adapter Pattern) may act as a bridge between two incompatible interfaces. This type of design model is a structural model that combines the functions of two independent interfaces. Adapter mode transparently calls external components by defining a new interface (abstracting the functionality to be implemented), and an Adapter class that implements the interface. Thus, when replacing external components, only a few classes need to be modified and other source code is not affected.
It can be understood that, in the above optional implementation manner, after the data returned by the global interface of the server is intercepted, an adapter design mode is adopted to convert the target character string in the intercepted interactive data into the display character string of the target character string, so that the target character strings in all the interactive data acquired by the execution main body can be converted, thereby improving the comprehensiveness of the conversion of the target character strings, contributing to further improving the friendliness of the information displayed on the page, and reducing the occurrence of the situations of white screen, stuck, dead halt and the like generated subsequently by the device.
Optionally, in a method according to any embodiment of the present disclosure, the generating a language based on the analysis information of the target character string and the back end of the interactive data, and converting the target character string into a display character string of the target character string includes:
and converting the target character string into a display character string of the target character string based on the analysis information of the target character string, the rear-end generation language of the interactive data and the position of the target character string in the interactive data.
By way of example, if a character is preceded or followed by a backslash (\ or /) or other special character (such as @, #, $,%, &, # or the like) in the interaction data, the character, as well as its preceding or following backslash (\ or /) or other special character (such as @, #, $,%, &, # or the like), may be converted to a display string. In this scenario, the target character is the character and its preceding or following backslash (\ or /) or other special characters (such as @, #, $,%, &, #) and the like).
With continued reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of the interactive data processing method according to the present embodiment. In fig. 3, a terminal 310 first obtains interactive data 301 (e.g., "person": null ") sent by a server 320, and then the terminal 310 determines whether a character string in a preset character string set (e.g., including a character string" null ") is included in the interactive data 302, and then, in a case where the interactive data 301 includes a character string in the preset character string set, takes the character string in the preset character string set included in the interactive data 301 as a target character string 302 (in the illustration, the target character string" null ") and converts the target character string 302 into a display character string 305 (e.g.," invincible person ") of the target character string 302 based on parsing information 303 (e.g., parsing language and semantic information) of the target character string and a backend generation language 304 (e.g., java) of the interactive data. As a result, when the display character string 305 is subsequently analyzed and the analysis result of the analysis of the display character string is displayed, the display character string 305 (e.g., "blindman") can be displayed on the terminal 310.
The method for processing interactive data according to the embodiment of the disclosure may obtain interactive data sent by a server, then determine whether a character string in a preset character string set is included in the interactive data, then, when the interactive data includes a character string in the preset character string set, take a character string in the preset character string set included in the interactive data as a target character string, and convert the target character string into a display character string of the target character string based on parsing information of the target character string and a back-end generation language of the interactive data, where the display character string is used for front-end display of the target character string. Therefore, the language can be generated based on the analysis information of the target character string in the interactive data and the rear end of the interactive data, and the target character string is converted into the display character string of the target character string, so that the accuracy of conversion of the target character string is improved, the friendliness of page display information is improved, and the situations of white screen, blockage, dead halt and the like generated subsequently by equipment are reduced.
With further reference to fig. 4, fig. 4 illustrates a flow 400 of yet another embodiment of a method of processing interaction data. The flow of the interactive data processing method comprises the following steps:
step 401, acquiring interactive data sent by a server. Thereafter, step 402 is performed.
In this embodiment, an execution subject of the interactive data processing method (for example, the electronic device shown in fig. 1) may obtain the interactive data sent by the server from other electronic devices or locally in a wired or wireless manner.
Step 402, determining whether the interactive data includes a character string in a preset character string set. Thereafter, step 403 is performed.
In this embodiment, the execution main body may determine whether the interactive data includes a character string in a preset character string set.
Step 403, taking the character string in the preset character string set included in the interactive data as a target character string, in case that the interactive data includes the character string in the preset character string set. Thereafter, steps 404 and 405 are performed.
In this embodiment, in a case where a character string in the preset character string set is included in the interactive data, the execution main body may use a character string in the preset character string set included in the interactive data as a target character string.
At step 404, it is determined whether the target string includes a null object, a null array, or a first string. If yes, go to step 406.
In this embodiment, the execution subject may determine whether the target character string includes a null object, a null array, or a first character string.
At step 405, it is determined whether the target string includes a second string. Then, if yes, go to step 407.
In this embodiment, the execution body may determine whether the target character string includes the second character string.
Step 406, converting the target character string into a display character string of the target character string in the backend generation language, which is displayed in a blank format.
In this embodiment, the execution body may convert the target character string into a display character string of the target character string in the backend generation language displayed in a blank format.
Step 407 is to convert the target character string into a display character string of the target character string in the backend generation language, which represents semantic information of the target character string.
In this embodiment, the execution body may convert the target character string into a display character string of the target character string in the backend generation language, which represents semantic information of the target character string.
Here, the present embodiment is exemplarily described by taking development of a plug-in a mobile phone application that controls smart home via a wireless network as an example.
In the process of developing the plug-in, the plug-in may obtain the required interactive data by calling the interface, and when the format of the interactive data is JSON format (or other format, such as XML format), the interface returns the interactive data to the plug-in, and data without actual content, such as null array, null object, true, false, null string, JavaScript keyword, slash, backslash or other special characters (e.g., @, #, $,%, &, # and the like), JavaScript keyword and the like, inevitably occur in the interactive data. In the JSON-format interactive data, the above data having no actual content is generally a value. Different programming languages treat the array, the null object, true, false, null, the string, the slash, the backslash and other special characters (such as @, ##, #$,%, &andthe like) differently, if fault-tolerant treatment is not carried out in the process of writing the plug-in, unfriendly word prompts such as NaN, undefined and the like are displayed in the plug-in, and after the plug-in is embedded in an Application (app) through a webpage view (WebView), the conditions of white screen, button unresponsiveness, jamming and dead halt can also be generated in the process of joint debugging.
Specifically, the preset character string set may include: an empty object "{ }", an empty array "[ ]", "null", a data type "true" of boolean type, a construction character (e.g., "[", "", ""), a slash "\", a backslash "/", a special character (e.g., "@", "#", "$", "%", "&", ""). Therefore, when the analysis information includes an analysis language, the analysis language is JavaScript, and the backend generation language of the interactive data is Java, the specific implementation steps may be as follows:
step one, calling a specified interface through an agreed network Protocol (such as HTTP (Hyper Text Transfer Protocol) or HTTPs (Hyper Text Transfer Protocol over secure HTTP channel) and a parameter (such as a login interface, where the parameter to be transmitted includes a user name, a password, etc.), and returning JSON data (i.e., interactive data) to the plug-in.
Step two, the following judgment is carried out on the interactive data:
if the interactive data includes a null object (for example, whether the interactive data includes the null object can be judged by using a json.
If the interactive data comprises a null array (for example, whether the interactive data comprises the null array can be judged by using a json.
If true or false is included in the interactive data and the data type is boolean, converting the target character string (i.e. boolean true or false) into an empty character string (i.e. display character string) for subsequent display in the page;
if null is included in the interactive data (a JavaScript statement "| getneedleddata & & typeof (getneedleddata) |" undefined "& & getneedleddata | 0" may be employed to determine whether null is included in the interactive data), converting the target character string (i.e., null) into an empty character string (i.e., a display character string) for subsequent presentation in the page;
if a structural character (e.g., "[", "{", "]", "}", "", ":") is included in the interaction data, the target character string (i.e., the structural character included in the interaction data) is converted into an empty character string (i.e., a display character string) for subsequent presentation in the page;
if the interaction data includes JavaScript keywords (such as constructs, definitions, boilean, break, byte, case, catch, char, class, const, continue, debugger, default, delete, do, double, else, even, export, extensions, false, final, float, for, function, goto, if, comments, import, in, instanceof, int, interface, let, long, native, new, null, page, private, protected, public, return, short, static, sub, switch, synchronized, this, thread, private, string () of pass, pass () of pass, pass of, pass.
In practice, the target character string may be converted into a display character string of the target character string by using a regular expression or a place method in JavaScript. For example, backslash (\ or /) or other special characters (such as @, #, $,%, &, # and the like) may be replaced with spaces, horizontal tabs, line breaks, carriage returns, or empty strings using a regular expression or place in JavaScript method for subsequent display in a page.
And step three, after the process is finished, displaying the corresponding data (namely the analysis result of the display character string) in the page according to the requirement.
It should be noted that, besides the contents described above, the present embodiment can also be implemented in a manner corresponding to that described in the embodiment described in the above method, and details are not described here.
In addition, interception processing can be performed in a function returned by the global interface, and the data format returned by the interface is converted into a format required by the plug-in by using an adapter design mode.
In the method for processing the interactive data in the embodiment, the content displayed on the page is more friendly, unfriendly prompt information such as undefined information, NaN information and the like cannot be generated, and the occurrence of the white screen and blockage of the page caused by the unfriendly prompt information is reduced.
As shown in fig. 5, the interactive data processing apparatus 500 of the present embodiment. The above apparatus 500 includes: an acquisition unit 501, a determination unit 502, and a conversion unit 503. The obtaining unit 501 is configured to obtain interactive data sent by a server; a determining unit 502 configured to determine whether a character string in a preset character string set is included in the interactive data; a conversion unit 503 configured to, when a character string in the preset character string set is included in the interactive data, take a character string in the preset character string set included in the interactive data as a target character string, convert the target character string into a display character string of the target character string based on analysis information of the target character string and a back-end generation language of the interactive data, where the display character string is used for front-end display of the target character string.
In this embodiment, the obtaining unit 501 of the interactive data processing apparatus 500 may obtain the interactive data sent by the server.
In this embodiment, the determining unit 502 may determine whether the interactive data includes a character string in a preset character string set.
In this embodiment, when the interactive data includes a character string in the preset character string set, the converting unit 503 may use the character string in the preset character string set included in the interactive data as a target character string, and convert the target character string into a display character string of the target character string based on the analysis information of the target character string and the back-end generation language of the interactive data. Wherein the display character string is used for front end display of the target character string.
In some optional implementations of this embodiment, the converting unit 503 includes:
a first conversion subunit (not shown in the figure), configured to convert the target character string into a display character string displayed in a blank format and used for the target character string in the backend generation language if the target character string comprises a blank object, a blank array or a first character string, wherein the usage frequency of the first character string is less than or equal to a preset frequency threshold; and/or
A second conversion subunit (not shown in the figure) configured to, if the target character string includes a second character string, convert the target character string into a display character string of the target character string in the backend generation language, which characterizes semantic information of the target character string, wherein the second character is a keyword in the parsing language of the target character string.
In some optional implementations of this embodiment, the apparatus 500 further includes:
an analysis unit (not shown) configured to analyze the display character string using an analysis language of the target character string;
and a display unit (not shown) configured to display a result of the analysis of the display character string.
In some optional implementation manners of this embodiment, the obtaining unit 501 includes:
an obtaining subunit (not shown in the figure), configured to obtain the interactive data sent by the server when a preset fault occurs to a page or a device for displaying the interactive data; and
the display unit includes:
and a display subunit (not shown in the figure) configured to display an analysis result of analyzing the display character string on the page or the device.
In some optional implementation manners of this embodiment, the obtaining unit 501 includes:
an interception subunit (not shown in the figure), configured to intercept data returned by the global interface of the server to obtain interactive data sent by the server; and
the conversion unit 503 includes:
and a third conversion subunit (not shown in the figure) configured to convert the target character string into a display character string of the target character string by using the adapter design mode.
In some optional implementations of this embodiment, the converting unit 503 includes:
a fourth conversion subunit (not shown in the figure) configured to convert the target character string into a display character string of the target character string based on the parsing information of the target character string, the back-end generation language of the interactive data, and the position of the target character string in the interactive data.
In some optional implementations of this embodiment, the parsing information includes at least one of: display style, semantic information, data type, parsing language.
In some optional implementations of the embodiment, the interactive data is JSON data or extensible markup language.
In the apparatus 500 provided in the foregoing embodiment of the present disclosure, the obtaining unit 501 may obtain interactive data sent by a server, then the determining unit 502 may determine whether a character string in a preset character string set is included in the interactive data, and finally, the converting unit 503 may, when the interactive data includes a character string in the preset character string set, take a character string in the preset character string set included in the interactive data as a target character string, and convert the target character string into a display character string of the target character string based on parsing information of the target character string and a back-end generation language of the interactive data, where the display character string is used for front-end display of the target character string. Therefore, the language can be generated based on the analysis information of the target character string in the interactive data and the rear end of the interactive data, and the target character string is converted into the display character string of the target character string, so that the accuracy of conversion of the target character string is improved, the friendliness of page display information is improved, and the occurrence of the conditions of white screen, blockage, dead halt and the like generated subsequently by equipment is reduced.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, where the electronic device 600 shown in fig. 6 includes: at least one processor 601, memory 602, and at least one network interface 604 and other user interfaces 603. The various components in the electronic device 600 are coupled together by a bus system 605. It is understood that the bus system 605 is used to enable communications among the components. The bus system 605 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 605 in fig. 6.
The user interface 603 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, trackball, touch pad, or touch screen, among others.
It will be appreciated that the memory 602 in embodiments of the disclosure may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of illustration and not limitation, many forms of RAM are available, such as Static random access memory (Static RAM, SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (ddr Data Rate SDRAM, ddr SDRAM), Enhanced Synchronous SDRAM (ESDRAM), synchlronous SDRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 602 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some embodiments, memory 602 stores the following elements, executable units or data structures, or a subset thereof, or an expanded set thereof: an operating system 6021 and application programs 6022.
The operating system 6021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, and is used for implementing various basic services and processing hardware-based tasks. The application programs 6022 include various application programs such as a Media Player (Media Player), a Browser (Browser), and the like for implementing various application services. Programs that implement methods of embodiments of the present disclosure can be included in application program 6022.
In the embodiment of the present disclosure, by calling a program or an instruction stored in the memory 602, specifically, a program or an instruction stored in the application program 6022, the processor 601 is configured to execute the method steps provided by the method embodiments, for example, including: acquiring interactive data sent by a server; determining whether the interactive data comprises character strings in a preset character string set or not; when the interactive data includes a character string in the preset character string set, the character string in the preset character string set included in the interactive data is used as a target character string, a language is generated based on analysis information of the target character string and the rear end of the interactive data, and the target character string is converted into a display character string of the target character string, wherein the display character string is used for displaying the front end of the target character string.
The method disclosed by the embodiment of the present disclosure can be applied to the processor 601 or implemented by the processor 601. The processor 601 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 601. The Processor 601 may be a general-purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present disclosure may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present disclosure may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software elements in the decoding processor. The software elements may be located in ram, flash, rom, prom, or eprom, registers, among other storage media that are well known in the art. The storage medium is located in the memory 602, and the processor 601 reads the information in the memory 602 and completes the steps of the method in combination with the hardware thereof.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the Processing units may be implemented within one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units performing the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
The electronic device provided in this embodiment may be the electronic device shown in fig. 6, and may execute all the steps of the method for processing the interactive data shown in fig. 2, so as to achieve the technical effect of the method for processing the interactive data shown in fig. 2.
The disclosed embodiments also provide a storage medium (computer-readable storage medium). The storage medium herein stores one or more programs. Among others, the storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When one or more programs in the storage medium can be executed by one or more processors, the method for processing the interactive data executed on the electronic device side is realized.
The processor is used for executing the communication program stored in the memory so as to realize the following steps of the interactive data processing method executed on the electronic equipment side: acquiring interactive data sent by a server; determining whether the interactive data comprises character strings in a preset character string set or not; when the interactive data includes a character string in the preset character string set, the character string in the preset character string set included in the interactive data is used as a target character string, a language is generated based on analysis information of the target character string and the rear end of the interactive data, and the target character string is converted into a display character string of the target character string, wherein the display character string is used for displaying the front end of the target character string.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments, objects, technical solutions and advantages of the present disclosure are described in further detail, and it should be understood that the above-mentioned embodiments are merely illustrative of the present disclosure and are not intended to limit the scope of the present disclosure, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.

Claims (10)

1. A method for processing interactive data, the method comprising:
acquiring interactive data sent by a server;
determining whether the interactive data comprises character strings in a preset character string set or not;
and under the condition that the interactive data comprises the character strings in the preset character string set, taking the character strings in the preset character string set in the interactive data as target character strings, converting the target character strings into the display character strings of the target character strings based on the analysis information of the target character strings and the language generated at the rear end of the interactive data, wherein the display character strings are used for the front-end display of the target character strings.
2. The method of claim 1, wherein the converting the target character string into a display character string of the target character string based on the parsing information of the target character string and a back-end generation language of the interactive data comprises:
if the target character string comprises a null object, a null array or a first character string, converting the target character string into a display character string which is displayed in a blank format and is of the target character string in the back-end generation language, wherein the use frequency of the first character string is less than or equal to a preset frequency threshold; and/or
And if the target character string comprises a second character string, converting the target character string into a display character string which represents semantic information of the target character string and is used for generating the target character string in the language generated by the rear end, wherein the second character is a keyword in the analytic language of the target character string.
3. The method of claim 1, further comprising:
analyzing the display character string by adopting the analysis language of the target character string;
and displaying an analysis result of analyzing the display character string.
4. The method of claim 3, wherein the obtaining of the interactive data sent by the server comprises:
the method comprises the steps that under the condition that a preset fault occurs in a page or equipment used for displaying interactive data sent by a server, the interactive data are obtained; and
the displaying of the analysis result of analyzing the display character string includes:
and displaying an analysis result for analyzing the display character string on the page or the equipment.
5. The method of claim 1, wherein the obtaining of the interactive data sent by the server comprises:
intercepting data returned by a global interface of a server to obtain interactive data sent by the server; and
the converting the target character string into a display character string of the target character string includes:
and adopting an adapter design mode to convert the target character string into a display character string of the target character string.
6. The method of claim 1, wherein the converting the target character string into a display character string of the target character string based on the parsing information of the target character string and a back-end generation language of the interactive data comprises:
and converting the target character string into a display character string of the target character string based on the analysis information of the target character string, the rear-end generation language of the interactive data and the position of the target character string in the interactive data.
7. The method according to one of claims 1 to 5, wherein the interaction data is JSON data or extensible markup language; or
The resolution information includes at least one of: display style, semantic information, data type, parsing language.
8. An apparatus for processing interactive data, the apparatus comprising:
the acquisition unit is configured to acquire the interactive data sent by the server;
the determining unit is configured to determine whether character strings in a preset character string set are included in the interactive data;
a conversion unit configured to, in a case where a character string in the preset character string set is included in the interactive data, take the character string in the preset character string set included in the interactive data as a target character string, convert the target character string into a display character string of the target character string based on parsing information of the target character string and a back-end generation language of the interactive data, where the display character string is used for front-end display of the target character string.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing a computer program stored in the memory, and when executed, implementing the method of any of the preceding claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of the preceding claims 1 to 7.
CN202111084846.4A 2021-09-15 2021-09-15 Interactive data processing method and device, electronic equipment and storage medium Pending CN113821209A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111084846.4A CN113821209A (en) 2021-09-15 2021-09-15 Interactive data processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111084846.4A CN113821209A (en) 2021-09-15 2021-09-15 Interactive data processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113821209A true CN113821209A (en) 2021-12-21

Family

ID=78914664

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111084846.4A Pending CN113821209A (en) 2021-09-15 2021-09-15 Interactive data processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113821209A (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
CN109313665B (en) Creation of computer messaging robots
KR102220127B1 (en) Method and apparatus for customized software development kit (sdk) generation
US9208054B2 (en) Web service for automated cross-browser compatibility checking of web applications
US8201143B2 (en) Dynamic mating of a modified user interface with pre-modified user interface code library
WO2018133452A1 (en) Webpage rendering method and related device
US8150939B1 (en) Method and system for wrapping and componentizing javascript centric widgets using java components
US8572554B2 (en) Method and system for integrating Java and JavaScript technologies
US9389891B2 (en) Custom browser-side spreadsheet functions
JP2009506465A (en) Method and computer-readable medium for commanding
US20190244225A1 (en) Data analytics for international product quality and user experience
US20170310784A1 (en) Systems and Methods for Hosted Application Marketplaces
JP2023541186A (en) Visualization page rendering method, device, equipment and storage medium
CN108062474B (en) File detection method and device
CN112395843A (en) PHP code-based service processing method, device, equipment and medium
CN115407977A (en) Information compiling method, device, equipment and computer readable storage medium
US20110276950A1 (en) Name binding extensibility for typed programming language
CN112328342A (en) To-do item processing method and device based on online document
US20090254837A1 (en) Accessing external functionality within a component-based web application
CN113821209A (en) Interactive data processing method and device, electronic equipment and storage medium
US9185513B1 (en) Method and system for compilation with profiling feedback from client
CN114253537A (en) Form generation method and device, electronic equipment and storage medium
CN113778897A (en) Automatic test method, device, equipment and storage medium of interface
CN112799760A (en) Form rendering method and device
KR20170105325A (en) Method for analyzing source code, system and apparatus for executing the method
CN111767111B (en) Page data processing 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