Instant messaging historical message acquisition method, system and device and storage medium

By obtaining the local serial number set on the terminal device and performing difference analysis, determining and synchronizing the difference in historical messages in the instant messaging system, the problem of excessive load on the server is solved, and server performance and message synchronization efficiency are improved.

CN119276822APending Publication Date: 2025-01-07HANGZHOU AKEY ME CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411551620.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

In the instant messaging system, the server side has too heavy load when performing message difference comparison query, which affects the server performance.

Method used

Obtain the local serial number set on the terminal device and perform a difference analysis to determine whether there is a message difference between the terminal and the server of the historical message of the target page, and obtain message synchronization in the terminal based on the difference analysis results to reduce the server load.

Benefits of technology

By distributing the difference analysis to the terminal device, the load on the server is reduced, the overall performance of the server is improved, and the synchronization of terminal and server messages is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119276822A_ABST
    Figure CN119276822A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of instant messaging, and discloses an instant messaging historical message obtaining method, system and device and a storage medium, and the method comprises the steps: obtaining a local serial number set in response to a received request for accessing a historical message of a target page of a session interface layer; determining a difference analysis result between the first session data and the second session data according to the number of historical messages of a target page and the number of local serial numbers in the local serial number set; and obtaining a historical message of a target page of the session interface layer according to the difference analysis result, and displaying the historical message on the target page of the session interface layer. According to the embodiment of the invention, the message difference analysis is carried out at the terminal instead of the conventional mode of carrying out message difference comparison query at the server, and the difference analysis is dispersed to the terminal equipment, so that the load of the server is reduced, and the overall performance of the server is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of instant messaging, and in particular to a method, system, device and storage medium for acquiring instant messaging history messages. Background Art

[0002] In the related technology, the instant messaging terminal informs the server through the request interface of the time range of historical messages to be obtained, the number of messages to be obtained, and the unique identifier of the messages that the terminal has locally within the time range; the server then performs a comparison query and returns the message difference part that the terminal does not have within the time range to the terminal. However, due to the high complexity of comparing and querying message differences, if a large number of terminals concurrently request the server to obtain historical messages, it will increase the load on the server, thereby affecting the overall performance of the server. Summary of the invention

[0003] In view of this, the present invention provides a method, system, device and storage medium for obtaining instant messaging historical messages to solve the problem of excessive server load caused by comparing and querying message differences on the server side, thereby affecting the overall performance of the server.

[0004] In a first aspect, the present invention provides a method for acquiring instant messaging history messages, the method comprising:

[0005] In response to receiving a request for accessing a history message of a target page of the session interface layer, obtaining a set of local sequence numbers; each of the local sequence numbers is stored locally and corresponds to the history message of the target page;

[0006] Determine a difference analysis result between first session data and second session data according to the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set; the first session data is the historical messages of the target page stored locally; the second session data is the historical messages of the target page stored on the server;

[0007] According to the difference analysis result, historical messages of the target page of the session interface layer are obtained and displayed on the target page of the session interface layer.

[0008] The embodiment of the present invention obtains a local sequence number set and performs message differential analysis at the terminal, and can determine whether there is a message differential between the historical messages of the target page between the terminal and the server only based on the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set, and obtains historical messages synchronized between the terminal and the server at the terminal based on the differential analysis result, instead of the conventional method of identifying the existence of message differentials in the terminal at the server, and distributes the differential analysis to the terminal device, thereby reducing the load on the server and improving the overall performance of the server.

[0009] In an optional implementation, determining the difference analysis result between the first session data and the second session data according to the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set includes:

[0010] Determine a difference between the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set;

[0011] comparing the difference to zero;

[0012] If the difference is equal to zero, it is determined as the first difference analysis result;

[0013] If the difference is greater than zero, the difference ratio is determined based on the difference and the number of historical messages of the target page, and the difference ratio is compared with the set threshold; if it is greater than the set threshold, it is determined as the second difference analysis result; otherwise, it is determined as the third difference analysis result; the difference ratio is the ratio of the difference to the number of historical messages of the target page.

[0014] In an optional implementation, acquiring historical messages of a target page of a session interface layer according to the difference analysis result and displaying the historical messages on the target page of the session interface layer includes:

