CN106844662B - Method and device for recording reading state of instant message - Google Patents

Method and device for recording reading state of instant message Download PDF

Info

Publication number
CN106844662B
CN106844662B CN201710051105.3A CN201710051105A CN106844662B CN 106844662 B CN106844662 B CN 106844662B CN 201710051105 A CN201710051105 A CN 201710051105A CN 106844662 B CN106844662 B CN 106844662B
Authority
CN
China
Prior art keywords
message
group
bitmap data
bitmap
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710051105.3A
Other languages
Chinese (zh)
Other versions
CN106844662A (en
Inventor
徐锐波
付赟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201710051105.3A priority Critical patent/CN106844662B/en
Publication of CN106844662A publication Critical patent/CN106844662A/en
Application granted granted Critical
Publication of CN106844662B publication Critical patent/CN106844662B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for recording the reading state of an instant message. The method comprises the following steps: receiving a message sent by a sending end to a receiving end, and generating a message identifier for the message; generating first bitmap data according to the record of the receiving end, and storing the message identifier and the first bitmap data; sending the message to a receiving end; receiving a message reading notice returned by the receiving terminal, and modifying the first bitmap data according to the message reading notice to obtain second bitmap data; and returning the reading state of the message to the sending end according to the second bitmap data. The invention records the reading state of each receiving end by using the bitmap, compresses the record of the reading state of each receiving end into 1bit, and greatly saves the data storage space compared with the prior art which occupies at least one record of 16 bytes, thereby solving the problems of huge data writing pressure and information storage pressure brought to the database.

Description

Method and device for recording reading state of instant message
Technical Field
The invention relates to the technical field of communication, in particular to a method and a device for recording the reading state of an instant message.
Background
Instant Messaging (IM) is a terminal service that allows two or more people to communicate text messages, files, voice and video in real time over a network. Instant messaging differs from e-mail in that its conversations are instant, such as the commonly used QQ, YY voice, flyletter, and the like. When using these instant messaging applications to communicate, the sender of the message needs to know whether the recipient of the message has read the message or not, so as to prevent important messages from being missed.
The recording method of the reading state of the instant message in the prior art is mainly divided into the following two types:
method 1, client recording mode. After each receiver of the information finishes reading the information, the receiver of the information notifies the sender of the information through the transfer of the server, and at the moment, the client of the sender adds records in the local equipment to identify who reads the information;
method 2, server side recording mode. After each receiver of the information finishes reading the information, the server is informed, and at the moment, the server inserts a record into the database to identify who has read the information.
In the process of implementing the embodiment of the present invention, the inventor finds that at least the following problems exist in the prior art:
the method 1 has the following defects: after the client is reinstalled, all read and unread information is cleared; the read and unread information of the same account of different devices is not complete.
The method 2 has the following defects: when the number of recipients of information is very large, for example, when a group chat is performed, the number of recipients of each piece of information may be several tens or even thousands. Reading information of each person inserts a record into the database, one record at least needs to store a recording element which is composed of a user identifier and an information identifier of the reading person, wherein the recording element is int64, and the recording element is int64, and is at least 16 bytes, and huge data writing pressure and information storage pressure are brought to the database along with the increase of the number of receiving persons.
Disclosure of Invention
In view of the above problems, the present invention has been made to provide an instant message reading status recording apparatus and a corresponding instant message reading status recording method that overcome or at least partially solve the above problems.
According to an aspect of the present invention, there is provided a method for recording an instant message reading status, including:
receiving a message sent by a sending end to a receiving end, and generating a message identifier for the message;
generating first bitmap data according to the record of the receiving end, and storing the message identifier and the first bitmap data;
sending the message to a receiving end;
receiving a message reading notice returned by the receiving terminal, and modifying the first bitmap data according to the message reading notice to obtain second bitmap data;
and returning the reading state of the message to the sending end according to the second bitmap data.
According to another aspect of the present invention, there is provided an instant message reading status recording apparatus, including:
the receiving module is used for receiving the message sent by the sending end to the receiving end and generating a message identifier for the message;
the storage module is used for generating first bitmap data according to the record of the receiving end and storing the message identifier and the first bitmap data;
the sending module is used for sending the message to a receiving end;
the modification module is used for receiving a message reading notice returned by the receiving terminal and modifying the first bitmap data according to the message reading notice to obtain second bitmap data;
and the returning module is used for returning the reading state of the message to the sending end according to the second bitmap data.
According to the method and the device for recording the reading state of the instant message, after the message sent by the sending end is received, first bitmap data are generated according to the record of the receiving end; and after receiving the message reading notification returned by the receiving end, modifying the first bitmap data according to the message reading notification to obtain second bitmap data, wherein the second bitmap data records the reading state of the instant message so as to return the reading state of the message to the sending end. The invention records the reading state of each receiving end by using the bitmap, compresses the record of the reading state of each receiving end into 1bit, and greatly saves the data storage space compared with the prior art which occupies at least one record of 16 bytes, thereby solving the problems of huge data writing pressure and information storage pressure brought to the database.
The above description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 illustrates a flowchart of a method of recording an instant message reading status according to one embodiment of the present invention;
fig. 2 is a flowchart illustrating a method of recording an instant message reading status according to another embodiment of the present invention;
FIG. 3 illustrates a functional block diagram of an apparatus for recording instant message reading status in accordance with one embodiment of the present invention;
fig. 4 shows a functional block diagram of an instant message reading status recording apparatus according to another embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 shows a flowchart of a recording method of an instant message reading state according to one embodiment of the present invention. As shown in fig. 1, the method comprises the following steps:
step S101, receiving the message sent by the sending end to the receiving end, and generating a message identifier for the message.
Each time the sending end sends a message, the sending end information, the message data, the receiving end information and other data are sent to the server, so that the server can conveniently inquire related data and forward the instant message.
After receiving the data such as the sending end information, the message data, the receiving end information and the like, the server newly generates an information record, each information record has a unique corresponding message _ id value, namely a message identifier, and the message identifier is returned to the sending end for the sending end to obtain the basis of the reading state, and meanwhile, the message identifier can also be used for inquiring the related data of the data table.
Step S102, generating first bitmap data according to the record of the receiving end, and storing the message identification and the first bitmap data.
The receiving end records the receiver condition of the receiving end, the first bitmap data is corresponding to the message identification, and each message identification has a unique corresponding first bitmap data.
Specifically, when the receiving end is a receiver, that is, a private communication mode in a one-to-one format, in this case, the receiver is selected by the user, so the record of the receiving end records the data of the receiver, and according to this record, the first bitmap data generated by the service end is 0x 1; when the receiving end includes a plurality of receivers, i.e. a one-to-many communication mode, in this case, each record in the record of the receiving end records data of one receiver, such as a serial number corresponding to the receiver. When the first bitmap data is generated, the position of the member serial number of the receiver corresponding to the first bitmap data is set to 1, indicating that a member exists at the position. Taking the example that the receiving end includes 5 receivers, if the member serial numbers in the records of the 5 receivers are 1, 2, 3, 4, and 5, respectively, 1 to 5 of the first bitmap data are all set to 1, and therefore the generated first bitmap data is 0x 1F.
And inserting the message identification and the first bitmap data corresponding to the message identification into a database of the server.
Step S103, sending the message to the receiving end.
The server side sends messages carrying information such as message data and message identification to all receivers of the receiving end.
And step S104, receiving the message reading notification returned by the receiving terminal, and modifying the first bitmap data according to the message reading notification to obtain second bitmap data.
After receiving a message sent by a server, if a corresponding member reads the message, the receiving end returns a message reading notification to the server, where the message reading notification includes a member serial number and a message identifier of a receiver corresponding to the receiving end, the member serial number is numbered from 1, and each receiver corresponds to a unique serial number, which is not repeated or spaced, for example, there are 100 receivers at the receiving end, and the serial numbers of the 100 receivers are 1, 2, and 3 … … 100 in sequence.
Assuming that the member serial number of the receiver in the message reading notification received by the server is 3, the 3 rd bit of the first bitmap data is modified to be 0, and thus, the 0x1F of the first bitmap data of the original 5 receivers is modified to be 0x1B, and the modified bitmap data is referred to as second bitmap data; similarly, if only the member with the member serial number of 3 of the receiver does not return the message reading notification, only the 3 rd bit of the first bitmap data is not modified to be 0, and therefore, the modified second bitmap data is 0x 4.
The operation of modifying the corresponding bit of the first bitmap data into 0 is realized by performing bit-wise AND operation on the value of the corresponding bit and 0.
And step S105, returning the reading state of the message to the sending end according to the second bitmap data.
After modifying the bits of the first bitmap data corresponding to all message reading notifications corresponding to the recipient member serial number, the obtained bitmap data is called second bitmap data, each bit of the second bitmap data represents the reading state of one recipient, specifically, if it is 0, it represents that the recipient corresponding to the bit has read the message, and if it is 1, it represents that the recipient corresponding to the bit has not read the message.
If the sending end wants to know the reading state of the members of the receiving end, the server end can inquire the second bitmap data according to the corresponding relation between the message identification and the second bitmap data by providing the message identification to the server end, and return the second bitmap data to the sending end, so that the sending end can know the reading state of the receiver of the receiving end; or, the server directly transmits the reading state of the receiving end to the transmitting end.
Next, the specific implementation of the steps S101 to S105 is described by taking the private communication mode with the receiving end as a receiver as an example:
in step S101, the sender a sends a message to the receiver B, and after receiving the sender a information, the message data, and the receiver B information, the server generates a message identifier mid1 for the message, and returns a message identifier mid1 to the sender a.
In step S102, the receiving end has a data record of the recipient B recorded therein, and the server generates the first bitmap data rs1 of 0x1 based on the record, and inserts the generated message id mid1 and the first bitmap data rs1 into the database.
In step S103, the server sends a message carrying information such as message data and message identification mid1 to the recipient B.
In step S104, after receiving the message, the receiver B returns a message reading notification to the server, including the information of the sender a and the message identifier mid1, and records the position where the first bitmap data rs1 is 1 as 0 as the second bitmap data rs 2; if recipient B does not return a message reading notification, the method terminates.
In step S105, after the second bitmap data rs2 is obtained, the server may directly return the reading status of the receiver B to the sender a; alternatively, the sender a obtains the reading status of the receiver B by providing the message identification mid1 to the server. The reading status, i.e. the value of 0 or 1 of the corresponding bit of the second bitmap data rs2, indicates that the message mid1 is read by the recipient B if it is 0, and indicates that the message mid1 is not read by the recipient B if it is 1.
According to the method for recording the reading state of the instant message, after receiving the message sent by the sending end, first bitmap data is generated according to the record of the receiving end; and after receiving the message reading notification returned by the receiving end, modifying the first bitmap data according to the message reading notification to obtain second bitmap data, wherein the second bitmap data records the reading state of the instant message so as to return the reading state of the message to the sending end. The invention records the reading state of each receiving end by using the bitmap, compresses the record of the reading state of each receiving end into 1bit, and greatly saves the data storage space compared with the prior art which occupies at least one record of 16 bytes, thereby solving the problems of huge data writing pressure and information storage pressure brought to the database.
The invention records the reading state of the receiving end through the bitmap, compresses the record of each receiver to 1bit, solves the problem of huge data writing pressure and information storage pressure brought to the database, and obtains the beneficial effect of saving the data storage space. Especially, when the receiving end is a large number of group members, the effect obtained by adopting the invention to record is more obvious.
Before the implementation of the preferred embodiment of the present invention, the recording and query of the implementation process are simplified by establishing a reasonable data structure model, which includes an information data table model (message _ t), a group member data table model (qun _ member _ t), and an information-related group member snapshot data table model (qun _ snapshot _ t).
a. See table 1 for the information data table model (message _ t) main fields:
table 1 information data table message _ t main field
Name of field Type of field
message_id int64
read_status bitmap
message _ id: when a message is sent each time, the server newly generates a message record, each message record has a unique corresponding message _ id value, namely a message identifier, and the message _ id value strictly and monotonically increases, namely: the message id of the later sent message will be larger than the value sent first.
read _ status: indicating the reading status of the message read by the receiver, when the read _ status bitmap values are all 0, indicating that all the receivers have read, otherwise indicating that some receivers have read or no one reads.
b. The group member data table model (qun _ member _ t) main fields are seen in table 2:
table 2 group member data table qun _ member _ t main field
Name of field Type of field
qun_id int64
member_seq int64
qun _ id: when a user newly creates a group, the server generates a new group id, i.e. a group identifier, and the group id values of different groups are strictly monotonically increased, i.e.: the group id of the later created group will be larger than the group id value of the earlier created group.
member _ seq: when a new group member is added to the group, the server generates a new number _ seq value, i.e. a member serial number corresponding to the group member, under the qun _ id corresponding to the group. The number _ seq value is strictly monotonically increasing and continuous at the same value of qun _ id. That is, there is a group with a value of qun _ id of 1, the member _ seq that is the first member to join the group has a value of 1, the member _ seq that is the second member to join the group has a value of 2, and so on.
c. Information-related group member snapshot data table model (qun _ snapshot _ t) main fields:
table 3 group member snapshot data table qun _ snapshot _ t main field
Figure BDA0001217793470000071
Figure BDA0001217793470000081
qun _ id corresponding to the value of qun _ id field in qun _ member _ t
message _ id: corresponding to the message _ id field value in the message _ t
member _ bitmap: and (3) a group member snapshot bitmap, wherein each time when a group member has a change of increasing or decreasing members, a group member snapshot record is added into the table, the x-th bit of the bitmap in the member _ bitmap is 0 to indicate that the member with the member _ seq value of x is still in the group, otherwise, the member is indicated that the member has quit the group.
Fig. 2 is a flowchart illustrating a method of recording an instant message reading status according to another embodiment of the present invention. As shown in fig. 2, the method is directed to a case where a receiving end is a member of a group, that is, a plurality of receivers of the receiving end are in the same group, and includes the following steps:
step S201, receiving a message sent from a sending end to a receiving end, and generating a message identifier for the message.
After receiving the information data sent by the sending end, the server end generates a new information record, and each information record has a unique corresponding message _ id value, namely a message identifier.
Step S202, inquiring the record of the effective member in the group according to the group identification.
And inquiring a group member data table qun _ member _ t according to a group identification qun _ id value corresponding to the group for sending the message, and acquiring records of effective members in the group when the message is sent, wherein the records of the effective members are member records which are not returned.
Assuming that the group id qun _ id has a value of 1, the records of the valid members obtained by querying the group member data table qun _ member _ t are:
[{“qun_id”:1,“member_seq”:1},{“qun_id”:1,“member_seq”:2},…,]
{ "qun _ id": 1, "member _ seq": 1} is the 1 st record, and { "qun _ id": 1, "member _ seq": 2} is the 2 nd record.
Step S203, the member serial number corresponding to the effective member in the group is inquired.
The member sequence number of the active member of each record can be obtained according to the records of the active members. For example, the member sequence number corresponding to the effective member in the group represented by the record { "qun _ id": 1, "member _ seq": 4} is 4.
Step S204, data of a position corresponding to a member serial number corresponding to an effective member in the group in the bitmap is set as first data, and first bitmap data are obtained.
Each bit value of the first bitmap data indicates whether a member of the corresponding member serial number in the group is valid, if so, the corresponding member is a valid member, namely, the member is still in the group; if 0, it indicates that the corresponding member is an invalid member, i.e. the member has exited the group. The first bitmap data is corresponding to the message identifications, and each message identification has a unique corresponding first bitmap data.
After the member serial number, namely, the number _ seq, corresponding to the effective member in the group is inquired, the corresponding number _ seq bit in the first bitmap data read _ status is set to be 1.
For example: if the member serial number msx of the valid member in the 1 st record is 3, the 3 rd bit of the first bitmap data rs1 is set to 1, i.e., rs1 is 0x 4; if the member serial number msx of the valid member in the record 2 is 5, the 5 th bit of the first bitmap data rs1 is set to 1, that is, the rs1 is 0x14 … …, and the data at the position corresponding to the member serial number msx of the valid member in the first bitmap data rs1 is set as the first data, so as to obtain the first bitmap data rs 1.
Therefore, the specific operation of generating the first bitmap data read _ status by the record of the group member is to query the record of the effective member in the group according to the group identifier qun _ id, and generate the first bitmap data according to the effective member in the group.
Step S205 stores the message identifier and the first bitmap data.
And inserting the message identification message _ id and the corresponding first bitmap data read _ status into a database of the service end.
Step S206, the message is sent to the receiving end.
The server side sends messages carrying information such as message data, member serial number (number _ seq) and message identification (message _ id) to all group members of the receiving end.
Step S207, receiving the message reading notification returned by the group member.
For the condition that the group member corresponding to the receiving end is the effective member, the reading state is read or unread. After receiving the message sent by the server, the receiving end returns a message reading notification to the server if the group members of the receiving end read the message.
Step S208, determining the member serial number corresponding to the group member returning the message reading notice according to the message reading notice.
The message reading notification includes a member serial number, namely, a message _ seq, and a message identifier, namely, a member returning the message reading notification is to return the message identifier, namely, the message _ id corresponding to the read message and the member serial number, namely, the member returns the message reading notification to the server. And determining which members have read states as read according to the member serial number (member _ seq) of the reading notice of the returned message.
Step S209, setting the data of the position corresponding to the member serial number corresponding to the group member returning the message reading notification in the bitmap corresponding to the first bitmap data as the second data, and obtaining the second bitmap data.
The server side inquires an information data table message _ t according to the values of the member sequence number, member _ seq and the message identification, message _ id, in the message reading notification, sets the bit of the first bitmap data corresponding to the member sequence number, member _ seq, to 0, and the step of setting to 0 is realized by performing and operation on the value of the corresponding bit and 0, and the set first bitmap data read _ status is called as second bitmap data read _ status.
Step S210, acquiring group member snapshot bitmap data according to the group identifier and the message identifier, wherein the group member snapshot bitmap data is set according to the snapshot records of the unremoved group members and the moved group members in the group.
And inquiring the group member snapshot data table qun _ snapshot _ t according to the group identification qun _ id and the message identification message _ id, and acquiring corresponding group member snapshot bitmap data, member _ bitmap.
The group member snapshot bitmap data member _ bitmap is set according to snapshot records of unremoved group members and moved group members in the group, each time when the group members have the change of increase or decrease of members, a snapshot record is added into the group member snapshot data table qun _ snapshot _ t, the value of the bit corresponding to the member serial number member _ seq in the group member snapshot bitmap data member _ bitmap is 0, which indicates that the member corresponding to the member serial number member _ seq is still in the group, otherwise, the member is already moved out of the group.
Taking the original 10-bit group members in the group as an example, if the two-bit group members with the member serial numbers msx of 3 and 5 are moving back from the group midway, the 3 rd bit and the 5 th bit of the latest group member snapshot bitmap data mb1 are 1, and the values of the rest bits are 0, that is, the group member snapshot bitmap data mb1 is 0x 14.
Step S211, carrying out bitwise operation on the group member snapshot bitmap data and the second bitmap data to obtain third bitmap data for recording the reading state of the group members; and traversing the third bitmap data and returning the reading state of the message to the sending terminal.
The value of a bit of the second bitmap data read _ status is 0 in two cases: the message corresponding to the read message identifier message _ id of the group member corresponding to the bit and the group member corresponding to the bit quits.
Therefore, it cannot be directly determined which group members read the messages corresponding to the message identifiers message _ id, and the embodiment of the present invention obtains the third bitmap data bitmap by performing a bitwise xor operation on the second bitmap data read _ status and the group member snapshot bitmap data, where the bitmap data number _ bitmap is a bitmap, so that the value of the bit of the group member having already exited in the second bitmap data read _ status is set to 1, and the sending end can know which group members read the messages corresponding to the message identifiers message _ id.
By following the example of the original 10-bit members of the group, the invalid members in the group are members with the member sequence numbers msx of 3 and 5, and the 3 rd bit and the 5 th bit 0, and other positions 1 of the first bitmap data rs1 can be obtained, so the first bitmap data rs1 is 0x3 EB; assuming that the member serial number msx of the member who returns the message reading notification is 1, 2, 4, 6, 7, 9, and 10, the modified second bitmap data rs2 is 0x80 by bitwise and of the value divided by the 1 st, 2 nd, 4 th, 6 th, 7 th, 9 th, and 10 th bits and 0 on the basis of the first bitmap data rs 1. Only the 8 th bit of the second bitmap data rs2 has a value of 1, but actually, no message notification is returned by members with member serial numbers msx of 3 and 5, so with the method of this embodiment, bitwise exclusive-or operation is performed on the second bitmap data rs2 and the group member snapshot bitmap data mb1 of 0x14, and the third bitmap data mp1 of 0x94 is obtained, that is, the values of the 1 st, 2 nd, 4 th, 6 th, 7 th, 9 th and 10 th bits are 0, which indicates that the members with corresponding member serial numbers msx of 1, 2, 4, 6 th, 7 th, 9 th and 10 have returned message reading notifications.
Therefore, the message reading state of each member can be known through each bit of the obtained third bitmap data bitmap.
According to the method for recording the reading state of the instant message, after receiving the message sent by the sending end, first bitmap data is generated according to the record of the receiving end; and after receiving the message reading notification returned by the receiving end, modifying the first bitmap data according to the message reading notification to obtain second bitmap data, wherein the second bitmap data records the reading state of the instant message so as to return the reading state of the message to the sending end. The reading state of each receiving end is recorded by utilizing the bitmap, and the record of the reading state of each receiving end is compressed into 1bit, so that compared with the prior art that at least one record with 16 bytes is occupied, the data storage space is greatly saved, and the problems of huge data writing pressure and information storage pressure brought to a database are solved; by acquiring the snapshot bitmap data of the group members, confirming the effective members in the group and adopting the third bitmap data to distinguish and mark the reading states of the withdrawn group members and the reading states of the effective members, the sending end can directly judge the members which have read the message through the third bitmap data without referring to other information, so that the mode of acquiring the reading states by the sending end is simpler and more convenient.
Fig. 3 shows a functional block diagram of an apparatus for recording an instant message reading status according to one embodiment of the present invention. As shown in fig. 3, the present apparatus includes: a receiving module 310, a generating module 320, a sending module 330, a modifying module 340, and a returning module 350.
The receiving module 310 is configured to receive a message sent by a sending end to a receiving end, and generate a message identifier for the message.
After receiving the data such as the sending end information, the message data, the receiving end information and the like, the server newly generates an information record, each information record has a unique corresponding message _ id value, namely a message identifier, and the message identifier is returned to the sending end for the sending end to obtain the basis of the reading state, and meanwhile, the message identifier can also be used for inquiring the related data of the data table. .
The generating module 320 is configured to generate first bitmap data according to the record of the receiving end, and store the message identifier and the first bitmap data.
The receiving end records the receiver condition of the receiving end, the first bitmap data is corresponding to the message identification, and each message identification has a unique corresponding first bitmap data.
And inserting the message identification and the first bitmap data corresponding to the message identification into a database of the server.
A sending module 330, configured to send the message to the receiving end.
The server side sends messages carrying information such as message data and message identification to all receivers of the receiving end.
The modifying module 340 is configured to receive a message reading notification returned by the receiving end, and modify the first bitmap data according to the message reading notification to obtain the second bitmap data.
The server side inquires the first bitmap data according to the member serial number and the message identification in the message reading notification, sets the bit of the corresponding member serial number of the first bitmap data as 0, and performs AND operation on the value of the bit and 0 in the step of setting 0, wherein the modified first bitmap data is called as second bitmap data.
A returning module 350, configured to return the reading status of the message to the sender according to the second bitmap data.
After modifying the bits of the first bitmap data corresponding to all message reading notifications corresponding to the recipient member serial number, the obtained bitmap data is called second bitmap data, each bit of the second bitmap data represents the reading state of one recipient, specifically, if it is 0, it represents that the recipient corresponding to the bit has read the message, and if it is 1, it represents that the recipient corresponding to the bit has not read the message.
According to the recording device for the reading state of the instant message provided by the embodiment, after receiving the message sent by the sending end, first bitmap data is generated according to the record of the receiving end; and after receiving the message reading notification returned by the receiving end, modifying the first bitmap data according to the message reading notification to obtain second bitmap data, wherein the second bitmap data records the reading state of the instant message so as to return the reading state of the message to the sending end. The invention records the reading state of each receiving end by using the bitmap, compresses the record of the reading state of each receiving end into 1bit, and greatly saves the data storage space compared with the prior art which occupies at least one record of 16 bytes, thereby solving the problems of huge data writing pressure and information storage pressure brought to the database.
Fig. 4 shows a functional block diagram of an instant message reading status recording apparatus according to another embodiment of the present invention. As shown in fig. 4, the apparatus further includes, on the basis of the functional block diagram of the recording apparatus for instant message reading status provided in fig. 3: the obtaining module 420 and the operating module 430, and the modifying module 340 further includes a receiving unit 411, a determining unit 412, and a setting unit 413.
A receiving module 310, configured to receive a message sent by a sending end to a receiving end, and generate a message identifier for the message; wherein, the receiving end is a group member.
After receiving the information data sent by the sending end, the server end generates a new information record, and each information record has a unique corresponding message _ id value, namely a message identifier.
The generating module 320 is configured to query the record of the group member according to the group identifier, and generate the first bitmap data according to the record of the group member.
Inquiring a group member data table qun _ member _ t according to a group identification qun _ id value corresponding to a group for sending the message, and acquiring records of effective members in the group when the message is sent, wherein the records of the effective members are member records of unremoved groups; after the member serial number, namely, the number _ seq, corresponding to the effective member in the group is inquired, the corresponding number _ seq bit in the first bitmap data read _ status is set to be 1.
As can be seen, the generation module 320 is further configured to: and inquiring records of the effective members in the group according to the group identification, and generating first bitmap data according to the effective members in the group.
Specifically, the generating module 320 is further configured to: inquiring records of effective members in the group according to the group identification; inquiring member serial numbers corresponding to effective members in the group; and setting data of a position corresponding to a member serial number corresponding to the effective member in the group in the bitmap as first data to obtain first bitmap data.
And inserting the message identification message _ id and the corresponding first bitmap data read _ status into a database of the service end.
The sending module 330 sends the message to the receiving end.
The server side sends messages carrying information such as message data, member serial number (number _ seq) and message identification (message _ id) to all group members of the receiving end.
The modification module 340 further comprises a receiving unit 411, a determining unit 412 and a setting unit 413.
The receiving unit 411 is configured to receive a message reading notification returned by a group member.
For the condition that the group member corresponding to the receiving end is the effective member, the reading state is read or unread. After receiving the message sent by the server, the receiving end returns a message reading notification to the server if the group members of the receiving end read the message.
The determining unit 412 is configured to determine, according to the message reading notification, a member sequence number corresponding to the group member that returns the message reading notification.
The message reading notification includes a member sequence number, namely, a message _ seq, and a message identifier, namely, the member returning the message reading notification is to return the message identifier, namely, the message _ id corresponding to the read message and the member sequence number, namely, the member returning the message reading notification is to return the message identifier, namely, the message _ seq, corresponding to the read message and the member sequence number, namely, the member returning the message reading notification to the server. And determining which members have read states as read according to the member sequence number member _ seq of the reading notice of the returned message.
The setting unit 413 is configured to set, as the second data, data in a position corresponding to a member serial number corresponding to a group member that returns a message reading notification in a bitmap corresponding to the first bitmap data, so as to obtain the second bitmap data.
The server side inquires an information data table message _ t according to the values of the member sequence number of the message reading notification and the message identification message _ id, sets the position of the first bitmap data corresponding to the member sequence number of the message _ seq to 0, and the step of setting to 0 is realized by performing AND operation on the value of the corresponding position and 0, and the set first bitmap data is recorded as read _ status and is called as second bitmap data read _ status.
The obtaining module 420 is configured to obtain snapshot bitmap data of the group members according to the group identifier and the message identifier, where the snapshot bitmap data of the group members is set according to snapshot records of unremoved group members and moved group members in the group.
And querying the group member snapshot data table qun _ snapshot _ t according to the group identifier qun _ id and the message identifier message _ id, and acquiring corresponding group member snapshot bitmap data, namely, the number _ bitmap.
The group member snapshot bitmap data member _ bitmap is set according to snapshot records of unremoved group members and moved group members in the group, each time when the group members have the change of increase or decrease of members, a snapshot record is added into the group member snapshot data table qun _ snapshot _ t, the value of the bit corresponding to the member serial number member _ seq in the group member snapshot bitmap data member _ bitmap is 0, which indicates that the member corresponding to the member serial number member _ seq is still in the group, otherwise, the member is already moved out of the group.
The operation module 430 is configured to perform bitwise operation on the group member snapshot bitmap data and the second bitmap data to obtain a third bitmap data for recording the reading state of the group member.
The value of a bit of the second bitmap data read _ status is 0 in two cases: the message corresponding to the read message identifier message _ id of the group member corresponding to the bit and the group member corresponding to the bit quits.
Therefore, it cannot be directly determined which group members read the messages corresponding to the message identifiers message _ id, and the embodiment of the present invention obtains the third bitmap data bitmap by performing a bitwise xor operation on the second bitmap data read _ status and the group member snapshot bitmap data, where the bitmap data number _ bitmap is a bitmap, so that the value of the bit of the group member having already exited in the second bitmap data read _ status is set to 1, and the sending end can know which group members read the messages corresponding to the message identifiers message _ id.
And a returning module 350, configured to traverse the third bitmap data and return the read status of the message to the sending end.
Each bit of the third bitmap data bitmap represents the reading state of the member corresponding to the member serial number, and the third bitmap data bitmap is returned to the sending end, so that the sending end can know the message reading condition of each member.
According to the recording device for the reading state of the instant message provided by the embodiment, after receiving the message sent by the sending end, first bitmap data is generated according to the record of the receiving end; and after receiving the message reading notification returned by the receiving end, modifying the first bitmap data according to the message reading notification to obtain second bitmap data, wherein the second bitmap data records the reading state of the instant message so as to return the reading state of the message to the sending end. The reading state of each receiving end is recorded by utilizing the bitmap, and the record of the reading state of each receiving end is compressed into 1bit, so that compared with the prior art that at least one record with 16 bytes is occupied, the data storage space is greatly saved, and the problems of huge data writing pressure and information storage pressure brought to a database are solved; by acquiring the snapshot bitmap data of the group members, confirming the effective members in the group and adopting the third bitmap data to distinguish and mark the reading states of the withdrawn group members and the reading states of the effective members, the sending end can directly judge the members which have read the message through the third bitmap data without referring to other information, so that the mode of acquiring the reading states by the sending end is simpler and more convenient. .
The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and placed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be appreciated by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the instant message read status recording apparatus according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (12)

1. A method for recording the reading state of an instant message comprises the following steps:
receiving a message sent by a sending end to a receiving end, and generating a message identifier for the message;
generating first bitmap data according to the record of the receiving end, and storing the message identification and the first bitmap data; wherein each bit value of the first bitmap data indicates whether a member of the corresponding member sequence number within the group is valid;
sending the message to a receiving end;
receiving a message reading notice returned by the receiving terminal, and modifying the first bitmap data according to the message reading notice to obtain second bitmap data; wherein each bit of the second bitmap data represents a reading status of a recipient;
returning the reading state of the message to the sending end according to the second bitmap data;
wherein, the receiving end is a group member;
the step of generating first bitmap data according to the record of the receiving end includes:
inquiring records of effective members in the group according to the group identification;
inquiring member serial numbers corresponding to effective members in the group;
and setting data of a position corresponding to a member serial number corresponding to the effective member in the group in the bitmap as first data to obtain first bitmap data.
2. The method according to claim 1, wherein the generating of the first bitmap data according to the record of the receiving end specifically includes: and inquiring the record of the group member according to the group identifier, and generating first bitmap data according to the record of the group member.
3. The method according to claim 2, wherein the querying the record of the group member according to the group identifier, and the generating the first bitmap data according to the record of the group member specifically comprise:
and inquiring records of the effective members in the group according to the group identification, and generating first bitmap data according to the effective members in the group.
4. The method according to claim 1, wherein the receiving a message reading notification returned by the receiving end, and modifying the first bitmap data according to the message reading notification to obtain the second bitmap data further comprises:
receiving a message reading notice returned by the group members;
determining member serial numbers corresponding to group members returning the message reading notification according to the message reading notification;
and setting the data of the position corresponding to the member serial number corresponding to the group member returning the message reading notice in the bitmap corresponding to the first bitmap data as second data to obtain second bitmap data.
5. The method of claim 1, prior to said returning a read status of a message to a sender according to said second bitmap data, further comprising: and acquiring group member snapshot bitmap data according to the group identifier and the message identifier, wherein the group member snapshot bitmap data is set according to snapshot records of unremoved group members and withdrawn group members in the group.
6. The method of claim 5, the returning the read status of the message to the sender according to the second bitmap data further comprising:
performing bitwise operation on the group member snapshot bitmap data and the second bitmap data to obtain third bitmap data for recording the reading state of the group members;
and traversing the third bitmap data and returning the reading state of the message to the sending end.
7. An apparatus for recording an instant message reading status, comprising:
the receiving module is used for receiving a message sent by a sending end to a receiving end and generating a message identifier for the message;
the generating module is used for generating first bitmap data according to the record of the receiving end and storing the message identifier and the first bitmap data; wherein each bit value of the first bitmap data indicates whether a member of the corresponding member sequence number within the group is valid;
the sending module is used for sending the message to a receiving end;
the modification module is used for receiving a message reading notice returned by the receiving terminal and modifying the first bitmap data according to the message reading notice to obtain second bitmap data; wherein each bit of the second bitmap data represents a reading status of a recipient;
the return module is used for returning the reading state of the message to the sending end according to the second bitmap data;
wherein, the receiving end is a group member;
the generation module is further to:
inquiring records of effective members in the group according to the group identification;
inquiring member serial numbers corresponding to effective members in the group;
and setting data of a position corresponding to a member serial number corresponding to the effective member in the group in the bitmap as first data to obtain first bitmap data.
8. The apparatus of claim 7, the generation module further to: and inquiring the record of the group member according to the group identifier, and generating first bitmap data according to the record of the group member.
9. The apparatus of claim 8, the generation module further to: and inquiring records of the effective members in the group according to the group identification, and generating first bitmap data according to the effective members in the group.
10. The apparatus of claim 7, the modification module further comprising:
the receiving unit is used for receiving the message reading notification returned by the group members;
the determining unit is used for determining the member serial numbers corresponding to the group members returning the message reading notice according to the message reading notice;
and the setting unit is used for setting the data of the position corresponding to the member serial number corresponding to the group member returning the message reading notice in the bitmap corresponding to the first bitmap data as second data to obtain second bitmap data.
11. The apparatus of claim 7, the apparatus further comprising: and the acquisition module is used for acquiring the snapshot bitmap data of the group members according to the group identification and the message identification, and the snapshot bitmap data of the group members is set according to the snapshot records of the unremoved group members and the removed group members in the group.
12. The apparatus of claim 11, the apparatus further comprising: the operation module is used for carrying out bitwise operation on the group member snapshot bitmap data and the second bitmap data to obtain third bitmap data used for recording the reading state of the group members;
the return module is further to: and traversing the third bitmap data and returning the reading state of the message to the sending end.
CN201710051105.3A 2017-01-23 2017-01-23 Method and device for recording reading state of instant message Active CN106844662B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710051105.3A CN106844662B (en) 2017-01-23 2017-01-23 Method and device for recording reading state of instant message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710051105.3A CN106844662B (en) 2017-01-23 2017-01-23 Method and device for recording reading state of instant message

Publications (2)

Publication Number Publication Date
CN106844662A CN106844662A (en) 2017-06-13
CN106844662B true CN106844662B (en) 2020-12-04

Family

ID=59120507

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710051105.3A Active CN106844662B (en) 2017-01-23 2017-01-23 Method and device for recording reading state of instant message

Country Status (1)

Country Link
CN (1) CN106844662B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107948050A (en) * 2017-11-08 2018-04-20 用友网络科技股份有限公司 A kind of device and method that group message read states are provided
CN108228759B (en) * 2017-12-22 2021-07-27 金蝶软件(中国)有限公司 Record set storage processing method and device, computer equipment and storage medium
CN109977117A (en) * 2019-03-18 2019-07-05 广州虎牙信息科技有限公司 The method and device that storage method, the data of status data are sent
CN113645123A (en) * 2021-08-03 2021-11-12 福建天泉教育科技有限公司 Message storage method and terminal
CN113704339A (en) * 2021-08-30 2021-11-26 平安普惠企业管理有限公司 Recording of read information status, apparatus, device and storage medium
CN115955450B (en) * 2023-03-09 2023-06-30 美云智数科技有限公司 Instant message display and push method and device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060258336A1 (en) * 2004-12-14 2006-11-16 Michael Sajor Apparatus an method to store and forward voicemail and messages in a two way radio
WO2014183267A1 (en) * 2013-05-14 2014-11-20 华为技术有限公司 Message sending method, messaging read notification method, method receiving method and apparatus
CN105024787A (en) * 2014-08-29 2015-11-04 魅族科技(中国)有限公司 Data transmission method, associated device and system

Also Published As

Publication number Publication date
CN106844662A (en) 2017-06-13

Similar Documents

Publication Publication Date Title
CN106844662B (en) Method and device for recording reading state of instant message
US8977696B2 (en) Declassifying of suspicious messages
CN110968431B (en) Message processing method, device and equipment
CN102769687B (en) Mass texting system and method
CN105791082B (en) Method for message transmission and its device between computer cluster based on message-oriented middleware
CN104518946A (en) Method and device for deleting instant messaging message
WO2008091636A1 (en) Excluding a group member from receiving an electronic message addressed to a group alias address
CN108881354A (en) A kind of pushed information storage method, device, server and computer storage medium
US8713122B2 (en) Message value indicator
US8874675B2 (en) Message thread management using dynamic pointers
CN103903124A (en) E-mail processing method and apparatus
CN104243282B (en) A kind of information notice method and server
CN108462625B (en) Method and device for determining recipients in process of replying electronic mail
CN105376137A (en) Instant messaging method and device
CN111798207A (en) Mail processing method, device, equipment and medium
CN103516757A (en) Method, device and system for processing content
CN109309613B (en) Mail delivery method, device and system
CN102387089B (en) Method and server for transporting messages
US20130054710A1 (en) Categorizing email recipients into logical groups when sending a mass email
US20110191427A1 (en) Communication method adapted for users using multiple communication facilities
CN101827068A (en) Business scenario reduction method and device
CN102111348A (en) Information processing method and device
CN110999227B (en) Mail transmission method and related equipment
JP3938145B2 (en) E-mail proxy device and program
US20240259336A1 (en) Distributed email threading

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant