Disclosure of Invention
The invention aims to provide a method capable of synchronizing background updated information to a terminal in time.
In order to achieve the above object, the present invention provides an information synchronization method, including:
a first terminal receives first information and sends the first information to an information editing server, wherein the first information is information input by a background of the first terminal;
the information editing server converts the first information into a first character string and sends the first character string to a middleware server;
the middleware server sends the first character string to an information management server;
the information management server presets a naming rule;
the information management server extracts information of a type to be operated from the first character string and carries out corresponding operation on the first character string according to the information of the type to be operated;
the information management server generates a storage directory and a file name corresponding to the first character string according to a preset naming rule;
the information management server converts the first character string into second information, wherein the second information is static file information corresponding to the first information;
the information management server encapsulates the second information, the storage directory and the file name to obtain third information, and stores the third information into a second database;
the information management server sends the third information to the middleware server;
the middleware server sends the third information to an information issuing server;
the information issuing server extracts the third information to obtain the storage directory, and stores the second information in the third information to a third database according to the storage directory;
the information issuing server generates access address information of the second information in the third database;
and the information issuing server sends the access address information to a second terminal.
Further, the information management server extracts type information to be operated from the first character string, and performs corresponding operation on the first character string according to the type information to be operated specifically as follows:
the information management server extracts information of types to be operated from the first character string, wherein the information of the types to be operated is an adding/updating database;
if the operation is database adding operation, the information management server stores the first character string in the second database;
if the operation is the database updating operation, the information management server analyzes the first character string to obtain a database updating rule contained in the first character string;
and the information management server updates the first character string in the second database according to the database updating rule.
Further, after the information editing server converts the first information into a first character string and sends the first character string to the middleware server, the method further includes:
the information management server regularly inquires whether the middleware server has a data updating event;
if the middleware server generates a data updating event, the middleware server sends the information of the data updating event to an information management server;
after receiving the data updating event occurrence information, the information management server sends a data updating request to the middleware server;
and the middleware server sends the first character string to an information management server and stores the first character string.
Further, after the information editing server converts the first information into a first character string and sends the first character string to the middleware server, the method further includes:
the information management server regularly inquires whether the middleware server has a data updating event;
if the middleware server generates a data updating event, the middleware server sends the information of the data updating event to an information management server;
after receiving the data updating event occurrence information, the information management server sends a data updating request to the middleware server;
the middleware server sends the first character string to an information management server;
the information management server analyzes the first character string to obtain an information identifier contained in the first character string;
and the information management server searches a corresponding specific character string according to the information identifier and replaces the specific character string with the first character string.
Further, the naming rule is as follows:
naming is carried out according to the sequence of date, file type, file number and current time stamp, wherein the date comprises year, month and day.
According to the information synchronization method provided by the embodiment of the invention, the updated information of the background terminal is synchronized to the user terminal in time by setting the information editing server, the information management server, the information publishing server and other equipment, and meanwhile, higher working efficiency and higher storage space utilization rate are ensured.
Detailed Description
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
The information synchronization method provided by the embodiment of the invention synchronizes information input by a first terminal, namely a background, to a second terminal, namely a user terminal through the steps of an information editing server, an information management server, an information publishing server and the like. The technical purpose of synchronizing the information of the background to the user side in time is achieved.
Fig. 1 is a flowchart of an information synchronization method according to an embodiment of the present invention, where as shown in the figure, the method includes:
s101: the method comprises the steps that a first terminal receives first information and sends the first information to an information editing server, wherein the first information is information input by a background of the first terminal.
The first terminal is used for receiving new information input by an administrator, namely the first information, and sending the new information input by the administrator to the information editing server. The first terminal is known as the background, and the first message is the message that the administrator wants to distribute to the user terminal.
For example, when an administrator of a certain platform wants to update the content published by the platform, the administrator enters first information to be published on an editor of the first terminal in the background, for example, an article "high-value patent how to wake up high school sleeping deep" is entered, and the entered article information is sent to the information editing server.
After receiving the first information input and sent in step 101, the information editing server stores the first information in the first database, and plays a role in saving and backing up. For example, after the entered article "high-value patent how to wake up colleges and universities to sleep aloft" is sent to the information editing server, the information editing server stores the article into the first database, so that when other steps of data updating send data loss, the data can be retrieved in the first database.
S102: and the information editing server converts the first information into a first character string and sends the first character string to a middleware server.
The information editing server not only stores the received first information in the first database, but also converts the first information into a first character string editable by the server, and sends the obtained first character string to the intermediate server for forwarding.
Specifically, the information editing server, after converting the first information into a first character string and sending the first character string to the middleware server, further includes:
the information management server regularly inquires whether the middleware server has a data updating event; if the middleware server generates a data updating event, the middleware server sends the information of the data updating event to an information management server; after receiving the data updating event occurrence information, the information management server sends a data updating request to the middleware server; and the middleware server sends the first character string to an information management server and stores the first character string.
Specifically, there are many possibilities in the process of sending the received first character string to the subsequent information management server by the middleware server, where one of the possibilities is that the information management server periodically queries the middleware server whether there is data update, if the middleware server does have data update, the middleware server sends information of sending a data update event to the information management server, and otherwise, the middleware server does not send the reminding information. After receiving the reminding information, the information management server considers that the middleware server receives a new first character string, so that a data updating request is sent to the middleware server to request to acquire the updated data information of the middleware server, after receiving the request information, the middleware server sends the updated first character string to the information management server, and the information management server stores the first character string in a corresponding database.
In another case, after the information editing server converts the first information into a first character string and sends the first character string to the middleware server, the method further includes:
the information management server regularly inquires whether the middleware server has a data updating event; if the middleware server generates a data updating event, the middleware server sends the information of the data updating event to an information management server; after receiving the data updating event occurrence information, the information management server sends a data updating request to the middleware server; the middleware server sends the first character string to an information management server; the information management server analyzes the first character string to obtain an information identifier contained in the first character string; and the information management server searches a corresponding specific character string according to the information identifier and replaces the specific character string with the first character string.
Specifically, another possibility of the process of the middleware server sending the received first character string to the subsequent information management server is that if a data update event occurs in the middleware server, the middleware server actively sends information of sending the data update event to the information management server, and otherwise, the reminding information is not sent. After receiving the reminding information, the information management server considers that the middleware server receives a new first character string, and therefore sends a data updating request to the middleware server to request to acquire the updated data information of the middleware server, after receiving the request information, the middleware server sends the updated first character string to the information management server, and after receiving the first character string, the information management server recognizes the first character string to acquire an information identifier contained in the first character string, wherein the information identifier describes an operation step or an operation type to be performed by the first character string, for example, the information identifier which needs to be updated can describe a storage directory or a storage address in which the character string should be stored, and can also describe an identifier of a specific character string which needs to be replaced. After obtaining the information identifier, the information management server finds the corresponding specific character string according to the information identifier, and replaces the character string with the first character string in this embodiment.
S103: and the middleware server sends the first character string to an information management server.
After receiving the first character string sent in step 103, the middleware server detects the first character string, confirms that the first character string is in an available data format, and then sends the first character string to an information management server, where the information management server is used to perform subsequent operations and processing on the first character string. The middleware server is used for connecting the information editing server and the information management server.
S104: the information management server presets a naming rule.
Because the network information has the characteristics of large quantity and complexity, if the network information is issued according to the original name of each network information, the speed of calling data by the server is reduced, and if the name is irregular, the information is not beneficial to be stored, so that the information management server presets a naming rule which is used for naming the information sent by the middleware server according to a certain rule. The naming rule is not unique and can be set by the background according to needs.
Further, the naming rule is as follows: naming is carried out according to the sequence of date, file type, file number and current time stamp, wherein the date comprises year, month and day.
Specifically, an embodiment of a naming rule is provided that names are made according to time and file characteristics, such as in the order of date-file type-file number-current timestamp, such as: {20151109} - { pdf } - {1039731} - {1505198982}. html.
And S105, the information management server extracts the type information to be operated from the first character string and performs corresponding operation on the first character string according to the type information to be operated.
And after receiving the first character string, the information management server extracts the first character string and extracts the type information to be operated contained in the character string, wherein the type information to be operated refers to the type of operation which the information management server should perform on the first character string next. And after the information management server acquires the type information to be operated, subsequently performing corresponding operation on the first character string according to the type information to be operated. For example, the update operation, the new operation, or other hyperlink operation may be performed.
Specifically, the information management server extracts type information to be operated from the first character string, wherein the type information to be operated is an addition/update database;
if the operation is database adding operation, the information management server stores the first character string in the second database; i.e. adding a new storage address or management address in the database for storing the first string.
If the operation is the database updating operation, the information management server analyzes the first character string to obtain a database updating rule contained in the first character string; and the information management server updates the first character string in the second database according to the database updating rule. Specifically, if the first character string requires to perform an update database operation, the information management server first obtains a storage address or a management address corresponding to the first character string and an update rule corresponding to the first character string. And then, the information management server updates the corresponding storage address along with the first character string in the database according to the obtained updating rule.
S106: the information management server generates a storage directory and a file name corresponding to the first character string according to a preset naming rule;
the information management server names the first character string according to a preset naming rule, and the naming further comprises the step of generating a storage directory and a file name corresponding to the first character string. The storage directory is generated in two ways, the first is to newly create a file storage address in the original storage area, and the second is to store the information in the original file storage address, that is, update the original information.
S107: and the information management server converts the first character string into second information, wherein the second information is static file information corresponding to the first information.
The information management server subsequently converts the first character string from the data language into static file information, which is set as the second information. In detail, a freemarker template engine is adopted to replace the configured template, so that static file information, namely the second information is generated.
S108: and the information management server encapsulates the second information, the storage directory and the file name to obtain third information, and stores the third information into a second database.
After the information management server obtains the second information, the storage directory and the file name, the three are packaged together to generate third information, the third information is expressed in a character string form, and the third information is convenient to extract and the like in the follow-up process when being converted into the character string. The information management server stores the obtained third information in the second database.
S109: and the information management server sends the third information to the middleware server.
And after the third information is obtained by the information management server, the third information is sent to the middleware server, added into a file queue of the middleware server, and sequentially operated in the next step. If the third information does not have the information identifier which is issued preferentially, the subsequent steps are waited for in sequence, and if the third information contains the information identifier which is issued preferentially, the third information is arranged at the front end of the queue, and the third information is issued preferentially. Or if the third information contains the identification of the importance degree, sorting in the queue according to the importance degree.
S110: and the middleware server sends the third information to an information issuing server.
When the subsequent operation of the third information in the queue is performed, the middleware server sends the third information to the information publishing server, the information publishing server publishes the third information, and similarly, the third information is added into the file queue of the information publishing server, and the next operation is sequentially performed in sequence. If the third information does not have the information identifier which is issued preferentially, the subsequent steps are waited for in sequence, and if the third information contains the information identifier which is issued preferentially, the third information is arranged at the front end of the queue, and the third information is issued preferentially. Or if the third information contains the identification of the importance degree, sorting in the queue according to the importance degree.
S111: and the information issuing server extracts the third information to obtain the storage directory, and stores the second information in the third information to a third database according to the storage directory.
When the third information in the queue is published, the information publishing server extracts the third information to obtain the second information, the storage directory and the file name which are packaged by the third information. And then, the information publishing server stores the second information into a third database according to the storage directory, wherein the stored name is the file name. The stored addresses are obtained from the aforementioned storage directory.
S112: and the information publishing server generates access address information of the second information in the third database.
After the second information is successfully stored in the third database, the information publishing server obtains the real-time access address information of the second information, and the file name of the second information corresponding to the storage directory. The access address information is used for facilitating the user side to obtain the second information, and can keep smaller space occupancy rate.
S113: and the information issuing server sends the access address information to a second terminal.
After the access address information of the second information is acquired, the information issuing server sends the access address information to the second terminal, and after the second terminal receives the access address information, if the user clicks the access address information, the second terminal requests file information corresponding to the access address information, namely the second information, and displays the second information on the second terminal.
According to the information synchronization method provided by the embodiment of the invention, the updated information of the background terminal is synchronized to the user terminal in time by setting the information editing server, the information management server, the information publishing server and other equipment, and meanwhile, higher working efficiency and higher storage space utilization rate are ensured.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.