[0015] Sending the first session data to a target page of the session interface layer according to the first difference analysis result;

[0016] Or, according to the second difference analysis result, second session data is obtained, and the second session data is sent to a target page of the session interface layer.

[0017] In an optional implementation, determining the historical message of the target page displayed on the session interface layer according to the difference analysis result includes:

[0018] According to the third difference analysis result, a server-side sequence number set is obtained; each of the server-side sequence numbers is stored on the server and corresponds to a historical message of the target page; the server-side sequence number set is at least partially the same as the local sequence number set;

[0019] Determine a difference set according to the server sequence number set and the local sequence number set; the difference set is a portion of the server sequence number set that is different from the local sequence number set;

[0020] According to the difference set, third session data is acquired; the third session data is stored on the server and is a historical message of the target page corresponding to the difference set;

[0021] The third session data and the first session data are sent to a target page of the session interface layer.

[0022] In an optional implementation, before obtaining the local sequence number set in response to receiving a request for accessing a history message of a target page of a session interface layer, the method further includes:

[0023] In response to receiving a request to modify the history message of the first page of the session interface layer, obtaining fourth session data; the fourth session data is the history message of the first page stored locally;

[0024] Acquire fifth session data from the server; the fifth session data includes a control instruction and a historical message of the first page stored on the server; the control instruction includes at least one of a delete instruction, a withdraw instruction, and an edit instruction;

[0025] According to the control instruction, executing a corresponding instruction operation on the fourth session data;

[0026] Deduplication of the fifth session data is performed according to the fourth session data that completes the instruction operation;

[0027] The deduplicated fifth session data is sent to the first page of the session interface layer.

[0028] In an optional implementation, after sending the third session data and the first session data to the target page of the session interface layer, the method further includes:

[0029] In response to receiving a request for a new message input to the session interface layer, obtaining a local sequence number corresponding to the local new message;

[0030] Creating a corresponding model according to the attributes of the new message, and sending the model to the server;

[0031] Obtaining a server serial number corresponding to the new message; the server serial number corresponding to the new message is stored on the server and is returned by the server according to the model;

[0032] The local sequence number corresponding to the new message is updated to the server sequence number corresponding to the new message, and the first sending status information is sent to the session interface layer; the first sending status information is generated by obtaining the server sequence number corresponding to the new message, and is used to indicate that the new message is sent successfully.

[0033] In an optional implementation, after creating a corresponding model according to the attributes of the new message and sending the model to the server, the method further includes:

[0034] The second sending status information is sent to the session interface layer; the second sending status information is generated because the server sequence number corresponding to the new message is not obtained, and is used to indicate that the new message fails to be sent.

[0035] In a second aspect, the present invention provides a system for acquiring instant messaging history messages, the system comprising:

[0036] A local message acquisition module, configured to acquire a set of local sequence numbers in response to receiving a request for accessing a historical message of a target page of the session interface layer; each of the local sequence numbers is stored locally and corresponds to a historical message of the target page;

[0037] a differential analysis module, configured to determine a differential analysis result between first session data and second session data according to the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set; the first session data is the historical messages of the target page stored locally; the second session data is the historical messages of the target page stored on the server;

[0038] The historical message acquisition module is used to acquire the historical messages of the target page of the session interface layer according to the difference analysis result, and display them on the target page of the session interface layer.

[0039] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the instant messaging history message acquisition method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0040] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method for obtaining instant messaging history messages according to the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0042] Figure 1 is a flow chart of a method for acquiring instant messaging history messages according to an embodiment of the present invention;

[0043] Figure 2is a message list display diagram of a session interface layer according to an embodiment of the present invention;

[0044] Figure 3 is a target page display diagram of a session interface layer according to an embodiment of the present invention;

[0045] Figure 4 is a flow chart of another method for acquiring instant messaging history messages according to an embodiment of the present invention;

[0046] Figure 5 is a structural block diagram of a system for acquiring instant messaging history messages according to an embodiment of the present invention;

