CN109787884B - Message pushing method and device - Google Patents

Message pushing method and device Download PDF

Info

Publication number
CN109787884B
CN109787884B CN201910002453.0A CN201910002453A CN109787884B CN 109787884 B CN109787884 B CN 109787884B CN 201910002453 A CN201910002453 A CN 201910002453A CN 109787884 B CN109787884 B CN 109787884B
Authority
CN
China
Prior art keywords
message
push
target
identification code
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910002453.0A
Other languages
Chinese (zh)
Other versions
CN109787884A (en
Inventor
肖甜
丁海
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN201910002453.0A priority Critical patent/CN109787884B/en
Publication of CN109787884A publication Critical patent/CN109787884A/en
Application granted granted Critical
Publication of CN109787884B publication Critical patent/CN109787884B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a message pushing method and device, relates to the field of message pushing, and can save resources when delay information is pushed. The method comprises the following steps: acquiring a push instruction sent by a client; the push instruction at least carries a target message identification code and a push type; when the push type is determined to be delayed push, searching a push message to which the target message identification code belongs and writing time thereof from a target file corresponding to the current time according to the target message identification code; the target file comprises at least two push messages, and the message identification codes of the at least two messages to be pushed are continuous; calculating the time difference between the write-in time of the push message to which the target message identification code belongs and the current time; and when the time difference is determined to be larger than or equal to the preset time interval, acquiring a push message corresponding to the push instruction according to the target message identification code and a preset rule, and pushing.

Description

Message pushing method and device
Technical Field
The present invention relates to the field of message sending, and in particular, to a message pushing method and apparatus.
Background
When the current message push platform sends a message to a specific user, the current message push platform can send a real-time push message and also can send a delay push message. The real-time message pushing means that a message can be sent to a specific user after being formed, so that the specific user can obtain the message in real time; correspondingly, delaying the push message refers to suspending transmission if the message is within the disturbance-free time period after the message is formed, and transmitting the message until the message is not transmitted after the disturbance-free time period, so that the message is acquired by a specific user. The existing methods for implementing message delay pushing mainly include the following two methods: the memory scheme is as follows: all messages are stored in the memory, and when pushing is delayed, the messages are retrieved from the memory; the disadvantage is that the memory is too large when the message amount is large, and the memory is lost after restarting. A database scheme: the message is stored in the database, and when the pushing is delayed, the message is retrieved from the database; the disadvantages are that the retrieval process is complex, the resource consumption is large, and when the message volume is large, the access process is not fast enough.
Disclosure of Invention
The embodiment of the invention provides a message pushing method, which is used for quickly pushing a delayed push message from a file and saving resources.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
in a first aspect, a message pushing method is provided, including:
acquiring a push instruction sent by a client; the push instruction at least carries a target message identification code and a push type;
when the push type is determined to be delayed push, searching a push message to which the target message identification code belongs and writing time thereof from a target file corresponding to the current time according to the target message identification code; the target file comprises at least two push messages, and the message identification codes of the at least two messages to be pushed are continuous;
calculating the time difference between the write-in time of the push message to which the target message identification code belongs and the current time;
and when the time difference is determined to be larger than or equal to the preset time interval, acquiring a push message corresponding to the push instruction according to the target message identification code and a preset rule, and pushing.
In a second aspect, a message pushing apparatus is provided, including: the device comprises an acquisition module, a judgment module, a search module, a calculation module and a push module;
the acquisition module is used for acquiring a push instruction sent by a client; the push instruction at least carries a target message identification code and a push type;
when the judging module determines that the push type acquired by the acquiring module is delayed push, the searching module is used for searching a push message and writing time thereof, which the target message identification code belongs to, from a target file corresponding to the current time according to the target message identification code acquired by the acquiring module; the target file comprises at least two push messages, and the message identification codes of the at least two messages to be pushed are continuous;
the calculation module is used for calculating the time difference between the write-in time of the push message to which the target message identification code searched by the search module belongs and the current time;
and when the judging module determines that the time difference calculated by the calculating module is greater than or equal to the preset time interval, the pushing module is used for acquiring a pushing message corresponding to the pushing instruction according to the target message identification code acquired by the acquiring module and a preset rule and pushing the pushing message.
In a third aspect, a message pushing apparatus is provided, which includes a memory, a processor, a bus, and a communication interface; the memory is used for storing computer execution instructions, and the processor is connected with the memory through a bus; when the message pushing device is running, the processor executes computer-executable instructions stored by the memory to cause the device to perform the message pushing method as provided by the first aspect.
In a fourth aspect, a computer storage medium is provided, which includes computer executable instructions, when the computer executable instructions are executed on a computer, the computer is caused to execute the message pushing method provided in the first aspect.
The embodiment of the invention provides a message pushing method and a device, wherein the method comprises the following steps: acquiring a push instruction sent by a client; the push instruction at least carries a target message identification code and a push type; when the push type is determined to be delayed push, searching a push message to which the target message identification code belongs and writing time thereof from a target file corresponding to the current time according to the target message identification code; the target file comprises at least two push messages, and the message identification codes of the at least two messages to be pushed are continuous; calculating the time difference between the write-in time of the push message to which the target message identification code belongs and the current time; and when the time difference is determined to be larger than or equal to the preset time interval, acquiring a push message corresponding to the push instruction according to the target message identification code and a preset rule, and pushing. According to the technical scheme provided by the embodiment of the invention, after the push instruction of the client is received, if the push type in the push instruction is determined to be delayed push, the push message corresponding to the target identification code and the write time thereof can be quickly acquired from the target file stored with the delayed push message according to the target message identification code contained in the push instruction, and if the difference value between the current moment and the suction time is determined to be larger than the preset delay interval, the push message is pushed, so that the push flow of the delayed push message is completed. Because the technical scheme provided by the embodiment of the invention stores the push delay push messages based on a file storage mode, each delay message has a unique identification code and correspondingly stores the writing time of each delay push message, the position of the delay push message to be pushed and whether the delay push message can be sent can be quickly determined when the message needs to be pushed; in the existing database scheme, all information of a certain push message is gathered together to form a character string, searching is relatively complex, and computing resources are consumed, so that compared with the existing delay push message pushing method based on memory storage or database storage, the method saves a large amount of resources and can efficiently and quickly push the delay push message.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a message pushing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of another message pushing method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a message pushing apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of another message pushing apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that, in the embodiments of the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "e.g.," an embodiment of the present invention is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
It should be noted that, in the embodiments of the present invention, "of", "corresponding" and "corresponding" may be sometimes used in combination, and it should be noted that, when the difference is not emphasized, the intended meaning is consistent.
For the convenience of clearly describing the technical solutions of the embodiments of the present invention, in the embodiments of the present invention, the words "first", "second", and the like are used for distinguishing the same items or similar items with basically the same functions and actions, and those skilled in the art can understand that the words "first", "second", and the like are not limited in number or execution order.
The existing push of the delayed push message is to search from a memory or a database and then push, when the message amount is large, the push of the delayed push message from the memory occupies a large memory, which wastes computing resources, and the search of data in the database is not fast enough.
In view of the foregoing problems, embodiments of the present invention provide a format for storing delayed push messages in a file, where for example, 1000 push messages are stored in one message group, and at least two message groups are stored in one subfile, a format for storing the delayed push messages to be pushed in 2018, 10, 25 and a file is as follows:
181025// file name;
1810250000000001. idindexttime// index file of data files and write times of the first subfile, wherein 1810250000000001 is the file identification code of the first subfile;
1810250000000001 write time// write time of the first group of messages of the first subfile, where 1810250000000001 is the group identification code of the first group of messages;
1810250000001001 write time// write time of the second message group of the first subfile, where 1810250000001001 is the group identifier of the first message group;
1810250000000001.datapushindex first message group push message index file
1810250000000001. datapushmessage data file for a first message group
1810250000001001.datapushindex second message group push message index file
1810250000001001. datapushmessage data file for a second message group
The push message index file of each message group comprises message identification codes, starting bytes and sizes of one thousand messages, and the push message data file of each message group stores 1000 push messages. The message id of each push message is stored according to the writing time and the actual push sequence, for example, the message id of the first push message to be sent stored in the first message group in the above example is 1810250000000001, and then 1810250000000002, 1810250000000003 … … 1810250000001000 are performed in sequence, and the message id of the first push message to be sent in the second message group is 1810250000001001; in practice, the name of the file (file identification code) is generally determined by the content stored in the file, for example, a message to be pushed in 2018, 10, 25 and is named 181025; the file identifier of the subfile is named by taking the message identifier of any one of 2000 messages stored by the subfile as a name according to the same rule, for example, as shown in the above example, the name is taken as the minimum value of the identifiers of all push messages stored by the subfile; the group identifier naming rule of the message group and the file identifier naming rule of the subfile are the same. Therefore, the messages needing to be pushed for a certain period of time can be orderly stored in the file; because the server needs to push many actual push messages, the write time of 1000 push messages in each message group in the file is very different and approximately the same.
In practice, a message pushing process is performed between a client and a server, when some APP loaded by the client itself is about to be performed, the client sends an instruction for indicating some pushed message to the server, and the server pushes a corresponding pushed message to the client after receiving the instruction, but a user using the client may set a time period, such as 0 pm to six pm, in the APP, during which the client does not receive the pushed message, so that the server avoids the time period when sending the pushed message, and there is a delay pushed message that needs to be stored for a certain time period and then sent.
Based on the file storage manner and the related content of the delayed push message, referring to fig. 1, an embodiment of the present invention provides a message push method, including:
101. acquiring a push instruction sent by a client; the push instruction at least carries a target message identification code and a push type.
102. And when the push type is determined to be delayed push, searching the push message to which the target message identification code belongs and the write-in time thereof from the target file corresponding to the current time according to the target message identification code.
The target file comprises at least two push messages, and the message identification codes of the at least two messages to be pushed are continuous.
Optionally, referring to fig. 2, the step 102 specifically includes:
1021. and searching a target subfile to which the push message of the target message identification code belongs from all subfiles in the target file corresponding to the current moment according to the target message identification code.
Since the step 1021 selects the target subfile according to the target message identification code and the file identification code of each subfile, and referring to the file storage format described above, the file identification code of the subfile is the message identification code of a certain push message in the push messages stored in the subfile, and in order to ensure that the target subfile is selected more quickly, the maximum value or the minimum value among all the message identification codes is generally used, so that the optional step 1021 specifically includes:
and S1, when the file identification code of any subfile in the target file is the minimum value of the message identification codes of all the push messages included in any subfile, determining the subfile which belongs to the maximum file identification code in the file identification codes of all the subfiles in the target file and which are less than or equal to the file identification code of the target message identification code as the target subfile.
S2, when the file identification code of any subfile in the target file is the maximum value in the message identification codes of all push messages included in any subfile, determining the subfile to which the minimum file identification code belongs as the target subfile from the file identification codes of all subfiles in the target file, wherein the file identification codes of all subfiles in the target file are greater than or equal to the file identification code of the target message identification code.
1022. And acquiring a target message group to which the push message of the target message identification code belongs from all message groups in the target subfile according to the target message identification code.
Since the step 1022 specifically selects the target subfile according to the target message identification code and the group identification code of each message group, and it can be known by referring to the file storage format described above that the group identification code of a message group is the message identification code of a certain push message in the push messages stored therein, and in order to ensure that the target subfile is selected more quickly, the maximum value or the minimum value among all the message identification codes is generally used, the step 1022 may optionally specifically include:
and Q1, when the group identification code of any message group in the target subfile is the minimum value of the message identification codes of all the push messages in any message group, determining the message group to which the maximum group identification code belongs in the group identification codes of all the message groups in the target file, wherein the group identification codes are less than or equal to the target message identification code.
And Q2, when the group identification code of any message group in the target subfile is the maximum value of the message identification codes of all the push messages in any message group, determining the message group to which the minimum group identification code belongs in the group identification codes of all the message groups in the target file, wherein the group identification codes are more than or equal to the target message identification code.
1023. Determining the writing time of the target message group as the writing time of the push message of the target message identification code; the write time of the target message group is stored in the target subfile.
Any subfile in the target file comprises a first preset plurality of push messages; any message group in the subfiles comprises a second preset plurality of push messages with the same writing time and continuous and uninterrupted identification codes.
103. And calculating the time difference between the writing time of the push message to which the target message identification code belongs and the current time.
104. And judging whether the time difference is greater than or equal to a preset time interval.
When the time difference is determined to be larger than or equal to the preset time interval, 105 is executed; when it is determined that the time difference is less than the preset time interval, 101 is performed.
Specifically, the preset time interval may be sent by the client, for example, the preset time interval caused by that the user does not want to receive the push message in a certain time period, or may be set by the server itself, for example, after a certain bank APP sends a push instruction to the server in a certain activity, the server pushes the same push message to the client at intervals, so as to increase the probability that the user corresponding to the client participates in the activity.
105. And acquiring a push message corresponding to the push instruction according to the target message identification code and a preset rule and pushing the push message.
Specifically, in practice, the push message required to be obtained by the instruction sent by the client to the server may be one or multiple, for example, a certain bank APP holds activities at twenty-one, including a savings card activity, a credit card activity, a saving activity, an old user activity, a new user activity, and the like, so that it may be necessary for some clients to receive multiple push messages, and therefore the push message to which the target message identification code in the obtained push message instruction belongs is the first push message in the push messages corresponding to the push instruction, and the push instruction further includes the number of pushes; in addition, since all the push messages stored in the target file may actually be the messages whose identification codes are determined according to the predetermined push sequence, optionally, referring to fig. 2, the step 105 includes:
1051. when at least two push messages in the target file are provided with continuous message identification codes from small to large according to a preset push sequence from first to last, a plurality of push messages are sequentially selected and pushed from the push message to which the target message identification code in the target file belongs to serve as first target push messages according to the sequence from small to large of the identification codes, and the first target push messages are determined to be push messages corresponding to the push instructions.
1051, the corresponding message identification code setting rule is suitable for setting the message identification code of the push message when the quantity of the push message is uncertain.
1052. And sending the maximum value in the identification codes of the push messages corresponding to the push instructions to the client.
After the required push message is sent out, the client needs to know which push message is sent to so as to determine the target message identification code in the next sending; of course, in step 1052, the minimum value of all message identification codes larger than the maximum value of the identification codes of the push messages corresponding to the push instruction may also be sent to the client, so that the client determines the minimum value as the target message identification code sent when requesting push information next time; 1054 the same procedure.
1053. When at least two push messages in the target file are provided with continuous message identification codes from large to small according to a preset push sequence from first to last, a plurality of push messages are sequentially selected and pushed from the push message to which the target message identification code in the target file belongs to serve as second target push messages according to the sequence from large to small of the identification codes, and the preset second target push messages are determined to be push messages corresponding to the push instructions.
1053 the corresponding rule for setting message ID is suitable for setting message ID of push message when determining the number of push messages.
1054. And sending the minimum value in the identification codes of the push messages corresponding to the push instructions to the client.
1055. And pushing a push message corresponding to the command.
For example, because the target file includes the target subfile including the target message group, and actually when searching for the push message of the push instruction, the push message is searched from the target message group, and when searching for the push message from the target message, there may be a case where the number of push messages whose message identification codes are larger than the target message identification codes is smaller than the number of push messages or the number of push messages whose message identification codes are smaller than the target message identification codes is smaller than the number of push messages, in this case, after pushing the push message that can be sent from the target message group, the message group whose group identification codes are smaller than the group identification codes in the message group that is larger than the target message group is the smallest (if the message group that meets the requirement is in another subfile, the search for the further subfile is required, and the message identification codes used for the search are set for different message identification codes, so that the maximum value or the minimum value of all the message identification codes of the push message obtained from the target message group is sufficient to push message group The selection process is similar to that in the target message group.
106. And when the push type is determined to be real-time push, acquiring the push message to which the target identification code belongs from the memory according to the target message identification code, and pushing the push message to which the target identification code belongs.
Specifically, the space of the memory is limited in practice, and if a large amount of real-time push messages appear, the memory is not enough, so all push messages (delay push messages and real-time push messages) in the embodiment of the present invention are stored in a file, when push messages to be sent are not searched from the memory, the files need to be searched, and the searching process is the same as that in the foregoing embodiment; in order to ensure that the storage of the real-time push message does not affect the push of the subsequent real-time push message and the delayed push message, after the real-time push message is pushed, the message identification code (or the message identification code of the push message to be sent after the real-time push message) of the real-time push message is sent to the client needing to be received or the message identification code is stored and sent to the server, so that the client corresponding to the push message needing to be sent after the real-time push message can receive the needed push message.
The message pushing method provided by the embodiment of the invention comprises the following steps: acquiring a push instruction sent by a client; the push instruction at least carries a target message identification code and a push type; when the push type is determined to be delayed push, searching a push message to which the target message identification code belongs and writing time thereof from a target file corresponding to the current time according to the target message identification code; the target file comprises at least two push messages, and the message identification codes of the at least two messages to be pushed are continuous; calculating the time difference between the write-in time of the push message to which the target message identification code belongs and the current time; and when the time difference is determined to be larger than or equal to the preset time interval, acquiring a push message corresponding to the push instruction according to the target message identification code and a preset rule, and pushing. According to the technical scheme provided by the embodiment of the invention, after the push instruction of the client is received, if the push type in the push instruction is determined to be delayed push, the push message corresponding to the target identification code and the write time thereof can be quickly acquired from the target file stored with the delayed push message according to the target message identification code contained in the push instruction, and if the difference value between the current moment and the suction time is determined to be larger than the preset delay interval, the push message is pushed, so that the push flow of the delayed push message is completed. Because the technical scheme provided by the embodiment of the invention stores the push delay push messages based on a file storage mode, each delay message has a unique identification code and correspondingly stores the writing time of each delay push message, the position of the delay push message to be pushed and whether the delay push message can be sent can be quickly determined when the message needs to be pushed; in the existing database scheme, all information of a certain push message is gathered together to form a character string, searching is relatively complex, and computing resources are consumed, so that compared with the existing delay push message pushing method based on memory storage or database storage, the method saves a large amount of resources and can efficiently and quickly push the delay push message.
An embodiment of the present invention further provides a server, where the server includes a message pushing apparatus 01, and as shown in fig. 3, the message pushing apparatus 01 includes: the device comprises an acquisition module 31, a judgment module 32, a search module 33, a calculation module 34 and a push module 35;
the obtaining module 31 is configured to obtain a push instruction sent by the client 02; the push instruction at least carries a target message identification code and a push type;
when the determining module 32 determines that the push type acquired by the acquiring module 31 is delayed push, the searching module 33 is configured to search, according to the target message identification code acquired by the acquiring module 31, a push message to which the target message identification code belongs and writing time thereof from a target file corresponding to the current time; the target file comprises at least two push messages, and the message identification codes of the at least two messages to be pushed are continuous;
the calculating module 34 is configured to calculate a time difference between the write time of the push message to which the target message identification code found by the searching module 33 belongs and the current time;
when the determining module 32 determines that the time difference calculated by the calculating module 34 is greater than or equal to the preset time interval, the searching module 33 is configured to obtain, according to the target message identification code obtained by the obtaining module 31 and according to a preset rule, a push message corresponding to the push instruction, and deliver the push message to the pushing module 35 for pushing.
Optionally, the searching module 33 includes a subfile searching unit 331, a message group searching unit 332, and a writing time determining module 333;
the subfile searching unit 331 is configured to search, according to the target message identification code acquired by the acquisition module 31, a target subfile to which a push message to which the target message identification code belongs from all subfiles in a target file corresponding to the current time;
a message group searching unit 332, configured to obtain, according to the target message identification code obtained by the obtaining module 31, a target message group to which the push message to which the target message identification code belongs from all message groups in the target subfile searched by the subfile searching unit 331;
a write time determining module 333, configured to determine the write time of the target message group found by the message group finding unit 332 as the write time of the push message of the target message identification code; the write time of the target message group is stored in the target subfile;
any subfile in the target file comprises a first preset plurality of push messages; any message group in the subfiles comprises a second preset plurality of push messages with the same writing time and continuous and uninterrupted identification codes.
Optionally, the subfile lookup module 33 is specifically configured to:
when the file identification code of any subfile in the target file is the minimum value of the message identification codes of all push messages included in any subfile, determining the subfile to which the largest file identification code belongs as the target subfile, wherein the largest file identification code is less than or equal to the file identification code of the target message identification code acquired by the acquisition module 31 in the file identification codes of all subfiles in the target file;
when the file identification code of any subfile in the target file is the maximum value among the message identification codes of all push messages included in any subfile, the subfile to which the minimum file identification code belongs is determined as the target subfile from the file identification codes of all subfiles in the target file, wherein the file identification codes of all subfiles in the target file are greater than or equal to the file identification code of the target message identification code acquired by the acquisition module 31.
Optionally, the message group searching module 33 is specifically configured to:
when the group identification code of any message group in the target subfile is the minimum value of the message identification codes of all the push messages included in any message group, determining the message group to which the maximum group identification code belongs as the target message group from the group identification codes of all the message groups in the target file, wherein the group identification codes of all the message groups are less than or equal to the target message identification code;
and when the group identification code of any message group in the target subfile is the maximum value in the message identification codes of all the push messages included in any message group, determining the message group to which the minimum group identification code belongs as the target message group in the group identification codes of all the message groups in the target file, wherein the group identification codes are more than or equal to the target message identification code.
Optionally, the push message to which the target message identification code belongs is a first push message in the push messages corresponding to the push instruction; the push instruction also comprises the push number; the search module 33 is specifically configured to:
when at least two push messages in the target file are provided with continuous message identification codes from small to large according to a preset push sequence from first to last, starting from the push message to which the target message identification code acquired by the acquisition module 31 in the target file belongs, sequentially selecting and pushing a plurality of push messages as first target push messages according to the sequence from small to large of the identification codes, and determining the first target push messages as the push messages corresponding to the push instructions;
when at least two push messages in the target file are provided with continuous message identification codes from large to small according to a preset push sequence from first to last, starting from the push message to which the target message identification code obtained by the obtaining module 31 in the target file belongs, selecting and pushing a plurality of push messages as second target push messages according to the sequence from large to small of the identification codes in sequence, and determining the preset second target push message as the push message corresponding to the push instruction.
Optionally, when the determining module 32 determines that the push type is real-time push, the searching module 33 is further configured to obtain, according to the target message identification code obtained by the obtaining module 31, a push message to which the target identification code belongs from the memory, and deliver the push message to which the target identification code belongs to the push module 35.
Optionally, when the determining module 32 determines that the time difference calculated by the calculating module 34 is smaller than the delay interval, the obtaining module 31 is further configured to obtain the push message instruction again.
Optionally, when at least two push messages in the target file set consecutive message identification codes from small to large according to a preset push sequence from first to last, the pushing module 35 further includes, after pushing the push message corresponding to the push instruction: sending the maximum value in the identification code of the push message corresponding to the push instruction to the client 02;
when at least two push messages in the target file set continuous message identification codes from large to small according to a preset push sequence from first to last, the pushing module 35 further includes, after pushing the push message corresponding to the push instruction: and sending the minimum value in the identification code of the push message corresponding to the push instruction to the client 02.
The message pushing device provided by the embodiment of the invention comprises: the acquisition module is used for acquiring a push instruction sent by a client; the push instruction at least carries a target message identification code and a push type; when the judging module determines that the push type acquired by the acquiring module is delayed push, the searching module is used for searching a push message and writing time thereof, which the target message identification code belongs to, from a target file corresponding to the current time according to the target message identification code acquired by the acquiring module; the target file comprises at least two push messages, and the message identification codes of the at least two messages to be pushed are continuous; the calculation module is used for calculating the time difference between the write-in time of the push message to which the target message identification code searched by the search module belongs and the current time; and when the judging module determines that the time difference calculated by the calculating module is greater than or equal to the preset time interval, the pushing module is used for acquiring a pushing message corresponding to the pushing instruction according to the target message identification code acquired by the acquiring module and a preset rule and pushing the pushing message. Therefore, according to the technical scheme provided by the embodiment of the present invention, after receiving the push instruction of the client, if it is determined that the push type in the push instruction is the delayed push, the push message corresponding to the target identification code and the write time thereof can be quickly obtained from the target file in which the delayed push message is stored according to the target message identification code included in the push instruction, and if it is determined that the difference between the current time and the suction time is greater than the preset delay interval, the push message is pushed, thereby completing the push process of the delayed push message. Because the technical scheme provided by the embodiment of the invention stores the push delay push messages based on a file storage mode, each delay message has a unique identification code and correspondingly stores the writing time of each delay push message, the position of the delay push message to be pushed and whether the delay push message can be sent can be quickly determined when the message needs to be pushed; in the existing database scheme, all information of a certain push message is gathered together to form a character string, searching is relatively complex, and computing resources are consumed, so that compared with the existing delay push message pushing method based on memory storage or database storage, the method saves a large amount of resources and can efficiently and quickly push the delay push message.
Referring to fig. 4, an embodiment of the present invention further provides another message pushing apparatus, which includes a memory 41, a processor 42, a bus 43, and a communication interface 44; the memory 41 is used for storing computer execution instructions, and the processor 42 is connected with the memory 41 through a bus 43; when the message pushing device is running, the processor 42 executes computer-executable instructions stored by the memory 41 to cause the message pushing device to perform the message pushing method provided by the above-described embodiments.
In particular implementations, processor 42(42-1 and 42-2) may include one or more CPUs, such as CPU0 and CPU1 shown in FIG. 4, for example, as one embodiment. And as an example, the message pushing means may comprise a plurality of processors 42, such as processor 42-1 and processor 42-2 shown in fig. 4. Each of the processors 42 may be a Single-core processor (Single-CPU) or a Multi-core processor (Multi-CPU). Processor 42 may refer herein to one or more devices, circuits, and/or processing cores that process data (e.g., computer program instructions).
The Memory 41 may be a Read-Only Memory 41 (ROM) or other types of static storage devices that can store static information and instructions, a Random Access Memory (RAM) or other types of dynamic storage devices that can store information and instructions, an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic Disc storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 41 may be self-contained and coupled to the processor 42 via a communication bus 43. The memory 41 may also be integrated with the processor 42.
In a specific implementation, the memory 41 is used for storing data in the present application and computer-executable instructions corresponding to software programs for executing the present application. The processor 42 may operate or execute software programs stored in the memory 41 and invoke various functions of the message push device by data stored in the memory 41.
The communication interface 44 is any device such as a transceiver for communicating with other devices or communication Networks, such as a control system, a Radio Access Network (RAN), a Wireless Local Area Network (WLAN), and the like. The communication interface 44 may include a receiving unit implementing a receiving function and a transmitting unit implementing a transmitting function.
The bus 43 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus 43 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 4, but this does not indicate only one bus or one type of bus.
An embodiment of the present invention further provides a computer storage medium, where the computer storage medium includes computer execution instructions, and when the computer execution instructions run on a computer, the computer is caused to execute the message pushing method provided in the foregoing embodiment.
The embodiment of the present invention further provides a computer program, where the computer program may be directly loaded into the memory and contains a software code, and the computer program is loaded and executed by a computer, so as to implement the message pushing method provided by the above embodiment.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in this invention may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules or units is only one logical function division, and there may be other division ways in actual implementation. For example, various elements or components may be combined or may be integrated into another device, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form. Units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed to a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (16)

1. A message pushing method, comprising:
acquiring a push instruction sent by a client; the push instruction at least carries a target message identification code and a push type;
when the push type is determined to be delayed push, searching a push message to which the target message identification code belongs and writing time thereof from a target file corresponding to the current moment according to the target message identification code; the target file comprises at least two push messages, and the message identification codes of the at least two messages to be pushed are continuous;
calculating the time difference between the writing time of the push message to which the target message identification code belongs and the current time;
when the time difference is determined to be larger than or equal to a preset time interval, acquiring a push message corresponding to the push instruction according to the target message identification code and a preset rule, and pushing the push message;
the searching for the push message and the writing time thereof which belong to the target message identification code from the target file corresponding to the current time according to the target message identification code comprises the following steps:
searching a target subfile to which a push message of the target message identification code belongs from all subfiles in a target file corresponding to the current moment according to the target message identification code;
acquiring a target message group to which a push message of the target message identification code belongs from all message groups in the target subfile according to the target message identification code;
determining the writing time of the target message group as the writing time of the push message of the target message identification code; the write time of the target message group is stored in the target subfile;
any subfile in the target file comprises a first preset plurality of push messages; any message group in the subfiles comprises a second preset plurality of push messages which have the same writing time and continuous and uninterrupted identification codes.
2. The message pushing method according to claim 1, wherein the searching for the target subfile to which the push message of the target message identifier belongs from all subfiles in the target file corresponding to the current time according to the target message identifier comprises:
when the file identification code of any subfile in the target file is the minimum value of the message identification codes of all push messages included in the any subfile, determining the subfile to which the maximum file identification code belongs as the target subfile, wherein the file identification codes of all subfiles in the target file are less than or equal to the file identification code of the target message identification code;
and when the file identification code of any subfile in the target file is the maximum value in the message identification codes of all push messages included in the any subfile, determining the subfile to which the minimum file identification code belongs as the target subfile from the file identification codes of all subfiles in the target file, wherein the file identification codes of all subfiles in the target file are greater than or equal to the file identification code of the target message identification code.
3. The message pushing method according to claim 1, wherein obtaining the target message group to which the push message of the target message identifier belongs from all message groups in the target subfile according to the target message identifier comprises:
when the group identification code of any message group in the target subfile is the minimum value of the message identification codes of all the push messages included in the message group, determining the message group to which the maximum group identification code belongs in the group identification codes of all the message groups in the target file, wherein the group identification code is less than or equal to the group identification code of the target message identification code;
and when the group identification code of any message group in the target subfile is the maximum value in the message identification codes of all the push messages in any message group, determining the message group to which the minimum group identification code belongs as the target message group in the group identification codes of all the message groups in the target file, wherein the group identification codes of all the message groups in the target file are more than or equal to the group identification code of the target message identification code.
4. The message pushing method according to claim 1, wherein the push message to which the target message identification code belongs is a first push message in the push messages corresponding to the push instruction; the push instruction further comprises the push number; the obtaining of the push message corresponding to the push instruction according to the target message identification code and a preset rule includes:
when at least two push messages in the target file are provided with continuous message identification codes from small to large according to a preset push sequence from first to last, sequentially selecting the push messages with the number of push messages as first target push messages from the push message to which the target message identification code in the target file belongs according to the sequence from small to large of the identification codes, and determining the first target push messages as the push messages corresponding to the push instructions;
when at least two pieces of push messages in the target file are provided with continuous message identification codes from large to small according to a preset push sequence from first to last, the number of push messages to be pushed is sequentially selected from the push messages to which the target message identification codes in the target file belong according to the sequence from large to small of the identification codes and used as second target push messages, and the preset second target push messages are determined to be the push messages corresponding to the push instructions.
5. The message pushing method according to claim 1, further comprising:
and when the push type is determined to be real-time push, acquiring the push message to which the target identification code belongs from the memory according to the target message identification code, and pushing the push message to which the target identification code belongs.
6. The message pushing method according to claim 1, further comprising:
and when the time difference is determined to be smaller than the delay interval, the push message instruction is acquired again.
7. The message pushing method according to claim 1,
when at least two push messages in the target file are provided with continuous message identification codes from small to large according to a preset push sequence from first to last, pushing the push message corresponding to the push instruction further comprises: sending the maximum value in the identification code of the push message corresponding to the push instruction to the client;
when at least two push messages in the target file are provided with continuous message identification codes from big to small according to a preset push sequence from first to last, pushing the push message corresponding to the push instruction further comprises: and sending the minimum value in the identification codes of the push messages corresponding to the push instructions to the client.
8. A message push apparatus, comprising: the device comprises an acquisition module, a judgment module, a search module, a calculation module and a push module;
the acquisition module is used for acquiring a push instruction sent by a client; the push instruction at least carries a target message identification code and a push type;
when the judging module determines that the push type acquired by the acquiring module is delayed push, the searching module is used for searching a push message and writing time thereof, which the target message identification code belongs to, from a target file corresponding to the current time according to the target message identification code acquired by the acquiring module; the target file comprises at least two push messages, and the message identification codes of the at least two messages to be pushed are continuous;
the calculation module is configured to calculate a time difference between the write time of the push message to which the target message identification code belongs and the current time, where the push message belongs and the target message identification code are found by the search module;
when the judging module determines that the time difference calculated by the calculating module is greater than or equal to a preset time interval, the searching module is used for acquiring a push message corresponding to the push instruction according to the target message identification code acquired by the acquiring module and a preset rule and delivering the push message to the pushing module for pushing;
the searching module comprises a subfile searching unit, a message group searching unit and a writing time determining module;
the subfile searching unit is configured to search, according to the target message identification code acquired by the acquisition module, a target subfile to which a push message to which the target message identification code belongs from all subfiles in a target file corresponding to the current time;
the message group searching unit is configured to obtain, according to the target message identification code obtained by the obtaining module, a target message group to which a push message to which the target message identification code belongs from all message groups in the target subfile searched by the subfile searching unit;
the writing time determining module is configured to determine the writing time of the target message group found by the message group searching unit as the writing time of the push message of the target message identification code; the write time of the target message group is stored in the target subfile;
any subfile in the target file comprises a first preset plurality of push messages; any message group in the subfiles comprises a second preset plurality of push messages which have the same writing time and continuous and uninterrupted identification codes.
9. The message pushing apparatus according to claim 8, wherein the subfile lookup module is specifically configured to:
when the file identification code of any subfile in the target file is the minimum value of the message identification codes of all push messages included in the any subfile, determining the subfile to which the largest file identification code belongs as the target subfile, wherein the largest file identification code is less than or equal to the file identification code of the target message identification code acquired by the acquisition module;
and when the file identification code of any subfile in the target file is the maximum value in the message identification codes of all push messages included in the any subfile, determining the subfile to which the smallest file identification code belongs as the target subfile, wherein the largest value is greater than or equal to the file identification code of the target message identification code acquired by the acquisition module in the file identification codes of all subfiles in the target file.
10. The message pushing apparatus according to claim 8, wherein the message group searching module is specifically configured to:
when the group identification code of any message group in the target subfile is the minimum value of the message identification codes of all the push messages included in the message group, determining the message group to which the maximum group identification code belongs in the group identification codes of all the message groups in the target file, wherein the group identification code is less than or equal to the group identification code of the target message identification code;
and when the group identification code of any message group in the target subfile is the maximum value in the message identification codes of all the push messages in any message group, determining the message group to which the minimum group identification code belongs as the target message group in the group identification codes of all the message groups in the target file, wherein the group identification codes of all the message groups in the target file are more than or equal to the group identification code of the target message identification code.
11. The message pushing apparatus according to claim 8, wherein the push message to which the target message identification code belongs is a first push message in the push messages corresponding to the push instruction; the push instruction further comprises the push number; the search module is specifically configured to:
when at least two push messages in the target file are provided with continuous message identification codes from small to large according to a preset push sequence from first to last, sequentially selecting the push messages with the number of push messages as first target push messages according to the sequence from small to large of the identification codes from the push message to which the target message identification code obtained by the obtaining module in the target file belongs, and determining the first target push messages as the push messages corresponding to the push instructions;
when at least two pieces of push messages in the target file are provided with continuous message identification codes from large to small according to a preset push sequence from first to last, the push messages of the push number are sequentially selected as second target push messages from the push message to which the target message identification code obtained by the obtaining module in the target file belongs according to the sequence from large to small of the identification codes, and the preset second target push messages are determined as the push messages corresponding to the push instruction.
12. The message pushing apparatus according to claim 8, further comprising:
when the judging module determines that the push type is real-time push, the searching module is further configured to obtain, according to the target message identification code obtained by the obtaining module, a push message to which the target identification code belongs from a memory, and deliver the push message to the pushing module to push the push message to which the target identification code belongs.
13. The message pushing apparatus according to claim 8, further comprising:
and when the judging module determines that the time difference calculated by the calculating module is smaller than the delay interval, the acquiring module is further configured to reacquire a push message instruction.
14. The message push apparatus according to claim 8,
when at least two push messages in the target file are provided with continuous message identification codes from small to large according to a preset push sequence from first to last, the push module further comprises, after pushing the push message corresponding to the push instruction: sending the maximum value in the identification code of the push message corresponding to the push instruction to the client;
when at least two push messages in the target file are provided with continuous message identification codes from large to small according to a preset push sequence from first to last, the push module further comprises, after pushing the push message corresponding to the push instruction: and sending the minimum value in the identification codes of the push messages corresponding to the push instructions to the client.
15. The message pushing device is characterized by comprising a memory, a processor, a bus and a communication interface; the memory is used for storing computer execution instructions, and the processor is connected with the memory through the bus; when the message pushing device is running, the processor executes the computer-executable instructions stored by the memory to cause the device to perform the message pushing method of any one of claims 1-7.
16. A computer storage medium comprising computer executable instructions which, when executed on a computer, cause the computer to perform the message push method of any one of claims 1-7.
CN201910002453.0A 2019-01-02 2019-01-02 Message pushing method and device Active CN109787884B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910002453.0A CN109787884B (en) 2019-01-02 2019-01-02 Message pushing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910002453.0A CN109787884B (en) 2019-01-02 2019-01-02 Message pushing method and device

Publications (2)

Publication Number Publication Date
CN109787884A CN109787884A (en) 2019-05-21
CN109787884B true CN109787884B (en) 2021-03-12

Family

ID=66499729

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910002453.0A Active CN109787884B (en) 2019-01-02 2019-01-02 Message pushing method and device

Country Status (1)

Country Link
CN (1) CN109787884B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111209124B (en) * 2019-12-27 2021-09-07 北京五八信息技术有限公司 Message processing method, device, server and storage medium
CN111917843A (en) * 2020-07-16 2020-11-10 远光软件股份有限公司 Message pushing method, computer equipment and storage medium
CN114244792B (en) * 2020-09-09 2023-07-25 中国联合网络通信集团有限公司 Message sending method and device and message display method and device
CN114710556B (en) * 2022-06-08 2022-09-16 深圳市信润富联数字科技有限公司 Multi-system integrated message pushing method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101729436A (en) * 2008-10-21 2010-06-09 中兴通讯股份有限公司 Method for acquiring messages and convergence message service system
JP2015215728A (en) * 2014-05-09 2015-12-03 Kddi株式会社 Push notification transmission method and system, and push notification device and communication terminal
CN105611505A (en) * 2015-08-17 2016-05-25 宇龙计算机通信科技(深圳)有限公司 Message pushing method, message pushing device and terminal
CN106899488A (en) * 2016-07-22 2017-06-27 阿里巴巴集团控股有限公司 A kind of application message method for pushing, device
CN107070990A (en) * 2011-03-17 2017-08-18 华为技术有限公司 The method and apparatus of transmitting data resources
CN107943828A (en) * 2017-10-18 2018-04-20 深圳市牛鼎丰科技有限公司 Service condition querying method, device, computer equipment and storage medium
CN108388479A (en) * 2018-02-10 2018-08-10 深圳壹账通智能科技有限公司 Postpone information push method, device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101729436A (en) * 2008-10-21 2010-06-09 中兴通讯股份有限公司 Method for acquiring messages and convergence message service system
CN107070990A (en) * 2011-03-17 2017-08-18 华为技术有限公司 The method and apparatus of transmitting data resources
JP2015215728A (en) * 2014-05-09 2015-12-03 Kddi株式会社 Push notification transmission method and system, and push notification device and communication terminal
CN105611505A (en) * 2015-08-17 2016-05-25 宇龙计算机通信科技(深圳)有限公司 Message pushing method, message pushing device and terminal
CN106899488A (en) * 2016-07-22 2017-06-27 阿里巴巴集团控股有限公司 A kind of application message method for pushing, device
CN107943828A (en) * 2017-10-18 2018-04-20 深圳市牛鼎丰科技有限公司 Service condition querying method, device, computer equipment and storage medium
CN108388479A (en) * 2018-02-10 2018-08-10 深圳壹账通智能科技有限公司 Postpone information push method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN109787884A (en) 2019-05-21

Similar Documents

Publication Publication Date Title
CN109787884B (en) Message pushing method and device
US20170364697A1 (en) Data interworking method and data interworking device
CN110134648A (en) Log processing method, device, equipment, system and computer readable storage medium
WO2019057193A1 (en) Data deletion method and distributed storage system
CN113886494A (en) Message storage method, device, equipment and computer readable medium for instant messaging
CN111488373B (en) Method and system for processing request
CN111143053A (en) Scheduling method of timing task, server and storage device
CN109669735B (en) Application starting method and device based on delayed registration and storage medium
CN108769244B (en) Storage task information acquisition method and related device
EP4102367A1 (en) Message format indicator for resource-constrained devices
CN115878035A (en) Data reading method and device, electronic equipment and storage medium
CN108958967A (en) A kind of method and server of data processing
CN113672248A (en) Patch acquisition method, device, server and storage medium
CN107332679B (en) Centerless information synchronization method and device
CN108206933B (en) Video data acquisition method and device based on video cloud storage system
CN110213314B (en) Method, device and server for determining storage node
CN112491986B (en) Method, device and system for distributing commands in distributed system
CN117724852B (en) Cloud computer computing resource allocation method and device
EP4209923A1 (en) Method for sharing prepare statement, system, network device, and storage medium
US12015684B2 (en) Message format indicator for resource-constrained devices
CN117651075B (en) Task message transmission method, device, computer equipment and computer readable storage medium
WO2022028165A1 (en) Cache management method, terminal, and storage medium
CN112000391B (en) Configuration processing method and system
CN117251277A (en) Method, device, equipment, medium and program product for executing task instance
CN115168440A (en) Data read-write method, distributed storage system, device, equipment and storage medium

Legal Events

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