CN110932966A - Message processing method and device, computer storage medium and electronic equipment - Google Patents
Message processing method and device, computer storage medium and electronic equipment Download PDFInfo
- Publication number
- CN110932966A CN110932966A CN201911251226.8A CN201911251226A CN110932966A CN 110932966 A CN110932966 A CN 110932966A CN 201911251226 A CN201911251226 A CN 201911251226A CN 110932966 A CN110932966 A CN 110932966A
- Authority
- CN
- China
- Prior art keywords
- message
- interval
- message interval
- identifier
- messages
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/04—Real-time or near real-time messaging, e.g. instant messaging [IM]
- H04L51/043—Real-time or near real-time messaging, e.g. instant messaging [IM] using or handling presence information
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/21—Monitoring or handling of messages
- H04L51/216—Handling conversation history, e.g. grouping of messages in sessions or threads
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/52—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail for supporting social networking services
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The disclosure relates to the field of computers, and provides a message processing method, a message processing device, a readable medium and electronic equipment, wherein the method comprises the following steps: responding to the login operation of a user, and receiving a message signal at the current moment, wherein the message signal is used for indicating a session for receiving an offline message; acquiring a first preset number of first messages in a session, and determining a first message interval of the first messages; responding to the message viewing operation of the user, and acquiring a second message corresponding to a second message interval continuous with the first message interval; acquiring a third message interval in the local database, wherein the third message interval is a message interval corresponding to a message received by the user during previous login; and judging whether the second message interval and the third message interval have intersection or not, and performing target operation on the second message interval according to the judgment result. According to the method and the system, the timeline of the message is tracked through message interval fusion, the problem of repeated request of a data interface is solved, the load of the server is effectively reduced, and the user experience is improved.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a message processing method, a message processing apparatus, a computer-readable storage medium, and an electronic device.
Background
With the development of the mobile internet technology, in numerous application software, a lot of functions for providing instant messaging chat sessions exist, but in a scene with poor network signals, the situation of jamming or long-time page empty can occur, and the user experience is seriously influenced.
In the prior art, all unread session message signals are loaded to the local in the background in advance, and when a user enters a session, the unread messages are directly acquired locally and displayed on a session interface. However, if there are tens of thousands of message data, when the message data is loaded through the interface in the background, threads of the thread pool are occupied, and some background threads are affected and delayed.
In view of the above, there is a need in the art to develop a new message processing method and apparatus.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure is directed to a message processing method, a message processing apparatus, a computer-readable storage medium, and an electronic device, and further to a problem that a message loading is stuck or a long-time chat session page is empty due to weak network signals at least to some extent.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the present disclosure, there is provided a message processing method, the method including: responding to the login operation of a user, and receiving a message signal at the current moment, wherein the message signal is used for indicating a session for receiving an offline message; acquiring a first preset number of first messages in the session, and determining a first message interval of the first messages, wherein the first message interval is a message interval formed by a maximum message identifier and a minimum message identifier in the first messages; responding to the message viewing operation of the user, and acquiring a second message corresponding to a second message interval continuous with the first message interval; acquiring a third message interval in a local database, wherein the third message interval is a message interval corresponding to a message received when the user logs in last time; and judging whether the second message interval and the third message interval have intersection or not, and performing target operation on the second message interval according to a judgment result.
In some exemplary embodiments of the present disclosure, performing a target operation on the second message interval according to the determination result includes: if the second message interval and the third message interval have an intersection, performing message interval fusion on the second message interval and the third message interval, and replacing the third message interval with the fused message interval; and if the second message interval does not intersect with the third message interval, recording the second message interval in the local database.
In some exemplary embodiments of the present disclosure, the minimum message identifier in the third message interval is less than or equal to the minimum message identifier in the second message interval, and the maximum message identifier in the third message interval is greater than or equal to the minimum message identifier in the second message interval; performing message interval fusion on the second message interval and the third message interval, and replacing the third message interval with the fused message interval, including: merging the second message interval and the third message interval to form a fourth message interval, wherein the minimum message identifier of the third message interval is the minimum message identifier of the fourth message interval, and the maximum message identifier of the second message interval is the maximum message identifier of the fourth message interval; replacing the third message interval with the fourth message interval.
In some exemplary embodiments of the present disclosure, the obtaining, in response to a message viewing operation of a user, a second message corresponding to a second message interval consecutive to the first message interval includes: responding to a first message viewing operation of the user in the session, and inquiring whether a second message interval continuous with the first message interval exists in the local database; if the second message interval exists, reading a second message corresponding to the second message interval from the local database; and if the first message does not exist, acquiring the second message from the server according to the minimum message identifier corresponding to the first message.
In some exemplary embodiments of the present disclosure, reading a second message corresponding to the second message interval from the local database includes: judging whether the number of the second messages reaches a second preset number or not; if the second preset number is reached, reading second messages of the second preset number from the local database according to the second message interval; and if the second preset number is not reached, reading the second message from the local database according to the second message interval, determining a target number according to the number of the second message and the second preset number, and acquiring the messages of the target number continuous with the second message interval from the server.
In some exemplary embodiments of the present disclosure, a minimum message identification in the second message interval is less than or equal to a minimum message identification in the first message interval, and a maximum message identification in the second message interval is greater than or equal to the minimum message identification in the first message interval; the method further comprises the following steps: merging the first message interval and the second message interval to form a fifth message interval, wherein the minimum message identifier of the second message interval is the minimum message identifier of the fifth message interval, and the maximum message identifier of the first message interval is the maximum message identifier of the fifth message interval; recording the fifth message interval in the local database.
In some exemplary embodiments of the present disclosure, the obtaining, in response to a message viewing operation of a user, a second message corresponding to a second message interval consecutive to the first message interval includes: and responding to a second message viewing operation of the user in the session, and acquiring the second message from a server according to the maximum message identifier corresponding to the first message.
In some exemplary embodiments of the present disclosure, a minimum message identification in the first message interval is less than or equal to a minimum message identification in the second message interval, and a maximum message identification in the first message interval is greater than or equal to the minimum message identification in the second message interval; the method further comprises the following steps: merging the first message interval and the second message interval to form a sixth message interval, wherein a minimum message identifier of the first message interval is a minimum message identifier of the sixth message interval, and a maximum message identifier of the second message interval is a maximum message identifier of the sixth message interval; recording the sixth message interval in the local database.
In some exemplary embodiments of the present disclosure, the method further comprises: judging whether an intersection exists between the first message interval and the third message interval; if the first message interval and the third message interval have an intersection, performing message interval fusion on the first message interval and the third message interval, and replacing the third message interval with the fused message interval; and if the intersection does not exist between the first message interval and the third message interval, recording the first message interval in the local database.
In some exemplary embodiments of the present disclosure, before acquiring the first preset number of first messages in the session, the method further comprises: inquiring whether a first message identification corresponding to the message signal exists in the local database; if yes, acquiring the first messages with the first preset quantity from the local database; and if the first message identification does not exist, acquiring a first preset number of first messages corresponding to the first message identification from a server according to the first message identification.
According to an aspect of the present disclosure, there is provided a message processing apparatus including: the receiving signal module is used for responding to the login operation of a user and receiving a message signal at the current moment, wherein the message signal is used for indicating a session of an offline message to be received; an obtaining message module, configured to obtain a first preset number of first messages in the session, and determine a first message interval of the first messages, where the first message interval is a message interval formed by a maximum message identifier and a minimum message identifier in the first messages; the response operation module is used for responding to the message viewing operation of the user and acquiring a second message corresponding to a second message interval continuous with the first message interval; the acquisition interval module is used for acquiring a third message interval in a local database, wherein the third message interval is a message interval corresponding to a message received by the user during previous login; and the target operation module is used for judging whether an intersection exists between the second message interval and the third message interval or not and carrying out target operation on the second message interval according to a judgment result.
According to an aspect of the present disclosure, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the messaging method as described in the above embodiments.
According to an aspect of the present disclosure, there is provided an electronic device including: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the message method as described in the above embodiments.
According to the technical scheme, the message method and device, the computer-readable storage medium and the electronic device in the exemplary embodiments of the disclosure have at least the following advantages and positive effects:
in the technical solutions provided in some embodiments of the present disclosure, first, a first preset number of first messages in a session are obtained by receiving a message signal at a current time, and a first message interval of the first messages is determined; then, responding to the message viewing operation of the user, and acquiring a second message corresponding to a second message interval continuous with the first message interval; and finally, performing target operation on the second message interval and a third message interval in the local database. According to the message processing method, on one hand, the latest preset number of messages can be silently loaded in the background according to the received message signals, the process of entering a session interface to wait for data loading is avoided, and the use experience of a user is improved in the environment with a weak network; on the other hand, by only loading the fixed preset number of messages, the problem that the system resources are occupied due to the fact that the number of the loaded messages is too large is solved, influence on other threads in the system is avoided, and the system resources are effectively utilized; on the other hand, by performing target operation on the message interval, the problem that whether the interface needs to be requested to acquire message data cannot be judged after the discontinuous message is loaded in advance is solved, the load of the server is reduced, and the message processing time is saved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
Fig. 1 schematically shows a flow diagram of a message processing method according to an embodiment of the present disclosure;
fig. 2 schematically shows a schematic diagram of a system architecture for performing a message processing method according to an embodiment of the present disclosure;
FIG. 3 schematically shows a block diagram of a message processing apparatus according to an embodiment of the present disclosure;
FIG. 4 schematically shows a block schematic diagram of an electronic device according to an embodiment of the present disclosure;
fig. 5 schematically shows a program product schematic according to an embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
In the related art in the field, for the problem that a message loading is stuck or a long chat session page is empty due to weak network signals, the following three solutions exist:
firstly, before entering a chat session page, no operation is performed, after entering the chat session page, a certain number of latest messages are acquired, then a message viewing operation of a user is responded, and a message identifier of the oldest message displayed in the chat session page is used for requesting a data interface, so that historical messages are acquired from a server. However, since data is not preloaded to the local, a user needs to wait to acquire all unread message data after entering a chat session page, and if the acquired data volume is large, the phenomenon that the user waits for a long time occurs, which affects user experience.
Secondly, after a user logs in the application, the unread messages are loaded to the local as long as the unread session message signals are received, and when the user enters a chat session page, the unread messages are directly obtained in a local database. However, if the number of unread messages is too large, the running resources of the system are occupied when loading in the background, and some background threads are affected and delayed. Furthermore, if the user never clicks on a chat session page that has already been loaded with a large number of unread messages, it makes no sense to the loading process of the unread messages in the session.
Thirdly, when logging in the application and receiving the unread session message signal each time, only the latest messages are loaded to the local in advance, and when the user enters the chat session page, the latest messages can be seen, so that the message loading time is shortened. However, the message identifier of the message is usually a non-continuous ascending number uniformly generated by the server, so that if the user starts the application and logs in for many times, the system will pre-load part of the offline message, but when the user enters the chat session page, it is not possible to confirm whether the message interval displayed in the session is continuous, and the interface has to be requested again to obtain the message data, which may cause waste of resources and increase the pressure of the server.
Based on the problems in the related art, a message processing method is proposed in one embodiment of the present disclosure. Fig. 1 shows a flow diagram of a message processing method, which, as shown in fig. 1, at least comprises the following steps:
step S110: responding to the login operation of a user, and receiving a message signal at the current moment, wherein the message signal is used for indicating a session for receiving an offline message;
step S120: acquiring a first preset number of first messages in a session, and determining a first message interval of the first messages, wherein the first message interval is a message interval formed by a maximum message identifier and a minimum message identifier in the first messages;
step S130: responding to the message viewing operation of the user, and acquiring a second message corresponding to a second message interval continuous with the first message interval;
step S140: acquiring a third message interval in the local database, wherein the third message interval is a message interval corresponding to a message received by the user during previous login;
step S150: and judging whether the second message interval and the third message interval have intersection or not, and performing target operation on the second message interval according to the judgment result.
According to the message processing method in the embodiment of the disclosure, on one hand, the latest preset number of messages can be silently loaded in the background according to the received message signals, so that the process of entering a session interface to wait for data loading is avoided, and the use experience of a user is improved in the environment with a weak network; on the other hand, by only loading the fixed preset number of messages, the problem that the system resources are occupied due to the fact that the number of the loaded messages is too large is solved, influence on other threads in the system is avoided, and the system resources are effectively utilized; on the other hand, by performing target operation on the message interval, the problem that whether the interface is required to acquire message data cannot be judged after discontinuous messages are loaded in advance is solved, the load of a server is reduced, and the message processing time is saved.
Fig. 2 shows a schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of the present disclosure can be applied. As shown in fig. 2, the system architecture may include a terminal device 201, and the terminal device 201 may receive and respond to various operations of a user on one hand, and may send a request to the server 202 to obtain data from the server 202 by calling a data interface of the server 202 on the other hand. The terminal device 201 may be various electronic devices with a processor, including but not limited to a smart phone, a tablet computer, a portable computer, a desktop computer, and the like. The system architecture further includes a server 202, where the server 202 may be a server cluster formed by a plurality of servers 202, and the server 202 may receive request information sent by the terminal device 201, respond to the request information, and return data corresponding to the request information to the terminal device 201.
It should be noted that the message processing method provided by the embodiment of the present disclosure is generally executed by the terminal device 201, and accordingly, the message processing apparatus is generally disposed in the terminal device 201. However, in other embodiments of the present disclosure, the server 202 may also have similar functions to the terminal device 201, so as to execute the message processing method provided by the embodiments of the present disclosure.
In order to make the technical solution of the present disclosure clearer, each step of the message processing method is explained next.
In step S110, a user logs in, and a message signal indicating a session to receive an offline message at the current time is received.
In an exemplary embodiment of the present disclosure, a user starts an application at a terminal device 201 and logs in an account, and the terminal device 201 receives a login account operation of the user, establishes an information transfer mechanism of a long connection, and receives a message signal at a current time, where the message signal includes an offline message signal and a real-time message signal, and the offline message signal includes the number of unread messages in a current message session and a latest message identifier of a latest unread message in each message session. The message identification may be a string of digits, the message identification of the new message being larger than the message identification of the old message.
In step S120, a first preset number of first messages in the session are obtained, and a first message interval of the first messages is determined, where the first message interval is a message interval formed by a maximum message identifier and a minimum message identifier in the first messages.
In an exemplary embodiment of the present disclosure, before a first preset number of first messages in a session are acquired, whether a first message identifier corresponding to a message signal exists in a local database is queried, wherein the first message identifier is a latest message identifier. Specifically, the received latest message identifier is utilized, and whether a message interval corresponding to the latest message identifier exists is inquired in a local database according to the latest message identifier. If a message interval corresponding to the latest message identifier exists in the local database, acquiring a first preset number of first messages in the local database, and displaying the first preset number of first messages on a chat session page after receiving that a user enters the chat session page; if the message interval corresponding to the latest message identifier does not exist in the local database, according to the latest message identifier, a first preset number of first messages corresponding to the latest message identifier are acquired by calling a data interface of the server 202, the first messages are stored in the local database, and after a user enters the chat session page, the first preset number of first messages are displayed on the chat session page. The first preset number may be specifically set according to an actual situation, and the disclosure does not specifically limit this.
It should be noted that the local database at least includes a message database and a message interval database, and stores the message content corresponding to the message in the message database according to the sequence of the message identifier, and stores the message interval corresponding to the message in the message interval database.
In an exemplary embodiment of the present disclosure, after the first message and the first message interval corresponding to the first message are acquired by the server 202, the message interval in the local database is traversed, where the message interval in the local database may be all message intervals in a session corresponding to the first message in the local database. Judging whether the first message interval and the message interval in the local database have intersection, and if the first message interval and the message interval in the local database have intersection, performing interval fusion on the first message interval and the message interval in the local database; and if the first message interval does not intersect with the message interval in the local database, recording the first message interval in the local database according to the sequence of the first message identifier.
In step S130, in response to the message viewing operation of the user, a second message corresponding to a second message interval consecutive to the first message interval is acquired.
In an exemplary embodiment of the present disclosure, the message viewing operation of the user may include a slide-up operation of the user, which acquires a real-time message in a conversation, and a pull-down operation of the user, which acquires a history message in the conversation. The message viewing operation of the user may also be that the user selects to view a real-time message or a historical message by a click operation, which is not specifically limited by the present disclosure.
In an exemplary embodiment of the present disclosure, acquiring, in response to a message viewing operation of a user, a second message corresponding to a second message interval consecutive to a first message interval includes: responding to a first message viewing operation of a user in the conversation, wherein the first message viewing operation comprises a pull-down operation or a click viewing history message operation. Inquiring whether a second message interval continuous with the first message interval exists in the local database; if a second message interval continuous with the first message interval exists in the local database, reading a second message corresponding to the second message interval from the local database, and displaying the second message in a chat session page; if a second message interval continuous with the first message interval does not exist in the local database, the second message is acquired from the server 202 according to the minimum message identifier corresponding to the first message, stored in the local database and displayed in the chat session page.
In an exemplary embodiment of the present disclosure, the minimum message identification in the second message interval is less than or equal to the minimum message identification in the first message interval, and the maximum message identification in the second message interval is greater than or equal to the minimum message identification in the first message interval. After the second message interval and the second message are obtained, the second message interval and the first message interval are subjected to interval fusion, and the fused message interval is recorded in the local database, specifically, the first message interval and the second message interval are combined to form a fifth message interval, and the fifth message interval is recorded in the local database. The minimum message identifier of the second message interval is the minimum message identifier of the fifth message interval, and the maximum message identifier of the first message interval is the maximum message identifier of the fifth message interval.
In an exemplary embodiment of the present disclosure, acquiring, in response to a message viewing operation of a user, a second message corresponding to a second message interval consecutive to a first message interval includes: responding to a second message viewing operation of the user in the session, wherein the second message viewing operation comprises a slide-up operation or a click viewing real-time message operation, acquiring a second message from the server 202 according to the maximum message identifier corresponding to the first message, storing the second message in a local database, and displaying the second message in a chat session page.
In an exemplary embodiment of the present disclosure, the minimum message identification in the first message interval is less than or equal to the minimum message identification in the second message interval, and the maximum message identification in the first message interval is greater than or equal to the minimum message identification in the second message interval. After the second message interval and the second message are obtained, the second message interval and the first message interval are subjected to interval fusion, the message interval after fusion is recorded in a local database, specifically, the first message interval and the second message interval are combined to form a sixth message interval, and the sixth message interval is recorded in the local database. Wherein, the minimum message identifier of the first message interval is the minimum message identifier of the sixth message interval, and the maximum message identifier of the second message interval is the maximum message identifier of the sixth message interval.
In an exemplary embodiment of the present disclosure, if a second message interval continuous to the first message interval exists in the local database, reading a second message corresponding to the second message interval from the local database, and determining whether the number of the second message reaches a second preset number, where the second preset number may be the number of messages that can be displayed on a chat session page set by a background according to a specific situation, or the number of displayed messages set by a user according to a requirement, and the present disclosure does not specifically limit this. If the number of the second messages in the local database reaches a second preset number, reading the second messages with the second preset number from the local database according to the second message interval, and displaying the second messages with the second preset number in a chat session page; if the number of the second messages in the local database does not reach the second preset number, the second messages are firstly read from the local database according to the second message interval, the target number is determined according to the number of the second messages and the second preset number, and the messages with the target number continuous with the second message interval are obtained from the server 202. For example, if the second preset number set by the user is 10, and the number of the second messages in the local database is 6, the 6 second messages are first read from the local database, the target number is determined to be 4 according to the second preset number and the second message number, then 4 tagged messages continuous with the second message interval are acquired from the server 202 according to the second message interval, and finally the 6 second messages and the 4 tagged messages are displayed in the chat session page.
In step S140, a third message interval in the local database is obtained, where the third message interval is a message interval corresponding to a message received when the user logs in last time.
In an exemplary embodiment of the present disclosure, it is determined whether an intersection exists between the first message interval and the third message interval, and if the intersection exists between the first message interval and the third message interval, the first message interval and the third message interval are fused together, and the third message interval is replaced by the fused message interval; and if the intersection does not exist between the first message interval and the third message interval, recording the first message interval in a local database.
In step S150, it is determined whether an intersection exists between the second message interval and the third message interval, and a target operation is performed on the second message interval according to the determination result.
In an exemplary embodiment of the present disclosure, it is determined whether an intersection exists between the second message interval and the third message interval, and if the intersection exists between the second message interval and the third message interval, the message intervals are fused between the second message interval and the third message interval, and the third message interval is replaced with the fused message interval; and if the second message interval does not have an intersection with the third message interval, recording the second message interval in the local database.
In an exemplary embodiment of the present disclosure, the minimum message identifier in the third message interval is less than or equal to the minimum message identifier in the second message interval, and the maximum message identifier in the third message interval is greater than or equal to the minimum message identifier in the second message interval. And performing message interval fusion on the second message interval and the third message interval, replacing the third message interval with the fused message interval, specifically, combining the second message interval and the third message interval to form a fourth message interval, and replacing the third message interval with the fourth message interval. The minimum message identifier of the third message interval is the minimum message identifier of the fourth message interval, and the maximum message identifier of the second message interval is the maximum message identifier of the fourth message interval.
The message processing method in the present exemplary embodiment is further described below with reference to a specific embodiment in which a message identification is schematically represented by a simple numeral.
The xiaoming sends messages with message identifications 2, 3, 4, 5, 6, 7, 8, 9, 10 and 11 to the queen, the terminal device 201 responds to the login account operation of the queen and receives message signals corresponding to the session between the queen and the xiaoming, and the message signals comprise prompt information with 10 unread messages and the latest message identification 11 of the unread messages. And storing the messages in the message intervals [2-11] in a local database, performing message interval fusion on the message intervals [2-11], storing the message intervals [2-11] in the local database, and responding to log-out operation of the King.
The xiaoming sends a message with message identifications 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 to the queen, and the terminal device 201 responds to the login account operation of the queen again and receives a message signal corresponding to the session between the queen and the xiaoming, wherein the message signal comprises prompting information of 17 unread messages and the latest message identification 28 of the unread messages.
The terminal device 201 uses the latest message identifier 28 to inquire whether a message interval corresponding to the latest message identifier 28 exists in the message intervals of the local database, if so, the terminal device directly acquires the first messages with 10 message intervals in [19-28] from the local database, if not, the terminal device calls a data interface, acquires the first messages with 10 message intervals in [19-28] corresponding to the latest message identifier 28 from the server 202, stores the first messages in the local database, performs message interval fusion on the first message intervals [19-28] corresponding to the first messages, and stores the first message intervals [19-28] in the local database. The terminal device 201 responds to the joker click entry and the small and clear chat session page to directly display the first message in the chat session page.
At this time, the oldest message identifier displayed in the session page is 19, the terminal device 201 responds to the pull-down message viewing operation of the king, uses the message identifier 19 to inquire whether a message interval corresponding to the message identifier 19 exists in the local database, if so, directly acquires the second messages with the message intervals of [10-19] from the local database, if not, invokes a data interface, acquires the second messages with the message intervals of [10-19] from the server 202, displays the second messages corresponding to the message intervals of [10-19] in the session page, and performs message interval fusion on the second message intervals of [10-19 ].
The message interval fusing of the second message interval [10-19] specifically comprises: judging that the first message interval [19-28] and the second message interval [10-19] have intersection, combining the first message interval [19-28] and the second message interval [10-19] to form a message interval [10-28], storing the fused message interval [10-28] in a local database, deleting [10-19] and [19-28], judging that the fused message interval [10-28] and [2-11] in the local database have intersection, combining the message interval [10-28] and the message interval [2-11] to form a message interval [2-28], storing the message interval [2-28] in the local database, and deleting the message interval [10-28] and the message interval [2-11 ]. At this time, the local database stores the message interval [2-28] and the message corresponding to the message interval [2-28 ].
The message processing method in the exemplary embodiment effectively tracks the time line of the message by performing message interval fusion on the message intervals, avoids the problem that the repeated request interface downloads the message loaded to the local, and effectively reduces the load of the server 202. And the message can be immediately seen when the user just enters the chat session page to a great extent, so that the user experience is improved.
The following describes embodiments of an apparatus of the present disclosure, which may be used to perform the above-mentioned message processing method of the present disclosure. For details not disclosed in the embodiments of the apparatus of the present disclosure, reference is made to the embodiments of the method of the present disclosure described above.
Fig. 3 schematically shows a block diagram of a message processing apparatus according to one embodiment of the present disclosure.
Referring to fig. 3, a message processing apparatus 300 according to an embodiment of the present disclosure, the message processing apparatus 300 including: a received signal module 301, an acquire message module 302, a response operation module 303, an acquire interval module 304, and a target operation module 305. Specifically, the method comprises the following steps:
a signal receiving module 301, configured to respond to a login operation of a user and receive a message signal at a current time, where the message signal is used to indicate a session of an offline message to be received;
an obtaining message module 302, configured to obtain a first preset number of first messages in the session, and determine a first message interval of the first messages, where the first message interval is a message interval formed by a maximum message identifier and a minimum message identifier in the first messages;
a response operation module 303, configured to respond to the message viewing operation of the user, and obtain a second message corresponding to a second message interval that is consecutive to the first message interval;
an obtaining interval module 304, configured to obtain a third message interval in a local database, where the third message interval is a message interval corresponding to a message received when the user logs in last time;
and a target operation module 305, configured to determine whether an intersection exists between the second message interval and the third message interval, and perform a target operation on the second message interval according to a determination result.
The details of the message processing apparatus have been described in detail in the corresponding message processing method, and therefore are not described herein again.
It should be noted that although in the above detailed description several modules or units of the apparatus for performing are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 400 according to this embodiment of the invention is described below with reference to fig. 4. The electronic device 400 shown in fig. 4 is only an example and should not bring any limitation to the function and the scope of use of the embodiments of the present invention.
As shown in fig. 4, electronic device 400 is embodied in the form of a general purpose computing device. The components of electronic device 400 may include, but are not limited to: the at least one processing unit 410, the at least one memory unit 420, a bus 430 connecting different system components (including the memory unit 420 and the processing unit 410), and a display unit 440.
Wherein the storage unit stores program code that is executable by the processing unit 410 to cause the processing unit 410 to perform steps according to various exemplary embodiments of the present invention as described in the above section "exemplary methods" of the present specification. For example, the processing unit 410 may execute step S110 shown in fig. 1, respond to a login operation of a user, and receive a message signal at the current moment, where the message signal is used to indicate a session to receive an offline message; step S120, acquiring a first preset number of first messages in the session, and determining a first message interval of the first messages, wherein the first message interval is a message interval formed by a maximum message identifier and a minimum message identifier in the first messages; step S130, responding to the message checking operation of the user, and acquiring a second message corresponding to a second message interval continuous with the first message interval; step S140, a third message interval in the local database is obtained, wherein the third message interval is a message interval corresponding to a message received by the user during the previous login; step S150, determining whether there is an intersection between the second message interval and the third message interval, and performing a target operation on the second message interval according to the determination result.
The storage unit 420 may include readable media in the form of volatile storage units, such as a random access memory unit (RAM)4201 and/or a cache memory unit 4202, and may further include a read only memory unit (ROM) 4203.
The storage unit 420 may also include a program/utility 4204 having a set (at least one) of program modules 4205, such program modules 4205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The electronic device 400 may also communicate with one or more external devices 600 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a viewer to interact with the electronic device 400, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 400 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 450. Also, the electronic device 300 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 460. As shown, the network adapter 460 communicates with the other modules of the electronic device 400 over the bus 430. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with electronic device 400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, aspects of the invention may also be implemented in the form of a program product comprising program code means for causing a terminal device to carry out the steps according to various exemplary embodiments of the invention described in the above section "exemplary methods" of the present description, when said program product is run on the terminal device.
Referring to fig. 5, a program product 500 for implementing the above method according to an embodiment of the present invention is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the terms of the appended claims.
Claims (13)
1. A message processing method, comprising:
responding to the login operation of a user, and receiving a message signal at the current moment, wherein the message signal is used for indicating a session for receiving an offline message;
acquiring a first preset number of first messages in the session, and determining a first message interval of the first messages, wherein the first message interval is a message interval formed by a maximum message identifier and a minimum message identifier in the first messages;
responding to the message viewing operation of the user, and acquiring a second message corresponding to a second message interval continuous with the first message interval;
acquiring a third message interval in a local database, wherein the third message interval is a message interval corresponding to a message received when the user logs in last time;
and judging whether the second message interval and the third message interval have intersection or not, and performing target operation on the second message interval according to a judgment result.
2. The message processing method according to claim 1, wherein performing the target operation on the second message interval according to the determination result comprises:
if the second message interval and the third message interval have an intersection, performing message interval fusion on the second message interval and the third message interval, and replacing the third message interval with the fused message interval;
and if the second message interval does not intersect with the third message interval, recording the second message interval in the local database.
3. The message processing method according to claim 2, wherein the minimum message identifier in the third message interval is less than or equal to the minimum message identifier in the second message interval, and the maximum message identifier in the third message interval is greater than or equal to the minimum message identifier in the second message interval;
performing message interval fusion on the second message interval and the third message interval, and replacing the third message interval with the fused message interval, including:
merging the second message interval and the third message interval to form a fourth message interval, wherein the minimum message identifier of the third message interval is the minimum message identifier of the fourth message interval, and the maximum message identifier of the second message interval is the maximum message identifier of the fourth message interval;
replacing the third message interval with the fourth message interval.
4. The message processing method according to claim 1, wherein the obtaining of the second message corresponding to the second message interval consecutive to the first message interval in response to a message viewing operation of a user comprises:
responding to a first message viewing operation of the user in the session, and inquiring whether a second message interval continuous with the first message interval exists in the local database;
if the second message interval exists, reading a second message corresponding to the second message interval from the local database;
and if the first message does not exist, acquiring the second message from the server according to the minimum message identifier corresponding to the first message.
5. The message processing method of claim 4, wherein reading the second message corresponding to the second message interval from the local database comprises:
judging whether the number of the second messages reaches a second preset number or not;
if the second preset number is reached, reading second messages of the second preset number from the local database according to the second message interval;
and if the second preset number is not reached, reading the second message from the local database according to the second message interval, determining a target number according to the number of the second message and the second preset number, and acquiring the messages of the target number continuous with the second message interval from the server.
6. The message processing method according to claim 3 or 4, wherein the minimum message identifier in the second message interval is smaller than or equal to the minimum message identifier in the first message interval, and the maximum message identifier in the second message interval is larger than or equal to the minimum message identifier in the first message interval;
the method further comprises the following steps:
merging the first message interval and the second message interval to form a fifth message interval, wherein the minimum message identifier of the second message interval is the minimum message identifier of the fifth message interval, and the maximum message identifier of the first message interval is the maximum message identifier of the fifth message interval;
recording the fifth message interval in the local database.
7. The message processing method according to claim 1, wherein the obtaining of the second message corresponding to the second message interval consecutive to the first message interval in response to a message viewing operation of a user comprises:
and responding to a second message viewing operation of the user in the session, and acquiring the second message from a server according to the maximum message identifier corresponding to the first message.
8. The message processing method of claim 7, wherein the minimum message identifier in the first message interval is less than or equal to the minimum message identifier in the second message interval, and wherein the maximum message identifier in the first message interval is greater than or equal to the minimum message identifier in the second message interval;
the method further comprises the following steps:
merging the first message interval and the second message interval to form a sixth message interval, wherein a minimum message identifier of the first message interval is a minimum message identifier of the sixth message interval, and a maximum message identifier of the second message interval is a maximum message identifier of the sixth message interval;
recording the sixth message interval in the local database.
9. The message processing method of claim 1, wherein the method further comprises:
judging whether an intersection exists between the first message interval and the third message interval;
if the first message interval and the third message interval have an intersection, performing message interval fusion on the first message interval and the third message interval, and replacing the third message interval with the fused message interval;
and if the intersection does not exist between the first message interval and the third message interval, recording the first message interval in the local database.
10. The message processing method according to claim 1, before acquiring the first preset number of first messages in the session, comprising:
inquiring whether a first message identification corresponding to the message signal exists in the local database;
if yes, acquiring the first messages with the first preset quantity from the local database;
and if the first message identification does not exist, acquiring a first preset number of first messages corresponding to the first message identification from a server according to the first message identification.
11. A message processing apparatus, comprising:
the receiving signal module is used for responding to the login operation of a user and receiving a message signal at the current moment, wherein the message signal is used for indicating a session of an offline message to be received;
an obtaining message module, configured to obtain a first preset number of first messages in the session, and determine a first message interval of the first messages, where the first message interval is a message interval formed by a maximum message identifier and a minimum message identifier in the first messages;
the response operation module is used for responding to the message viewing operation of the user and acquiring a second message corresponding to a second message interval continuous with the first message interval;
the acquisition interval module is used for acquiring a third message interval in a local database, wherein the third message interval is a message interval corresponding to a message received by the user during previous login;
and the target operation module is used for judging whether an intersection exists between the second message interval and the third message interval or not and carrying out target operation on the second message interval according to a judgment result.
12. A computer-readable storage medium on which a computer program is stored, the program, when being executed by a processor, implementing a message processing method according to any one of claims 1 to 10.
13. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the message processing method as claimed in any one of claims 1 to 10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911251226.8A CN110932966A (en) | 2019-12-09 | 2019-12-09 | Message processing method and device, computer storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911251226.8A CN110932966A (en) | 2019-12-09 | 2019-12-09 | Message processing method and device, computer storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110932966A true CN110932966A (en) | 2020-03-27 |
Family
ID=69858508
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911251226.8A Pending CN110932966A (en) | 2019-12-09 | 2019-12-09 | Message processing method and device, computer storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110932966A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113612676A (en) * | 2021-02-01 | 2021-11-05 | 广州虎牙科技有限公司 | Social group message synchronization method, device, equipment and storage medium |
CN115002137A (en) * | 2022-08-03 | 2022-09-02 | 广州此声网络科技有限公司 | Offline message processing method and device, computer equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110213657A1 (en) * | 2008-11-06 | 2011-09-01 | O'malley Matthew Carl | System and method for providing messages |
US20130226943A1 (en) * | 2010-10-13 | 2013-08-29 | Tencent Technology (Shenzhen) Company Limited | Method And Device For Displaying Message |
CN104811366A (en) * | 2014-01-26 | 2015-07-29 | 阿里巴巴集团控股有限公司 | Network communication message roaming method and device |
CN109639564A (en) * | 2018-12-12 | 2019-04-16 | 金瓜子科技发展(北京)有限公司 | A kind of method, apparatus and computer readable storage medium obtaining offline message |
CN110365739A (en) * | 2019-06-05 | 2019-10-22 | 平安科技(深圳)有限公司 | Message synchronization method, apparatus, computer installation and computer readable storage medium |
-
2019
- 2019-12-09 CN CN201911251226.8A patent/CN110932966A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110213657A1 (en) * | 2008-11-06 | 2011-09-01 | O'malley Matthew Carl | System and method for providing messages |
US20130226943A1 (en) * | 2010-10-13 | 2013-08-29 | Tencent Technology (Shenzhen) Company Limited | Method And Device For Displaying Message |
CN104811366A (en) * | 2014-01-26 | 2015-07-29 | 阿里巴巴集团控股有限公司 | Network communication message roaming method and device |
CN109639564A (en) * | 2018-12-12 | 2019-04-16 | 金瓜子科技发展(北京)有限公司 | A kind of method, apparatus and computer readable storage medium obtaining offline message |
CN110365739A (en) * | 2019-06-05 | 2019-10-22 | 平安科技(深圳)有限公司 | Message synchronization method, apparatus, computer installation and computer readable storage medium |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113612676A (en) * | 2021-02-01 | 2021-11-05 | 广州虎牙科技有限公司 | Social group message synchronization method, device, equipment and storage medium |
CN113612676B (en) * | 2021-02-01 | 2024-01-19 | 广州虎牙科技有限公司 | Social group message synchronization method, device, equipment and storage medium |
CN115002137A (en) * | 2022-08-03 | 2022-09-02 | 广州此声网络科技有限公司 | Offline message processing method and device, computer equipment and storage medium |
CN115002137B (en) * | 2022-08-03 | 2022-10-21 | 广州此声网络科技有限公司 | Offline message processing method and device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110351572B (en) | Method, device and equipment for updating live broadcast room information and storage medium | |
CN110287146B (en) | Method, device and computer storage medium for downloading application | |
CN110955640B (en) | Cross-system data file processing method, device, server and storage medium | |
CN109947408B (en) | Message pushing method and device, storage medium and electronic equipment | |
CN110516984B (en) | Method and apparatus for generating delivery path information | |
US10897512B2 (en) | Generating push notifications | |
CN110932966A (en) | Message processing method and device, computer storage medium and electronic equipment | |
AU2018403361B2 (en) | Data transmission | |
CN110881224B (en) | Network long connection method, device, equipment and storage medium | |
CN113656193A (en) | Application communication method, system, electronic equipment and storage medium | |
CN111124291B (en) | Data storage processing method and device of distributed storage system and electronic equipment | |
US20200382447A1 (en) | Chatbot information processing | |
CN110266813B (en) | Data request processing method and device, terminal equipment and storage medium | |
CN113781154A (en) | Information rollback method, system, electronic equipment and storage medium | |
CN113157162A (en) | Method, apparatus, medium and program product for revoking session messages | |
US20230004897A1 (en) | Method and apparatus for providing counseling service | |
CN114048177B (en) | Sharing method and device, electronic equipment, storage medium and program product | |
CN114553806B (en) | Optimization method, device and equipment for instant messaging and storage medium | |
CN115312208B (en) | Method, device, equipment and medium for displaying treatment data | |
CN110659933B (en) | Method and device for generating balance tailed recommendation content | |
CN111090485B (en) | Multi-cluster-oriented help data processing method and device, medium and equipment | |
CN117156400A (en) | Information notification method, device, equipment and storage medium | |
CN115705387A (en) | File generation method and device, terminal equipment and computer medium | |
CN114661728A (en) | Key recording and managing method applied to redis database | |
CN114817445A (en) | Method, device, equipment and computer readable medium for information interaction |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200327 |
|
RJ01 | Rejection of invention patent application after publication |