[0047] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0049] In the related art, when an instant messaging terminal obtains historical messages from a server, the server performs a message difference comparison query based on the time range of the historical messages sent by the terminal, the number to be obtained, and the unique identifier of the messages locally available in the terminal within the time range, and returns the message difference part that the terminal does not have to the terminal to ensure the synchronization of historical messages between the terminal and the server. However, the message difference comparison query in this historical message acquisition method is executed on the server and is relatively complex. At this time, if a large number of terminals concurrently request the server to obtain historical messages, the server load will be increased, thereby affecting the overall performance of the server.

[0050] In order to solve the problem of server overload caused by executing message difference comparison query on the server side, thereby affecting the overall performance of the server, an embodiment of the present invention provides a method for obtaining instant messaging historical messages, which obtains a local sequence number set and performs message difference analysis on the terminal, and can judge whether there is a message difference between the historical messages of the target page and the server side only based on the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set, and obtains the historical messages of the target page for synchronization of terminal and server messages on the terminal based on the difference analysis result, instead of the conventional method of identifying the existence of message difference in the terminal on the server side, the difference analysis is distributed to the terminal device, which reduces the load on the server and improves the overall performance of the server.

[0051] According to an embodiment of the present invention, an embodiment of a method for obtaining instant messaging history messages is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0052] In this embodiment, a method for acquiring instant messaging history messages is provided, which is applied to a mobile terminal with an instant messaging function, such as a mobile phone, a tablet computer, a computer, etc. Figure 1 FIG. 1 is a flow chart of a method for acquiring instant messaging history messages according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0053] Step S101, in response to receiving a request for accessing a history message of a target page of a session interface layer, obtaining a set of local sequence numbers; each local sequence number is stored locally and corresponds to a history message of the target page;

[0054] In step S101, if the user wants to query historical messages within a specified range sent between other users, he can open the target page of the session interface layer through interactive operations to trigger a request to access the historical messages of the target page of the terminal session interface layer; the terminal responds to the request and obtains a local sequence number set stored locally.

[0055] It should be noted that historical messages can be displayed in the form of pages, and each page can only display a certain number of historical messages. The historical messages in the specified range here can correspond to historical messages on one page of the terminal session interface layer, or historical messages on multiple pages. When the number of historical messages that the user wants to query is greater than the number of historical messages that can be displayed on each page, the user can query historical messages on more pages by sliding up and down, clicking up and down, sliding left and right, clicking left and right, etc., until all historical messages have been viewed.

[0056] The session interface layer can be represented as an interface for data interaction between the user and the terminal. The user can perform interactive operations on the terminal session interface layer, such as clicking, sliding, dragging, etc., and send a request to the terminal to query historical messages within a specified range. The terminal can also respond to the user's query request and display the historical messages sent between the user and other users on the terminal's session interface layer, so that the user can view these historical messages.

[0057] The interactive operations performed by the user on the terminal session interface layer may be set according to specific application scenarios and are not limited here.

[0058] The local sequence number set is stored locally, and each local sequence number in the local sequence number set has a corresponding historical message in the target page.

[0059] Step S102, determining a difference analysis result between first session data and second session data according to the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set; the first session data is the historical messages of the target page stored locally; the second session data is the historical messages of the target page stored on the server;

[0060] In step S102, as mentioned above, each local sequence number in the local sequence number set has a corresponding historical message in the target page. However, not all historical messages in the target page have corresponding local sequence numbers locally. This is because when a user successfully sends a new message to another user, the terminal will synchronize the new message to the server, and the server will generate a server sequence number corresponding to the new message and return it to the terminal, and the terminal will use the server sequence number as the local sequence number of the new message.

[0061] It should be noted that the server serial number generation rule is to generate an integer serial number that is sorted by the message sending time. Therefore, the server serial number set corresponding to the historical messages of the target page on the server is continuous.

[0062] When a user sends a message to a user on another terminal, the message is not synchronized to the server in time, so that when the user is in the current client, the server serial number corresponding to the message cannot be obtained from the server, resulting in the missing local serial number corresponding to the message, that is, the local serial numbers corresponding to the historical messages in the target page are discontinuous, that is, there is a message difference between the first session data and the second session data.

[0063] Therefore, before obtaining the historical messages in the target page, it is necessary to first query whether there is a difference between the local and server-side historical messages in the target page to ensure that the messages on the terminal and the server are synchronized.

