CN109413452B - Bullet screen checking method and device based on different modes, terminal and storage medium - Google Patents

Bullet screen checking method and device based on different modes, terminal and storage medium Download PDF

Info

Publication number
CN109413452B
CN109413452B CN201811171044.5A CN201811171044A CN109413452B CN 109413452 B CN109413452 B CN 109413452B CN 201811171044 A CN201811171044 A CN 201811171044A CN 109413452 B CN109413452 B CN 109413452B
Authority
CN
China
Prior art keywords
target
bullet screen
check
preset
screen data
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.)
Active
Application number
CN201811171044.5A
Other languages
Chinese (zh)
Other versions
CN109413452A (en
Inventor
张磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201811171044.5A priority Critical patent/CN109413452B/en
Publication of CN109413452A publication Critical patent/CN109413452A/en
Application granted granted Critical
Publication of CN109413452B publication Critical patent/CN109413452B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/235Processing of additional data, e.g. scrambling of additional data or processing content descriptors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/435Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4788Supplemental services, e.g. displaying phone caller identification, shopping application communicating with other users, e.g. chatting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols

Abstract

The embodiment of the invention discloses a bullet screen checking method, a bullet screen checking device, a bullet screen checking terminal and a storage medium based on different modes. The method comprises the following steps: acquiring target bullet screen data and a target verification identifier corresponding to the target bullet screen data; determining a target check class in each check class according to the target check identifier, wherein the check classes correspond to the bullet screen check modes one by one, and each check class inherits a check interface protocol in advance; initializing a preset check protocol object according to the target check class; and calling the bullet screen check function in the initialized check protocol object by taking the target bullet screen data as a function input parameter, and checking the target bullet screen data by using a target bullet screen check mode corresponding to a target check class. Through the technical scheme of the embodiment of the invention, the integrity of the bullet screen data can be verified by using the target verification mode in different verification modes, the detection logic in the existing verification mode selection means can be effectively decoupled, and the expandability of the code is improved.

Description

Bullet screen checking method and device based on different modes, terminal and storage medium
Technical Field
The embodiment of the invention relates to the technical field of barrage, in particular to a barrage checking method, a device, a terminal and a storage medium based on different modes.
Background
With the rapid development of intelligent terminals, various application software is developed and applied to the intelligent terminals. Some application software such as live broadcast software and video playing software often have barrage functions of barrage receiving, parsing, pushing and the like. In the process of developing the application software, the bullet screen data issued by the server needs to be subjected to a relevant test to determine whether the bullet screen function normally operates.
At present, in the development of application software based on an Android operating system, after a server constructs and completes bullet screen data according to a preset bullet screen protocol, or after a client receives bullet screen data, the bullet screen data needs to be checked to ensure that the bullet screen data can be normally analyzed, and the problems of system breakdown and the like of the client are avoided.
In the prior art, when there are multiple data verification methods and data needs to be verified in different verification methods according to different situations, a type parameter of an integer int type may be set, and different verification methods are selected by assigning the type parameter, for example, when the type is 1, it indicates to perform data verification by using a verification method 1, when the type is 2, it indicates to perform data verification by using a verification method 2, and so on.
If there are multiple bullet screen check modes for checking bullet screen data, a check mode selection means in the prior art is directly applied to bullet screen check, and then a type parameter needs to be added to the input parameter of the bullet screen check function, and all bullet screen check modes are added to the interior of the bullet screen check function. Therefore, the selection means of the bullet screen check mode can make the logic function of the bullet screen check function very complex, and further the maintainability of the bullet screen check function is very low, and the modification of any bullet screen check mode needs to adjust the service function of the bullet screen check function, so that the bullet screen check function is not convenient for expansion, maintenance and other processing.
Disclosure of Invention
The embodiment of the invention provides a bullet screen checking method, a bullet screen checking device, a terminal and a storage medium based on different modes, which are used for carrying out integrity checking on bullet screen data by utilizing target checking modes in different checking modes, can effectively decouple detection logic in the existing checking mode selection means, and greatly improve the expandability and maintainability of codes.
In a first aspect, an embodiment of the present invention provides a bullet screen checking method based on different modes, including:
acquiring target bullet screen data and a target verification identifier corresponding to the target bullet screen data;
determining a target check class in each check class according to the target check identifier, wherein the check classes correspond to the bullet screen check modes one by one, and each check class inherits a check interface protocol in advance;
initializing a preset check protocol object according to the target check class, wherein the check protocol object is an object of the type of the check interface protocol;
and calling the bullet screen check function in the initialized check protocol object by taking the target bullet screen data as a function input parameter, and checking the target bullet screen data by using a target bullet screen check mode corresponding to the target check class.
In a second aspect, an embodiment of the present invention further provides a bullet screen checking apparatus based on different modes, including:
the target bullet screen information acquisition module is used for acquiring target bullet screen data and a target verification identifier corresponding to the target bullet screen data;
the target check class determining module is used for determining a target check class in each check class according to the target check identifier, wherein the check classes correspond to the bullet screen check modes one by one, and each check class inherits a check interface protocol in advance;
a check protocol object initialization module, configured to initialize a preset check protocol object according to the target check class, where the check protocol object is an object of the type of the check interface protocol;
and the target bullet screen data checking module is used for calling the bullet screen checking function in the initialized checking protocol object by taking the target bullet screen data as a function input parameter and checking the target bullet screen data by using a target bullet screen checking mode corresponding to the target checking class.
In a third aspect, an embodiment of the present invention further provides a terminal, where the terminal includes:
one or more processors;
a memory 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 bullet screen checking method based on different modes as provided by any embodiment of the invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a bullet screen checking method based on different modes as provided in any embodiment of the present invention.
According to the embodiment of the invention, a target check class is determined in each check class according to a target check identifier corresponding to target bullet screen data, and a preset check protocol object is initialized according to the target check class; and calling the bullet screen check function in the initialized check protocol object by taking the target bullet screen data as a function input parameter, thereby carrying out integrity check on the target bullet screen data by using a target bullet screen check mode corresponding to the target check class. The method has the advantages that each check class inherits a uniform check interface protocol in advance, different bullet screen check modes are distributed to different check classes, so that the bullet screen check function in each check class only realizes the check function of the corresponding bullet screen check mode, the logic function of the bullet screen check function is simplified, the target bullet screen check mode is selected by determining the target check class, the detection logic in the existing check mode selection means can be effectively decoupled, and the expandability and maintainability of codes are greatly improved.
Drawings
Fig. 1 is a flowchart of a bullet screen checking method based on different modes according to an embodiment of the present invention;
fig. 2 is a flowchart of a bullet screen checking method based on different modes according to a second embodiment of the present invention;
fig. 3 is a flowchart of a bullet screen checking method based on different modes according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a bullet screen checking apparatus based on different modes according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a bullet screen checking method based on different modes according to an embodiment of the present invention, which is applicable to a situation that integrity of bullet screen data is checked by using a target bullet screen checking mode among different bullet screen checking modes, and particularly, the method can be used in an application scenario in which bullet screen data is checked after the bullet screen data is generated according to a preset bullet screen protocol in a bullet screen server, and can also be used in an application scenario in which bullet screen data issued by an Android client is checked. The method can be executed by bullet screen checking devices based on different modes, the device can be realized by software and/or hardware, and can be integrated in a bullet screen server or a terminal with a bullet screen function and loaded with an Android system, such as an intelligent terminal like a smart phone, a tablet personal computer, a smart television or a notebook computer. As shown in fig. 1, the method specifically includes the following steps:
s110, obtaining target bullet screen data and a target verification identifier corresponding to the target bullet screen data.
The bullet screen data may be data of a String type obtained by encapsulating the bullet screen parameter information according to a preset bullet screen protocol. The preset bullet screen protocol can be preset according to actual conditions and user requirements and is used for stipulating a transmission data structure of bullet screen data so that data transmission can be carried out between a bullet screen server and a client. The preset barrage protocol may specify one or more data structures for barrage data. The target bullet screen data may be bullet screen data to be verified, which is obtained by encapsulating bullet screen parameter information based on a data structure (referred to as a target data structure) specified by a preset bullet screen protocol. The check identifier may be, but is not limited to, a data structure identifier, a check type identifier, or a check mode identifier, and is respectively used to distinguish different data structures, different check types, or different bullet screen check modes, so as to perform targeted check on bullet screen data according to the check identifier. The target check mark is a check mark corresponding to the target bullet screen data. The target verification identification can be preset according to a target data structure corresponding to the target bullet screen data and user requirements. The bullet screen checking mode is a mode for checking the integrity of bullet screen data. In this embodiment, the bullet screen data with different data structures can be verified by using different bullet screen verification methods, and the bullet screen data with the same data structure can also be verified by using various different bullet screen verification methods.
Specifically, when the bullet screen server generates the target bullet screen data according to the target data structure in the preset bullet screen protocol, the data structure identifier corresponding to the target data structure may be directly determined as the target verification identifier corresponding to the target bullet screen data, the verification type identifier corresponding to the target bullet screen verification mode may also be determined as the target verification identifier corresponding to the target bullet screen data, and the verification mode identifier corresponding to the target bullet screen verification mode may also be determined as the target verification identifier corresponding to the target bullet screen data, so that when the target bullet screen data generated by the bullet screen server is acquired, the target verification identifier corresponding to the target bullet screen data may be acquired.
And S120, determining a target check class in each check class according to the target check identifier.
The check types correspond to the bullet screen check modes one to one, namely each bullet screen check mode corresponds to an independent check type. The check class is a predefined class which can check the bullet screen data by using a corresponding bullet screen check mode. Each check class inherits a check interface protocol in advance so that each check class can realize the check function of a corresponding bullet screen check mode. The check interface protocol refers to a predefined interface for bullet screen check, which includes a predefined bullet screen check function. The target check class refers to one of all check classes which can check the target bullet screen data. The target verification identifier may include, but is not limited to, a target verification class identifier, a target verification mode identifier, and a target data structure identifier.
Specifically, in this embodiment, the target check class may be determined in each check class according to the correspondence between each check identifier and each check class and the target check identifier, so that a target bullet screen check mode corresponding to the target check class may be determined in different bullet screen check modes by determining the target check class, so as to check the target bullet screen data by using the target bullet screen check mode.
Illustratively, before each check class inherits the check interface protocol in advance, the method further includes: defining a check interface protocol and a bullet screen check function in the check interface protocol, wherein the check interface protocol is an interface type with a public authority modifier, the bullet screen check function is provided with a public authority modifier, and the function input parameter type and the function output parameter type of the bullet screen check function are respectively a character string type and a Boolean type.
Specifically, a check interface protocol is predefined, and the check structure protocol includes a predefined bullet screen check function which is not implemented by a function. For example, the check interface protocol may be defined as:
public interface ICheckInfo{
public boolean checkDanmInfo(String danmuInfo);
}
the check interface protocol ICheckInfo internally comprises a barrage check function checkDanmInfo, the function input parameter of the checkDanmInfo only comprises barrage data danmuInfo of a String type, and the function output parameter of the checkDanmInfo is a return value of a coolean Boolean type. Illustratively, the checkDanmInfo may return true by calling return true if the bullet screen data check is successful, and may return false by calling return false if the target bullet screen data check fails. The check interface protocol ICheckInfo is an interface type with public authority modifier public, so that any check class can inherit the check interface protocol ICheckInfo. The bullet screen check function checkDanmInfo also has public authority modifier public, so that the bullet screen check function can be directly called by class, and the calling convenience of the bullet screen check function is improved.
Illustratively, each check class inherits the check interface protocol in advance, including: and each check class calls an interface inheritance keyword in advance, inherits a check interface protocol and overwrites a bullet screen check function in the check interface protocol so that the bullet screen check function in each check class realizes the check function of a corresponding bullet screen check mode. The interface inheritance keyword refers to a keyword specified in the Java language for carrying out interface protocol inheritance.
Specifically, for each check class, the check class inherits the check interface protocol icheklnfo in a way that the interface inherits the keyword instance, and overwrites the bullet screen check function checkdanmnlnfo in the check interface protocol icheklnfo in a way of overwriting @ Override in the check class, and the bullet screen check way corresponding to the check class is implemented in the overwrite function checkdanmnlnfo in the check class, that is, instantiated, so that the bullet screen check function checkdanlnfo in the check class can implement the check function of the corresponding bullet screen check way. For example, each check class CheckSimple may be defined as:
public class CheckSimple implements ICheckInfo{
@Override
public boolean checkDanmInfo(String danmuInfo){}
}
according to the embodiment, the verification functions of different bullet screen verification modes are realized through different verification types, so that the detection logic in the existing verification mode selection means is effectively decoupled, and the subsequent verification operation is more convenient. It should be noted that if a barrage check mode is added, only a new check class needs to be defined, and the new check class inherits the check interface protocol, so that the barrage check function checkdanmninfo in the new check class can implement the check function of the added barrage check mode without modifying other check codes, thereby greatly improving the expandability and maintainability of the codes.
And S130, initializing a preset check protocol object according to the target check class.
The check protocol object is a predefined object used for checking the target bullet screen data. The check protocol object is an object of the type of the check interface protocol.
Specifically, the mcheckinfo may be called as new CheckSimple1(), and the target check class CheckSimple1() is used to initialize the check protocol object mcheckinfo, so that the initialized check protocol object includes the bullet screen check function in the target check class, and the bullet screen check function in the check protocol object may implement the check function of the target bullet screen check mode.
And S140, calling the bullet screen check function in the initialized check protocol object by taking the target bullet screen data as a function input parameter, and checking the target bullet screen data by using a target bullet screen check mode corresponding to a target check class.
Specifically, by taking the target bullet screen data danmuInfo of the character string type as a function input parameter, a bullet screen check function miicheckinfo, checkdannfo (danmuInfo) in the initialized check protocol object miicheckinfo is called, so that the target bullet screen data is checked by using a target check mode corresponding to the target check class, and a check result of the target bullet screen data can be determined according to a return value of the bullet screen check function.
It should be noted that, if a certain bullet screen check mode checklist 2() is used to check the target bullet screen data, except for the target bullet screen check mode checklist 1(), the check protocol object only needs to be initialized by the check class corresponding to the bullet screen check mode, that is, the miicheckinfo ═ new checklist 2(), and no other check code needs to be changed, so that the switching of the bullet screen check scheme is more convenient and faster.
Optionally, before the bullet screen server issues the target bullet screen data to the Android client, the bullet screen verification method based on different modes provided by this embodiment may be used to perform verification, and after the target bullet screen data is successfully verified, the target bullet screen data is issued, so as to ensure that the target bullet screen data issued by the bullet screen server is accurate and complete data. After receiving the delivered target bullet screen data, the Android client can perform secondary verification by using the bullet screen verification method based on different modes provided by the embodiment, and after the target bullet screen data is successfully verified, the target bullet screen data is analyzed, so that the problems of system breakdown and the like of the client due to abnormal bullet screen data can be avoided, and the bullet screen testing efficiency is improved.
According to the technical scheme of the embodiment of the invention, a target check class is determined in each check class according to a target check identifier corresponding to target bullet screen data, and a preset check protocol object is initialized according to the target check class; and calling the bullet screen check function in the initialized check protocol object by taking the target bullet screen data as a function input parameter, thereby carrying out integrity check on the target bullet screen data by using a target bullet screen check mode corresponding to the target check class. The method has the advantages that each check class inherits a uniform check interface protocol in advance, different bullet screen check modes are distributed to different check classes, so that the bullet screen check function in each check class only realizes the check function of the corresponding bullet screen check mode, the logic function of the bullet screen check function is simplified, the target bullet screen check mode is selected by determining the target check class, the detection logic in the existing check mode selection means can be effectively decoupled, and the expandability and maintainability of codes are greatly improved.
On the basis of the above technical solution, S120 may include: if the target verification identification is the target verification type identification, determining a target verification type according to the corresponding relation between each verification type identification and each verification type and the target verification type identification; if the target verification identifier is a target verification mode identifier, determining a target verification class according to the corresponding relation between each verification mode identifier and each verification class and the target verification mode identifier; and if the target verification identification is the target data structure identification, determining the target verification classes according to the corresponding relation between each data structure identification and each verification class and the target data structure identification, wherein each data structure identification corresponds to at least one verification class.
Specifically, when the target check identifier is the target check identifier, the correspondence between each check identifier and each check class is a one-to-one correspondence, that is, each check class identifier uniquely identifies one check class, and at this time, the target check class corresponding to the target check identifier can be determined directly according to the correspondence between each check class identifier and each check class. When the target verification identifier is the target verification mode identifier, the verification types are in one-to-one correspondence with the bullet screen verification modes, and the verification mode identifier uniquely identifies one bullet screen verification mode, so that the correspondence between each verification mode identifier and each verification type is also in one-to-one correspondence, and at the moment, the target verification type corresponding to the target verification mode identifier can be determined directly according to the correspondence between each verification mode identifier and each verification type. When the target verification identifier is the target data structure identifier, the same data structure can correspond to one or more different bullet screen verification modes, namely one or more different verification classes, so that each data structure identifier corresponds to at least one verification class, and at this time, the target verification class can be determined according to the corresponding relation between each data structure identifier and each verification class and the target data structure identifier on the basis of a preset selection rule.
On the basis of the above technical solution, determining a target check class according to the correspondence between each data structure identifier and each check class and the target data structure identifier may include: determining candidate check classes corresponding to the target data structure identifications according to the corresponding relation between the data structure identifications and the check classes; if only one candidate check class exists, determining the candidate check class as a target check class; and if at least two candidate check classes exist, determining a target check class according to the check priority of each candidate check class.
The verification priority may be used to reflect a verification order of each candidate verification class, and may be preset according to verification efficiency and user requirements corresponding to the candidate verification classes. Illustratively, if the bullet screen check efficiency corresponding to a certain candidate check class is higher, the check priority of the candidate check class is higher.
Specifically, in this embodiment, the correspondence between each data structure identifier and each check class may be a one-to-one correspondence, or may be a one-to-many correspondence, so that there may be one or more candidate check classes corresponding to the target data structure identifier determined based on the correspondence. When the target data structure identifier corresponds to only one candidate check class, the candidate check class may be directly determined as the target check class. When the target data structure identifier corresponds to at least two candidate check classes, the candidate check class with the highest check priority may be determined as the target check class, or the candidate check class corresponding to the pre-specified check priority may be determined as the target check class.
Example two
Fig. 2 is a flowchart of a bullet screen checking method based on different modes according to a second embodiment of the present invention, where on the basis of the second embodiment, a checking process of target bullet screen data is described in detail in this embodiment when a target data structure corresponding to the target bullet screen data is a first preset character string structure. Wherein explanations of the same or corresponding terms as those of the above-described embodiments are omitted.
Referring to fig. 2, the bullet screen checking method based on different modes provided in this embodiment includes the following steps:
s210, obtaining target bullet screen data and a target verification identifier corresponding to the target bullet screen data.
Wherein, the target data structure that target barrage data corresponds is first preset character string structure, and first preset character string structure is: the method comprises the steps of taking a preset start character as a first character, dividing each key value pair information by a preset separator, connecting the key information and the value information in the key value pair information by a preset connector, and taking a preset end character as a last character, wherein the key value pair information does not contain a character string the same as the preset separator.
In this embodiment, the first character in the accurate and complete target bullet screen data is a preset start character, the last character is a preset end character, and the bullet screen parameter information exists in a key value pair form. The preset separator is used for dividing each key value pair information in the bullet screen data, and the preset connector is used for connecting the key information and the value information in the key value pair information. The value information and the preset end symbol in the last key value pair information in the target bullet screen data can also be divided by using a preset separator so as to distinguish the content contained in the value. The number of the preset characters included in the preset separator or the preset connector in this embodiment may be one or multiple. Illustratively, the preset start symbol may be, but is not limited to, a left curly brace "{", a left curly brace "(" and a left curly brace "[". to increase a degree of distinction from the key-value pair information content, preferably, the left curly brace "{". the preset separator may be, but is not limited to, a slash "\\" and "/". the preset connector may be, but is not limited to, "@", "" ═ and "@ ═", and the preset end symbol may be, but is not limited to, a right curly brace "}", a right curly brace ")" and a right curly brace "]". Preferably right curly braces "}".
It should be noted that, according to the specification of the preset bullet screen protocol, neither the key information nor the value information in each piece of key-value pair information includes the same character string as the preset delimiter, and the value information in each piece of key-value pair information may include neither the same character string as the preset connector nor the same character string as the preset connector. For example, if "{" is taken as a preset start symbol, "}" is taken as a preset end symbol, "/" is taken as a preset separator, and "@" is taken as a preset connector, the target bullet screen data of the first preset string structure may be: { type @/rid @ 104838/uid @ 20080138/wgei @ 0/}, wherein each key-value pair information does not contain a character string identical to a preset separator or a preset connector.
The target barrage data of the first preset character string structure may also be: { type @/rid @ 104838/uid @ 20088/aveter @ www @ douyuu @ tv @ com/wgei @ 0/}, wherein the value information "www @ douyuu @ tv @ com" in the fourth key-value pair information includes the same character string as the preset connector.
And S220, determining a target check class in each check class according to the target check identifier.
And S230, initializing a preset check protocol object according to the target check class.
Specifically, the checking function of the target bullet screen checking manner implemented by the bullet screen checking function in the target checking class may be implemented through steps S240 to S290.
S240, calling a bullet screen storage function in the initialized check protocol object, and storing the target bullet screen data into a bullet screen data object.
Wherein, the bullet screen data object is an object for storing target bullet screen data. The target barrage data in this embodiment is a String type data, so that the barrage data object is a String object.
And S250, calling a character verification function in the bullet screen data object, and performing character verification on the first character and the last character in the target bullet screen data.
The character verification function is a predefined function used for verifying the first character and the last character in the target bullet screen data. The character verification function may include a first character verification function and a second character verification function, which are respectively used for verifying a first character and a last character in the target bullet screen data.
Specifically, if the bullet screen data object is marked as danmuster, the preset start symbol is "{", and the preset end symbol is "}", it may be detected whether the first character in the target bullet screen data is the preset start symbol by calling the first character verification function danmuster. If so, indicating that the first character is successfully verified, calling a second character verification function danmustr.endwith ("}") to detect whether the last character in the target bullet screen data is a preset terminator, if so, indicating that the first character and the last character in the target bullet screen data are both legal, and determining that the character verification is successful; if not, the target bullet screen data is indicated to be incomplete data, and at the moment, the failure of the verification of the target bullet screen data can be directly determined.
And S260, if the character verification is successful, calling a character string segmentation function in the bullet screen data object, segmenting the target bullet screen data by using preset separators, and determining a character string array.
The character string segmentation function is predefined and is used for segmenting the target bullet screen data into a function of a character string array. Specifically, if the bullet screen data object is marked as danmuStr, the character string splitting function in the bullet screen data object may be: property () so that the target bullet screen data stored in bullet screen data object danmuster can be divided into an array of character strings.
Illustratively, if the target bullet screen data stored in the bullet screen data object danmuStr is:
{ type @/rid @ 104838/uid @ 20088/avetter @ www @ douyuu @ tv @ com/wg ei @ 0/}, and the preset separator is "/", then by calling splitstrraray ═ danmustr. split ("\/"), the character string data obtained by splitting the target bullet screen data by "/" is stored into the character string array splitsraray, that is, the character string elements in the splitsraray are: "{ type @, @ rid @ 104838", "uid @ ═ 20088", "aveter @ ═ www @ douyuu @ tv @ com", "wgei @ ═ 0", and "}.
It should be noted that, because all the bullet screen parameter information in the target bullet screen data does not include the character string the same as the preset separator, when the target bullet screen data is divided by the preset separator, the bullet screen parameter content is not divided, and the situation of mistaken division is avoided, so that the number of the preset separators in the target bullet screen data can be accurately calculated by using the dividing mode.
S270, determining the number of preset separators in the target bullet screen data according to the array length of the character string array.
Specifically, in this embodiment, the array length of the string array, that is, the number of the divided string data, may be directly obtained according to the length attribute of the string array. Illustratively, the array length of the string array splitstartay may be obtained by calling splitstartay. For accurate and complete target bullet screen data, neither the first character nor the last character in the target bullet screen data is a preset delimiter, and one character string data exists before and after each preset delimiter in the target bullet screen data, so that the number of the divided character string data is 1 more than the number of the preset delimiter, and the result obtained by subtracting 1 from the array length of the character string array can be determined as the number of the preset delimiter.
S280, storing each character string element in the character string array into a corresponding character string object, calling a character searching function in each character string object, and determining the number of preset connectors in the target bullet screen data.
The identifier searching function is predefined and is used for searching whether the character string data stored in the spliced character string object contains the function of the input parameter. If the preset connector is "@", the function input object may be called to find the function tmpStr. contacts ("@"), and the query may be performed to determine whether the string element includes "@".
Specifically, in this embodiment, each string element in the string array is stored in a corresponding string object, that is, the string element and the string object are in one-to-one correspondence, and by using a preset connector as a function input parameter, calling an identifier lookup function in each string object, and detecting whether the string element stored in each string object includes the preset connector, the number of preset connectors in the target bullet screen data is counted. The embodiment can call the identifier searching function in each character string object once; and an identifier search function in the character string object can be called in each cycle period in a cycle traversal mode, so that the running memory is reduced, and the calculation speed is increased.
It should be noted that the identifier lookup function can only be used to determine whether the character string data includes the input parameters, and cannot determine the number of the input parameters included in the character string data, so that the identifier lookup function can be used to accurately determine the number of the preset connectors in the target bullet screen data no matter whether the bullet screen parameter information includes the character string identical to the preset connector.
And S290, if the number of the preset separators is equal to that of the preset connectors, determining that the target bullet screen data is successfully verified.
Wherein, through the analysis to the first preset string structure, can derive: and if the target bullet screen array is complete, the number of the preset separators is equal to the number of the preset connectors.
Specifically, if the number of the preset separators is equal to the number of the preset connectors, it is indicated that the target bullet screen data is a complete piece of data and can be normally analyzed, and at this time, it can be determined that the target bullet screen data is successfully verified. If the number of the preset separators is not equal to that of the preset connectors, it is indicated that the target bullet screen data is illegal data, and at this time, it can be determined that the target bullet screen data fails to be checked.
According to the technical scheme, integrity verification is carried out on the target bullet screen data of the first preset character string structure. After the target bullet screen data is successfully verified, the target bullet screen data can be normally analyzed, the problems that a client is crashed due to the fact that the bullet screen data is abnormal and the like are solved, and bullet screen testing efficiency is improved.
EXAMPLE III
Fig. 3 is a flowchart of a bullet screen checking method based on different modes according to a third embodiment of the present invention, where on the basis of the third embodiment, a checking process of target bullet screen data is described in detail in this embodiment when a target data structure corresponding to the target bullet screen data is a preset character string nested structure. Wherein explanations of the same or corresponding terms as those of the above-described embodiments are omitted.
Referring to fig. 3, the bullet screen checking method based on different modes provided in this embodiment includes the following steps:
s310, obtaining target bullet screen data and a target verification identifier corresponding to the target bullet screen data.
Wherein, the target data structure that target bullet screen data correspond is preset character string nested structure, and preset character string nested structure includes: a nested configuration formed by a predetermined number of second predetermined string structures, wherein the second predetermined string structures are: and taking a preset start character as a first character, dividing each key value pair information by a preset separator, connecting the key information and the value information in the key value pair information by a preset connector, and taking a preset end character as a last character. The second predetermined string structure in this embodiment is a non-nested structure. The preset number of second preset string structures may form a preset string nesting structure based on a plurality of nesting ways.
Specifically, in this embodiment, each second preset character string structure may be regarded as one key value pair information, and the second preset character string structure and other key value pair information are divided by a preset separator, and then nested in another second preset character string nesting structure in parallel, so as to form a preset character string nesting structure. For example, if the preset start symbol is "{", the preset end symbol is "}", the preset separator is "/", the preset connector is "@ ═ and when the preset number of the second preset string structures is 3, the target bullet screen data of the preset string nested structure may be: { type @ uenter/{ rid @ 104838/}/uid @ 20088/{ wgei @ 0/}/aveter @ www @ douyuu @ tv @ com/}, wherein both the data { rid @ 104838} of the first and second preset string structures and the second and second preset string structures { wgei @ 0/} are regarded as one-value pair information and are nested side by side into the data { type @/eater @ w @ douyuyuu ═ tv @ of the third and second preset string structures, thereby forming a bullet screen data string of the preset string structure.
The embodiment may also nest each second preset character string structure with each other, so as to form a preset character string nesting structure. For example, when the preset number of the second preset character string structure is 3, the target barrage data of the preset character string nested structure may be: { type @/uenter/{ rid @ 104838/{ uid @ 20088/}/wgei @ 0/}/aveter @ www @ douyuu @ tv @ com/}, wherein data { uid @ ═ 20088/} of a first and second preset string structure is regarded as a key-value pair information, nested into data { rid @ 104838/wgei @ 0/} of a second and second preset string structure, and nested with other key-value pair information by a preset delimiter first and second preset string structure, and then the nested structure { rid @ 104838/{ uid @ 20088 } to/geyi @/watj @ 0 @/watje @ 0/} is nested into a third and second preset string structure, and is further divided from the preset delimiter @ watjuew @/watje @, thereby forming the bullet screen data with a preset character string nesting structure.
In the present embodiment, the nesting manner may also be that a part of the second preset character string structures are nested in parallel, and another part of the second preset character string structures are nested with each other. The nesting mode in the preset character string nesting structure is not specifically limited in this embodiment.
And S320, determining a target check class in each check class according to the target check identifier.
S330, initializing the preset check protocol object according to the target check class.
Specifically, the check function of the target bullet screen check mode implemented by the bullet screen check function in the target check class in this embodiment may be implemented through steps S340 to S391.
And S340, calling a bullet screen storage function in the initialized check protocol object, and storing the target bullet screen data into a bullet screen data object.
And S350, calling a character string conversion function in the bullet screen data object for storing the target bullet screen data, converting the target bullet screen data into a target character array, traversing character elements in the target character array, and determining the number of preset start symbols and the number of preset end symbols in the target bullet screen data.
The character string conversion function is predefined and is used for converting the target bullet screen data into a function of a character array. The character sequence in the target character array is consistent with the character sequence in the target bullet screen data. For example, if the bullet screen data object is marked as danmuStr, the string conversion function in danmuStr can be: tocarrray (), so that target bullet screen data stored in danmunstr can be converted into a target character array.
Specifically, in the embodiment, during the traversal of the character elements in the target character array, each character element in the target character array may be matched with the preset start symbol at one time, the number of times of successful matching is determined as the number of the preset start symbol in the target bullet screen data, each character element in the target character array is matched with the preset end symbol, and the number of times of successful matching is determined as the number of the preset end symbol in the target bullet screen data; in a cyclic traversal mode, in each cycle period, the character elements are respectively matched with the preset start symbols and the preset end symbols, so that the number of the preset start symbols and the number of the preset end symbols can be quickly determined, and the calculation speed is increased.
And S360, if the number of the preset start symbols is equal to the number of the preset end symbols, removing each preset start symbol and each preset end symbol in the target character array based on a preset character removing mode, and obtaining bullet screen data to be detected.
The preset character removing mode is a mode of removing a preset start symbol and a preset end symbol in the target bullet screen data. The preset character removing mode can be, but is not limited to, character removing by calling a replacement function in the bullet screen data object, or character removing mode based on a linked list structure.
Specifically, when the number of the preset start symbols is equal to the number of the preset end symbols, the present embodiment may replace all the preset start symbols "{" in the target bullet screen data with special invisible characters such as an empty character string by calling a replacement function danmustr. Similarly, all the preset end symbols "}" in the target bullet screen data are replaced by special invisible characters such as an empty character string and the like by calling a replacement function danmustr. In this embodiment, the target character array may be converted into the target character linked list, each node in the target character linked list may be traversed, and all nodes whose node data is the preset start symbol or the preset end symbol may be deleted, so as to update the target character linked list. And converting the updated target character linked list into a character array to be tested, and converting the character array to be tested into a character String to be tested, so that the character String to be tested is used as bullet screen data to be tested, and the bullet screen data to be tested at the moment is String type data.
Illustratively, if there are three nodes a, b and c in the target character chain table, where none of the node data in node a is the preset start symbol and the preset end symbol, the node pointer (i.e. the current pointer) in node a points to node b, the node data in node b is the preset start symbol, and the node pointer in node b points to node c, it is detected whether the node data in node b is the preset start symbol or the preset end symbol by calling a- > next- > data { "i | P- > next- > data ═ so, if so, it is possible to delete the node b in the target character chain table and update the target character chain table by pointing the node a to the node pointed to by the node pointer in node b, that is, pointing the node pointer in node a to node c, the updated target character linked list at this time includes only two nodes a and c, and the node pointer in node a points to node c.
And S370, calling a character string segmentation function in the data object to be tested for storing the bullet screen data to be tested, segmenting the bullet screen data to be tested by using a preset separator, and determining a character string array.
Illustratively, if the bullet-screen data to be tested stored in the data object to be tested danmuStr2 is: when the preset separator is "/", the character string data obtained by dividing the target bullet screen data by "/" is stored in the character string array splitlsrtarray by calling splitlsrtarray @ danmuth 2.split ("\/"), that is, the character string elements in the splitlsrtarray are: "type @," rid @ 104838 "," ui d @ 20088 "," @ wgei @ ═ 0 "," ", and" avatar @ ═ www @ douyuu @ tv @ com ". It should be noted that the empty string at the tail of the partition cannot be used as an array element in the string array, and the empty string in the middle can be used as an array element in the string array.
And S380, determining the number of preset separators in the bullet screen data to be detected according to the array length of the character string array.
Specifically, for accurate and complete bullet screen data to be detected, the first character in the bullet screen data to be detected is not a preset delimiter, and the last character is a preset delimiter, so that the number of the character string data after division is equal to the number of the preset delimiter, and the array length of the character string array can be directly determined as the number of the preset delimiter.
And S390, storing each character string element in the character string array into a corresponding character string object, calling an identifier search function in each character string object, and determining the number of preset connectors in the bullet screen data to be detected.
S391, determining the quantity difference between the quantity of the preset separators and the quantity of the preset connectors, and determining that the target bullet screen data is successfully verified when the difference between the quantity difference and the preset quantity is equal to 1.
Wherein, through analyzing the complete nested structure of the preset character string, can see that: when the preset number of the second preset character string structures is 1, the number of the preset separators is equal to the number of the preset connectors; when the preset number is N, N-1 preset separators are added in the bullet screen data for division, and the number of the preset connectors is kept unchanged, so that the number of the preset separators is N-1 more than that of the preset connectors. As can be seen, for the bullet screen data of the complete preset character string nesting structure, the number difference between the number of the preset separators and the number of the preset connectors is 1 more than the preset number.
Specifically, the difference between the number of the preset separators and the number of the preset connectors is subtracted from the preset number to obtain a difference between the number of the preset separators and the number of the preset connectors, if the difference is equal to 1, the target bullet screen data is complete, at this moment, it can be determined that the verification of the target bullet screen data is successful, and otherwise, it is determined that the verification of the target bullet screen data is failed.
According to the technical scheme, integrity verification is carried out on the target bullet screen data with the preset character string nested structure, so that normal analysis of the target bullet screen data is guaranteed.
Example four
Fig. 4 is a schematic structural diagram of a bullet screen checking apparatus based on different modes according to a fourth embodiment of the present invention, where this embodiment is applicable to a situation where integrity check is performed on bullet screen data by using a target bullet screen checking mode in different bullet screen checking modes, and the apparatus may specifically include: the system comprises a target bullet screen information acquisition module 410, a target verification class determination module 420, a verification protocol object initialization module 430 and a target bullet screen data verification module 440.
The target bullet screen information obtaining module 410 is configured to obtain target bullet screen data and a target verification identifier corresponding to the target bullet screen data; a target check class determining module 420, configured to determine a target check class in each check class according to the target check identifier, where the check classes correspond to the bullet screen check modes one to one, and each check class inherits a check interface protocol in advance; a check protocol object initialization module 430, configured to initialize a preset check protocol object according to a target check class, where the check protocol object is an object of a type of a check interface protocol; and the target bullet screen data checking module 440 is configured to call the initialized bullet screen checking function in the check protocol object by using the target bullet screen data as a function input parameter, and check the target bullet screen data by using a target bullet screen checking mode corresponding to the target checking class.
Optionally, the target check class determining module 420 includes: the first target verification type determining unit is used for determining a target verification type according to the corresponding relation between each verification type identifier and each verification type and the target verification type identifier if the target verification identifier is the target verification type identifier; a second target verification type determining unit, configured to determine a target verification type according to a correspondence between each verification method identifier and each verification type and the target verification method identifier if the target verification identifier is the target verification method identifier; and a third target check class determining unit, configured to determine a target check class according to a correspondence between each data structure identifier and each check class and the target data structure identifier if the target check identifier is the target data structure identifier, where each data structure identifier corresponds to at least one check class.
Optionally, the third target check class determining unit is specifically configured to: determining candidate check classes corresponding to the target data structure identifications according to the corresponding relation between the data structure identifications and the check classes; if only one candidate check class exists, determining the candidate check class as a target check class; and if at least two candidate check classes exist, determining a target check class according to the check priority of each candidate check class.
Optionally, the apparatus further comprises: and the verification interface protocol inheritance module is used for calling the interface inheritance key words in advance for each verification class, inheriting the verification interface protocol and overwriting the bullet screen verification function in the verification interface protocol so as to enable the bullet screen verification function in each verification class to realize the verification function of the corresponding bullet screen verification mode.
Optionally, the apparatus further comprises: the system comprises a check interface protocol definition module, a check interface protocol definition module and a bullet screen check function, wherein the check interface protocol and the bullet screen check function in the check interface protocol are defined before each check class inherits the check interface protocol in advance, the check interface protocol is an interface type with a public authority modifier, the bullet screen check function is provided with a public authority modifier, and the function input parameter type and the function output parameter type of the bullet screen check function are respectively a character string type and a Boolean type.
Optionally, the target data structure corresponding to the target bullet screen data is a first preset character string structure, and the first preset character string structure is: the method comprises the steps of taking a preset start character as a first character, dividing each key value pair information by a preset separator, connecting the key information and the value information in the key value pair information by a preset connector, and taking a preset end character as a last character, wherein the key value pair information does not contain a character string which is the same as the preset separator; correspondingly, the target bullet screen data checking module 440 includes a first bullet screen checking function execution unit, and is configured to implement a function of checking the target bullet screen data by using a target bullet screen checking manner corresponding to the target checking class through the following steps:
calling a data storage function in the initialized check protocol object, and storing the target bullet screen data into a bullet screen data object; calling a character verification function in the bullet screen data object, and performing character verification on the first character and the last character in the target bullet screen data; if the character verification is successful, calling a character string segmentation function in the bullet screen data object, segmenting the target bullet screen data by using a preset separator, and determining a character string array; determining the number of preset separators in the target bullet screen data according to the array length of the character string array; storing each character string element in the character string array into a corresponding character string object, calling a character search function in each character string object, and determining the number of preset connectors in target bullet screen data; and if the number of the preset separators is equal to that of the preset connectors, determining that the target bullet screen data is successfully verified.
Optionally, the target data structure corresponding to the target bullet screen data is a preset character string nesting structure, and the preset character string nesting structure includes: a nested configuration formed by a predetermined number of second predetermined string structures, wherein the second predetermined string structures are: taking a preset start character as a first character, dividing each key value pair information by a preset separator, connecting the key information and the value information in the key value pair information by a preset connector, and taking a preset end character as a last character; correspondingly, the target bullet screen data checking module 440 further includes a second bullet screen checking function executing unit, configured to implement a function of checking the target bullet screen data by using a target bullet screen checking manner corresponding to the target checking class through the following steps:
calling a data storage function in the initialized check protocol object, and storing the target bullet screen data into a bullet screen data object; calling a character string conversion function in the bullet screen data object, converting the target bullet screen data into a target character array, traversing character elements in the target character array, and determining the number of preset start symbols and the number of preset end symbols in the target bullet screen data; if the number of the preset start symbols is equal to the number of the preset end symbols, removing all the preset start symbols and all the preset end symbols in the target character array based on a preset character removing mode to obtain bullet screen data to be detected; calling a character string segmentation function in a to-be-detected data object storing to-be-detected bullet screen data, segmenting the to-be-detected bullet screen data by using a preset separator, and determining a character string array; determining the number of preset separators in the bullet screen data to be detected according to the array length of the character string array; storing each character string element in the character string array into a corresponding character string object, calling an identifier search function in each character string object, and determining the number of preset connectors in bullet screen data to be detected; and determining the quantity difference between the quantity of the preset separators and the quantity of the preset connectors, and determining that the target bullet screen data is successfully verified when the difference between the quantity difference and the preset quantity is equal to 1.
The bullet screen checking device based on different modes can execute the bullet screen checking method based on different modes provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the bullet screen checking method based on different modes.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a terminal according to a fifth embodiment of the present invention. Referring to fig. 5, the terminal includes:
one or more processors 510;
a memory 520 for storing one or more programs;
when executed by the one or more processors 510, the one or more programs cause the one or more processors 510 to implement a bullet screen proof method based on different approaches as set forth in any of the embodiments above.
In FIG. 5, a processor 510 is illustrated as an example; the processor 510 and the memory 520 in the terminal may be connected by a bus or other means, as exemplified by the bus connection in fig. 5.
The memory 520 is a computer-readable storage medium, and can be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to bullet screen checking methods based on different modes in the embodiment of the present invention (for example, the target bullet screen information obtaining module 410, the target checking class determining module 420, the checking protocol object initializing module 430, and the target bullet screen data checking module 440 in the bullet screen checking apparatus based on different modes). The processor 510 executes various functional applications and data processing of the terminal by running software programs, instructions and modules stored in the memory 520, that is, the bullet screen checking method based on different modes as described above is implemented.
The memory 520 mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system and an application program required by at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 520 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 520 may further include memory located remotely from the processor 510, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The terminal provided by the embodiment belongs to the same inventive concept as the bullet screen checking method based on different modes provided by the above embodiment, and the technical details not described in detail in the embodiment can be referred to the above embodiment, and the embodiment has the same beneficial effects as the bullet screen checking method based on different modes.
EXAMPLE six
The present embodiment provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements a bullet screen checking method based on different modes as provided by any of the embodiments of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the bullet screen checking method according to the various embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments illustrated herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (9)

1. A bullet screen checking method based on different modes is characterized by comprising the following steps:
acquiring target bullet screen data and a target verification identifier corresponding to the target bullet screen data;
determining a target check class in each check class according to the target check identifier, wherein the check classes correspond to the bullet screen check modes one by one, and each check class inherits a check interface protocol in advance;
initializing a preset check protocol object according to the target check class, wherein the check protocol object is an object of the type of the check interface protocol;
taking the target bullet screen data as a function input parameter, calling a bullet screen check function in the initialized check protocol object, and checking the target bullet screen data by using a target bullet screen check mode corresponding to the target check class;
the target data structure corresponding to the target bullet screen data is a first preset character string structure, and the first preset character string structure is as follows: the method comprises the steps of taking a preset start character as a first character, dividing each key value pair information by a preset separator, connecting the key information and the value information in the key value pair information by a preset connector, and taking a preset end character as a last character, wherein the key value pair information does not contain a character string the same as the preset separator;
correspondingly, the bullet screen verification function realizes the function of verifying the target bullet screen data by using the target bullet screen verification mode corresponding to the target verification class through the following steps:
calling a data storage function in the initialized check protocol object, and storing the target bullet screen data into a bullet screen data object;
calling a character verification function in the bullet screen data object, and performing character verification on the first character and the last character in the target bullet screen data;
if the character verification is successful, calling a character string segmentation function in the bullet screen data object, segmenting the target bullet screen data by the preset separators, and determining a character string array;
determining the number of preset separators in the target bullet screen data according to the array length of the character string array;
storing each character string element in the character string array into a corresponding character string object, calling a character search function in each character string object, and determining the number of preset connectors in the target bullet screen data;
and if the number of the preset separators is equal to that of the preset connectors, determining that the target bullet screen data is successfully verified.
2. The method of claim 1, wherein determining a target check class among the check classes based on the target check identifier comprises:
if the target verification identification is a target verification type identification, determining the target verification type according to the corresponding relation between each verification type identification and each verification type and the target verification type identification;
if the target verification identification is a target verification mode identification, determining the target verification class according to the corresponding relation between each verification mode identification and each verification class and the target verification mode identification;
and if the target verification identification is a target data structure identification, determining the target verification classes according to the corresponding relation between each data structure identification and each verification class and the target data structure identification, wherein each data structure identification corresponds to at least one verification class.
3. The method of claim 2, wherein determining the target parity class according to the correspondence between each data structure identifier and each parity class and the target data structure identifier comprises:
determining candidate check classes corresponding to the target data structure identifications according to the corresponding relation between each data structure identification and each check class;
if only one candidate check class exists, determining the candidate check class as the target check class;
and if at least two candidate check classes exist, determining the target check class according to the check priority of each candidate check class.
4. The method of claim 1, wherein each of the check classes inherits a check interface protocol in advance, comprising:
and each check class calls an interface inheritance keyword in advance, inherits the check interface protocol and overwrites a bullet screen check function in the check interface protocol so as to enable the bullet screen check function in each check class to realize the check function of a corresponding bullet screen check mode.
5. The method of claim 1, wherein before each of the check classes inherits a check interface protocol in advance, further comprising:
defining the check interface protocol and the bullet screen check function in the check interface protocol, wherein the check interface protocol is an interface type with a public authority modifier, the bullet screen check function is provided with a public authority modifier, and the function input parameter type and the function output parameter type of the bullet screen check function are respectively a character string type and a Boolean type.
6. The method according to claim 1, wherein the target data structure corresponding to the target bullet screen data is also a preset character string nesting structure, and the preset character string nesting structure includes: a nested configuration formed by a predetermined number of second predetermined string structures, wherein the second predetermined string structures are: taking a preset start character as a first character, dividing each key value pair information by a preset separator, connecting the key information and the value information in the key value pair information by a preset connector, and taking a preset end character as a last character;
correspondingly, the bullet screen check function also realizes the function of checking the target bullet screen data by using the target bullet screen check mode corresponding to the target check class through the following steps:
calling a data storage function in the initialized check protocol object, and storing the target bullet screen data into a bullet screen data object;
calling a character string conversion function in the bullet screen data object, converting the target bullet screen data into a target character array, traversing character elements in the target character array, and determining the number of preset start symbols and the number of preset end symbols in the target bullet screen data;
if the number of the preset start symbols is equal to the number of the preset end symbols, removing each preset start symbol and each preset end symbol in the target character array based on a preset character removing mode to obtain bullet screen data to be detected;
calling a character string segmentation function in a to-be-detected data object storing the to-be-detected bullet screen data, segmenting the to-be-detected bullet screen data by using the preset separator, and determining a character string array;
determining the number of preset separators in the bullet screen data to be detected according to the array length of the character string array;
storing each character string element in the character string array into a corresponding character string object, calling an identifier search function in each character string object, and determining the number of preset connectors in the bullet screen data to be detected;
and determining the quantity difference between the quantity of the preset separators and the quantity of the preset connectors, and determining that the target bullet screen data is successfully verified when the difference between the quantity difference and the preset quantity is equal to 1.
7. The utility model provides a bullet curtain calibration equipment based on different modes which characterized in that includes:
the target bullet screen information acquisition module is used for acquiring target bullet screen data and a target verification identifier corresponding to the target bullet screen data;
the target check class determining module is used for determining a target check class in each check class according to the target check identifier, wherein the check classes correspond to the bullet screen check modes one by one, and each check class inherits a check interface protocol in advance;
a check protocol object initialization module, configured to initialize a preset check protocol object according to the target check class, where the check protocol object is an object of the type of the check interface protocol;
the target bullet screen data verification module is used for calling a bullet screen verification function in an initialized verification protocol object by taking the target bullet screen data as a function input parameter and verifying the target bullet screen data by using a target bullet screen verification mode corresponding to the target verification class;
the target data structure corresponding to the target bullet screen data is a first preset character string structure, and the first preset character string structure is as follows: the method comprises the steps of taking a preset start character as a first character, dividing each key value pair information by a preset separator, connecting the key information and the value information in the key value pair information by a preset connector, and taking a preset end character as a last character, wherein the key value pair information does not contain a character string the same as the preset separator; correspondingly, the target bullet screen data checking module comprises a bullet screen checking function execution unit and is used for realizing the function of checking the target bullet screen data by using a target bullet screen checking mode corresponding to the target checking class through the following steps:
calling a data storage function in the initialized check protocol object, and storing the target bullet screen data into a bullet screen data object; calling a character verification function in the bullet screen data object, and performing character verification on the first character and the last character in the target bullet screen data; if the character verification is successful, calling a character string segmentation function in the bullet screen data object, segmenting the target bullet screen data by the preset separators, and determining a character string array; determining the number of preset separators in the target bullet screen data according to the array length of the character string array; storing each character string element in the character string array into a corresponding character string object, calling a character search function in each character string object, and determining the number of preset connectors in the target bullet screen data; and if the number of the preset separators is equal to that of the preset connectors, determining that the target bullet screen data is successfully verified.
8. A terminal, characterized in that the terminal comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the bullet screen proof method based on different approaches as recited in any of claims 1-6.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the bullet screen checking method according to any one of claims 1 to 6 based on different modes.
CN201811171044.5A 2018-09-30 2018-09-30 Bullet screen checking method and device based on different modes, terminal and storage medium Active CN109413452B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811171044.5A CN109413452B (en) 2018-09-30 2018-09-30 Bullet screen checking method and device based on different modes, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811171044.5A CN109413452B (en) 2018-09-30 2018-09-30 Bullet screen checking method and device based on different modes, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109413452A CN109413452A (en) 2019-03-01
CN109413452B true CN109413452B (en) 2021-02-02

Family

ID=65466188

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811171044.5A Active CN109413452B (en) 2018-09-30 2018-09-30 Bullet screen checking method and device based on different modes, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109413452B (en)

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9275036B2 (en) * 2006-12-21 2016-03-01 International Business Machines Corporation System and method for adaptive spell checking
CN106681855B (en) * 2015-11-10 2019-07-05 澜起科技股份有限公司 One Time Programmable storage device and the method that data check is carried out to it
CN106973332A (en) * 2017-03-10 2017-07-21 武汉斗鱼网络科技有限公司 A kind of barrage message treatment method, analytic method and system
CN107239316A (en) * 2017-04-20 2017-10-10 武汉斗鱼网络科技有限公司 The optimized treatment method and device of a kind of function
CN113688006B (en) * 2017-10-16 2024-03-29 创新先进技术有限公司 Log data verification method and device
CN108132880B (en) * 2017-12-21 2020-07-07 武汉斑马快跑科技有限公司 Parameter checking method and device
CN108089989B (en) * 2018-01-04 2020-10-16 武汉斗鱼网络科技有限公司 Path detection method, electronic device and readable storage medium

Also Published As

Publication number Publication date
CN109413452A (en) 2019-03-01

Similar Documents

Publication Publication Date Title
CN109345388B (en) Block chain intelligent contract verification method and device and storage medium
CN112560045A (en) Application program vulnerability detection method and device, computer equipment and storage medium
CN108694320B (en) Method and system for measuring sensitive application dynamic under multiple security environments
CN109299719B (en) Bullet screen checking method and device based on character segmentation, terminal and storage medium
CN111368289B (en) Malicious software detection method and device
CN109413016B (en) Rule-based message detection method and device
KR102095853B1 (en) Virus database acquisition method and device, equipment, server and system
CN112434288A (en) Internet of things-based network big data information leakage prevention method and system
CN109359045B (en) Test method, device, equipment and storage medium
CN113419971B (en) Android system service vulnerability detection method and related device
CN116324773A (en) Method and apparatus for protecting smart contracts from attack
CN109413450B (en) Bullet screen data integrity verification method and device, terminal and storage medium
CN111352829A (en) Memory leak test method, device and equipment
CN111339531B (en) Malicious code detection method and device, storage medium and electronic equipment
CN109413452B (en) Bullet screen checking method and device based on different modes, terminal and storage medium
CN109379640B (en) Bullet screen checking method and device based on linked list mode, terminal and storage medium
KR20210132545A (en) Apparatus and method for detecting abnormal behavior and system having the same
CN109348304B (en) Bullet screen data verification method and device and terminal
CN109495782B (en) Storage method, system and storage medium for barrage message
CN109413506B (en) Bullet screen data verification method and device, terminal and storage medium
CN109413505B (en) Bullet screen data verification method and device, terminal and storage medium
CN109413451B (en) Bullet screen data verification method and device and terminal
CN113946516A (en) Code coverage rate determining method and device and storage medium
CN109325496B (en) Bullet screen checking method and device based on character removal, terminal and storage medium
CN109413504B (en) Bullet screen checking method, device, terminal and storage medium based on character string replacement

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
GR01 Patent grant
GR01 Patent grant