CN110727384B - Unread message quantity statistical method and device and electronic equipment - Google Patents

Unread message quantity statistical method and device and electronic equipment Download PDF

Info

Publication number
CN110727384B
CN110727384B CN201910919674.4A CN201910919674A CN110727384B CN 110727384 B CN110727384 B CN 110727384B CN 201910919674 A CN201910919674 A CN 201910919674A CN 110727384 B CN110727384 B CN 110727384B
Authority
CN
China
Prior art keywords
message
category
unread
target
messages
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
CN201910919674.4A
Other languages
Chinese (zh)
Other versions
CN110727384A (en
Inventor
王欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Internet Security Software Co Ltd
Original Assignee
Beijing Kingsoft Internet Security Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Internet Security Software Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201910919674.4A priority Critical patent/CN110727384B/en
Publication of CN110727384A publication Critical patent/CN110727384A/en
Application granted granted Critical
Publication of CN110727384B publication Critical patent/CN110727384B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/04817Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance using icons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a method, a device and electronic equipment for counting the quantity of unread messages, which are used for determining a target message category object corresponding to a target message category to be counted; traversing state variables in the message objects in a target storage area corresponding to the target message type object, and determining the number of messages with the message states of unread states as the number of unread messages in the target message type; each message category object corresponds to one storage area and is used for storing message objects corresponding to messages belonging to the message category; each message corresponds to a message object; the message object comprises a state variable for representing whether the message state is an unread state. In the embodiment of the invention, the quantity of the unread messages in the message category can be obtained only by traversing the message objects corresponding to the messages belonging to the message category in the storage area corresponding to the message category, so that the efficiency of counting the quantity of the unread messages is improved.

Description

Unread message quantity statistical method and device and electronic equipment
Technical Field
The invention relates to the technical field of data processing, in particular to a method and a device for counting the number of unread messages and electronic equipment.
Background
The unread message prompt (notifiationwedge) is generally located at the upper right corner of an APP icon of an application class or a mall icon in a game, and the common expression form is as follows: a red dot in which specific data is displayed indicating the number of user unread messages or user unviewed items present in the APP or mall.
At present, the method for counting the number of unread messages includes: and adding a state variable for representing whether the message or the commodity is in an unread state in a data structure of the message or the commodity in advance, and traversing the state variable in the data structure of each message or the commodity when the total quantity of the unread messages needs to be counted, so as to obtain the total quantity of the unread messages.
In some scenarios, there is a category difference between messages or goods, that is: the messages or commodities belong to different categories, for example, in a game mall, the number of commodities may be more than 1 million, the commodities belonging to 1 million belong to several different categories (for example, the commodities comprise dress, shirt, canvas shoes, Yitian sword, butcher sword, Primary and secondary sword, etc., the commodity category comprises clothing, weapons, etc., the commodities belonging to clothing comprise dress, shirt, canvas shoes, etc., the commodities belonging to weapons comprise Yitian sword, butcher sword, primary and secondary sword, etc.), when the quantity of unread messages (commodities) needs to be respectively counted according to different categories, in the method, the state variables of more than 1 ten thousand commodities need to be traversed, the calculation amount in the statistical process is large, the statistical efficiency is low, and furthermore, in a scene that frequent statistics on the number of unread messages are needed, such as a game, the problem of low statistical efficiency of the above method is further serious.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for counting the quantity of unread messages and electronic equipment, so as to improve the efficiency of counting the quantity of the unread messages. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for counting unread messages, including:
determining a target message category object corresponding to a target message category to be counted, wherein each message category corresponds to one message category object, and the message category object is obtained after a predefined message category is instantiated based on identification information of the message category;
traversing state variables in the message objects in a target storage area corresponding to the target message type object, and determining the number of messages with message states in an unread state as the number of unread messages in the target message type; each message category object corresponds to one storage area and is used for storing message objects corresponding to messages belonging to the message category; each message corresponds to a message object, and the message object is obtained after a predefined message class is instantiated based on the identification information of the message; the message object comprises a state variable for representing whether the message state is an unread state.
Further, message objects corresponding to messages belonging to the same message category are stored in the same storage area in a dictionary mode, and the dictionary takes identification information of the messages as keys;
the step of traversing the state variables in the message objects in the target storage area corresponding to the target message category object, and determining the number of messages with the message state being an unread state as the number of unread messages in the target message category, includes:
and traversing the state variables in the message objects in the dictionary corresponding to the target message category object, and determining the number of the messages with the message states being unread states as the number of the unread messages in the target message category.
Further, the method further comprises:
when it is detected that the unread message is viewed, determining a first message category object corresponding to a first message category to which the viewed unread message belongs according to category attribution information prestored in a data structure of the viewed unread message; wherein the category attribution information is used for representing the message category to which the viewed unread message belongs;
determining a first message object corresponding to the viewed unread message in a dictionary corresponding to the first message category based on the identification information of the viewed unread message;
modifying a state variable value in the first message object.
Further, the step of determining a target message category object corresponding to a target message category to be counted includes:
determining a target message category object corresponding to a target message category to be counted in the display loading process of a target category icon corresponding to the target message category to be counted;
after the step of traversing the state variables in the message objects in the dictionary corresponding to the target message category object, and determining the number of messages whose message states are unread, as the number of unread messages in the target message category, the method further includes:
and displaying the target category icon in a display interface, and generating an unread message prompt on the target category icon based on the number of the unread messages.
In a second aspect, an embodiment of the present invention provides an apparatus for counting the number of unread messages, where the apparatus includes:
a target message category object determining module, configured to determine a target message category object corresponding to a target message category to be counted, where each message category corresponds to one message category object, and the message category object is obtained after a predefined message category is instantiated based on identification information of the message category;
an unread message number determination module, configured to traverse state variables in each message object in a target storage area corresponding to the target message category object, and determine the number of messages whose message states are unread, as the number of unread messages in the target message category; each message category object corresponds to one storage area and is used for storing message objects corresponding to messages belonging to the message category; each message corresponds to a message object, and the message object is obtained after a predefined message class is instantiated based on the identification information of the message; the message object comprises a state variable for representing whether the message state is an unread state.
Further, message objects corresponding to messages belonging to the same message category are stored in the same storage area in a dictionary mode, and the dictionary takes identification information of the messages as keys;
the unread message number determination module is specifically configured to traverse state variables in each message object in the dictionary corresponding to the target message class object, and determine the number of messages whose message states are unread, as the number of unread messages in the target message class.
Further, the apparatus further comprises:
the first message type determining module is used for determining a first message type of the checked unread message according to category attribution information prestored in a data structure of the checked unread message when the unread message is checked; wherein the category attribution information is used for representing the message category to which the viewed unread message belongs;
a first message object determination module, configured to determine, in a dictionary corresponding to the first message category object, a first message object corresponding to the viewed unread message based on the identification information of the viewed unread message;
and the state variable value modification module is used for modifying the state variable value in the first message object.
Further, the target message category object determining module is specifically configured to determine a target message category object corresponding to a target message category to be counted in a display loading process of a target category icon corresponding to the target message category to be counted;
the device, still include: an unread message prompt generation module;
the unread message prompt generation module is configured to, after the step of traversing the state variables in the message objects in the dictionary corresponding to the target message category object, determine the number of messages of which the message states are unread, and use the number as the number of unread messages in the target message category, display the target category icon in a display interface, and generate an unread message prompt on the target category icon based on the number of the unread messages.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the steps of any unread message quantity statistical method when executing the program stored in the memory.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program runs on a computer, the computer is caused to execute any one of the above methods for counting the number of unread messages.
The method, the device and the electronic equipment for counting the number of the unread messages determine a target message category object corresponding to a target message category to be counted, wherein each message category corresponds to one message category object, and the message category object is obtained after a predefined message category is instantiated based on identification information of the message category; traversing state variables contained in the message objects in a target storage area corresponding to the target message type object, and determining the number of messages with the message states being unread states as the number of unread messages in the target message type; each message category object corresponds to one storage area and is used for storing message objects corresponding to messages belonging to the message category; each message corresponds to a message object, and the message object is obtained after a predefined message class is instantiated based on the identification information of the message; the message object comprises a state variable for representing whether the message state is an unread state. In the embodiment of the invention, the message objects corresponding to the messages are introduced, the state variables are adopted in the message objects to represent the message states, the message objects corresponding to the messages belonging to the same message category are stored in the same storage area in advance, the message objects corresponding to the messages belonging to different message categories are stored in different storage areas, when the quantity of the unread messages belonging to a certain message category needs to be counted, the quantity of the unread messages in the message category can be obtained only by traversing the message objects corresponding to the messages belonging to the message category in the storage area corresponding to the message category without traversing the data structures of all the messages, and therefore, the efficiency of counting the quantity of the unread messages is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for counting unread messages according to an embodiment of the present invention;
fig. 2 is another schematic flow chart of a method for counting the number of unread messages according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for counting the number of unread messages according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to improve the efficiency of unread message quantity statistics, the embodiment of the invention provides an unread message quantity statistics method, an unread message quantity statistics device and electronic equipment.
The unread message in the embodiment of the present invention may be any form of information that is not viewed or read by the user, for example, news information, chat information, or virtual goods in a certain game mall, and here, the specific form of the unread message is not limited.
Referring to fig. 1, fig. 1 is a schematic flow chart of a method for counting the number of unread messages according to an embodiment of the present invention, which specifically includes the following steps:
step 101, determining a target message category object corresponding to a target message category to be counted.
Each message category corresponds to a message category object, and the message category object is obtained after a predefined message category class is instantiated based on identification information of the message category.
In daily life, there are many classes and objects. For example: bread, milk, soy milk, fresh flowers, which are objects with certain attributes (characteristics) and functions (behaviors), the objects with the same attributes form a class, and in the above example, bread, milk, soy milk all have edibility, so that 3 objects of bread, milk, soy milk all belong to the class of "food", and all the objects with edibility form the class of "food".
In programming language, class is the most basic unit, we can define the attribute abstractly in the class, then instantiate the class into an object with concrete attribute information according to concrete attribute information.
In the embodiment of the invention, a message category class corresponding to the message category can be predefined, the identification information of the message category is used as the attribute in the message category class, and then the message category class is instantiated into the message category objects respectively corresponding to the message categories according to the identification information of the message categories. When the number of unread messages in a certain message category needs to be counted, the message category is taken as a target message category, and in the step, a target message category object corresponding to the target message category is determined firstly.
Step 102, traversing the state variables in the message objects in the target storage area corresponding to the target message type object, and determining the number of messages with the message state being an unread state as the number of unread messages in the target message type.
Each message category object corresponds to one storage area and is used for storing message objects corresponding to messages belonging to the message category; each message corresponds to a message object, and the message object is obtained after a predefined message class is instantiated based on identification information of the message; the message object comprises a state variable for representing whether the message state is an unread state.
In the embodiment of the present invention, a message class corresponding to a specific message may be predefined, and the message class may include the following two attributes: the identification information of the message and the state variable representing whether the message is in an unread state, and then instantiating the message class into message objects respectively corresponding to the messages. After the target storage area corresponding to the target message type object is determined, the number of messages of which the message states are unread can be determined by traversing the state variables of the message objects in the target storage area.
Furthermore, message objects corresponding to messages belonging to the same message category are stored in the same storage area in a dictionary mode, and identification information of the messages is used as a key in the dictionary.
In the target storage area corresponding to the target message type object, traversing the state variables in the message objects, determining the message quantity of which the message state is an unread state, and taking the message quantity as the quantity of the unread messages in the target message type, wherein the step comprises the following steps:
and traversing the state variables in the message objects in the dictionary corresponding to the target message class object, and determining the number of the messages with the message states of unread states as the number of the unread messages in the target message class.
For ease of understanding, the foregoing is illustrated by way of example as follows:
taking a virtual commodity in a game mall as an example, the commodity categories are assumed to include: the facial make-up, dress and cap are three, and wherein, the facial make-up commodity includes: shirts, wallets, casual T-shirts, and the like.
The message class and the message class can be predefined and instantiated respectively to obtain the message class object and the message object. The message category includes a plurality of messages, and therefore, whether a certain message category is checked cannot be represented in a state variable manner, but in order to facilitate the calling of the message category class and the message class, an attribute of a state variable may be added in the message category class, for example, in the message class and the message category class, an isChecked variable may be used as the state variable, where in the message class, when the value of isChecked is false, the message is not read, and when the value of isChecked is true, the message is read; in the message class, the value of isshecked may be set to true by default, so that the message class object corresponding to the message class will not be included in the statistical result when the subsequent unread message number is counted.
Specifically, the message category class may be named as groupincommgmessage, and the specific definition process is as follows:
public class GroupIncomingMessage{
public string ID;
public bool isChecked;
}
after the message category classes are defined, the message category classes may be instantiated based on the identification information of each commodity category, resulting in 3 message category objects: the specific instantiation process of the groupingmessage top-loading, groupingmessage bottom-loading and groupingmessage hat is as follows (for easy understanding, in the embodiment of the present invention, chinese is used as a variable name in the message type class, the message type object, the message class and the message object):
the groupingmessage upload is new groupingmessage ("upload");
groupingmessage download ═ new groupingmessage ("download");
a groupingmessage hat (new groupingmessage hat);
accordingly, the message class may be named as IncomingMessage, and the specific definition process is as follows:
public class IncomingMessage{
public string ID;
public bool isChecked;
}
after the message class is defined, the message class may be instantiated based on the identification information of each of the goods, resulting in a plurality of message objects: the Incoming message shirt, the Incoming message wallet, the Incoming message leisure T-shirt and the like are specifically instantiated as follows:
an IncomingMessage shirt ═ new IncomingMessage ("shirt");
an IncomingMessage wallet, new IncomingMessage ("wallet");
an IncomingMessage leisure T-shirt ═ new IncomingMessage ("leisure T-shirt");
after the message class and the message class are defined and instantiated respectively to obtain the message class object and the message object, each message object can be added to the message class object to which the message object belongs. For example:
add upper part of the jacket (shirt)
Add (wallet)
Add of jacket (leisure T shirt)
Then, the message objects corresponding to the messages belonging to the same message type are collectively stored in the same storage area, and the message objects corresponding to the messages belonging to different message types are stored in different storage areas, specifically, the IncomingMessage shirt, the IncomingMessage wallet, and the IncomingMessage casual T-shirt may be stored in the same storage area a.
If the number of commodities which are not read by the player in the loaded commodities is to be counted, the target message type object-groupnomingmessage corresponding to the target commodity type-loading is determined to be loaded, and then the state variables in the message objects are traversed in the storage area A corresponding to the groupngmessage loading, so that the message number of which the message state is the unread state is determined to be the number of the unread commodities in the loading.
It can be seen from the above embodiments that, in the embodiments of the present invention, message objects corresponding to messages are introduced, and state variables are used in the message objects to represent message states, and meanwhile, message objects corresponding to messages belonging to the same message category are stored in the same storage area in advance, and message objects corresponding to messages belonging to different message categories are stored in different storage areas.
Referring to fig. 2, fig. 2 is another schematic flow chart of a method for counting the number of unread messages according to an embodiment of the present invention, which includes the following specific steps:
step 201, in the process of displaying and loading the target category icon corresponding to the target message category to be counted, determining a target message category object corresponding to the target message category to be counted.
For example, assuming that the target category icon is an uploading category commodity icon in a certain game mall, at this time, the above steps may be executed in the first display loading process of the uploading category commodity icon after the player installs the game; or the steps can be executed in the process that the player clicks the uploading type commodity icon, enters the uploading type commodity detail page, checks the related information and exits the page, and the uploading type commodity icon is displayed and loaded again.
Step 202, traversing the state variables in the message objects in the dictionary corresponding to the target message category object, and determining the number of messages with the message state being an unread state as the number of unread messages in the target message category.
And 203, displaying the target category icon in the display interface, and generating an unread message prompt on the target category icon based on the number of the unread messages.
For each message, a data structure corresponding to the message is predefined and used for storing attribute information of the message, such as: the message classification method includes identification information of a message, category attribution information of the message and the like, wherein the category attribution information of the message is used for representing a message category to which the message belongs.
In another embodiment of the invention, when it is detected that the unread message is viewed, a first message category object corresponding to a first message category to which the viewed unread message belongs is determined according to category attribution information prestored in a data structure of the viewed unread message;
determining a first message object corresponding to the viewed unread message in a dictionary corresponding to the first message category object based on the identification information of the viewed unread message;
the state variable value in the first message object is modified.
Because the message objects corresponding to the messages belonging to the same message category are stored in the same dictionary, and the dictionary takes the identification information of the messages as keys, when the state variable value in a certain message object needs to be modified, the target message object corresponding to the message can be directly found according to the identification information of the message, and all the message objects in the dictionary do not need to be traversed, so that the efficiency of modifying the state variable value is improved.
As can be seen from the embodiment shown in fig. 2, in the embodiment of the present invention, message objects corresponding to messages are introduced, and state variables are used in the message objects to represent message states, meanwhile, message objects corresponding to messages belonging to the same message category are stored in the same dictionary in advance, message objects corresponding to messages belonging to different message categories are stored in different dictionaries, and in the process of displaying and loading a target category icon corresponding to a target message category to be counted, the number of unread messages in the target message category can be obtained only by traversing the message objects corresponding to the messages belonging to the target message category in the dictionary corresponding to the target message category object, without traversing the data structures of all messages, so that the efficiency of counting the number of the unread messages is improved. Meanwhile, after the number of the unread messages in the target message category is obtained, the target category icons are displayed in the display interface, and the unread message prompts are generated, so that a user can intuitively know the number of the unread messages belonging to the target message category before entering a detail page corresponding to the target category icons, and therefore user experience is improved.
Based on the same inventive concept, according to the unread message quantity statistical method provided by the above embodiments of the present invention, correspondingly, the embodiments of the present invention further provide an unread message quantity statistical device; the schematic structural diagram of the device is shown in fig. 3, and the device comprises:
a target message category object determining module 301, configured to determine a target message category object corresponding to a target message category to be counted, where each message category corresponds to one message category object, and the message category object is obtained after instantiating a predefined message category based on identification information of the message category;
an unread message number determination module 302, configured to traverse state variables in each message object in a target storage area corresponding to a target message class object, and determine the number of messages whose message states are unread, as the number of unread messages in the target message class; each message category object corresponds to one storage area and is used for storing message objects corresponding to messages belonging to the message category; each message corresponds to a message object, and the message object is obtained after a predefined message class is instantiated based on identification information of the message; the message object comprises a state variable for representing whether the message state is an unread state.
Further, message objects corresponding to messages belonging to the same message category are stored in the same storage area in a dictionary mode, and identification information of the messages is used as a key in the dictionary;
and the unread message number determining module is specifically used for traversing the state variables in the message objects in the dictionary corresponding to the target message class object, and determining the message number of which the message state is an unread state as the number of the unread messages in the target message class.
Further, the apparatus further comprises:
the first message category determining module is used for determining a first message category object corresponding to a first message category to which the unread message to be checked belongs according to category attribution information prestored in a data structure of the unread message to be checked when the unread message to be checked is detected; wherein the category attribution information is used for representing the message category to which the viewed unread message belongs;
the first message object determining module is used for determining a first message object corresponding to the viewed unread message in a dictionary corresponding to the first message category object based on the identification information of the viewed unread message;
and the state variable value modification module is used for modifying the state variable value in the first message object.
Further, the target message category object determining module is specifically configured to determine a target message category object corresponding to the target message category to be counted in a display loading process of a target category icon corresponding to the target message category to be counted;
the device, still include: an unread message prompt generation module;
and the unread message prompt generation module is used for traversing the state variables in the message objects in the dictionary corresponding to the target message class object, determining the number of messages with the message states in an unread state, displaying the target class icon in the display interface after the step of taking the number of the unread messages in the target message class, and generating the unread message prompt on the target class icon based on the number of the unread messages.
In the embodiment shown in fig. 3 of the present invention, a message object corresponding to a message is introduced, a state variable is used in the message object to represent a message state, meanwhile, message objects corresponding to messages belonging to the same message category are stored in the same storage area in advance, message objects corresponding to messages belonging to different message categories are stored in different storage areas, and when the number of unread messages belonging to a certain message category needs to be counted, the number of the unread messages in the message category can be obtained only by traversing the message objects corresponding to the messages belonging to the message category in the storage area corresponding to the message category without traversing the data structures of all the messages, so that the efficiency of counting the number of the unread messages is improved.
An embodiment of the present invention further provides an electronic device, as shown in fig. 4, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404,
a memory 403 for storing a computer program;
the processor 401, when executing the program stored in the memory 403, implements the following steps:
determining target message category objects corresponding to target message categories to be counted, wherein each message category corresponds to one message category object, and the message category objects are obtained after instantiation is carried out on predefined message category classes based on identification information of the message categories;
traversing state variables in the message objects in a target storage area corresponding to the target message type object, and determining the number of messages with the message states of unread states as the number of unread messages in the target message type; each message category object corresponds to one storage area and is used for storing message objects corresponding to messages belonging to the message category; each message corresponds to a message object, and the message object is obtained after a predefined message class is instantiated based on identification information of the message; the message object comprises a state variable for representing whether the message state is an unread state.
Further, other processing flows in the unread message quantity statistical method provided by the embodiment of the present invention may also be included, and are not described in detail herein.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Further, the memory may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In another embodiment of the present invention, there is also provided a computer-readable storage medium, having stored therein instructions, which when executed on a computer, cause the computer to perform any one of the above-mentioned unread message quantity statistics methods.
In yet another embodiment of the present invention, there is provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the above-mentioned unread message quantity statistics methods.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions described above in accordance with the embodiments of the invention may be generated, in whole or in part, when the computer program instructions described above are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic cable, Digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more of the available media. The usable medium may be a magnetic medium (e.g., a floppy Disk, a hard Disk, a magnetic tape), an optical medium (e.g., a Digital Video Disc (DVD)), a semiconductor medium (e.g., a Solid State Disk (SSD)), or the like.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the device, the electronic apparatus, and the storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to part of the description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A method for counting the quantity of unread messages is characterized in that the unread messages are virtual commodities which are not viewed by a user, and comprises the following steps:
determining a target message category object corresponding to a target message category to be counted, wherein each message category corresponds to one message category object, and the message category object is obtained after a predefined message category is instantiated based on identification information of the message category;
traversing state variables in the message objects in a target storage area corresponding to the target message type object, and determining the number of messages with message states in an unread state as the number of unread messages in the target message type; each message category object corresponds to one storage area and is used for storing message objects corresponding to messages belonging to the message category; each message corresponds to a message object, and the message object is obtained after a predefined message class is instantiated based on the identification information of the message; the message object comprises a state variable for representing whether the message state is an unread state.
2. The method according to claim 1, wherein message objects corresponding to messages belonging to the same message category are stored in the same storage area in a dictionary manner, and the dictionary uses identification information of the messages as keys;
the step of traversing the state variables in the message objects in the target storage area corresponding to the target message category object, and determining the number of messages with the message state being an unread state as the number of unread messages in the target message category, includes:
and traversing the state variables in the message objects in the dictionary corresponding to the target message category object, and determining the number of the messages with the message states being unread states as the number of the unread messages in the target message category.
3. The method of claim 2,
the method further comprises the following steps:
when it is detected that the unread message is viewed, determining a first message category object corresponding to a first message category to which the viewed unread message belongs according to category attribution information prestored in a data structure of the viewed unread message; wherein the category attribution information is used for representing the message category to which the viewed unread message belongs;
determining a first message object corresponding to the viewed unread message in a dictionary corresponding to the first message category object based on the identification information of the viewed unread message;
modifying a state variable value in the first message object.
4. The method according to claim 3, wherein the step of determining the target message class object corresponding to the target message class to be counted comprises:
determining a target message category object corresponding to a target message category to be counted in the display loading process of a target category icon corresponding to the target message category to be counted;
after the step of traversing the state variables in the message objects in the dictionary corresponding to the target message category object, and determining the number of messages whose message states are unread, as the number of unread messages in the target message category, the method further includes:
and displaying the target category icon in a display interface, and generating an unread message prompt on the target category icon based on the number of the unread messages.
5. An unread message quantity statistical device, wherein the unread message is a virtual commodity that is not viewed by a user, comprising:
a target message category object determining module, configured to determine a target message category object corresponding to a target message category to be counted, where each message category corresponds to one message category object, and the message category object is obtained after a predefined message category is instantiated based on identification information of the message category;
an unread message number determination module, configured to traverse state variables in each message object in a target storage area corresponding to the target message category object, and determine the number of messages whose message states are unread, as the number of unread messages in the target message category; each message category object corresponds to one storage area and is used for storing message objects corresponding to messages belonging to the message category; each message corresponds to a message object, and the message object is obtained after a predefined message class is instantiated based on the identification information of the message; the message object comprises a state variable for representing whether the message state is an unread state.
6. The device according to claim 5, wherein message objects corresponding to messages belonging to the same message category are stored in the same storage area in a dictionary manner, and the dictionary takes identification information of the messages as keys;
the unread message number determination module is specifically configured to traverse state variables in each message object in the dictionary corresponding to the target message class object, and determine the number of messages whose message states are unread, as the number of unread messages in the target message class.
7. The apparatus of claim 6,
the device further comprises:
the first message category determining module is used for determining a first message category object corresponding to a first message category to which the unread message to be checked belongs according to category attribution information prestored in a data structure of the unread message to be checked when the unread message to be checked is detected; wherein the category attribution information is used for representing the message category to which the viewed unread message belongs;
a first message object determination module, configured to determine, in a dictionary corresponding to the first message category object, a first message object corresponding to the viewed unread message based on the identification information of the viewed unread message;
and the state variable value modification module is used for modifying the state variable value in the first message object.
8. The apparatus of claim 6,
the target message category object determining module is specifically used for determining a target message category object corresponding to a target message category to be counted in the display loading process of a target category icon corresponding to the target message category to be counted;
the device, still include: an unread message prompt generation module;
the unread message prompt generation module is configured to traverse state variables in the message objects in the dictionary corresponding to the target message category object, determine the number of messages of which the message states are unread, display the target category icon in a display interface after the number of the unread messages in the target message category is determined, and generate an unread message prompt on the target category icon based on the number of the unread messages.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 4 when executing a program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 4.
CN201910919674.4A 2019-09-26 2019-09-26 Unread message quantity statistical method and device and electronic equipment Active CN110727384B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910919674.4A CN110727384B (en) 2019-09-26 2019-09-26 Unread message quantity statistical method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910919674.4A CN110727384B (en) 2019-09-26 2019-09-26 Unread message quantity statistical method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN110727384A CN110727384A (en) 2020-01-24
CN110727384B true CN110727384B (en) 2022-04-22

Family

ID=69219486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910919674.4A Active CN110727384B (en) 2019-09-26 2019-09-26 Unread message quantity statistical method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110727384B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111857466B (en) * 2020-06-30 2022-05-17 维沃移动通信有限公司 Message display method and device
CN113992612A (en) * 2021-09-15 2022-01-28 上海绚显科技有限公司 Message processing method and device, electronic equipment and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100544268C (en) * 2005-09-28 2009-09-23 腾讯科技(深圳)有限公司 A kind of reminding demand service of telecommunication method and device
US8244984B1 (en) * 2008-12-08 2012-08-14 Nvidia Corporation System and method for cleaning dirty data in an intermediate cache using a data class dependent eviction policy
US9378065B2 (en) * 2013-03-15 2016-06-28 Advanced Elemental Technologies, Inc. Purposeful computing
CN104965580B (en) * 2014-05-08 2018-10-16 腾讯科技(深圳)有限公司 The methods of exhibiting and device of unread message
CN105224532B (en) * 2014-05-28 2019-11-08 腾讯科技(深圳)有限公司 Data processing method and device
CN107608720A (en) * 2017-09-12 2018-01-19 广东欧珀移动通信有限公司 Using the display methods of footmark, device, mobile terminal and storage medium
CN110166619B (en) * 2018-02-13 2021-11-02 阿里巴巴集团控股有限公司 Picture downloading method and client
CN108494972B (en) * 2018-04-18 2020-04-24 Oppo广东移动通信有限公司 Message reminding method and device, mobile terminal and readable storage medium
CN109525647B (en) * 2018-10-25 2022-07-08 平安科技(深圳)有限公司 Message push badge value control method, electronic device and storage medium

Also Published As

Publication number Publication date
CN110727384A (en) 2020-01-24

Similar Documents

Publication Publication Date Title
KR102122373B1 (en) Method and apparatus for obtaining user portrait
US10853099B2 (en) System, method, and apparatus for rendering interface elements
CN105511873B (en) User interface control display method and device
CN110727384B (en) Unread message quantity statistical method and device and electronic equipment
CN110688009B (en) Application program access method and device for folding screen terminal
CN111753192A (en) Advertisement popup intercepting method and device, electronic equipment and storage medium
CN110928626A (en) Interface switching method and device and electronic equipment
US9449308B2 (en) Defining actions for data streams via icons
CN112581162A (en) Information content display method, device, storage medium and terminal
CN110362453A (en) Log statistic alarm method and device, terminal and storage medium
CN111429148A (en) Evaluation interface entering method and device
CN111062490B (en) Method and device for processing and identifying network data containing private data
CN111597553A (en) Process processing method, device, equipment and storage medium in virus searching and killing
US20220060438A1 (en) System and method for generating and rendering intent-based actionable content using input interface
CN112800401B (en) Privacy processing method, privacy processing device and terminal
CN109033224B (en) Risk text recognition method and device
US20210150243A1 (en) Efficient image sharing
US20230418631A1 (en) Creating and exporting graphical user interfaces for video game runtime environments
CN112973122A (en) Game role makeup method and device and electronic equipment
CN116663505A (en) Comment area management method and system based on Internet
CN108268298B (en) Desktop icon generation method and device, storage medium and electronic equipment
US9230022B1 (en) Customizable result sets for application program interfaces
CN115373564A (en) Function shortcut key self-defining method and device, software function control method and terminal
CN112507214B (en) User name-based data processing method, device, equipment and medium
CN113849812A (en) Application program detection method and device and electronic equipment

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