[0064] Step S103, according to the difference analysis result, the historical messages of the target page of the session interface layer are obtained and displayed on the target page of the session interface layer.

[0065] In step S103, after determining the difference analysis result, the historical message of the corresponding page of the final session interface layer after the server and client message synchronization is obtained according to the different difference analysis results, and displayed on the target page of the session interface layer.

[0066] For example, Figure 2 is a message list display diagram of the session interface layer according to an embodiment of the present invention, such as Figure 2 As shown, "Forest TWO" is the current user ID, and the information in the message list represents other user IDs (not all are shown) that have message exchanges with the "Forest TWO" user, for example: "New York Knicks", "15611231123", "1568", etc.

[0067] Figure 3 is a target page display diagram of the session interface layer according to an embodiment of the present invention, such as Figure 3 As shown, "1362" indicates other user IDs that have message exchanges with the "Forest TWO" user, and the chat records in the current chat dialog box indicate the historical messages of the target page, which are 8 in total (including withdrawn messages);

[0068] Assuming that the target page is the second page, if the "Forest TWO" user wants to query the historical messages of the target page with the "1362" user, the "Forest TWO" user needs to pull down in the chat list to find the "1362" user, and enter the chat dialog box with the "1362" user by clicking, and query the historical messages of the second page by pulling down or swiping up, thereby triggering a request to access the historical messages of the second page of the mobile phone session interface layer; the terminal responds to the request and obtains the local serial number set corresponding to the 8 historical messages of the second page of the terminal session interface layer. The number of local serial numbers in the local serial number set may be less than or equal to the number of historical messages of the second page. According to the number of historical messages of the second page and the number of local serial numbers in the local serial number set, the difference analysis result between the first session data and the second session data can be determined. Then, according to different difference analysis results, the historical messages of the second page of the final session interface layer after the server and client messages are synchronized are obtained, and displayed on the target page of the session interface layer, so that the user can see the following. Figure 2 Display chat history.

[0069] If the "Forest TWO" user wants to query more pages of historical messages between him and the "1362" user, he can view the historical messages of multiple target pages by pulling down or swiping up, and execute steps S101 to S103 multiple times until the user does not need to view more pages of historical messages or no longer needs to preload the historical messages of the next page.

[0070] It should be noted that the number of historical messages displayed on the target page of the session interface layer may be less than the number of messages that the target page can accommodate, indicating that all the historical messages on the terminal are fully synchronized with the server, and there is no need to obtain more historical messages from the server. Only when the number of historical messages on the target page displayed on the session interface layer is equal to the number of messages that the target page can accommodate, indicating that all the historical messages on the terminal are not fully synchronized with the server, and more historical messages need to be obtained from the server, at this time, regardless of whether the terminal user needs to view the historical messages of the next page, the historical messages of the next page will be preloaded in advance.

[0071] The embodiment of the present invention obtains a local sequence number set and performs message differential analysis at the terminal, and can determine whether there is a message differential between the historical messages of the target page between the terminal and the server only based on the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set, and obtains historical messages synchronized between the terminal and the server at the terminal based on the differential analysis result, instead of the conventional method of identifying the existence of message differentials in the terminal at the server, and distributes the differential analysis to the terminal device, thereby reducing the load on the server and improving the overall performance of the server.

[0072] In some optional implementations, the above step S102 includes:

[0073] Step S1021, determining the difference between the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set;

[0074] In step S1021, as can be seen from the above, when there is a message difference between the first session data and the second session data, the local sequence number set is discontinuous, that is, the local sequence number corresponding to a message is missing. In this case, the number of historical messages of the target page will be inconsistent with the number of local sequence numbers in the local sequence number set. The embodiment of the present invention determines whether there is a message difference between the first session data and the second session data by judging the difference between the two.

[0075] Step S1022, comparing the difference with zero;

[0076] If the difference is equal to zero, it is determined as the first difference analysis result;

[0077] If the difference is greater than zero, the difference ratio is determined based on the difference and the number of historical messages of the target page, and the difference ratio is compared with the set threshold; if it is greater than the set threshold, it is determined as the second difference analysis result; otherwise, it is determined as the third difference analysis result; the difference ratio is the ratio of the difference to the number of historical messages of the target page.

