User real-time recommendation method, device, system, equipment and readable storage medium
The method calculates a user interest model and uses persistent connections to deliver targeted messages in real-time, addressing the limitations of fixed groupings and enhancing user experience.
Patent Information
- Application Number
- CN202110875530.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-30
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2041-07-30
AI Technical Summary
Existing business service systems lack the ability to push messages to targeted user groups in a real-time and interest-based manner due to fixed groupings, preventing timely adjustments based on changing user interests.
A method and device that calculates a user interest model based on user service data, establishes a long connection with the user terminal, and pushes messages through a persistent connection using a user interest model to achieve targeted, real-time message delivery.
Enhances user experience by enabling real-time, interest-based message delivery, improving user friendliness and responsiveness.
Smart Images

Figure CN113553511B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a user real-time recommendation method, device, system, equipment and readable storage medium. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the invention recited in the claims. No admission is made that the description herein is prior art by inclusion in this section.
[0003] Some business service systems need to push messages to users in real time, but currently they generally do not have the ability to push messages to targeted user groups. Users are grouped into fixed groups and then messages are pushed to users in the groups. This makes it impossible to push messages based on user interests in a targeted, real-time manner or based on timed changes in interests. Summary of the invention
[0004] The embodiment of the present invention provides a user real-time recommendation method for realizing targeted, real-time and interest-based message push based on user interests. The method includes:
[0005] Receiving user business data sent by the business service system, and calculating a user interest model based on the user business data;
[0006] Establish a long connection with the user end;
[0007] Receive push messages sent by the business service system, and push messages to the user end through a persistent connection based on the user interest model and push messages.
[0008] In one embodiment, receiving user service data sent by a service service system includes:
[0009] Each piece of user business data is obtained from the business data queue in the message middleware, wherein the business service system sends the user business data to the message middleware.
[0010] In one embodiment, it further includes:
[0011] The user service data is processed.
[0012] In one embodiment, calculating the user interest model based on the user service data includes:
[0013] Determine a user tag value according to the user service data, and determine a user model based on the user tag value;
[0014] Calculate the similarity between the user model and the label vector of the preset message;
[0015] The similarity is compared with a similarity threshold, and a user interest model is determined based on the comparison result.
[0016] In one embodiment, comparing the similarity with a similarity threshold, and determining a user interest model based on the comparison result, includes:
[0017] The similarity is compared with a similarity threshold, and when the similarity is greater than the similarity threshold, a user interest model corresponding to the message type corresponding to the label vector of the corresponding preset message is determined.
[0018] In one embodiment, the user interest model is {key: user ID, value: [message type 1, message type 2, message type 3]}.
[0019] In one embodiment, it further includes:
[0020] The user interest model is stored in a database and / or redis.
[0021] In one embodiment, it further includes:
[0022] Receive a user interest model query request sent by the management end;
[0023] Based on the user interest model query request, the corresponding user interest model is obtained from the database and / or redis and returned to the management end, and the management end corrects the user interest model.
[0024] In one embodiment, establishing a long connection with a user terminal includes:
[0025] Receiving a user data request sent by a user terminal;
[0026] Acquire connection information for establishing a persistent connection according to the user data request;
[0027] Based on the connection information for establishing the persistent connection, a persistent connection is established with the user end.
[0028] In one embodiment, establishing a long connection with a user terminal includes:
[0029] Receive the request to create a long connection sent by the sockjs client;
[0030] Based on the creation of the long connection request, a websocket dual-channel connection is established with the user end.
[0031] In one embodiment, receiving a push message sent by a business service system includes:
[0032] Each push message is obtained from the message queue in the message middleware, wherein the business service system sends the push message to the message middleware.
[0033] In one embodiment, it further includes:
[0034] Process the push message.
[0035] In one embodiment, based on the user interest model and the push message, the message is pushed to the user terminal through a persistent connection, including:
[0036] Based on the message type of the push message, determine the corresponding user identity in the user interest model;
[0037] Storing the user identity in a user identity list;
[0038] Based on the user identity list, a message is pushed to the corresponding user terminal through a persistent connection.
[0039] In one embodiment, before pushing a message to a user terminal through a persistent connection, the method further includes:
[0040] Receive an initialization message request sent by a user terminal;
[0041] Obtaining an initialization message according to the initialization message request;
[0042] Return the initialization message to the user.
[0043] The embodiment of the present invention also provides a user real-time recommendation device, which is used to implement targeted, real-time and interest-based message push based on user interests. The device includes:
[0044] A user interest management module, configured to receive user service data sent by the service service system and calculate a user interest model based on the user service data;
[0045] The persistent connection service module is used to establish a persistent connection with the user end;
[0046] The message management module is used to receive push messages sent by the business service system, and push messages to the user end through a persistent connection based on the user interest model and push messages.
[0047] In one embodiment, the user interest management module is specifically used to:
[0048] Each piece of user business data is obtained from the business data queue in the message middleware, wherein the business service system sends the user business data to the message middleware.
[0049] In one embodiment, the user interest management module is further used to:
[0050] The user service data is processed.
[0051] In one embodiment, the user interest management module is specifically used to:
[0052] Determine a user tag value according to the user service data, and determine a user model based on the user tag value;
[0053] Calculate the similarity between the user model and the label vector of the preset message;
[0054] The similarity is compared with a similarity threshold, and a user interest model is determined based on the comparison result.
[0055] In one embodiment, the user interest management module is specifically used to:
[0056] The similarity is compared with a similarity threshold, and when the similarity is greater than the similarity threshold, a user interest model corresponding to the message type corresponding to the label vector of the corresponding preset message is determined.
[0057] In one embodiment, the user interest model is {key: user ID, value: [message type 1, message type 2, message type 3]}.
[0058] In one embodiment, it also includes: a database and / or redis, used to store the user interest model.
[0059] In one embodiment, the message management module is further used to:
[0060] Receive a user interest model query request sent by the management end;
[0061] Based on the user interest model query request, the corresponding user interest model is obtained from the database and / or redis and returned to the management end, and the management end corrects the user interest model.
[0062] In one embodiment, the long connection service module is specifically used for:
[0063] Receiving a user data request sent by a user terminal;
[0064] Acquire connection information for establishing a persistent connection according to the user data request;
[0065] Based on the connection information for establishing the persistent connection, a persistent connection is established with the user end.
[0066] In one embodiment, the long connection service module is specifically used for:
[0067] Receive the request to create a long connection sent by the sockjs client;
[0068] Based on the creation of the long connection request, a websocket dual-channel connection is established with the user end.
[0069] In one embodiment, the message management module is specifically used to:
[0070] Each push message is obtained from the message queue in the message middleware, wherein the business service system sends the push message to the message middleware.
[0071] In one embodiment, the message management module is further used to:
[0072] Process the push message.
[0073] In one embodiment, the long connection service module is further used to:
[0074] Based on the message type of the push message, determine the corresponding user identity in the user interest model;
[0075] Storing the user identity in a user identity list;
[0076] Based on the user identity list, a message is pushed to the corresponding user terminal through a persistent connection.
[0077] In one embodiment, the message management module is further used to:
[0078] Before pushing a message to the user through a persistent connection, receiving an initialization message request sent by the user;
[0079] Obtaining an initialization message according to the initialization message request;
[0080] Return the initialization message to the user.
[0081] The embodiment of the present invention also provides a user real-time recommendation system for realizing targeted, real-time and interest-based message push based on user interests and timed changes. The system includes: a user real-time recommendation device, a business service system and a user terminal.
[0082] In one embodiment, it also includes: message middleware.
[0083] In one embodiment, it also includes: a management end.
[0084] An embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned user real-time recommendation method when executing the computer program.
[0085] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the above-mentioned user real-time recommendation method are implemented.
[0086] In the embodiment of the present invention, compared with the technical solution of the prior art of grouping users and then pushing messages to the users in the group, the user service data sent by the service service system is received, and the user interest model is calculated based on the user service data; a long connection is established with the user terminal; a push message sent by the service service system is received, and based on the user interest model and the push message, the message is pushed to the user terminal through the long connection. The present invention combines user interest mining and long connection real-time push to solve the real-time and targeted information push based on user interests, and effectively improves user friendliness and experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0087] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0088] Figure 1 The structure frame of the user real-time recommendation system in the embodiment of the present invention is Figure 1 ;
[0089] Figure 2 This is a specific architecture diagram of the user real-time recommendation system in an embodiment of the present invention;
[0090] Figure 3 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 1 ;
[0091] Figure 4 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 2 ;
[0092] Figure 5 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 3 ;
[0093] Figure 6 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 4 ;
[0094] Figure 7 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 5 ;
[0095] Figure 8 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 6 ;
[0096] Fig. 9 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 7 ;
[0097] Fig.10 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 8 ;
[0098] Fig.11 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 6 ;
[0099] Fig.12 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 7 ;
[0100] Fig.13 The process of the method for real-time recommendation of users in the embodiment of the present invention is as follows Figure 8 ;
[0101] Fig.14 An interaction graph for calculating user interests in an embodiment of the present invention;
[0102] Fig.15 An interactive diagram of user message push in an embodiment of the present invention;
[0103] Fig.16 The structure frame of the user real-time recommendation device in the embodiment of the present invention is Figure 1 ;
[0104] Fig.17 The structure frame of the user real-time recommendation device in the embodiment of the present invention is Figure 2 ;
[0105] Fig.18 It is a schematic block diagram of the system structure of the computer device 600 in an embodiment of the present invention. DETAILED DESCRIPTION
[0106] To make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0107] Explanation of terms
[0108] Spring Stomp: Spring Stomp is a websocket-based long connection processing framework provided by Spring;
[0109] Websocket: A communication protocol that provides full-duplex over a single TCP connection and is a commonly used protocol for long connections;
[0110] The embodiment of the present invention provides a user real-time recommendation system for realizing targeted, real-time and interest-based message push based on user interests. Figure 1 The structure frame of the user real-time recommendation system in the embodiment of the present invention is Figure 1 ,like Figure 1 As shown, the system includes: a user real-time recommendation device, a business service system and a user terminal.
[0111] The user real-time recommendation device is used to push messages in real time based on the user interest model.
[0112] The business service system is used to push user business data and push messages.
[0113] The client is used to receive push messages.
[0114] In the embodiment of the present invention, Figure 1 As shown, it also includes: a message middleware, which is responsible for receiving business data for interest mining from third-party business services, and push messages from other business servers.
[0115] In the embodiment of the present invention, Figure 1 As shown, it also includes: a management end, which is responsible for managing user interests, setting system message push, etc.
[0116] Specifically, Figure 2 As shown, the system includes a user layer, a service layer and a data layer.
[0117] User layer: User side (web side and app side) and management side (web side). The user side is responsible for obtaining user information and initial push messages from the user center, establishing a persistent connection with the persistent connection service, and real-time display of messages.
[0118] Service layer: user real-time recommendation device, which includes user center, message management module, long connection service module and user interest management module. The user center is responsible for managing user information, mainly including user information management and user history records (such as who the user has established a long connection with, what push messages the user has received, what requests the user has made, etc.); the message management module is used for message setting (such as setting message tags, message types, etc.), message management (managing message tags, etc.), message reception (receiving and processing messages from the message middleware) and initial push message management (including basic messages reserved by the system); the long connection service module is used for long connection management, connection creation and topic management; the user interest management module is used for user interest mining and user interest management, receives user business operation records from business services, uses simple rules to calculate user interests, and maintains user interests;
[0119] Message middleware;
[0120] The business service system includes a business service system for user interest mining data source service and a business service system for push message source service.
[0121] Data layer: includes databases mysql and redis.
[0122] Based on the above user real-time recommendation system, the present invention proposes a user real-time recommendation method (from the perspective of a user real-time recommendation device), such as Figure 3 As shown, Figure 3 As shown, the method includes:
[0123] Step 301: receiving user service data sent by the service service system, and calculating a user interest model based on the user service data;
[0124] Step 302: Establish a long connection with the user terminal;
[0125] Step 303: Receive the push message sent by the business service system, and push the message to the user end through a persistent connection based on the user interest model and the push message.
[0126] Specifically, different business service systems send user business data with business types.
[0127] In the embodiment of the present invention, step 301 of receiving user service data sent by the service service system includes:
[0128] Each piece of user business data is obtained from the business data queue in the message middleware, wherein the business service system sends the user business data to the message middleware.
[0129] Specifically, what is stored in the message middleware at this time is the business data queue. After the business service system sends the user business data to the message middleware, it is stored in the business data queue one by one, and it is consumed (i.e., obtained, read) from the business data queue one by one.
[0130] In the embodiment of the present invention, Figure 4 As shown, it also includes:
[0131] Step 401: Process the user service data.
[0132] In the embodiment of the present invention, Figure 5 As shown, step 301 calculates the user interest model based on the user service data, including:
[0133] Step 501: determining a user tag value according to the user service data, and determining a user model based on the user tag value;
[0134] Step 502: Calculate the similarity between the user model and the tag vector of the preset message;
[0135] Step 503: Compare the similarity with a similarity threshold, and determine a user interest model based on the comparison result.
[0136] Specifically, Figure 6 As shown, step 503 specifically includes:
[0137] Step 601: Compare the similarity with a similarity threshold, and when the similarity is greater than the similarity threshold, determine a user interest model corresponding to a message type corresponding to a tag vector of a corresponding preset message.
[0138] Specifically, based on the interest mining algorithm defined in advance, a user model is mined, and the user model is defined as A = {a 1 ,…,a x ,…,a n}, where a x Indicates the xth label value mined based on user service request data. Each message type will have a label vector, which is specific to the message type, and each message belongs to a message type. Each message also corresponds to a label vector B = {b 1 ,…,b x ,…,b n}; Calculate the Cosine similarity cos(A,B) between the user model and the label vector of each message; Based on the pre-defined similarity threshold, obtain the user's interest model, which is {key: user ID, value: [message type 1, message type 2, message type 3]}. The larger the cos value, the higher the similarity. If the cos value is 1, it means that the user model is exactly the same as the label vector of each message.
[0139] In the embodiment of the present invention, Figure 7 As shown, it also includes:
[0140] Step 701: Store the user interest model in a database and / or redis.
[0141] Specifically, redis is a key-value storage system. Similar to Memcached, it supports storing more value types, including string, list, set, zset (sorted set) and hash. These data types support push / pop, add / remove, intersection, union, difference and richer operations, and these operations are atomic. On this basis, redis supports various different sorting methods. Like memcached, in order to ensure efficiency, data is cached in memory. The difference is that redis will periodically write updated data to disk or write modification operations to additional record files, and on this basis, master-slave synchronization is implemented.
[0142] RedisRedis is a high-performance key-value database. The emergence of redis has largely compensated for the shortcomings of key / value storage such as memcached, and can play a good supplementary role to relational databases in some occasions. It provides clients such as Java, C / C++, C#, PHP, JavaScript, Perl, Object-C, Python, Ruby, Erlang, etc., which is very convenient to use.
[0143] Redis supports master-slave synchronization. Data can be synchronized from a master to any number of slaves, which can be masters that are linked to other slaves. This allows Redis to perform single-layer tree replication. Data can be written to the disk intentionally or unintentionally. Since the publish / subscribe mechanism is fully implemented, slaves can subscribe to a channel and receive the complete message publishing record of the master server when synchronizing the tree anywhere. Synchronization is very helpful for scalability of read operations and data redundancy.
[0144] In the embodiment of the present invention, Figure 8 As shown, it also includes:
[0145] Step 801: receiving a user interest model query request sent by a management terminal;
[0146] Step 802: Based on the user interest model query request, the corresponding user interest model is obtained from the database and / or redis and returned to the management end, and the management end corrects the user interest model.
[0147] Specifically, the administrator can query the user interest model through the management terminal and perform correction management.
[0148] In the embodiment of the present invention, Fig. 9As shown, step 302 of establishing a long connection with the user terminal includes:
[0149] Step 901: receiving a user data request sent by a user terminal;
[0150] Step 902: Acquire connection information for establishing a persistent connection according to the user data;
[0151] Step 903: Establish a persistent connection with the user terminal based on the connection information for establishing a persistent connection.
[0152] Specifically, the connection information for establishing a persistent connection may include a persistent connection list, and the persistent connection list may include a plurality of persistent connection information.
[0153] The so-called long connection means that multiple data packets can be sent continuously on a connection, and then the connection is disconnected. During the connection, if no data packet is sent, both parties need to send a link detection packet. Long connections are mostly used for frequent operations, point-to-point communication, and the number of connections cannot be too many. Each TCP connection requires a three-step handshake, which takes time. If each operation is connected first and then operated, the processing speed will be much lower. Therefore, after each operation, it is not disconnected. The next time the data packet is processed, it will be OK without establishing a TCP connection. For example: the database connection uses a long connection. If short connections are used for frequent communication, socket errors will occur, and frequent socket creation is also a waste of resources.
[0154] In the embodiment of the present invention, Fig.10 As shown, step 302 establishes a long connection with the user terminal, including:
[0155] Step 1001: receiving a request for creating a persistent connection sent by a sockjs client;
[0156] Step 1002: Based on the request to create a persistent connection, a websocket dual-channel connection is established with the user end.
[0157] Specifically, the present invention establishes a long connection based on Spring Stomp, and Spring Stomp is a webscoket-based long connection processing framework provided by Spring.
[0158] SockJS is a browser JavaScript library that provides a network-like object. SockJS provides a coherent, cross-browser Javascript API that creates a low-latency, full-duplex, cross-domain communication channel between the browser and the web server.
[0159] One of the great benefits of SockJS is that it provides browser compatibility. Native WebSocket is used first, and if it is in a browser that does not support websocket, it will automatically fall back to polling.
[0160] In addition, spring also provides support for socketJS.
[0161] The websocket (long connection transmission protocol) protocol is a new protocol of HTML5, which provides the function of full-duplex communication through sockets (full-duplex: means that the server can send messages to the browser, and the browser can also send messages to the server) and can realize asynchronous communication between the web browser and the server.
[0162] Stomp provides a frame-based wire format layer on top of WebSocket to define the semantics of messages. A Stomp frame consists of a command, one or more headers, and a payload! Take a Stomp frame for sending data:
[0163] SEND
[0164] destination: / app / marco
[0165] content-length:20
[0166] {\"message\":\"hello\"}
[0167] The Stomp command here is SEND, followed by the destination address, the length of the message content, then a blank line, and finally the content to be sent, which is a JSON message.
[0168] What needs to be noted here is the destination, the target address to which the message will be sent, and this destination has a server-side component to process it.
[0169] Spring needs to be configured to use Stomp, and Spring provides a SpringMVC-based programming model for Stomp messages.
[0170] In the embodiment of the present invention, step 303 of receiving a push message sent by the business service system includes:
[0171] Each push message is obtained from the message queue in the message middleware, wherein the business service system sends the push message to the message middleware.
[0172] Specifically, at this time, the message middleware stores the message queue. After the business service system sends the push message to the message middleware, it is stored in the message queue one by one, and it is consumed (ie, obtained, read) from the message queue one by one.
[0173] In the embodiment of the present invention, Fig.11 As shown, it also includes:
[0174] Step 1101: Process the push message.
[0175] Specifically, processing the push message may include determining the type of the push message.
[0176] In the embodiment of the present invention, Fig.12 As shown, step 303 pushes a message to the user terminal through a persistent connection based on the user interest model and the push message, including:
[0177] Step 1201: Determine the corresponding user identity in the user interest model based on the message type of the push message;
[0178] Step 1202: storing the user identity in a user identity list;
[0179] Step 1203: Based on the user identity list, push a message to the corresponding user terminal through a long connection.
[0180] Specifically, based on the message type of the push message, determine which message type in the user interest model {key: user ID, value: [message type 1, message type 2, message type 3]} corresponds to the message type 1, for example, the user ID is stored in the user identity list, that is, {message: user ID list}. Then, based on the user ID included in the user ID list, push the message to the corresponding user terminal.
[0181] Specifically, step 1203 pushes a message to a corresponding user terminal through a persistent connection based on the user identity list, including:
[0182] Process the push message into the format of {message: user ID list} and put it in the blocking queue;
[0183] Read push messages from the blocking queue and push messages to the user through a persistent connection based on the user interest model.
[0184] Specifically, what is a blocking queue:
[0185] 1) Support blocking insertion method: This means that when the queue is full, the queue will block the thread inserting elements until the queue is not full.
[0186] 2) Support blocking removal method: This means that when the queue is empty, the thread that obtains the element will wait for the queue to become non-empty.
[0187] In the embodiment of the present invention, Fig.13 As shown in the figure, before pushing a message to the user through a persistent connection, the following is also included:
[0188] Step 1301: receiving an initialization message request sent by a user terminal;
[0189] Step 1302: Obtain an initialization message according to the initialization message request;
[0190] Step 1303: Return the initialization message to the user end.
[0191] Specifically, the user-initialized message queue is a reserved basic message queue. Before pushing messages based on user interests, some basic messages are pushed to users in advance for display, solving the scenario of missing messages or waiting for messages for too long.
[0192] The following describes user interest calculation and user message push from a specific interaction diagram.
[0193] Fig.14 is an interaction diagram for calculating user interests in an embodiment of the present invention, such as Fig.14 As shown, including:
[0194] 1. Different business systems push business data to the message middleware; the request data sent to the message middleware needs to carry the business type;
[0195] 2. The user interest mining service of the user real-time recommendation device continuously consumes business data from the business data queue of the message middleware and processes messages;
[0196] 3. Get data from the user center:
[0197] 3.1 The user interest mining service of the user real-time recommendation device performs user information query from the user center;
[0198] 3.2 User information is returned by the User Center;
[0199] 4. The user interest mining service of the user real-time recommendation device calculates the user's interest model based on the pre-defined interest mining algorithm. The interest model is: {key: user ID, value: [message type 1, message type 2, message type 3]}; the user interest mining service updates the calculation result (user's interest model) to the database and redis for subsequent use;
[0200] 5. The administrator can query the user interest model through the management terminal and perform correction management:
[0201] 5.1 The administrator queries the user interest model through the management terminal;
[0202] 5.2 The user interest mining service of the user real-time recommendation device returns the user interest model to the management end.
[0203] Fig.15 This is an interactive diagram of user message push in an embodiment of the present invention, such as Fig.15 As shown, including:
[0204] 1. The user first requests the user center service to obtain user information and the user's latest initialization message queue (for the first round of message carousel display);
[0205] 1.1 The user terminal sends user data and initialization message request to the user center;
[0206] 1.2 The user center sends the initialization message request to the message management service;
[0207] 1.3 The message management service returns the initial message;
[0208] 1.4 The user center returns the user data and initial message to the user end;
[0209] 2. The client connected to sockjs sends a request to create a persistent connection to the persistent connection server, and the persistent connection service based on Spring Stomp completes the establishment of a websocket dual-channel connection with the server;
[0210] 3. The business system sends the message that needs to be pushed to the user to the message middleware;
[0211] 4. The message management service consumes the message queue in the message middleware and completes the message processing;
[0212] 5.1 The message management service pushes the message to the persistent connection service;
[0213] 5.2 The message management service saves the original message in the database;
[0214] 6. The persistent connection service processes the received message into the format of {message: user ID list} and puts it in the blocking queue; obtains the user interest model from redis;
[0215] 7. The long connection service push thread takes out messages from the blocking queue one by one and pushes them to the user based on the connection request.
[0216] The present invention also provides a user real-time recommendation device, as described in the following embodiments. Since the principle of solving the problem by the device is similar to that of the user real-time recommendation method, the implementation of the device can refer to the implementation of the user real-time recommendation method, and the repeated parts will not be repeated.
[0217] Fig.16 The structure frame of the user real-time recommendation device in the embodiment of the present invention is Figure 1 ,like Fig.16 As shown, the device comprises:
[0218] User interest management module 02, used to receive user service data sent by the service service system, and calculate the user interest model based on the user service data;
[0219] The persistent connection service module 04 is used to establish a persistent connection with the user terminal;
[0220] The message management module 06 is used to receive push messages sent by the business service system, and push messages to the user end through a persistent connection based on the user interest model and the push messages.
[0221] In the embodiment of the present invention, the user interest management module 02 is specifically used for:
[0222] Each piece of user business data is obtained from the business data queue in the message middleware, wherein the business service system sends the user business data to the message middleware.
[0223] In the embodiment of the present invention, the user interest management module 02 is also used for:
[0224] The user service data is processed.
[0225] In the embodiment of the present invention, the user interest management module 02 is specifically used for:
[0226] Determine a user tag value according to the user service data, and determine a user model based on the user tag value;
[0227] Calculate the similarity between the user model and the label vector of the preset message;
[0228] The similarity is compared with a similarity threshold, and a user interest model is determined based on the comparison result.
[0229] In the embodiment of the present invention, the user interest management module 02 is specifically used for:
[0230] The similarity is compared with a similarity threshold, and when the similarity is greater than the similarity threshold, a user interest model corresponding to the message type corresponding to the label vector of the corresponding preset message is determined.
[0231] In the embodiment of the present invention, the user interest model is {key: user ID, value: [message type 1, message type 2, message type 3]}.
[0232] In the embodiment of the present invention, Fig.17 As shown, it also includes: a database and / or redis 08, which is used to store the user interest model.
[0233] In the embodiment of the present invention, the message management module 06 is also used for:
[0234] Receive a user interest model query request sent by the management end;
[0235] Based on the user interest model query request, the corresponding user interest model is obtained from the database and / or redis and returned to the management end, and the management end corrects the user interest model.
[0236] In the embodiment of the present invention, the long connection service module 04 is specifically used for:
[0237] Receiving a user data request sent by a user terminal;
[0238] Acquire connection information for establishing a persistent connection according to the user data request;
[0239] Based on the connection information for establishing the persistent connection, a persistent connection is established with the user end.
[0240] In the embodiment of the present invention, the long connection service module 04 is specifically used for:
[0241] Receive the request to create a long connection sent by the sockjs client;
[0242] Based on the creation of the long connection request, a websocket dual-channel connection is established with the user end.
[0243] In the embodiment of the present invention, the message management module 06 is specifically used for:
[0244] Each push message is obtained from the message queue in the message middleware, wherein the business service system sends the push message to the message middleware.
[0245] In the embodiment of the present invention, the message management module 06 is also used for:
[0246] Process the push message.
[0247] In the embodiment of the present invention, the message management module 06 is specifically used for:
[0248] Based on the message type of the push message, determine the corresponding user identity in the user interest model;
[0249] Storing the user identity in a user identity list;
[0250] Based on the user identity list, a message is pushed to the corresponding user terminal through a persistent connection.
[0251] In the embodiment of the present invention, the message management module 06 is specifically used for:
[0252] Before pushing a message to the user through a persistent connection, receiving an initialization message request sent by the user;
[0253] Obtaining an initialization message according to the initialization message request;
[0254] Return the initialization message to the user.
[0255] An embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned user real-time recommendation method when executing the computer program.
[0256] The computer device provided in the embodiment of the present invention may be a desktop computer, a tablet computer, a mobile terminal, etc., but the embodiment is not limited thereto. In the embodiment, the computer device may refer to the implementation of the user real-time recommendation method and the user real-time recommendation device, the contents of which are incorporated herein, and the repeated parts are not repeated.
[0257] Fig.18 FIG. 6 is a schematic block diagram of the system structure of the computer device 600 according to an embodiment of the present invention. Fig.18 As shown, the computer device 600 may include a central processor 100 and a memory 140; the memory 140 is coupled to the central processor 100. It should be noted that this figure is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0258] like Fig.18 As shown, the computer device 600 may also include: a communication module 110, an input unit 120, an audio processing unit 130, a display 160, and a power supply 170. It is worth noting that the computer device 600 does not necessarily have to include Fig.18 In addition, the computer device 600 may also include Fig.18 For components not shown, reference may be made to the prior art.
[0259] like Fig.18 As shown, the central processor 100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processor 100 receives inputs and controls the operations of various components of the computer device 600 .
[0260] The memory 140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. It may store programs for executing related information. The CPU 100 may execute the programs stored in the memory 140 to implement information storage or processing.
[0261] The input unit 120 provides input to the CPU 100. The input unit 120 is, for example, a key or touch input device. The power supply 170 is used to provide power to the computer device 600. The display 160 is used to display display objects such as images and text. The display may be, for example, an LCD display, but is not limited thereto.
[0262] The memory 140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 140 may also be some other type of device. The memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application / function storage unit 142, which is used to store application programs and function programs or processes for executing the operation of the computer device 600 through the central processor 100.
[0263] The memory 140 may also include a data storage unit 143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the computer device. The driver storage unit 144 of the memory 140 may include various drivers for the computer device for communication functions and / or for executing other functions of the computer device (such as messaging applications, address book applications, etc.).
[0264] The communication module 110 is a transmitter / receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter / receiver) 110 is coupled to the central processor 100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0265] Based on different communication technologies, multiple communication modules 110 may be provided in the same computer device, such as a cellular network module, a Bluetooth module and / or a wireless local area network module, etc. The communication module (transmitter / receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide an audio output via the speaker 131 and receive an audio input from the microphone 132, thereby realizing a common telecommunication function. The audio processor 130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 130 is also coupled to the central processor 100, so that recording can be performed on the local machine through the microphone 132, and the sound stored on the local machine can be played through the speaker 131.
[0266] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the above-mentioned user real-time recommendation method are implemented.
[0267] In the embodiment of the present invention, compared with the technical solution of the prior art of grouping users and then pushing messages to the users in the group, the user service data sent by the service service system is received, and the user interest model is calculated based on the user service data; a long connection is established with the user terminal; a push message sent by the service service system is received, and based on the user interest model and the push message, the message is pushed to the user terminal through the long connection. The present invention combines user interest mining and long connection real-time push to solve the real-time and targeted information push based on user interests, and effectively improves user friendliness and experience.
[0268] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0269] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0270] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0271] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0272] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A user real-time recommendation method, characterized in that: include: Receiving user business data sent by the business service system, and calculating a user interest model based on the user business data; Calculating a user interest model based on the user service data includes: determining a user tag value according to the user service data, and determining a user model based on the user tag value; calculating a similarity between the user model and a tag vector of a preset message; comparing the similarity with a similarity threshold, and determining a user interest model based on the comparison result; the user interest model is {key: user ID, value: [message type 1, message type 2, message type 3]}; Establish a long connection with the user end; Receive push messages sent by the business service system, determine the type of push messages, and push messages to the user end through a persistent connection based on the user interest model and the push message; The step of establishing a persistent connection with the user end includes: receiving a persistent connection creation request sent by the sockjs user end; and establishing a websocket dual-channel connection with the user end based on the persistent connection creation request. Based on the user interest model and push messages, push messages to the user through a persistent connection, including: Based on the message type of the push message, determine the corresponding user identity in the user interest model; Storing the user identity in a user identity list; Based on the user identity list, push the message to the corresponding user terminal through the persistent connection; Based on the user identity list, push the message to the corresponding user terminal through the persistent connection, including: processing the push message into a {message: user ID list} format and placing it in a blocking queue; reading the push message from the blocking queue, and based on the user interest model, pushing the message to the user terminal through the persistent connection; Also includes: Storing the user interest model in a database and / or redis; Also includes: Receive a user interest model query request sent by the management end; Based on the user interest model query request, the corresponding user interest model is obtained from the database and / or redis and returned to the management end, and the management end corrects the user interest model.
2. The user real-time recommendation method according to claim 1, characterized in that: Receive user business data sent by the business service system, including: Each piece of user business data is obtained from the business data queue in the message middleware, wherein the business service system sends the user business data to the message middleware.
3. The user real-time recommendation method according to claim 1, characterized in that: Also includes: The user service data is processed.
4. The user real-time recommendation method according to claim 1, characterized in that: Comparing the similarity with a similarity threshold, and determining a user interest model based on the comparison result, including: The similarity is compared with a similarity threshold, and when the similarity is greater than the similarity threshold, a user interest model corresponding to the message type corresponding to the label vector of the corresponding preset message is determined.
5. The user real-time recommendation method according to claim 1, characterized in that: Establish a long connection with the client, including: Receiving a user data request sent by a user terminal; Acquire connection information for establishing a persistent connection according to the user data request; Based on the connection information for establishing the persistent connection, a persistent connection is established with the user terminal.
6. The user real-time recommendation method according to claim 1, characterized in that: Receive push messages sent by the business service system, including: Each push message is obtained from the message queue in the message middleware, wherein the business service system sends the push message to the message middleware.
7. The user real-time recommendation method according to claim 1, characterized in that: Also includes: Process the push message.
8. The user real-time recommendation method according to claim 1, characterized in that: Before pushing messages to the user through a persistent connection, it also includes: Receive an initialization message request sent by a user terminal; Obtaining an initialization message according to the initialization message request; Return the initialization message to the user.
9. A user real-time recommendation device, characterized in that: include: A user interest management module, configured to receive user service data sent by the service service system and calculate a user interest model based on the user service data; The persistent connection service module is used to establish a persistent connection with the user end; The message management module is used to receive push messages sent by the business service system and push messages to the user end through a persistent connection based on the user interest model and the push message; The user interest management module is specifically used to: calculate the user interest model based on the user service data, including: determining the user tag value according to the user service data, and determining the user model based on the user tag value; calculating the similarity between the user model and the tag vector of the preset message; comparing the similarity with the similarity threshold, and determining the user interest model based on the comparison result; the user interest model is {key: user ID, value: [message type 1, message type 2, message type 3]}; The message management module is specifically used to: determine the type of push message, determine the corresponding user identity in the user interest model based on the message type of the push message; store the user identity in a user identity list; push the message to the corresponding user terminal through a long connection based on the user identity list; push the message to the corresponding user terminal through a long connection based on the user identity list, including: processing the push message into a {message: user ID list} format and placing it in a blocking queue; reading the push message from the blocking queue, and pushing the message to the user terminal through a long connection based on the user interest model; The long connection service module is specifically used to: receive a long connection creation request sent by a sockjs client; based on the long connection creation request, establish a websocket dual-channel connection with the client; Also includes: a database and / or redis, used to store the user interest model; The message management module is also used to: Receive a user interest model query request sent by the management end; Based on the user interest model query request, the corresponding user interest model is obtained from the database and / or redis and returned to the management end, and the management end corrects the user interest model.
10. A user real-time recommendation system, characterized in that: include: The user real-time recommendation device, business service system and user terminal as described in claim 9.
11. The user real-time recommendation system according to claim 10, characterized in that: Also includes: Message middleware.
12. The user real-time recommendation system according to claim 10, characterized in that: Also includes: Management side.
13. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the user real-time recommendation method according to any one of claims 1 to 8 is implemented.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the user real-time recommendation method described in any one of claims 1 to 8 are implemented.
