[ summary of the invention ]
The invention provides a message pushing method and a message pushing system, which can efficiently and flexibly realize the pushing of various message data.
The specific technical scheme of the invention is as follows:
according to a preferred embodiment of the present invention, a message pushing method includes:
splitting message data provided by a third-party application into message index data and message content data; the message index data comprises attribute data of the message, and the message content data comprises specific content of the message;
screening the message index data according to a preset white list, a received message data list and data in the message index data, and acquiring corresponding message content data according to the screened message index data;
and screening the acquired message content data, and pushing the screened message content data to the front end.
In the above method, the method further comprises:
receiving message data of a user issued by a third-party application; or,
finding a third-party application corresponding to the unique user identifier according to the corresponding relation between the preset unique user identifier and the third-party application address, and pulling the message data of the user from the third-party application; or,
and finding the third-party application corresponding to the URL identification according to the corresponding relation between the preset URL identification and the third-party application address, and pulling the message data of the user from the third-party application.
In the above-mentioned method, the first step of the method,
the attribute data of the message includes the following data: message type, message source, message validity period and message display identifier;
the specific content of the message comprises the following data: message content, message description, and message icon.
In the above method, the screening the message index data specifically includes:
deleting message index data corresponding to message sources which are not contained in a white list, wherein the white list is the message sources accepted by a user;
deleting message index data corresponding to message types not contained in a received message data list, wherein the received message data list is the message types received by a user;
deleting the message index data which has not expired message validity period and is not displayed by the message display identifier, or has expired message validity period and is not displayed by the message display identifier.
In the above method, the message index data and the message content data further include: a message unique identifier;
and determining the corresponding relation between the stored message index data and the stored message content data according to the message unique identifier.
In the above method, the screening of the acquired message content data specifically includes:
and analyzing the message content data into more than two fields, and screening the fields according to the preset display field conditions to obtain the fields for display.
A message push system is located at a back-end server and comprises a splitting processing unit, a screening processing unit and a push unit; wherein,
the splitting processing unit is used for splitting the message data provided by the third-party application into message index data and message content data; the message index data comprises attribute data of the message, and the message content data comprises specific content of the message;
the screening processing unit is used for screening the message index data according to a preset white list, a received message data list and data in the message index data, acquiring corresponding message content data according to the screened message index data and screening the acquired message content data;
and the pushing unit is used for pushing the screened message content data to the front end.
In the above system, the system further includes:
the data acquisition unit is used for receiving the message data of the user issued by the third-party application; or the third-party application corresponding to the user unique identifier is found according to the corresponding relation between the preset user unique identifier and the third-party application address, and the message data of the user is pulled from the third-party application; or the third party application corresponding to the URL identification is found according to the corresponding relation between the preset URL identification and the third party application address, and the message data of the user is pulled from the third party application.
In the above-mentioned system, the first and second sensors are arranged in a single circuit,
the attribute data of the message includes the following data: message type, message source, message validity period and message display identifier;
the specific content of the message comprises the following data: message content, message description, and message icon.
In the above system, the screening processing unit screens the message index data, specifically:
deleting message index data corresponding to message sources which are not contained in a white list, wherein the white list is the message sources accepted by a user;
deleting message index data corresponding to message types not contained in a received message data list, wherein the received message data list is the message types received by a user;
deleting the message index data which has not expired message validity period and is not displayed by the message display identifier, or has expired message validity period and is not displayed by the message display identifier.
In the above system, the message index data and the message content data further include: a message unique identifier;
and determining the corresponding relation between the stored message index data and the stored message content data according to the message unique identifier.
In the above system, the screening processing unit screens the acquired message content data, specifically:
and analyzing the message content data into more than two fields, and screening the fields according to the preset display field conditions to obtain the fields for display.
According to the technical scheme, the invention has the following beneficial effects:
the message data is divided into the message index data and the message content data, so that the storage of various types and structures of message data can be supported, and the storage of the message data is realized more simply and conveniently; only the message index data with fixed field length is screened and retrieved, and the processing efficiency can be improved.
The message index data are screened according to the screening conditions preset by the user, the special requirements of the user on the message pushing system can be met, flexible dynamic configuration can be realized, and the message pushing system is more diverse.
[ detailed description ] embodiments
The basic idea of the invention is: splitting message data provided by a third-party application into message index data and message content data; the message index data comprises attribute data of the message, and the message content data is that the message data comprises the specific content of the message; screening the message index data according to a preset white list, a received message data list and data in the message index data, and acquiring corresponding message content data according to the screened message index data; and screening the acquired message content data, and pushing the screened message content data to the front end.
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
Fig. 1 is a schematic flow diagram of a preferred embodiment of a method for pushing a message according to the present invention, and as shown in fig. 1, the preferred embodiment includes the following steps:
step 101, splitting message data provided by a third party application into message index data and message content data, and storing the message index data and the message content data.
Specifically, the third-party application actively sends the message data of the user to the back-end server, or the back-end server actively pulls the message data of the user from the third-party application in real time; the back-end server actively pulls the message data of the user in real time, and the following two implementation methods can be adopted: one is that the back-end server allocates a user unique identifier to each user after the user registration is successful, the back-end server finds a third-party application corresponding to a preset user unique identifier according to the corresponding relation between the preset user unique identifier and a third-party application address, and obtains the message data of the user from the third-party application; and the other method is that the back-end server finds the third-party application corresponding to the URL identification configured in advance by the user according to the corresponding relation between the URL identification configured in advance and the address of the third-party application, and acquires the message data of the user from the third-party application. For each user, the back-end server may receive more than one message data from the third-party application.
The message data can be heterogeneous message data, heterogeneous message data or heterogeneous message data, wherein the heterogeneous message data refers to multiple types of message data; for example, microblog messages and station messages belong to different types of message data; the heterogeneous message data refers to message data with the same type and different structures; here, it is emphasized that the backend server can receive and process message data of different types and different structures. The message data includes all the following data, and for a certain data or some data, the value may be null: the message comprises a message unique identifier, a message type, a message source, a message owner, a message consumer, message generation time, a message validity period, a message display identifier, a message description, a message icon, a message state, a message acquisition mode and message content.
A message data model is set in a back-end server in advance, and the message data model comprises message index data and message content data; the message index data comprises a message unique identifier and attribute data of the message, and the attribute data of the message comprises all the following data: the message content data comprises a message unique identifier and specific content of the message, and the specific content comprises all the following data: message content, message description, and message icon; the message index data or the message content data also comprises other message attribute data, such as a message acquisition mode, a message owner, message generation time, a message consumer, message state and the like; after receiving the message data of the user from the third-party application, the back-end server needs to split each message data into message index data and message content data according to a preset message data model, and the database stores the split message index data and message content data. Here, the message data is split according to the message data model, because the data in the message index data is generally a simpler and common type, such as int type and char type with fixed length, the data storage capacity is smaller, the storage structure of the bottom layer is simple, the database can conveniently establish the index, the efficiency is higher when the message index data is retrieved, and the data can be quickly searched; the length of data in the message content data is generally not fixed, and may be larger or smaller, and is generally stored by adopting a text (text) and binary large object (blob) structure, the database stores the data slowly, which is not beneficial to establishing an index, and the specific content of the message is generally not used when the message is displayed, so that the two types of message data are stored in a split manner.
And 102, screening the message index data according to a preset white list, a received message data list and data in the message index data, and acquiring corresponding message content data according to the screened message index data.
Specifically, after the user logs in, the back-end server needs to push message content data to the front-end, and the message content data is displayed by the front-end, in order to reduce the retrieval workload and the pushed data amount, in the preferred embodiment, the back-end server does not push all the message content data of the user to the user, but determines which message content data are pushed to the user before the message content data are pushed to the user, so the back-end server needs to screen the message index data in the message data, and after the message index data are screened, the back-end server obtains the message content data corresponding to the screened message index data from the database according to the message unique identifier in the screened message index data.
The method for screening the message index data by the back-end server comprises the following steps:
firstly, screening all message index data of a user by using a white list, wherein the white list stores message sources which can be accepted by the user, only the message index data corresponding to the message sources contained in the white list is reserved in all the message index data, and the message index data corresponding to the message sources not contained in the white list is deleted in all the message index data, so that the message index data not contained in the white list is screened out. For example, if the white list includes the hundredth cafe and the newwave microblog, only the message index data from the hundredth cafe and the newwave microblog are reserved; the white list comprises a global white list and a user white list, the user can configure the white list in a database in advance, and the back-end server can acquire the preconfigured white list from the database during screening.
Then, screening the message index data obtained after screening by using an accepted message data list, wherein the accepted message data list stores message types which can be accepted by a user, such as one-to-one messages, one-to-many messages, broadcast messages and the like; according to the received message data list and the message types in the message index data, only the message index data corresponding to the message types contained in the received message data list are reserved, and the message index data corresponding to the message types not contained in the received message data list are deleted, so that the message index data not contained in the received message data list are screened out; the user may configure the received message data list in the database in advance, and the backend server may obtain the received message data list from the database when performing screening.
Finally, judging whether the message data is overdue or not according to the current time and the message validity period in each message index data for the message index data obtained after the two screening processes; meanwhile, judging whether the message data needs to be displayed or not according to the message display identifier in each message index data; when the judgment result is that the message data is not expired and needs to be displayed, the message index data is reserved, and when the judgment result is that the message data is not expired and does not need to be displayed, or when the message data is expired and needs to be displayed, or when the message data is expired and does not need to be displayed, the message index data is screened out.
And 103, screening the acquired message content data, and pushing the screened message content data to a front end.
Specifically, after obtaining the message content data to be sent to the front end, the back end server firstly analyzes the message content data into more than two fields, and then screens a plurality of fields corresponding to each message content data according to the configuration information to obtain the fields to be displayed; the configuration information can be configured in a database by a user in advance, and the configuration information can be used by a back-end server during screening; the configuration information comprises conditions for displaying fields, such as fields which are displayed by user specification or fields which are only updated and the like; and then, for each message content data, splicing the fields obtained after screening in the message content data by using a preset message template, packaging the fields obtained after splicing, and pushing the obtained data packet to the front end.
After receiving a data packet sent by a back-end server, a front end analyzes the data packet by using a lightweight data interchange format (JSON, JavaScript Object notification) to obtain a field to be displayed; the front end calls a presentation template configured in advance by a user, inputs fields for presentation obtained by analysis to the presentation template, generates message content data to be presented to the user, and presents the message content data to the user through a graphical interface.
To implement the foregoing method, the present invention further provides a message pushing system, fig. 2 is a schematic structural diagram of a preferred embodiment of implementing the message pushing system according to the present invention, as shown in fig. 2, the system is located in a backend server, and the system includes: a splitting processing unit 20, a screening processing unit 21 and a pushing unit 22; wherein,
a splitting processing unit 20, configured to split message data provided by a third-party application into message index data and message content data; the message index data comprises attribute data of the message, and the message content data comprises specific content of the message;
the screening processing unit 21 is configured to screen the message index data according to a preset white list, a list of received message data, and data in the message index data, acquire corresponding message content data according to the screened message index data, and screen the acquired message content data;
and the pushing unit 22 is configured to push the screened message content data to the front end.
The system further comprises:
the data acquisition unit 23 is configured to receive user message data sent by a third-party application; or the third-party application corresponding to the user unique identifier is found according to the corresponding relation between the preset user unique identifier and the third-party application address, and the message data of the user is pulled from the third-party application; or the third party application corresponding to the URL identification is found according to the corresponding relation between the preset URL identification and the third party application address, and the message data of the user is pulled from the third party application.
Wherein the attribute data of the message includes the following data: message type, message source, message validity period and message display identifier; the specific content of the message comprises the following data: message content, message description, and message icon; the message index data or the message content data further comprise a message unique identifier; and determining the corresponding relation between the stored message index data and the stored message content data according to the message unique identifier.
The screening processing unit 21 screens the message index data, specifically:
deleting message index data corresponding to message sources which are not contained in a white list, wherein the white list is the message sources accepted by a user;
deleting message index data corresponding to message types not contained in a received message data list, wherein the received message data list is the message types received by a user;
deleting the message index data which has not expired message validity period and is not displayed by the message display identifier, or has expired message validity period and is not displayed by the message display identifier.
The screening processing unit screens the message content data acquired by 21, specifically: and analyzing the message content data into more than two fields, and screening the fields according to the preset display field conditions to obtain the fields for display.
The technical scheme of the preferred embodiment of the invention has the following technical effects:
1. the back-end server can support various modes of acquiring the message data from the third-party application, and the acquisition of the message data is flexibly realized.
2. The message data is divided into the message index data and the message content data and stored, so that the storage of various types and structures of message data can be supported, and the storage of the message data can be realized more simply and conveniently; and only the message index data is searched and screened, so that the processing efficiency can be improved.
3. Before the back-end server pushes the message content data to the front-end, the message index data is screened to determine the message content data needing to be pushed instead of sending all the message content data to the front-end, so that the workload of a database and the pushed data volume of the back-end server are reduced.
4. When the message index data is screened by the rear-end server, screening is carried out according to screening conditions preset by a user, the special requirements of the user on the message pushing system can be met, flexible dynamic configuration can be realized, the message pushing system is more diverse, and the use convenience of the message pushing system is improved.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.