[0078] In step S1022, if the difference is zero, it indicates that the local sequence number set is complete and continuous, that is, there is no message difference between the first session data and the second session data, and at this time, the first session data and the second session data messages are synchronized.

[0079] If the difference is greater than zero, it indicates that at least one local sequence number is missing. In this case, the local sequence number set is discontinuous, that is, there is a message difference between the first session data and the second session data. In this case, the first session data and the second session data are not synchronized.

[0080] Determine the difference ratio, and compare the difference ratio with the set threshold; if it is greater than the set threshold, determine it as the second difference analysis result; otherwise, determine it as the third difference analysis result; the difference ratio is the ratio of the difference value to the number of historical messages of the target page.

[0081] It should be noted that the setting threshold of the difference ratio can be set and dynamically adjusted according to the collected interface performance data, and no specific limitation is made here.

[0082] For example, the number of historical messages that the user wants to obtain for the target page is n, and the starting sequence number of the historical messages to be obtained is begin. In this case, the range n_range of historical messages to be obtained is: [begin, begin+n] or [begin-n, begin]. {A} represents the local sequence number set sum within the range n_range; |A| represents the number of local sequence numbers in the local sequence number set sum.

[0083] The difference gap=(n-|A|). If gap=0, it means that there is no message difference between the local and server sides of the historical messages in the specified range, and it is determined as the first difference analysis result. If gap>0, it means that there is a message difference between the local and server sides of the historical messages in the specified range. At this time, the difference ratio gapRation=(gap / n) is calculated, and the difference ratio gapRation=(gap / n) is compared with the set threshold gapRationThreshold. If gapRation>gapRationThreshold, it is determined as the second difference analysis result; if gapRation≤gapRationThreshold, it is determined as the third difference analysis result.

[0084] In some optional implementations, the above step S103 includes:

[0085] Step S1031a, sending the first session data to a target page of the session interface layer according to the first difference analysis result;

[0086] Or, step S1031b, obtaining second session data according to the second difference analysis result, and sending the second session data to the target page of the session interface layer.

[0087] In step S1031a, the first difference analysis result indicates that there is no message difference between the first session data and the second session data, and the first session data and the second session data are synchronized. In this case, the local first session data can be directly sent to the target page of the session interface layer.

[0088] In step S1031b, the second difference analysis result indicates that there is a message difference between the first session data and the second session data, and the difference ratio is greater than the set threshold, indicating that the difference between the first session data and the second session data is relatively large. At this time, the second session data is directly obtained and sent to the target page of the session interface layer.

[0089] In some optional embodiments, the terminal may also store the second session data locally and use it as new first session data.

[0090] In some optional implementations, the above step S103 includes:

[0091] Step S1031c, according to the third difference analysis result, obtaining a server-side sequence number set; each server-side sequence number is stored on the server and corresponds to a historical message of the target page; the server-side sequence number set is at least partially the same as the local sequence number set;

[0092] Determine a difference set according to the server sequence number set and the local sequence number set; the difference set is the part of the server sequence number set that is different from the local sequence number set;

[0093] According to the difference set, third session data is obtained; the third session data is stored on the server side and is the historical message of the target page corresponding to the difference set;

[0094] The third session data and the first session data are sent to a target page of the session interface layer.

[0095] In step S1031c, the third difference analysis result indicates that there is a message difference between the first session data and the second session data, and the difference ratio is less than the set threshold, indicating that the difference between the first session data and the second session data is relatively small. At this time, if the second session data is sent to the target page of the session interface layer, unnecessary processing time will be increased. In the embodiment of the present invention, it is only necessary to find the difference between the server sequence number set and the local sequence number set, and the difference set contains a number of message sequence numbers that are not available locally in the terminal. Then, according to the server sequence number in the difference set, the corresponding historical message set, i.e., the third session data, is obtained from the server. At this time, the first session data and the first session data are added together, which are synchronized with the second session data. Therefore, the third session data and the first session data are directly sent to the target page of the session interface layer.

[0096] In some optional embodiments, the terminal may further merge the third session data with the first session data, and store the merged data locally as new first session data.

[0097] In this embodiment, a method for acquiring instant messaging history messages is provided, which is applied to a mobile terminal with an instant messaging function, such as a mobile phone, a tablet computer, or a computer. Figure 4 FIG. 1 is a flow chart of another method for acquiring instant messaging history messages according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:

[0098] Step S401;

[0099] Specifically, the above step S401 includes:

[0100] Step S4011, in response to receiving a request to modify the history message of the first page of the session interface layer, obtaining fourth session data; the fourth session data is the history message of the first page stored locally.

[0101] In step S4011, if the user wants to modify the historical messages of the first page sent between other users, the historical messages of the first page of the session interface layer can be modified through at least one interactive operation of modification, withdrawal, and editing to trigger a request to modify the historical messages of the first page of the terminal session interface layer; the terminal responds to the request and obtains the local historical messages of the first page, that is, the fourth session data.

[0102] Step S4012, obtaining fifth session data from the server; the fifth session data includes control instructions and historical messages of the first page stored on the server; the control instructions include at least one of a delete instruction, a withdraw instruction and an edit instruction.

[0103] Step S4012, when the terminal obtains the local history message of the first page, the flag bit of the local request isLocal=true, and the historical message of the first page of the server is obtained at the same time, that is, the fifth session data. The flag bit of the server request isLocal=false.

[0104] It should be noted that the control instructions in the fifth session data are used to manage the historical messages of the local first page. The historical messages of the first page stored on the server and locally are all visible messages, and visible messages refer to messages displayed on the terminal device. For example, a deleted message is an invisible message, and a withdrawn message is a visible message. This is because the withdrawn message will display words like "××× withdrew a message" in the session interface layer, while the visible message is still retained locally.

[0105] Step S4013, executing a corresponding instruction operation on the fourth session data according to the control instruction;

[0106] In step S4013, the terminal executes the corresponding operation that the user wants to modify on the local fourth session data according to the control instruction, ensuring that the modification of the historical message is only executed on the terminal through the control instruction.

[0107] Step S4014, deduplication of the fifth session data is performed according to the fourth session data that has completed the instruction operation;

[0108] Step S4013, the fifth session data is stored locally, and the fourth session data that completes the instruction operation is used as a reference object, and the unique constraint of the local database is used to deduplicate the data.

[0109] Data deduplication is mainly achieved by creating a unique index on the column that requires uniqueness. When a unique index is created on a column, the database will perform a uniqueness check on the value of the column. When trying to insert or update data, if the unique constraint is violated, that is, the insert or update operation causes the value of the column to be duplicated with the value in the existing row, the database will reject the operation and return an error.

[0110] Step S4015: Send the fifth session data after deduplication to the first page of the session interface layer.

[0111] Step S4015, the fifth session data after deduplication can ensure that the fifth session data and the fourth session data are synchronized and modified, thereby avoiding the occurrence of the message difference mentioned above.

[0112] Step S402, in response to receiving a request for accessing the history message of the target page of the session interface layer, obtain a set of local sequence numbers; each local sequence number is stored locally and corresponds to the history message of the target page. Figure 1Step S101 of the illustrated embodiment will not be described in detail here.

[0113] Step S403, according to the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set, determine the difference analysis result between the first session data and the second session data; the first session data is the historical messages of the target page stored locally; the second session data is the historical messages of the target page stored on the server. For details, please refer to Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0114] Step S404: According to the difference analysis result, the historical messages of the target page of the session interface layer are obtained and displayed on the target page of the session interface layer. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0115] In some optional implementations, the terminal divides the historical messages on the first page of the fifth session data into ordinary visible messages and edited visible messages, performs editing operations on ordinary visible messages, and after performing the editing instruction operation, returns the editing instruction to the server for storage. When the user obtains historical messages at other terminals, the server returns the previously saved editing instruction to the other terminals, and the other terminals perform the same operation as the current terminal according to the editing instruction. At the same time, the editing instruction does not need to be returned to the server, so as to ensure that the modification operation performed by the user at the current terminal can also take effect synchronously at other terminals.

[0116] In some optional implementations, after at least one of the deletion and withdrawal operations is performed on the fourth session, the deletion instruction and the withdrawal operation are returned to the server for storage. Similarly, it is ensured that the modification operation performed by the user on the current terminal can also be synchronously effective on other terminals.

[0117] In some optional implementations, after sending the third session data and the first session data to the target page of the session interface layer, the method further includes:

[0118] Step a, in response to receiving a request for a new message input into the session interface layer, obtaining a local sequence number corresponding to the local new message;

[0119] In step a, when a user wants to send a new message to other users, he can input the new message through the input box of the session interface layer and click "Send" to trigger a request for a new message input into the terminal session interface layer; the terminal responds to the request and obtains the local sequence number corresponding to the new message stored locally.

[0120] It should be noted that the local sequence number corresponding to the new message is generated locally, not sent by the server to the terminal.

[0121] Step b: creating a corresponding model according to the attributes of the new message, and sending the model to the server;

[0122] The model corresponding to the new message can be represented as a data type similar to the following example, which represents the fields and attributes of the new message.

[0123] Exemplary:

[0124] type Message struct {

[0125] MsgID string

[0126] Timestamp int64

[0127] Seqint64

[0128] Content string

[0129] State int32

[0130] }

[0131] Step c, obtaining the server serial number corresponding to the new message; the server serial number corresponding to the new message is stored on the server and is returned by the server according to the model;

[0132] Step d: update the local sequence number corresponding to the new message to the server sequence number corresponding to the new message, and send the first sending status information to the session interface layer; the first sending status information is generated to obtain the server sequence number corresponding to the new message, and is used to indicate that the new message is sent successfully.

[0133] In step d, if the terminal obtains the server sequence number returned by the server, the local sequence number corresponding to the new message is updated to the server sequence number, and the first status information indicating that the new message was sent successfully is sent to the session interface layer to notify the terminal session interface layer that the new message was sent successfully.

[0134] In some optional implementations, after creating a corresponding model according to the attributes of the new message and sending the model to the server, the method further includes:

[0135] Step e: sending the second sending status information to the session interface layer; the second sending status information is generated when the server sequence number corresponding to the new message is not obtained, and is used to indicate that the new message fails to be sent.

[0136] In step e, if the terminal does not obtain the server sequence number returned by the server, it directly uses the local sequence number corresponding to the new message, and sends the second status information indicating the failure to send the new message to the session interface layer to notify the terminal session interface layer that the new message failed to send.

[0137] If the user triggers a request to send the message again, steps a to e may be continued until the new message is successfully sent or the user stops sending the message.

[0138] Messages that fail to be sent are sorted based on the local sequence number and the local sending time, with the local sequence number having a higher priority.

[0139] Steps d and e ensure that the message sequence numbers corresponding to the newly sent messages are consistent on the terminal and the server, providing valid continuous sequence numbers for calculating message differences on the aforementioned terminal, while also satisfying the message sorting requirements on the terminal.

[0140] In the present embodiment, a system for acquiring historical messages of instant messaging is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made are omitted. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0141] This embodiment provides a system for acquiring instant messaging history messages. Figure 5 As shown, including:

[0142] A local message acquisition module, configured to acquire a set of local sequence numbers in response to receiving a request for accessing a historical message of a target page of the session interface layer; each of the local sequence numbers is stored locally and corresponds to a historical message of the target page;

[0143] a differential analysis module, configured to determine a differential analysis result between first session data and second session data according to the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set; the first session data is the historical messages of the target page stored locally; the second session data is the historical messages of the target page stored on the server;

[0144] The historical message acquisition module is used to acquire the historical messages of the target page of the session interface layer according to the difference analysis result, and display them on the target page of the session interface layer.

[0145] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0146] The instant messaging history message acquisition system in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0147] The embodiment of the present invention also provides a computer device having the above Figure 5 The instant messaging history message acquisition system shown.

[0148] See 6, Figure 6 1 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, and the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system).

[0149] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0150] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0151] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0152] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0153] The computer device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means, and FIG. X takes the bus connection as an example.

