Message processing method and device, equipment, readable storage medium and program product
Through the unread multi-forktree structure, the problem of slow update speed and poor scalability of unreads in the prior art is solved, and fast and accurate unread display and efficient message processing are achieved.
Patent Information
- Application Number
- CN202410983265.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-12
AI Technical Summary
Existing message processing methods are slow to update unreads in the application's message interface and poor scalability, resulting in untimely and errors in the unreads displayed.
Unread multi-forktree is used to determine the unreads of the message module. By building a multi-forktree structure based on the message module and the affiliation, it quickly and accurately obtains and updates unreads, simplifies the processing flow and improves scalability.
Improves the update speed and accuracy of unreads, reduces maintenance costs, and improves the user experience and interaction efficiency of the application.
Smart Images

Figure CN118945135A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a message processing method, apparatus, device, readable storage medium and program product. Background Art
[0002] In the message interface of an application, the unread counts of different types of messages, such as notification messages and interactive messages, are usually displayed. During the object interaction process, these unread counts are more eye-catching and serve as a strong reminder.
[0003] The unread count displayed in the message interface is related to the number of unread messages in the database, so a message processing method is needed to accurately, quickly and stably update the unread count in the message interface. However, the processing process of some message processing methods is redundant and has poor scalability, which easily leads to slow update of the unread count. Summary of the invention
[0004] The embodiments of the present application provide a message processing method, apparatus, device, readable storage medium and program product, which can use an unread multi-branch tree to determine the unread counts of a message module, effectively simplifying the message processing process, improving the update speed of the unread counts, and having good scalability.
[0005] On the one hand, an embodiment of the present application provides a message processing method, the message processing method comprising:
[0006] When a trigger event of unread numbers of a first message module in a statistical application is detected, a multi-branch tree of unread numbers corresponding to the application is obtained, wherein the multi-branch tree of unread numbers is constructed according to a plurality of message modules included in the application and the subordinate relationship between the message modules;
[0007] Determine at least one leaf node of the target node corresponding to the first message module in the unread multitree according to the connection relationship between the nodes in the unread multitree;
[0008] Acquire, from each leaf node of the target node, an unread number corresponding to each leaf node of the target node, wherein the unread number corresponding to the leaf node is determined according to the number of unread messages in the message data table corresponding to the leaf node;
[0009] The unread numbers corresponding to the target node are determined according to the unread numbers corresponding to each leaf node of the target node.
[0010] Accordingly, an embodiment of the present application provides a message processing device, the message processing device comprising:
[0011] An acquisition unit is used to acquire a multi-branch tree of unread numbers corresponding to the application when a trigger event of unread numbers of a first message module in the statistical application is detected, wherein the multi-branch tree of unread numbers is constructed according to a plurality of message modules included in the application and a subordinate relationship between the message modules;
[0012] A determining unit, configured to determine at least one leaf node of a target node corresponding to the first message module in the unread multitree according to a connection relationship between nodes in the unread multitree;
[0013] The acquisition unit is further used to acquire, from each leaf node of the target node, the unread count corresponding to each leaf node of the target node, wherein the unread count corresponding to the leaf node is determined according to the number of unread messages in the message data table corresponding to the leaf node;
[0014] The determining unit is further configured to determine the unread numbers corresponding to the target node according to the unread numbers corresponding to each leaf node of the target node.
[0015] Accordingly, an embodiment of the present application provides a computer device, the computer device comprising:
[0016] a processor suitable for implementing a computer program;
[0017] A computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the above-mentioned message processing method.
[0018] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is read and executed by a processor of a computer device, the computer device executes the above-mentioned message processing method.
[0019] Accordingly, an embodiment of the present application further provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned message processing method.
[0020] In the present application, the unread multitree corresponding to the application is constructed according to the multiple message modules contained in the application and the subordinate relationship of each message module. Therefore, when the message module in the application changes, the unread multitree can also be changed accordingly, which has good scalability and can effectively reduce maintenance costs. When a trigger event of the unread number of the first message module in the statistical application is detected (for example: a display request of the message interface, the message interface includes the first message module), the unread multitree corresponding to the application can be obtained, and the leaf node of the target node corresponding to the first message module can be determined; according to the unread number of the leaf node of the target node, the unread number of the target node can be determined, which can effectively simplify the processing flow of determining the unread number of the message module, improve the update speed of the unread number, effectively avoid the situation of the unread number error, and effectively improve the user experience of the interactive object. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0022] Figure 1 It is a schematic diagram of the system architecture of a message processing system provided by an embodiment of the present application;
[0023] Figure 2 It is a flowchart of a message processing method provided by an embodiment of the present application;
[0024] Figure 3 is a schematic diagram of an unread multi-branch tree provided in an embodiment of the present application;
[0025] Figure 4 It is a schematic diagram of the structure of a node in an unread multi-branch tree provided by an embodiment of the present application;
[0026] Figure 5 is a schematic diagram of a message processing method provided in an embodiment of the present application;
[0027] Figure 6 is a schematic diagram of another message processing method provided in an embodiment of the present application;
[0028] Figure 7 It is a flowchart of another message processing method provided in an embodiment of the present application;
[0029] Figure 8 It is an interactive schematic diagram of a message processing method provided in an embodiment of the present application;
[0030] Fig. 9 It is a flowchart of another message processing method provided in an embodiment of the present application;
[0031] Fig.10 It is an interactive schematic diagram of another message processing method provided in an embodiment of the present application;
[0032] Fig.11 It is a structural block diagram of a message processing device provided in an embodiment of the present application;
[0033] Fig.12 It is a structural block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0035] It should be noted that the descriptions of "first", "second", etc. involved in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the technical features defined as "first" or "second" may explicitly or implicitly include at least one of the features.
[0036] In the specific implementation of this application, user-related data is involved, such as the number of unread messages in the message data table. When the embodiment of this application is applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with local laws, regulations and standards.
[0037] The method provided in an embodiment of the present application is applied to a message processing device, which may be a terminal device configured with an application and a client that can run the application; wherein the terminal device may be a smart terminal, such as a mobile phone, a wearable device, a vehicle-mounted device, a tablet computer, a network device, and a smart computer.
[0038] The architecture of the message processing system provided in the embodiment of the present application will be introduced below in conjunction with the accompanying drawings.
[0039] See also Figure 1, which is a schematic diagram of the system architecture of a message processing system provided by an embodiment of the present application, the message processing system includes a terminal device 101 and a server 102, the terminal device 101 can receive messages or requests sent by the server 102, and can also send information to the server 102. The terminal device 101 can interact with objects and can also run a client of an application, the client includes a message interface, the message interface includes unread numbers, and the terminal device 101 is also provided with a database, and the database stores data associated with the application.
[0040] In this embodiment, upon detecting a trigger event (such as a trigger event) in which no readings of the first message module in the statistics application are detected, Figure 1 As shown in , when the server 102 sends an unread reading acquisition request to the terminal device 101, the unread reading acquisition request is used to request to obtain the unread reading of the first message module, the terminal device 101 can obtain the unread reading multi-branch tree corresponding to the application, and the unread reading multi-branch tree is constructed according to the multiple message modules included in the application and the subordinate relationship of each message module. Figure 1 As shown, the application includes a conversation message module, a notification message module, and an interactive message module, wherein the conversation message module includes a first conversation and a second conversation. Based on these message modules and the subordinate relationship between each message module, the following can be constructed: Figure 1 The unread multitree is shown, where nodes 1, 2, and 3 in the unread multitree correspond to the conversation message module, the notification message module, and the interactive message module respectively, and nodes 4 and 5 correspond to the first conversation and the second conversation in the conversation message module respectively.
[0041] The terminal device 101 can determine at least one leaf node of the target node corresponding to the first message module in the unread multitree according to the connection relationship between the nodes in the unread multitree. For example, if the first message module is a session message module, it can be determined that the target node corresponding to the first message module is node 1, and at least one leaf node of the target node is node 4 and node 5.
[0042] The terminal device 101 can obtain the unread counts corresponding to each leaf node of the target node from each leaf node of the target node. The unread counts corresponding to the leaf node are determined according to the number of unread messages in the message data table corresponding to the leaf node. For example, if the number of unread messages in the message data table corresponding to the leaf node is 4, then it can be determined that the unread count corresponding to the leaf node is 4.
[0043] The terminal device 101 can determine the unread numbers corresponding to the target node according to the unread numbers corresponding to each leaf node of the target node. Figure 1As shown, the target node is node 1, and its corresponding leaf nodes are node 4 and node 5. Assuming that the unread counts corresponding to node 4 are 2 and the unread counts corresponding to node 5 are 4, it can be determined that the unread counts corresponding to the target node are 6. The terminal device 101 can send the unread counts of the target node to the server 102 in response to the unread count acquisition request sent by the server 102.
[0044] The server 102 in the message processing system can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0045] Through the method provided in the embodiment of the present application, the unread counts of the target node can be determined based on the multi-branch tree, which systematically solves the problems of low efficiency in obtaining unread counts, high maintenance costs, and poor scalability, effectively improves the update efficiency of unread counts, avoids problems such as unread count errors, and improves the user experience.
[0046] Understandably, Figure 1 The servers or terminal devices in the message processing system shown do not constitute a limitation on the embodiments of the present invention, that is, the number of servers, the types of servers, the number of terminal devices, the types of terminal devices, or the number and types of devices contained in each server or terminal device do not affect the overall implementation of the technical solution in the embodiments of the present invention, and can all be regarded as equivalent replacements or derivatives of the technical solution claimed to be protected in the embodiments of the present invention.
[0047] See also Figure 2 , Figure 2 A flowchart of a message processing method provided in an embodiment of the present application. The message processing method can be implemented by the above-mentioned terminal device 101, or by other devices that can implement the message processing method. The following takes the implementation of the message processing method by the above-mentioned terminal device 101 as an example for explanation. The flow of the message processing method provided in the embodiment of the present application includes but is not limited to:
[0048] S201. When a trigger event of counting unread numbers of a first message module in a statistical application is detected, a multi-branch tree of unread numbers corresponding to the application is obtained, wherein the multi-branch tree of unread numbers is constructed according to multiple message modules included in the application and the subordinate relationships between the message modules.
[0049] In the embodiment of the present application, the terminal device is configured with an application, and the client of the application can be run. The application includes multiple message modules (for example: notification message module, session message module, etc.), and each message module may include different message components (for example: the session message module includes the first session component and the second session component, and the notification message module includes the first notification component and the second notification component, etc.). When the triggering event of the unreading of the first message module in the statistical application is detected, the terminal device can obtain the unreading multi-branch tree corresponding to the application, and the unreading multi-branch tree is constructed according to the multiple message modules included in the application and the subordinate relationship of each message module. It should be noted that before the triggering event of the unreading of the first message module in the statistical application is detected, the unreading multi-branch tree corresponding to the application has been constructed (for example: when the client of the application can be run for the first time in the terminal device, the unreading multi-branch tree corresponding to the application is created). Through the method provided in the embodiment of the present application, the unreading multi-branch tree corresponding to the application can be obtained, which is conducive to the subsequent rapid and accurate determination of the unreading of the first message module based on the unreading multi-branch tree, and the efficiency of message processing is improved.
[0050] See also Figure 3 , which is a schematic diagram of an unread multi-branch tree provided in an embodiment of the present application. The terminal device runs a client of an application, and the client includes a message interface, such as Figure 3 As shown, the message interface includes a conversation message module, a notification message module and an interactive message module, wherein the conversation message module includes a first conversation component, the notification message module includes a system notification component, and the interactive message module includes a collection component, a follow component and a comment component. Then, the unread tree multitree corresponding to the application degree may include an interface node (corresponding to the message interface), and the child nodes of the interface node include a conversation node (corresponding to the conversation message module), a notification node (corresponding to the notification message module), and an interactive node (corresponding to the interactive message module). The child nodes of the conversation node include a first conversation node (corresponding to the first conversation component); the child nodes of the notification node include a system notification node (corresponding to the system notification component); the child nodes of the interactive node include an interactive collection node (corresponding to the collection component), an interactive follow node (corresponding to the follow component), and an interactive comment node (corresponding to the comment component). The unread counts displayed by each message module in the message interface are associated with the unread counts corresponding to the nodes in the unread count multitree. When the unread counts corresponding to the node change, the unread counts displayed by the message module or component will also change. The unread counts corresponding to the node are determined based on the number of unread messages in the message data table corresponding to the node. As shown Figure 3 As shown, different leaf nodes may correspond to different message data tables. Figure 3In the figure, the message data table corresponding to the first conversation node is the conversation message data table, the message data table corresponding to the system notification node is the system message data table, and the message data tables corresponding to the interactive collection node, interactive attention node and interactive comment node are all interactive message data tables.
[0051] It should be noted that when the unread count corresponding to any node in the unread count multitree changes, the unread counts corresponding to other nodes in the unread count multitree will also change accordingly, which can change the display mode of the corresponding module or component in the message interface. That is, the change of the unread count corresponding to each node can be transmitted to the root node (that is, the interface node) layer by layer to cause the display change of the message interface; or the change of the unread count corresponding to each node can directly cause the display change of the message interface, that is, each node can also emit UI events individually. Figure 3 The message modules and the subordinate relationships of the message modules shown are only a feasible implementation method. In actual application, the elements in the message interface represented by the message modules can be adaptively adjusted according to different application requirements. Through the method provided in the embodiment of the present application, the association of the message modules in the multi-tree rain message interface can be used to realize the reconstruction of the unread module, improve the update efficiency of the unread, and ensure the accuracy of the unread.
[0052] In some cases, a prefix tree can be used to construct a multitree of unread messages. A prefix tree is a multitree used to store strings and index text. In a prefix tree, nodes with the same prefix string have the same parent node. Therefore, combined with a reasonable indexing method, the target text content stored in the prefix tree can be efficiently and conveniently found. When constructing a multitree of unread messages based on a prefix tree, the prefix of each node can be determined based on the message module and the subordinate relationship of the message module. Nodes with the same prefix can be considered to be the same link, for example: Figure 3 The changes in the unread counts corresponding to the interactive favorite nodes, interactive attention nodes, and interactive comment nodes can reflect the changes in the unread counts corresponding to the interactive nodes. Based on the prefix tree, the unread count multitree can be constructed, and the target node and the path to which the target node belongs can be identified. Through the path and the unread counts corresponding to the target node, the unread counts corresponding to the nodes on the path to which the target node belongs can be easily and quickly determined, which is also conducive to improving query efficiency.
[0053] See also Figure 4 , which is a schematic diagram of the structure of a node in an unread multi-branch tree provided by an embodiment of the present application. Figure 4As shown, the unread multitree contains a root node (BadgeNode), and the data structure of the root node includes information such as path, count, and parent node (parent, the parent node of the root node is itself). The child nodes of the root node may include a session identification node (ChatBadgeNode), a session setting identification node (ChatSetBadgeNode), etc. The unread number corresponding to the session identification node and the session setting identification node can be determined according to the number of unread messages in the corresponding message data table. There is also an identification tree management module (BadgeTreeManager) for managing the unread multitree in the terminal device, and the root node corresponding to the identification tree management module is BadgeNode, which is used to implement the increase and decrease of nodes in the unread multitree, and the identification tree management module may include a session identification management module (ChatBadgeManager), which is used to manage the session identification node. Through the method provided in the embodiment of the present application, the multitree can be systematically applied to the unread update scenario, effectively simplifying the processing flow of the unread update, improving the processing efficiency, and being conducive to improving the user experience.
[0054] In one embodiment, when the unread multitree construction condition is met, the terminal device can construct an unread multitree according to the multiple message modules included in the application and the subordinate relationship of each message module, and initialize the unread number corresponding to each node in the unread multitree according to the number of unread messages in the message data table associated with the application. In some cases, the unread multitree construction condition can be any of the following: the terminal device runs the client A of the application for the first time, and the client of the application running in the terminal device changes from client A to client B.
[0055] In one embodiment, after constructing a multi-branch tree of unread counts, it is necessary to update the unread counts corresponding to each node in the multi-branch tree of unread counts. The message processing method provided in the embodiment of the present application may further include the following steps: if it is detected that any message data table is updated, determine the first node corresponding to the update message in any message data table; determine at least one ancestor node of the first node in the multi-branch tree of unread counts; traverse the first node and at least one ancestor node in the multi-branch tree of unread counts from a low level to a high level, and update the unread counts corresponding to the currently traversed node according to the updated unread counts corresponding to the node last traversed, to obtain the updated unread counts corresponding to the currently traversed node, until the traversal is completed, and the updated unread counts corresponding to the first node are determined based on the update message in any message data table.
[0056] Specifically, when data is updated in any message data table associated with the application in the terminal device (for example, a new unread message is added to the message data table, or an unread message in the message data table becomes a read message, etc.), the first node corresponding to the updated message in the message data table can be determined. Figure 3 If a new unread message associated with the first session component is added to the session message data table, it can be determined that the first node corresponding to the updated message in the message data table can be the above Figure 3 The first session node in .
[0057] The terminal device can determine at least one ancestor node of the first node in the unread multitree according to the structure of the unread multitree. The ancestor nodes are all the nodes passed on the path from the root node to the first node in the unread multitree. The terminal device can determine the updated unread counts corresponding to the first node according to the update message in the message data table. The first node and at least one ancestor node of the first node are traversed in the order of the unread multitree from low level to high level, and the unread counts corresponding to the currently traversed node are updated according to the updated unread counts corresponding to the node traversed last time, so as to obtain the updated unread counts corresponding to the currently traversed node, until the traversal is completed. Figure 3 Taking the unread multitree shown as an example, the first node is determined to be an interactive collection node according to the update message in the message data table, and the ancestor nodes of the interactive collection node include the interactive node and the interface node; according to the update message in the message data table, it can be determined that the updated unread number corresponding to the interactive collection node is 5, and the first node and its ancestor nodes are traversed in the order from low level to high level in the unread multitree, and the updated unread number corresponding to the interactive node can be determined to be 5+3+1=9 according to the updated unread data corresponding to the interactive collection node; according to the updated unread number corresponding to the interactive node, it can be determined that the updated unread number corresponding to the interface node is 9+1+1=11. Through the method provided in the embodiment of the present application, the unread number corresponding to the node in the unread multitree can be traversed and updated from low level to high level based on the update of the message data table, which can improve the update efficiency of the unread number, and can also effectively ensure the accuracy of the unread number corresponding to the node in the unread multitree, solving the problems of high maintenance cost and poor scalability of the unread module.
[0058] In one embodiment, the triggering event may include one or more of the following: receiving a display request for a message interface including a first message module, receiving a request for obtaining an unread number of the first message module sent by a server, and a change in the message data table corresponding to the leaf node of the target node. Among them, receiving a display request for a message interface including a first message module means that when the terminal device runs the client of the application, a display request for a message display interface including the first message module is received from an interactive object or a terminal device. Receiving an acquisition request for an unread number of the first message module sent by a server means that the terminal device receives an acquisition request for an unread number of the first message module sent by a server, and the server may be a server of the application or another server. The change in the message data table corresponding to the leaf node of the target node means that the number of unread messages in the message data table corresponding to the leaf node changes, for example: the server sends an unread message to the terminal device, and the terminal device stores it in the message data table. At this time, the number of unread messages in the message data table increases, and the unread number of the corresponding leaf node also needs to change. Another example: in response to the triggering operation of the interactive object, the terminal device displays some unread messages, then these unread messages become read messages, the number of unread messages in the corresponding message data table decreases, and the number of unread messages in the corresponding leaf node also needs to change. Through the method provided in the embodiment of the present application, the message processing method provided in the present application can be executed in a variety of different scenarios, thereby improving the universality of the message processing method.
[0059] S202: Determine at least one leaf node of a target node corresponding to the first message module in the unread number multitree according to a connection relationship between nodes in the unread number multitree.
[0060] In an embodiment of the present application, the terminal device can determine at least one leaf node of the target node corresponding to the first message module in the unread multitree according to the connection relationship of each node in the unread multitree. It should be noted that if the target node corresponding to the first message module is a leaf node, then at least one leaf node of the target node is the target node itself. Through the method provided in an embodiment of the present application, the leaf node of the target node can be determined according to the connection relationship of each node in the unread multitree, which is conducive to the subsequent determination of the unread corresponding to the target node quickly and accurately according to the unread corresponding to the leaf node.
[0061] S203. Obtain the unread count corresponding to each leaf node of the target node from each leaf node of the target node, wherein the unread count corresponding to the leaf node is determined according to the number of unread messages in the message data table corresponding to the leaf node.
[0062] In an embodiment of the present application, the terminal device can obtain the unread numbers corresponding to each leaf node of the target node from each leaf node of the target node. The unread numbers corresponding to the leaf node are determined according to the number of unread messages in the message data table corresponding to the leaf node. For example: three message data tables are stored in the terminal device, namely the session message data table, the notification message data table, and the interactive message data table. The leaf node is an interactive attention node, and the message data table corresponding to the leaf node is an interactive message data table. Assuming that the number of unread messages of the interactive attention type in the interactive message data table is 3, it can be determined that the unread number corresponding to the interactive attention node is 3. Through the method provided in the embodiment of the present application, the unread numbers corresponding to the leaf nodes of the target node can be directly obtained without querying the message data table, which effectively improves the efficiency of message processing and can also effectively improve the efficiency of determining the unread numbers corresponding to the target node.
[0063] In one embodiment, when determining the unread count corresponding to a leaf node, the message processing method provided by the embodiment of the present application may also include the following steps: obtaining a message data table corresponding to a target leaf node, where the target leaf node is any leaf node in a multi-branch tree of unread counts; querying the unread messages corresponding to the target leaf node from the message data table corresponding to the target leaf node, and determining the unread count corresponding to the target leaf node based on the number of unread messages queried; and updating the unread count stored in the target leaf node to the determined unread count.
[0064] Specifically, for any leaf node (i.e., target leaf node) in the unread multitree, when the unread number corresponding to the target leaf node is determined, the message data table corresponding to the target leaf node can be obtained. The terminal device may include one or more message data tables, and one message data table may correspond to one or more leaf nodes. The terminal device may query the unread messages corresponding to the target leaf node from the message data table, and determine the unread number corresponding to the target leaf node according to the number of unread messages queried, and update the unread number stored in the target leaf node to the determined unread number. For example: the session message data table contains session messages associated with the application, and the message corresponding to the target leaf node is a message of the first session type, then the unread message of the type of the first session type in the session message data table can be queried, and the unread number corresponding to the target leaf node can be determined according to the number of unread messages queried. It should be noted that the execution of the update operation of the unread number corresponding to the leaf node can have a variety of different trigger conditions, for example: the trigger condition can be when the message data table is updated, it can also be when the update cycle of the unread number is reached, or it can be when there is a need to obtain or display the unread number corresponding to the leaf node. Through the method provided in the embodiment of the present application, the unread count corresponding to the leaf node can be determined based on the number of unread messages in the message data table, effectively ensuring the accuracy of the unread count corresponding to the leaf node, which is facilitating the subsequent determination of the unread counts corresponding to other nodes in the unread multi-branch tree based on the unread counts corresponding to each leaf node, and is also facilitating the subsequent display of accurate unread counts on the message interface, thereby improving the user experience of the application.
[0065] In one embodiment, the specific implementation method of obtaining the message data table corresponding to the target leaf node can be: obtaining the message type of the second message module corresponding to the target leaf node; determining the message data table corresponding to the message type of the second message module according to the correspondence between the message type and the message data table; determining the message data table corresponding to the target leaf node as the message data table corresponding to the message type of the second message module. Specifically, the terminal device can obtain the message type of the second message module corresponding to the target leaf node, and determine the message data table corresponding to the message type of the second message module according to the correspondence between the message type and the message data table. For example: the message module of the application includes a session message module (the message type is a session type), a notification message module (the message type is a notification type), and an interactive message module (the message type is an interactive type). The terminal device stores multiple message data tables associated with the application, namely, a session message data table (corresponding to a session type), a notification message data table (corresponding to a notification type), and an interactive message data table (corresponding to an interactive type). Assuming that the message type of the second message module corresponding to the acquired target leaf node is a notification type, then according to the correspondence between the message type and the message data table, the message data table corresponding to the message type of the second message module can be a notification message data table, and then the message data table corresponding to the target leaf node can be determined to be a notification message data table. Through the method provided in the embodiment of the present application, when determining the unread number corresponding to the leaf node, it is only necessary to query the corresponding message data table without traversing all message data tables associated with the application, thereby effectively improving the efficiency of determining the unread number, and also improving the updating efficiency of the unread number corresponding to the node.
[0066] In one embodiment, the method provided by the embodiment of the present application may also include the following steps: displaying the pending messages contained in the first message module, the pending messages are stored in the third message data table, the status of the pending messages is unread, and the third message data table is the message data table corresponding to the leaf node of the target node; in response to the display operation for the pending messages, the status of the pending messages in the third message data table is updated to a read status, and an updated third message data table is obtained, and the number of unread messages contained in the updated third message data table is used to determine the unread number corresponding to the leaf node of the target node.
[0067] Specifically, the terminal device can display the pending messages included in the first message module, and the pending messages are stored in the third message data table, which is the message data table corresponding to the leaf node of the target node. Before the pending messages are displayed, the pending messages in the third message data table are unread messages. In response to the display operation for the pending messages, the terminal device can update the status of the pending messages in the third message data table to a read status, and obtain the updated third message data. The number of unread messages contained in the updated third message data table is used to determine the number of unread messages corresponding to the leaf node of the target node.
[0068] See also Figure 5 , which is a schematic diagram of a message processing method provided by an embodiment of the present application. The client of the terminal device running the application includes a message interface, and the message interface includes a session message module, such as Figure 5 As shown, the session message module includes a session message component 1 and a session message component 2. The terminal device includes an unread multitree corresponding to the application, and the unread multitree is determined according to the multiple message modules included in the application and the subordinate relationship of each message module. Figure 5 As shown, the unread count of the session message module is 5, the unread count of session message component 1 is 2, and the unread count of session message component 2 is 3. The session message module, session message component 1 and session message component 2 correspond to the session node, session component node 1 and session component node 2 in the unread count multitree respectively. The message data table corresponding to session component node 1 and session component node 2 is the session message data table.
[0069] The terminal device displays the session message interface corresponding to the session message component 1 in response to the display operation for the unread messages in the session message component 1. After displaying the session message interface, the terminal device can update the status of the message matching the session message component 1 in the session message data table to the read status, and obtain the updated session message data table. The session component node 1 can determine the updated unread count (the updated unread count is 0) according to the number of unread messages in the updated session message data table. The updated unread count corresponding to the session node is determined according to the unread counts corresponding to the session component node 1 and the session component node 2. The terminal device can display the unread counts of the session message module, the session message component 1, and the session message component 2 according to the unread counts corresponding to the corresponding nodes in the unread multitree. Through the method provided in the embodiment of the present application, the update of the unread counts can be realized, and the problems of unread count errors, slow updates, etc. can be effectively avoided, and the user experience of the application can be effectively improved.
[0070] S204 , determining the unread numbers corresponding to the target node according to the unread numbers corresponding to each leaf node of the target node.
[0071] In an embodiment of the present application, the terminal device can determine the unread number corresponding to the target node based on the unread number corresponding to each leaf node of the target node. For example, the unread number corresponding to each leaf node of the target node can be summed to obtain the unread number corresponding to the target node. Through the method provided in the embodiment of the present application, the unread number of the target node can be quickly and accurately determined based on the unread number multi-branch tree, which greatly simplifies the unread number acquisition process and improves the efficiency of obtaining the unread number. At the same time, the unread number is determined using the unread number multi-branch tree, which improves the update efficiency of the unread number, reduces the maintenance cost, and has good scalability.
[0072] In one embodiment, the message processing method provided by the embodiment of the present application may further include the following steps: determining the display area of the unread counts of the first message module according to the position of the first message module in the message interface; and displaying the unread counts of the target node in the display area in the message interface. Specifically, the terminal device determines the unread counts corresponding to the target node, that is, determines the unread counts of the first message module, and may display the unread counts of the target node in the display area in the message interface. Through the method provided by the embodiment of the present application, the determined unread counts may be displayed in the message interface, thereby achieving the purpose of strong reminders. At the same time, since the method provided by the embodiment of the present application can quickly and accurately determine the unread counts, it is possible to avoid problems such as unread count errors, slow display, and untimely updates, thereby improving the user experience for the application.
[0073] See also Figure 6 , which is a schematic diagram of another message processing method provided in an embodiment of the present application. Figure 6In the present invention, the terminal device includes a node structure layer, a driver layer and a presentation layer, wherein the node structure layer is used to implement operations such as construction and destruction of an unread multitree; the driver layer is used to implement data layer switching, and the driver layer includes an external driver interface (for example: a data interface for updating the unread data of the message module in the message interface of the application, and a data interface for receiving messages sent by the server); the presentation layer is used to externally drive the binding-related logic of the message interface (observer mode), or directly hold the display object to directly update the unread data of the message module in the message interface according to the event. The update method of the unread data of the message module in the message interface can be a passive update, and the processing flow of the passive update is: the server generates a new unread message, the terminal device receives the new unread message through the interface of the driver layer, and stores the new unread message in the message data table to obtain an updated message data table. The leaf nodes in the unread multitree are processed for unread data update according to the updated message data table to obtain an updated unread data. According to the updated unread counts corresponding to the leaf nodes, the unread counts corresponding to the nodes in the unread counts multitree are updated, and the updated unread counts corresponding to each node are displayed on the message interface through the presentation layer (i.e., the presentation layer obtains and displays the unread counts from the unread counts multitree of the node structure layer). The method provided by the embodiment of the present application can effectively improve the update efficiency of the unread counts, avoid the problems of unread count errors, untimely updates, etc., thereby improving the user experience of the application.
[0074] In an embodiment of the present application, when a trigger event of unread counts of the first message module in a statistical application is detected, a multi-branch tree of unread counts corresponding to the application is obtained, and the unread counts of the first message module are determined through the multi-branch tree of unread counts, which greatly shortens the processing flow of unread counts, reduces redundant data, improves the efficiency of determining unread counts, and is also beneficial to improving the accuracy of unread counts, avoiding problems such as unread count errors and slow updates, and effectively improving the user experience of the application; the multi-branch tree can be used to reflect the unread counts involved in multiple message modules in the application and the subordinate relationships of each message module, has good scalability, and effectively reduces maintenance costs; when determining the unread counts corresponding to a leaf node, it is only necessary to find the corresponding message data table without traversing all message data tables associated with the application, which can further improve the efficiency of determining the unread counts. The present application proposes a complete and feasible solution for the unread count update and display scenarios of the message module in the application, which has practical guiding significance.
[0075] See also Figure 7 , Figure 7A flowchart of another message processing method provided in an embodiment of the present application. The message processing method can be implemented by the above-mentioned terminal device 101, and the scenario corresponding to the message processing method is: when the client of the application is not running in the terminal device. The process of the message processing method provided in the embodiment of the present application includes but is not limited to:
[0076] S701: When no client of an application is running in the terminal device, receive one or more offline messages for a first client sent by a server of the application, where the first client is a client of the application running in the terminal device within a historical time period.
[0077] In the embodiment of the present application, when an application is configured in a terminal device and the client of the application is not running, the terminal device can receive one or more offline messages for a first client sent by the server of the application. The first client can be a client of the application running in the terminal device in the historical time period, that is, the first client is a client of the application that has been running in the terminal device. For example: the terminal device runs the first client in the historical time period from 10 o'clock to 12 o'clock, and at 14 o'clock, the client of the application is not running in the terminal device. At this time, the terminal device can still receive offline messages for the first client sent by the server of the application.
[0078] In one embodiment, the terminal device can receive offline messages sent in batches by the server of the application through the data interface, and perform subsequent processing based on these offline messages, thereby updating the unread counts in the unread count multitree, so that when the first client of the application is run again in the terminal device, the accurate and updated unread counts can be displayed on the message interface of the first client, thereby improving the user experience of the application. It should be noted that in some cases, the data interface in the terminal device can pull offline messages for the first client from the server of the application.
[0079] S702: Store the one or more offline messages in a first message data table according to a message type of the offline message, wherein the message type corresponding to the first message data table matches the message type of the offline message.
[0080] In an embodiment of the present application, the terminal device can store one or more received offline messages in a first message data table according to the message type of the offline message, and the message type of the first message data table matches the message type of the offline message. For example: three message data tables associated with the application are stored in the terminal device, namely, a session message data table (corresponding to the session type), a notification message data table (corresponding to the notification type), and an interactive message data table (corresponding to the interactive type). If the message type of the offline message is the notification type, the offline message can be stored in the notification message data table. It should be noted that when multiple offline messages are received and the message types of the offline messages are not exactly the same, the terminal device can store them in the corresponding message data table according to the message type of each offline message.
[0081] In one embodiment, after receiving the offline message sent by the server of the application, the terminal device may also convert the offline message to obtain the converted offline message, and store the converted offline message in the corresponding message data table. The conversion process of the offline message may include format normalization of the offline message, setting the status of the offline message to an unread status, determining the message type corresponding to the offline message (i.e., a subdivision type under a certain message type, for example, the first session type under a session type), etc.
[0082] S703: When an unread count update period is reached, determine at least one to-be-updated node corresponding to the first message data table, and determine an updated unread count corresponding to the at least one to-be-updated node according to the number of unread messages in the first message data table.
[0083] In an embodiment of the present application, when the client of the application is not running in the terminal device, the terminal device can periodically update the unread numbers in the unread multitree. When the unread number update cycle is reached (for example, every 10 minutes), the terminal device determines that there is at least one node to be updated corresponding to the message data table (i.e., the first message data table) with data update. Specifically, at least one node to be updated corresponding to the first message data table can be determined according to the message type of the offline message. For example: the first message data table is a session message data table, and there are five leaf nodes corresponding to the session message data table. These five leaf nodes correspond to the first to fifth session types, respectively. The message type of the offline message is the first session type, then the node to be updated can be determined as a leaf node corresponding to the first session type. The terminal device can determine the unread number to be updated corresponding to at least one node to be updated according to the number of unread messages in the first message data table. The method for determining the unread number to be updated corresponding to the node to be updated can be as shown in the embodiment in the above step S203.
[0084] It should be noted that the process described in step S703 is that when the unread update cycle is reached, the node to be updated is determined according to the message type of the offline message, and the number of unread messages in the first message data table directly determines the updated unread number corresponding to the node to be updated, which is a passive node update method. In some cases, the node active update method can also be adopted, that is, when the unread update cycle is reached, each leaf node in the unread multi-branch tree queries the number of unread messages in the message data table corresponding to each leaf node, and obtains the query number corresponding to each leaf node. The query number corresponding to each leaf node is compared with the unread number stored therein. If the query number is different from the unread number stored therein, the leaf node is determined as a node to be updated, and the unread number corresponding to the node to be updated is updated. If the query number is the same as the unread number stored therein, the unread number corresponding to the leaf node is not updated. Through the method provided in the embodiment of the present application, different methods can be used to implement the update of the unread number corresponding to the node, so that the method has good universality and can improve the update efficiency of the unread number.
[0085] S704, updating the unread counts stored in the at least one to-be-updated node included in the unread counts multitree to the updated unread counts corresponding to the corresponding node, wherein the unread counts multitree is constructed according to the multiple message modules included in the application and the subordinate relationships between the message modules.
[0086] In an embodiment of the present application, the terminal device can update the unread counts stored in at least one node to be updated contained in the unread count multi-branch tree to the updated unread counts corresponding to the corresponding node, thereby realizing the update of the unread counts corresponding to the node to be updated. It should be noted that after the unread counts corresponding to the node to be updated are updated, the unread counts corresponding to the ancestor nodes of each node to be updated will also be updated to ensure the accuracy of the unread counts corresponding to each node in the unread count multi-branch tree. The update process can be as shown in the embodiment in the above step S203.
[0087] S705. When a first client of the application is running on a terminal device and a trigger event for counting the unread numbers of a first message module in the application is detected, a multi-branch tree of unread numbers corresponding to the application is obtained, at least one leaf node of a target node corresponding to the first message module in the multi-branch tree of unread numbers is determined, and the unread number corresponding to the target node is determined based on the unread numbers corresponding to each leaf node of the target node.
[0088] In an embodiment of the present application, when a first client of an application is running in a terminal device, and a trigger event of an unread number of a first message module in a statistical application is detected, the terminal device can obtain a multi-branch tree of unread numbers corresponding to the application, and determine at least one leaf node of the target node corresponding to the first message module in the multi-branch tree of unread numbers. The unread numbers of each leaf node object of the target node are obtained from each leaf node of the target node, and the unread numbers corresponding to each leaf node of the target node are determined based on the unread numbers corresponding to each leaf node of the target node. For example: when a client of the application is not running in the terminal device, the terminal device can execute the method described in the embodiment of the present application, update the unread numbers of each node in the multi-branch tree of unread numbers corresponding to the application, and when the first client of the application is running in the terminal device, in response to the display operation of the message interface, the terminal device can directly display the message interface containing the unread numbers.
[0089] It should be noted that when the client of the application is run for the first time in the terminal device, the terminal device can initialize the unread number multitree of the application and execute the steps described in the embodiment of the present application to ensure the accuracy of the unread number corresponding to each node in the unread number multitree.
[0090] In one embodiment, when the client of an application is run for the first time in a terminal device, the specific implementation method for the terminal device to initialize the unread multitree of the application can be: generating an initial unread multitree based on the message modules included in the application and the subordinate relationships of the message modules; querying and processing the message data table corresponding to each leaf node in the initial unread multitree respectively, and determining the unread numbers corresponding to each leaf node in the initial unread multitree based on the query results; determining the unread numbers corresponding to other nodes in the initial unread multitree based on the unread numbers corresponding to each leaf node in the initial unread multitree.
[0091] See also Figure 8 , which is an interactive schematic diagram of a message processing method provided in an embodiment of the present application. Figure 8 The object and the terminal device are included in the red dot management center, the nodes in the unread multitree (i.e., the message session node, the message notification node, and the interactive notification node), the local database, and the data interface. The red dot management center is used to obtain the unread number corresponding to each node in the unread multitree and display it on the message interface; the nodes in the unread multitree are determined according to the message modules included in the application and the subordinate relationship between each message module. Figure 8 Only three nodes in the unread multitree are shown as examples; the local database is used to store message data tables associated with the application; and the data interface is used to receive offline messages sent by the server of the application.
[0092] Specifically, when the terminal device runs the client of the application for the first time, that is, the object executes step S801 and starts the application, and the red dot management center in the terminal device executes step S802 and initializes the basic data of the red dot management center. After the basic data of the red dot management center is initialized, the terminal device can build an unread multi-branch tree based on the multiple message modules contained in the application and the subordinate relationship of each message module, and the red dot management center can execute step S803 and send a node initialization instruction to each node in the unread multi-branch tree. After each node in the unread multi-branch tree receives the initialization instruction, it executes step S804 and initializes the node. Specifically, after the interactive notification node receives the node initialization instruction, the unread number corresponding to the interactive notification node can be determined according to at least one leaf node of the interactive notification node and the number of unread messages in the message data table corresponding to the interactive notification node. After the message notification node receives the node initialization instruction, the unread number corresponding to the message notification node can be determined according to at least one leaf node of the message notification node and the number of unread messages in the message data table corresponding to the message notification node. After receiving the node initialization instruction, the message session node can determine the unread count corresponding to the message session node according to at least one leaf node of the message session node and the number of unread messages in the message data table corresponding to the message session node.
[0093] After determining the unread numbers corresponding to each node in the unread multitree, the nodes in the unread multitree can execute step S805 to call back the unread numbers; that is, after determining the unread numbers corresponding to each node in the unread multitree, the unread multitree sends the unread numbers corresponding to each node to the red dot management center. The red dot management center can execute step S806 to determine the total unread numbers, and transmit and display the total unread numbers externally; that is, the red dot management center can count the unread numbers corresponding to each node in the unread multitree, obtain the total unread numbers, and display the total unread numbers on the message interface.
[0094] When the client of the application is not running in the terminal device, the data interface in the terminal device can execute step S807, pull offline messages, and convert the offline messages; that is, the data interface can pull offline messages from the server of the application, or receive offline messages sent by the server, and convert the offline messages. After converting the offline messages, the data interface executes step S808, stores the converted offline messages; that is, stores the converted offline messages in the local database. Figure 8The message conversation node, message notification node and interactive notification node shown in can execute step S809 to determine whether an update is required, that is, the leaf node in the unread multitree can query its corresponding message data table to determine whether an update of the unread counts is required. If it is determined that an update is required, step S810 is executed to update the unread counts corresponding to the node; that is, the leaf node updates its stored unread counts according to the number of unread messages in its corresponding message data table; the unread counts corresponding to the ancestor node of the leaf node are also updated accordingly. After the unread counts corresponding to each node in the unread multitree are updated, step S805 can be executed again. When the terminal device runs the client of the application again, the red dot management center can execute step S806 again. Through the method provided in the embodiment of the present application, the offline update of the unread counts in the unread multitree can be realized, ensuring that when the terminal device runs the client of the application, accurate unread counts can be directly obtained based on the unread multitree, which is conducive to improving the user experience for the application.
[0095] In an embodiment of the present application, when the client is not running the application, the terminal device can receive offline messages sent by the server through the data interface, store the offline messages in the message data table, and update the unread numbers corresponding to each node in the unread multi-branch tree according to the data update of the message data table, thereby ensuring the accuracy of the unread numbers in the unread multi-branch tree, and achieving the effect of offline processing of messages, so that when the client of the application is subsequently run, the unread numbers of the message can be directly presented, which is conducive to improving the user experience of the application.
[0096] See also Fig. 9 , Fig. 9 A flowchart of another message processing method provided in an embodiment of the present application. The message processing method can be implemented by the above-mentioned terminal device 101, and the scenario corresponding to the message processing method is: when a client of an application is running in the terminal device. The flow of the message processing method provided in the embodiment of the present application includes but is not limited to:
[0097] S901: When a second client of the application is running in the terminal device, an online message for the second client sent by a server of the application is received, where the second client is any client of the application.
[0098] In the embodiment of the present application, when the second client of the application is running in the terminal device (the second client can be any client of the application), the terminal device can receive an online message for the second client sent by the server of the application through the data long link. It should be noted that the terminal device can receive one or more online messages for the second client sent by the server.
[0099] S902: Store the online message in a second message data table according to the message type of the online message, wherein the message type corresponding to the second message data table matches the message type of the online message.
[0100] In an embodiment of the present application, the terminal device can store the online message in the second message data table according to the message type of the online message, and the message type corresponding to the second message data table matches the message type of the online message. For example, if the message type of the online message is a session type, it can be determined that the second message data table is a session message data table (corresponding to the session type). In some cases, the terminal device can convert the online message (for example, normalize the online message, set the status of the online message to an unread state, etc.), and store the converted online message in the second message data table.
[0101] S903: Determine at least one to-be-processed node corresponding to the second message data table, and determine an updated unread number corresponding to the at least one to-be-processed node according to the number of unread messages in the second message data table.
[0102] In the embodiment of the present application, the terminal device can determine at least one to-be-processed node corresponding to the second message data table. Specifically, the terminal device can determine at least one to-be-processed node according to the message type of the update information (i.e., the received online message) in the second message data table. After determining the to-be-processed node, the terminal device can determine the updated unread number corresponding to the at least one to-be-processed node according to the number of unread messages in the second message data table. It should be noted that Figure 7 The scenario targeted by the embodiment shown is a client in the terminal device that does not run an application, that is, an offline scenario, so the terminal device can periodically update the unread numbers corresponding to the nodes in the unread multitree. The scenario targeted by the method provided in the embodiment of the present application is a client running an application in the terminal device, that is, an online scenario, so in order to ensure the timeliness of the update of the unread numbers, when the terminal device receives an online message, the unread numbers corresponding to the nodes in the unread multitree will be immediately updated according to the message data table.
[0103] S904: Update the unread numbers stored in the at least one to-be-processed node included in the unread number multi-branch tree to updated unread numbers corresponding to the corresponding node.
[0104] In an embodiment of the present application, the terminal device may update the unread counts stored in at least one to-be-processed node included in the unread count multitree to the updated unread counts corresponding to the corresponding node. It should be noted that after the unread counts corresponding to the to-be-updated node are updated, the unread counts corresponding to the ancestor nodes of each to-be-updated node will also be updated to ensure the accuracy of the unread counts corresponding to each node in the unread count multitree. The update process may be as shown in the embodiment in the above step S203.
[0105] S905. When a triggering event for counting the unread numbers of the first message module in the application is detected, a multi-branch tree of unread numbers corresponding to the application is obtained, at least one leaf node of the target node corresponding to the first message module in the multi-branch tree of unread numbers is determined, and the unread numbers corresponding to the target node are determined based on the unread numbers corresponding to each leaf node of the target node.
[0106] In the embodiment of the present application, when a second client of an application is running in a terminal device and a trigger event of counting the unread counts of the first message module in the application is detected, the terminal device can obtain a multi-branch tree of unread counts corresponding to the application, and determine at least one leaf node of the target node corresponding to the first message module in the multi-branch tree of unread counts. The unread counts of each leaf node object of the target node are obtained from each leaf node of the target node, and the unread counts corresponding to the target node are determined based on the unread counts corresponding to each leaf node of the target node.
[0107] In one embodiment, the message processing method provided by the embodiment of the present application may also include the following steps: when the account corresponding to the second client of the application running on the terminal device is the first account, and the account corresponding to the third client of the application running on the terminal device within a historical time period is the second account, the multi-branch tree of unread messages corresponding to the third client is deleted; and a multi-branch tree of unread messages corresponding to the second client is constructed based on the multiple message modules included in the second client of the application and the subordinate relationship of each message module.
[0108] The unread multitrees corresponding to different clients are usually different, therefore, when the client of the application program running in the same terminal device switches, it is necessary to reconstruct the unread multitree. Specifically, when the account corresponding to the second client of the application program currently running by the terminal device is the first account, and the account corresponding to the third client of the application program running by the terminal device in the historical time period (for example: the previous day) is the second account (that is, when the client of the application program running by the terminal device switches the account), the terminal device can delete the unread multitree corresponding to the third client (that is, the client of the application program running), and construct the unread multitree corresponding to the second client according to the multiple message modules contained in the second client of the application program and the subordinate relationship of each message module. Through the method provided by the embodiment of the present application, the corresponding relationship between the client and the unread multitree can be effectively guaranteed, the accuracy of the unread number can be guaranteed, and storage resources can also be effectively saved at the same time.
[0109] See also Fig.10 , which is an interactive schematic diagram of another message processing method provided in an embodiment of the present application. Fig.10 The object and the terminal device are included in the red dot management center, the nodes in the unread multi-branch tree (i.e., message session nodes, message notification nodes, and interactive notification nodes), the local database, and the data long chain. The red dot management center is used to obtain the unread numbers corresponding to each node in the unread multi-branch tree and display them on the message interface; the nodes in the unread multi-branch tree are determined according to the message modules included in the application and the subordinate relationship between each message module. Fig.10 Only three nodes in the unread multitree are shown as examples; the local database is used to store message data tables associated with the application; and the data long chain is used to receive online messages sent by the server of the application.
[0110] Specifically, when the terminal device runs the client of the application, the data long chain in the terminal device can execute step S1001, receive online messages, and convert the online messages; that is, the data long chain can receive online messages sent by the application server and convert the online messages. After converting the online messages, the data long chain executes step S1002, stores the converted online messages; that is, stores the converted online messages in the local database. Specifically, according to the message type of the converted online messages, the converted online information can be stored in the corresponding message data table. Nodes in the unread multi-branch tree (i.e. Fig.10The message conversation node, message notification node and interactive notification node shown in (shown in the unread multitree) can execute step S1003 to determine whether an update is required; that is, the leaf node in the unread multitree can query its corresponding message data table to determine whether an update of the unread number is required. If it is determined that an update is required, step S1004 is executed to update the unread number corresponding to the node; that is, the leaf node updates its stored unread number according to the number of unread messages in its corresponding message data table; the unread number corresponding to the ancestor node of the leaf node is also updated accordingly. After the unread number corresponding to each node in the unread multitree is updated, step S1005 can be executed to call back the unread number upward; that is, after determining the unread number corresponding to each node in the unread multitree, the unread multitree sends the unread number corresponding to each node to the red dot management center. The red dot management center can execute step S1006 to determine the overall unread number, and transmit and display the overall unread number externally; that is, the red dot management center can count the unread number corresponding to each node in the unread multitree, obtain the overall unread number, and display the overall unread number on the message interface. When the object executes step S1007, the terminal switching operation; that is, after switching the client of the application running in the terminal device, the red dot management center can execute step S1008, clean up the current red dot data, and reload the red dot data; that is, clean up the relevant data of the client before the switch (that is, the basic data of the red dot management center and the unread multi-branch tree corresponding to the client), and regenerate the relevant data of the client after the switch. Through the method provided by the embodiment of the present application, the online update of the unread multi-branch tree of unread numbers can be realized, ensuring that when the terminal device runs the client of the application, accurate unread numbers can be obtained in a timely manner based on the unread multi-branch tree, which is conducive to improving the user experience of the application.
[0111] In the embodiment of the present application, when the client of the application is not running, the terminal device can receive the online message sent by the server through the data long link, store the online message in the message data table, and update the unread counts corresponding to each node in the unread count multi-branch tree in real time according to the data update of the message data table, thereby ensuring the accuracy of the unread counts in the unread count multi-branch tree, and achieving the effect of online message processing. When the client of the application is running, the unread counts can be updated in time according to the operation of the object, avoiding the problems of unread count errors, untimely updates, etc., which is conducive to improving the user experience of the application; at the same time, when the client of the application is switched, the original unread count multi-branch tree can be deleted and a new unread count multi-branch tree can be constructed. While ensuring the matching of the unread count multi-branch tree with the client, storage resources can be effectively saved.
[0112] An embodiment of the present application further provides a computer storage medium, in which program instructions are stored. When the program instructions are executed, they are used to implement the corresponding methods described in the above embodiments.
[0113] See also Fig.11 , Fig.11 It is a structural diagram of a message processing device provided in an embodiment of the present application.
[0114] In one implementation of the message processing device of an embodiment of the present application, the message processing device includes the following structure.
[0115] The acquisition unit 1101 is used to acquire a multi-branch tree of unread numbers corresponding to the application when a trigger event of unread numbers of a first message module in the statistical application is detected, wherein the multi-branch tree of unread numbers is constructed according to a plurality of message modules included in the application and a subordinate relationship between the message modules;
[0116] A determining unit 1102 is configured to determine at least one leaf node of a target node corresponding to the first message module in the unread multitree according to a connection relationship between nodes in the unread multitree;
[0117] The acquisition unit 1101 is further configured to acquire, from each leaf node of the target node, an unread number corresponding to each leaf node of the target node, wherein the unread number corresponding to the leaf node is determined according to the number of unread messages in the message data table corresponding to the leaf node;
[0118] The determining unit 1102 is further configured to determine the unread numbers corresponding to the target node according to the unread numbers corresponding to each leaf node of the target node.
[0119] In one embodiment, the message processing device further includes a display unit 1103, and the display unit 1103 is further configured to perform the following steps:
[0120] Determining a display area of unread numbers of the first message module according to a position of the first message module in the message interface;
[0121] The display area in the message interface displays unread counts of the target node.
[0122] In one embodiment, the trigger event includes one or more of the following: receiving a display request for a message interface including the first message module, receiving a request for obtaining unread numbers of the first message module sent by a server, and a change in the message data table corresponding to the leaf node of the target node.
[0123] In one embodiment, the acquisition unit 1101 is further configured to perform the following steps:
[0124] If it is detected that any message data table is updated, determining the first node corresponding to the updated message in any message data table;
[0125] Determining at least one ancestor node of the first node in the unread multi-branch tree;
[0126] The first node and the at least one ancestor node are traversed in order from a low level to a high level in the multi-branch tree of unread counts, and the unread counts corresponding to the currently traversed node are updated according to the updated unread counts corresponding to the node traversed last time, to obtain the updated unread counts corresponding to the currently traversed node, until the traversal is completed, and the updated unread counts corresponding to the first node are determined based on the update message in any one of the message data tables.
[0127] In one embodiment, the acquisition unit 1101 is further configured to perform the following steps:
[0128] Obtain a message data table corresponding to a target leaf node, wherein the target leaf node is any leaf node in the unread multitree;
[0129] Querying the unread messages corresponding to the target leaf node from the message data table corresponding to the target leaf node, and determining the number of unread messages corresponding to the target leaf node according to the number of the queried unread messages;
[0130] The unread count stored in the target leaf node is updated to the determined unread count.
[0131] In one embodiment, when the acquisition unit 1101 is used to acquire the message data table corresponding to the target leaf node, it is specifically used to perform the following steps:
[0132] Obtain the message type of the second message module corresponding to the target leaf node;
[0133] Determine the message data table corresponding to the message type of the second message module according to the correspondence between the message type and the message data table;
[0134] Determine that the message data table corresponding to the target leaf node is the message data table corresponding to the message type of the second message module.
[0135] In one embodiment, the method is applied in a terminal device, and the determining unit 1102 is further configured to perform the following steps:
[0136] When the client of the application is not running in the terminal device, receiving one or more offline messages for a first client sent by a server of the application, where the first client is a client of the application running in the terminal device within a historical time period;
[0137] According to the message type of the offline message, the one or more offline messages are stored in a first message data table, wherein the message type corresponding to the first message data table matches the message type of the offline message;
[0138] When the unread count update period is reached, determining at least one to-be-updated node corresponding to the first message data table, and determining an updated unread count corresponding to the at least one to-be-updated node according to the number of unread messages in the first message data table;
[0139] The unread count stored in the at least one to-be-updated node included in the unread count multitree is updated to the updated unread count corresponding to the corresponding node.
[0140] In one embodiment, the method is applied in a terminal device, and the determining unit 1102 is further configured to perform the following steps:
[0141] When a second client of the application is running in the terminal device, receiving an online message for the second client sent by a server of the application, the second client being any client of the application;
[0142] According to the message type of the online message, the online message is stored in a second message data table, wherein the message type corresponding to the second message data table matches the message type of the online message;
[0143] Determine at least one to-be-processed node corresponding to the second message data table, and determine an updated unread number corresponding to the at least one to-be-processed node according to the number of unread messages in the second message data table;
[0144] The unread numbers stored in the at least one to-be-processed node included in the unread number multitree are updated to updated unread numbers corresponding to the corresponding node.
[0145] In one embodiment, the determining unit 1102 is further configured to perform the following steps:
[0146] When the account corresponding to the second client of the application program run by the terminal device is the first account, and the account corresponding to the third client of the application program run by the terminal device within the historical time period is the second account, deleting the unread multi-fork tree corresponding to the third client;
[0147] A multi-branch tree of unread numbers corresponding to the second client is constructed according to a plurality of message modules included in the second client of the application and the subordinate relationship between the message modules.
[0148] In one embodiment, the display unit 1103 is further configured to perform the following steps:
[0149] Displaying the pending messages contained in the first message module, the pending messages are stored in a third message data table, the status of the pending messages is unread, and the third message data table is a message data table corresponding to the leaf node of the target node;
[0150] In response to the display operation for the pending message, the status of the pending message in the third message data table is updated to a read status, and an updated third message data table is obtained. The number of unread messages contained in the updated third message data table is used to determine the number of unread messages corresponding to the leaf node of the target node.
[0151] The message processing device provided by the embodiment of the present application can obtain the multi-branch tree of unread counts corresponding to the application when a trigger event of unread counts of the first message module in the statistical application is detected, and the unread counts of the first message module are determined through the multi-branch tree of unread counts, which greatly shortens the processing flow of unread counts, reduces redundant data, improves the efficiency of determining unread counts, and is also conducive to improving the accuracy of unread counts, avoiding problems such as unread count errors and slow updates, and effectively improving the user experience for the application; the multi-branch tree can be used to reflect the unread counts involved in multiple message modules in the application and the subordinate relationships of each message module, has good scalability, and effectively reduces maintenance costs; when determining the unread counts corresponding to a leaf node, it is only necessary to find the corresponding message data table without traversing all message data tables associated with the application, which can further improve the efficiency of determining the unread counts.
[0152] Based on the above method and device embodiments, the present application embodiment provides a computer device. Fig.12 , Fig.12 A structural block diagram of a computer device provided in an embodiment of the present application. Fig.12 The computer device shown can be the above Figure 1 The terminal device 101 in. Fig.12 The computer device shown includes at least a processor 1201, an input interface 1202, an output interface 1203, and a computer-readable storage medium 1204. The processor 1201, the input interface 1202, the output interface 1203, and the computer-readable storage medium 1204 may be connected via a bus or other means.
[0153] The computer-readable storage medium 1204 may be stored in a memory of a computer device. The computer-readable storage medium 1204 is used to store a computer program. The computer program includes program instructions (such as Fig.12The processor 1201 is used to execute the computer program stored in the computer-readable storage medium 1204. The processor 1201 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing the computer program, specifically suitable for loading and executing the computer program to implement the corresponding method flow or corresponding function.
[0154] The embodiment of the present application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the operating system of the computer device. In addition, a computer program suitable for being loaded and executed by a processor is also stored in the storage space. It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory (Non-Volatile Memory), such as at least one disk storage; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.
[0155] In a specific implementation, the processor 1201 may load and execute a computer program stored in the computer-readable storage medium 1204 to implement the corresponding steps in the above message processing method. In a specific implementation, the computer program in the computer-readable storage medium 1204 is loaded by the processor 1201 and executes the following steps:
[0156] When a trigger event of unread numbers of a first message module in a statistical application is detected, a multi-branch tree of unread numbers corresponding to the application is obtained, wherein the multi-branch tree of unread numbers is constructed according to a plurality of message modules included in the application and the subordinate relationship between the message modules;
[0157] Determine at least one leaf node of the target node corresponding to the first message module in the unread multitree according to the connection relationship between the nodes in the unread multitree;
[0158] Acquire, from each leaf node of the target node, an unread number corresponding to each leaf node of the target node, wherein the unread number corresponding to the leaf node is determined according to the number of unread messages in the message data table corresponding to the leaf node;
[0159] The unread numbers corresponding to the target node are determined according to the unread numbers corresponding to each leaf node of the target node.
[0160] In one embodiment, when the computer program in the computer-readable storage medium 1204 is loaded and executed by the processor 1201, it is also used to perform the following steps:
[0161] Determining a display area of unread numbers of the first message module according to a position of the first message module in the message interface;
[0162] The display area in the message interface displays unread counts of the target node.
[0163] In one embodiment, the trigger event includes one or more of the following: receiving a display request for a message interface including the first message module, receiving a request for obtaining unread numbers of the first message module sent by a server, and a change in the message data table corresponding to the leaf node of the target node.
[0164] In one embodiment, when the computer program in the computer-readable storage medium 1204 is loaded and executed by the processor 1201, it is also used to perform the following steps:
[0165] If it is detected that any message data table is updated, determining the first node corresponding to the updated message in any message data table;
[0166] Determining at least one ancestor node of the first node in the unread multi-branch tree;
[0167] The first node and the at least one ancestor node are traversed in order from a low level to a high level in the multi-branch tree of unread counts, and the unread counts corresponding to the currently traversed node are updated according to the updated unread counts corresponding to the node traversed last time, to obtain the updated unread counts corresponding to the currently traversed node, until the traversal is completed, and the updated unread counts corresponding to the first node are determined based on the update message in any one of the message data tables.
[0168] In one embodiment, when the computer program in the computer-readable storage medium 1204 is loaded and executed by the processor 1201, it is also used to perform the following steps:
[0169] Obtain a message data table corresponding to a target leaf node, wherein the target leaf node is any leaf node in the unread multitree;
[0170] Querying the unread messages corresponding to the target leaf node from the message data table corresponding to the target leaf node, and determining the number of unread messages corresponding to the target leaf node according to the number of the queried unread messages;
[0171] The unread count stored in the target leaf node is updated to the determined unread count.
[0172] In one embodiment, when the computer program in the computer-readable storage medium 1204 is loaded and executed by the processor 1201 to obtain the message data table corresponding to the target leaf node, it is specifically used to perform the following steps:
[0173] Obtain the message type of the second message module corresponding to the target leaf node;
[0174] Determine the message data table corresponding to the message type of the second message module according to the correspondence between the message type and the message data table;
[0175] Determine that the message data table corresponding to the target leaf node is the message data table corresponding to the message type of the second message module.
[0176] In one embodiment, the method is applied in a terminal device, and when the computer program in the computer-readable storage medium 1204 is loaded and executed by the processor 1201, it is also used to perform the following steps:
[0177] When the client of the application is not running in the terminal device, receiving one or more offline messages for a first client sent by a server of the application, where the first client is a client of the application running in the terminal device within a historical time period;
[0178] According to the message type of the offline message, the one or more offline messages are stored in a first message data table, wherein the message type corresponding to the first message data table matches the message type of the offline message;
[0179] When the unread count update period is reached, determining at least one to-be-updated node corresponding to the first message data table, and determining an updated unread count corresponding to the at least one to-be-updated node according to the number of unread messages in the first message data table;
[0180] The unread count stored in the at least one to-be-updated node included in the unread count multitree is updated to the updated unread count corresponding to the corresponding node.
[0181] In one embodiment, the method is applied in a terminal device, and when the computer program in the computer-readable storage medium 1204 is loaded and executed by the processor 1201, it is also used to perform the following steps:
[0182] When a second client of the application is running in the terminal device, receiving an online message for the second client sent by a server of the application, the second client being any client of the application;
[0183] According to the message type of the online message, the online message is stored in a second message data table, wherein the message type corresponding to the second message data table matches the message type of the online message;
[0184] Determine at least one to-be-processed node corresponding to the second message data table, and determine an updated unread number corresponding to the at least one to-be-processed node according to the number of unread messages in the second message data table;
[0185] The unread numbers stored in the at least one to-be-processed node included in the unread number multitree are updated to updated unread numbers corresponding to the corresponding node.
[0186] In one embodiment, when the computer program in the computer-readable storage medium 1204 is loaded and executed by the processor 1201, it is also used to perform the following steps:
[0187] When the account corresponding to the second client of the application program run by the terminal device is the first account, and the account corresponding to the third client of the application program run by the terminal device within the historical time period is the second account, deleting the unread multi-fork tree corresponding to the third client;
[0188] A multi-branch tree of unread numbers corresponding to the second client is constructed according to a plurality of message modules included in the second client of the application and the subordinate relationship between the message modules.
[0189] In one embodiment, when the computer program in the computer-readable storage medium 1204 is loaded and executed by the processor 1201, it is also used to perform the following steps:
[0190] Displaying the pending messages contained in the first message module, the pending messages are stored in a third message data table, the status of the pending messages is unread, and the third message data table is a message data table corresponding to the leaf node of the target node;
[0191] In response to the display operation for the pending message, the status of the pending message in the third message data table is updated to a read status, and an updated third message data table is obtained. The number of unread messages contained in the updated third message data table is used to determine the number of unread messages corresponding to the leaf node of the target node.
[0192] The computer device provided by the embodiment of the present application can obtain a multi-branch tree of unread counts corresponding to the application when a trigger event of unread counts of the first message module in the statistical application is detected, and the unread counts of the first message module are determined through the multi-branch tree of unread counts, which greatly shortens the processing flow of unread counts, reduces redundant data, improves the efficiency of determining unread counts, and is also conducive to improving the accuracy of unread counts, avoiding problems such as unread count errors and slow updates, and effectively improving the user experience for the application; the multi-branch tree can be used to reflect the unread counts involved in multiple message modules in the application and the subordinate relationships of each message module, has good scalability, and effectively reduces maintenance costs; when determining the unread counts corresponding to a leaf node, it is only necessary to find the corresponding message data table without traversing all message data tables associated with the application, which can further improve the efficiency of determining the unread counts.
[0193] The embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored, and when the computer instructions are executed on a computer device, the computer device executes the steps in the method embodiments of the present application to implement the message processing method provided by the embodiment of the present application. The specific implementation method can be referred to the above description, which will not be repeated here.
[0194] The embodiment of the present application also provides a computer program product, which includes a computer program or a computer instruction, and the computer program or the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer program or the computer instruction from the computer-readable storage medium, and the processor executes the computer program or the computer instruction, so that the computer device executes the steps in the embodiments of the present application to implement the message processing method provided in the embodiment of the present application. The specific implementation method can be referred to the above description, which will not be repeated here.
[0195] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can 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. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted by a computer-readable storage medium. The computer instructions can be transmitted from a website site, a computer, a server or a data center to another website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
[0196] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technical object familiar with the technical field within the technical scope disclosed in the present application can be easily thought of for changes or replacements, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A message processing method, characterized in that: The method comprises: When a trigger event of unread numbers of a first message module in a statistical application is detected, a multi-branch tree of unread numbers corresponding to the application is obtained, wherein the multi-branch tree of unread numbers is constructed according to a plurality of message modules included in the application and the subordinate relationship between the message modules; Determine at least one leaf node of the target node corresponding to the first message module in the unread multitree according to the connection relationship between the nodes in the unread multitree; Acquire, from each leaf node of the target node, an unread number corresponding to each leaf node of the target node, wherein the unread number corresponding to the leaf node is determined according to the number of unread messages in the message data table corresponding to the leaf node; The unread numbers corresponding to the target node are determined according to the unread numbers corresponding to each leaf node of the target node.
2. The method according to claim 1, characterized in that The method further comprises: Determining a display area of unread numbers of the first message module according to a position of the first message module in the message interface; The display area in the message interface displays unread counts of the target node.
3. The method according to claim 1, characterized in that The trigger event includes one or more of the following: receiving a display request for a message interface including the first message module, receiving a request for obtaining unread numbers of the first message module sent by a server, and a change in the message data table corresponding to the leaf node of the target node.
4. The method according to claim 1, characterized in that The method further comprises: If it is detected that any message data table is updated, determining the first node corresponding to the updated message in any message data table; Determining at least one ancestor node of the first node in the unread multi-branch tree; The first node and the at least one ancestor node are traversed in order from a low level to a high level in the multi-branch tree of unread counts, and the unread counts corresponding to the currently traversed node are updated according to the updated unread counts corresponding to the node traversed last time, to obtain the updated unread counts corresponding to the currently traversed node, until the traversal is completed, and the updated unread counts corresponding to the first node are determined based on the update message in any one of the message data tables.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Obtain a message data table corresponding to a target leaf node, wherein the target leaf node is any leaf node in the unread multitree; Querying the unread messages corresponding to the target leaf node from the message data table corresponding to the target leaf node, and determining the number of unread messages corresponding to the target leaf node according to the number of the queried unread messages; The unread count stored in the target leaf node is updated to the determined unread count.
6. The method according to claim 5, characterized in that The step of obtaining the message data table corresponding to the target leaf node includes: Obtain the message type of the second message module corresponding to the target leaf node; Determine the message data table corresponding to the message type of the second message module according to the correspondence between the message type and the message data table; Determine that the message data table corresponding to the target leaf node is the message data table corresponding to the message type of the second message module.
7. The method according to any one of claims 1 to 4, characterized in that: The method is applied in a terminal device, and the method further includes: When the client of the application is not running in the terminal device, receiving one or more offline messages for a first client sent by a server of the application, where the first client is a client of the application running in the terminal device within a historical time period; According to the message type of the offline message, the one or more offline messages are stored in a first message data table, wherein the message type corresponding to the first message data table matches the message type of the offline message; When the unread count update period is reached, determining at least one to-be-updated node corresponding to the first message data table, and determining an updated unread count corresponding to the at least one to-be-updated node according to the number of unread messages in the first message data table; The unread count stored in the at least one to-be-updated node included in the unread count multitree is updated to the updated unread count corresponding to the corresponding node.
8. The method according to any one of claims 1 to 4, characterized in that: The method is applied in a terminal device, and the method further includes: When a second client of the application is running in the terminal device, receiving an online message for the second client sent by a server of the application, the second client being any client of the application; According to the message type of the online message, the online message is stored in a second message data table, wherein the message type corresponding to the second message data table matches the message type of the online message; Determine at least one to-be-processed node corresponding to the second message data table, and determine an updated unread number corresponding to the at least one to-be-processed node according to the number of unread messages in the second message data table; The unread numbers stored in the at least one to-be-processed node included in the unread number multitree are updated to updated unread numbers corresponding to the corresponding node.
9. The method according to claim 8, characterized in that The method further comprises: When the account corresponding to the second client of the application program run by the terminal device is the first account, and the account corresponding to the third client of the application program run by the terminal device within the historical time period is the second account, deleting the unread multi-fork tree corresponding to the third client; A multi-branch tree of unread numbers corresponding to the second client is constructed according to a plurality of message modules included in the second client of the application and the subordinate relationship between the message modules.
10. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Displaying the pending messages contained in the first message module, the pending messages are stored in a third message data table, the status of the pending messages is unread, and the third message data table is a message data table corresponding to the leaf node of the target node; In response to the display operation for the pending message, the status of the pending message in the third message data table is updated to a read status, and an updated third message data table is obtained. The number of unread messages contained in the updated third message data table is used to determine the number of unread messages corresponding to the leaf node of the target node.
11. A message processing device, characterized in that: include: An acquisition unit is used to acquire a multi-branch tree of unread numbers corresponding to the application when a trigger event of unread numbers of a first message module in the statistical application is detected, wherein the multi-branch tree of unread numbers is constructed according to a plurality of message modules included in the application and a subordinate relationship between the message modules; A determining unit, configured to determine at least one leaf node of a target node corresponding to the first message module in the unread multitree according to a connection relationship between nodes in the unread multitree; The acquisition unit is further used to acquire, from each leaf node of the target node, the unread count corresponding to each leaf node of the target node, wherein the unread count corresponding to the leaf node is determined according to the number of unread messages in the message data table corresponding to the leaf node; The determining unit is further configured to determine the unread numbers corresponding to the target node according to the unread numbers corresponding to each leaf node of the target node.
12. A computer device, characterized in that: The computer device comprises: a processor suitable for implementing a computer program; A computer-readable storage medium storing a computer program, wherein the computer program is suitable for being loaded by the processor and implementing the message processing method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and implementing the message processing method according to any one of claims 1 to 10.
14. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the message processing method according to any one of claims 1 to 10 is implemented.