[0154] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0155] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0156] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for acquiring instant messaging history messages, characterized in that: The method comprises: In response to receiving a request for accessing a history message of a target page of the session interface layer, obtaining a set of local sequence numbers; each of the local sequence numbers is stored locally and corresponds to the history message of the target page; Determine a difference analysis result between first session data and second session data according to the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set; the first session data is the historical messages of the target page stored locally; the second session data is the historical messages of the target page stored on the server; According to the difference analysis result, historical messages of the target page of the session interface layer are obtained and displayed on the target page of the session interface layer.

2. The method according to claim 1, characterized in that The determining, according to the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set, a difference analysis result between the first session data and the second session data includes: Determine a difference between the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set; comparing the difference to zero; If the difference is equal to zero, it is determined as the first difference analysis result; If the difference is greater than zero, the difference ratio is determined based on the difference and the number of historical messages of the target page, and the difference ratio is compared with the set threshold; if it is greater than the set threshold, it is determined as the second difference analysis result; otherwise, it is determined as the third difference analysis result; the difference ratio is the ratio of the difference to the number of historical messages of the target page.

3. The method according to claim 2, characterized in that The step of obtaining historical messages of a target page of a session interface layer according to the difference analysis result and displaying the historical messages on the target page of the session interface layer includes: Sending the first session data to a target page of the session interface layer according to the first difference analysis result; Or, according to the second difference analysis result, second session data is obtained, and the second session data is sent to a target page of the session interface layer.

4. The method according to claim 2, characterized in that: Determining the historical messages of the target page displayed on the session interface layer according to the difference analysis result includes: According to the third difference analysis result, a server-side sequence number set is obtained; each of the server-side sequence numbers is stored on the server and corresponds to a historical message of the target page; the server-side sequence number set is at least partially the same as the local sequence number set; Determine a difference set according to the server sequence number set and the local sequence number set; the difference set is a portion of the server sequence number set that is different from the local sequence number set; According to the difference set, third session data is acquired; the third session data is stored on the server and is a historical message of the target page corresponding to the difference set; The third session data and the first session data are sent to a target page of the session interface layer.

5. The method according to claim 1, characterized in that Before obtaining the local sequence number set in response to receiving a request for accessing a history message of a target page of the session interface layer, the method further includes: In response to receiving a request to modify the history message of the first page of the session interface layer, obtaining fourth session data; the fourth session data is the history message of the first page stored locally; Acquire fifth session data from the server; the fifth session data includes a control instruction and a historical message of the first page stored on the server; the control instruction includes at least one of a delete instruction, a withdraw instruction, and an edit instruction; According to the control instruction, executing a corresponding instruction operation on the fourth session data; Deduplication of the fifth session data is performed according to the fourth session data that completes the instruction operation; The deduplicated fifth session data is sent to the first page of the session interface layer.

6. The method according to claim 4, characterized in that After sending the third session data and the first session data to the target page of the session interface layer, the method further includes: In response to receiving a request for a new message input to the session interface layer, obtaining a local sequence number corresponding to the local new message; Creating a corresponding model according to the attributes of the new message, and sending the model to the server; Obtaining a server serial number corresponding to the new message; the server serial number corresponding to the new message is stored on the server and is returned by the server according to the model; The local sequence number corresponding to the new message is updated to the server sequence number corresponding to the new message, and the first sending status information is sent to the session interface layer; the first sending status information is generated by obtaining the server sequence number corresponding to the new message, and is used to indicate that the new message is sent successfully.

7. The method according to claim 6, characterized in that After creating a corresponding model according to the attributes of the new message and sending the model to the server, the method further includes: The second sending status information is sent to the session interface layer; the second sending status information is generated because the server sequence number corresponding to the new message is not obtained, and is used to indicate that the new message fails to be sent.

8. An instant messaging history message acquisition system, characterized in that: The system comprises: A local message acquisition module, configured to acquire a set of local sequence numbers in response to receiving a request for accessing a historical message of a target page of the session interface layer; each of the local sequence numbers is stored locally and corresponds to a historical message of the target page; a differential analysis module, configured to determine a differential analysis result between first session data and second session data according to the number of historical messages of the target page and the number of local sequence numbers in the local sequence number set; the first session data is the historical messages of the target page stored locally; the second session data is the historical messages of the target page stored on the server; The historical message determination module determines the historical message of the target page displayed on the session interface layer according to the difference analysis result.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.