Summary of the invention
The object of the invention is to provide a kind of technical scheme, keeps the problem of article editing content in the time of can effectively solving because of burst reason or issue failure.
The present invention also aims to provide a kind of technical scheme, avoid the too much problem of redundancy versions in the article editing process.
Concrete technical scheme is as follows:
A kind of article editing backup method based on draft comprises that the operation that the user preserves rough draft to the entry of editing is further comprising the steps of:
Judge whether this user has existed the draft of this entry;
If there is no then create draft, described rough draft is saved to this draft;
If exist then described rough draft be updated to this draft.
Described method further comprises:
In the editing process, according to instructing manually or automatically current rough draft is updated to described draft.
Describedly judge whether this user has existed the draft of this entry further to comprise:
Described front-end server sends the query requests that comprises entry name, user encryption ID, editor's reason and rough draft text to the entry central server;
Described entry central server makes up querying command and sends this querying command to database server according to described entry name and user encryption ID;
Described database server returns to described entry central server with Query Result;
Described entry central server judges whether to exist draft according to this Query Result, if there is no then creates draft, and described rough draft is saved to this draft, if exist, then described rough draft is updated to this draft.
Described establishment draft is saved to this draft with described rough draft and further comprises:
Described entry central server makes up according to described entry name, user encryption ID, editor's reason and rough draft text and inserts order and send this insertion order to described database server;
Described database server is carried out this insertion order, create the draft of this entry name of described user, described draft comprises critical data table and rough draft contents table, described critical data table comprises major key, entry name, user encryption ID, user name, last edit session, editor's reason, 7 fields of rough draft state; Described rough draft contents table comprises major key and 2 fields of rough draft text.
Described database server is carried out this insertion order, and the draft of creating this entry name of described user further comprises:
With described entry name and user encryption ID as the unique index of this draft and be kept at described database server.
Describedly described rough draft be updated to this draft further comprise:
Described entry central server makes up update command and sends this update command to described database server according to described rough draft text;
Described data server upgrades the edit session of critical data table in the described draft and the rough draft text of rough draft contents table according to this update command.
The present invention also provides a kind of entry dissemination method based on draft, comprises that the user carries out entry issue operation, and this method also comprises judges whether this user has existed the draft of this entry; If there is no then create draft, described rough draft is saved to this draft; If exist then described rough draft be updated to this draft; Also comprise:
Judge that whether issue is successful, if issue successfully, then deletes described rough draft; If the issue failure then keeps described draft.
Whether success further comprises in described judgement issue:
Described entry central server returns the issue result to described front-end server, and described front-end server judges according to this issue result whether issue is successful;
The described draft of described deletion further comprises:
Described front-end server sends removal request to described entry central server;
Described entry central server sends delete command to described database server;
Described database server is according to described delete command deletion draft.
Described database server is that described rough draft state is carried out the mode bit change according to described delete command deletion draft.
The present invention also provides a kind of new term creation method based on draft, comprises that the user creates the operation of new term, and is further comprising the steps of:
Judge whether this user has existed the draft of this entry;
Work as existence, then the rough draft text in this draft is loaded into the article editing device;
When not existing, then directly start blank article editing device.
This creation method further comprises in the described editing process, according to instructing manually or automatically current rough draft is updated to described draft.
This creation method further comprises described dissemination method.
The present invention also provides a kind of existing article editing method based on draft, comprises that the user edits the operation of existing entry, and is further comprising the steps of:
Judge whether this user has existed the draft of this entry;
If there is no, then start the article editing device of this existing entry;
If exist, then point out this user whether to abandon this draft, if this user selects not abandon then starts the contrast edit page,, this user starts the article editing device of this existing entry if selecting to abandon.
This edit methods further comprises in the described editing process, according to instructing manually or automatically current rough draft is updated to described draft.
This edit methods further comprises above-mentioned dissemination method.
Correspondingly, the present invention also provides a kind of article editing draft system, comprising:
Front-end server sends to the entry central server for the request that will comprise the entry data, and described entry data comprise entry name, user encryption ID, editor's reason and rough draft text, and described request is in response to user's operation;
The entry central server is used for encapsulating described entry data and sending to database server according to described request.
Database server is used for according to packaged entry data query, establishment, renewal or deletion draft; Described draft comprises critical data table and draft contents table; Described critical data table comprises major key, entry name, user encryption ID, user name, last edit session, editor's reason, 7 fields of rough draft state; Described draft contents table comprises major key and 2 fields of rough draft text.
Beneficial effect of the present invention is: by a kind of method and system that backs up entry data and article editing text in the process of article editing is provided, can in time back up user's content edited that works laboriously in burst reason or when failure issue, thereby improve user's experience.
Embodiment
With reference to the accompanying drawings and by embodiments of the invention, technical scheme of the present invention is described in detail.
The invention provides a kind of article editing backup method based on draft, method flow diagram as shown in Figure 1, this method may further comprise the steps:
When carrying out article editing, when the user preserved the operation of rough draft to the entry of editing, this method further comprised S30, judges whether this user has existed the draft of this entry, carries out step S31, then carries out step S32;
S31, if there is no then create draft, article editing content (or being called rough draft) is saved in this draft, carry out step S33;
If the S32 existence to this draft, enters step S33 with the article editing content update;
In S33, continuation editor's the process, according to instructing manually or automatically current article editing content update to described draft.
As Fig. 2, article editing of the present invention comprises with the draft system: front-end server, entry central server and database server.
Front-end server is used for disposing the article editing device, and the user operates the action of article editing device and can be handled by this front-end server checking, and this front-end server also sends to the entry central server for the request that will comprise the entry data.The described request that front-end server sends is issued request etc. in response to user's operation such as query requests, entry that whether draft exists.Described entry data comprise the relevant information of entry that the user edits, and such as entry name, user encryption ID, editor's reason and rough draft text, these entry data will be as the field value in the draft tables of data in the database server.
The entry central server is used for making up related command and calling database server in response to the request of front-end server.Particularly, this entry central server is at first verified the entry data that front-end server sends.If the checking result is that data are unreasonable, by name empty as entry, the entry name is oversize, entry is deleted or content of edit contains the word etc. of violating a ban, then can return error message and give front-end server, front-end server obtains this error message and returns to the user who is operating.If described entry data verification is passed through, the request that described entry central server can be sent according to front-end server is thereby that the order in response to this request created in the sql statement with this entry data encapsulation, and this order that will be somebody's turn to do with the performance of sql statement form sends to database server.Calling database server finishes additions and deletions to the draft data and changes and look into operation.
Database server is for inquiry, establishment, renewal or the deletion action finished according to above-mentioned packaged entry data draft.
Wherein, database server is set up the draft tables of data for this entry of this user, comprise the critical data table such as t_wiki_doc_draft and draft contents table such as t_wiki_doc_draft_text.
Described critical data table comprises major key, entry name, user encryption ID, user name, last edit session, editor's reason, 7 fields of rough draft state; Described draft contents table comprises major key and 2 fields of rough draft text.
For example, consisting of of critical data table:
`DRAFT_ID`' major key ID', this major key ID are that the database self-propagation forms, and can further inquire about acquisition by user encryption ID and entry name;
`DOC_TITLE`' entry name ';
`USER_ID_ENCRYPT`' user encryption ID';
The `USER_NICK`' user name ', also can inquire this USER_NICK at database server by user encryption ID;
The last edit session of `LAST_EDIT_TIME`' ';
`DRAFT_EDIT_REASON`' edit reason ';
`DRAFT_STATE`' rough draft state.
Rough draft state value in the critical data table is 0 or 1, and its meaning will be illustrated below.
For example, the draft contents table is composed as follows:
`DRAFT_ID`' major key ID';
`DOC_TEXT`' rough draft text '.
The idiographic flow of backup method of the present invention is as follows:
The user enters into the article editing device that is deployed on the front-end server, and this article editing device comprises preservation, issues, is saved in three buttons of draft.
Step S301, user at first can send a request of preserving rough draft by the forward end server by the article editing device, and front-end server receives this request, and this request comprises entry name, user encryption ID, editor's reason and these four parameters of rough draft text.
Step S302, front-end server obtain above-mentioned each parameter, and send the query requests that comprises above-mentioned each parameter to the entry central server.
Step S303, entry central server encapsulate described entry name and thereby user encryption ID makes up the querying command whether draft exists, and send this querying command to database server.Be the form of sql statement such as this querying command: the interactive encyclopaedia of SELECT*FROM t_wiki_doc_draft where DOC_TITLE=' ' and USER_ID_ENCRYPT='GdwFRBHZmXW9da0V8'.
By the result of top querying command, the value of the major key field DRAFT_ID that can also find is such as equaling 1.
Step S304, database server return to the entry central server with Query Result, and this Query Result comprises the information that whether has draft, comprise further also that when having draft the major key field value is 1 such as DRAFT_ID.
Step S305, entry central server judge whether there is draft according to this Query Result.
If Query Result is non-existent words, execution in step S311, entry central server make up according to described entry name, user encryption ID, editor's reason and rough draft text and insert order and send to database server.Step S312, database server receive and also carry out this insertions order, create this entry under one's name corresponding to described user's draft.
Among the step S311 for example the insertion sql statement to critical data literary name segment value be: INSERT INTO t_wiki_doc_draft (DOC_TITLE, USER_ID_ENCRYPT, USER_NICK, LAST_EDIT_TIME, DRAFT_EDIT_REASON, DRAFT_STATE) VALUES (' interactive encyclopaedia ', ' GdwFRBHZmXW9da0V8', ' Tian Tian ', " 2012/12/2810:57:28 ", ' improve content ', 1).
Wherein can inquire user name USER_NICK by user encryption ID from customer data base, LAST_EDIT_TIME is the current time that acquiescence is given.Database server obtains major key DRAFT_ID such as being 1 from increasing.
Further to the insertion sql statement of rough draft contents table field value: INSERT INTO t_wiki_doc_draft_text (DRAFT_ID, DOC_TEXT) values (' 1 ', ' draft content ').
Step S312 further comprises the unique index that utilizes described user encryption ID and described entry name to set up this draft and preserves that so new draft record occurs.The purpose of setting up unique index is in order to improve the efficient of data base querying, to guarantee the uniqueness of data-base recording simultaneously, and namely draft record can only by user encryption ID and the entry name is unique be determined.
If Query Result is to have had draft, the user can further inquire about the draft content, such as the sql statement that makes up and send following form by the entry central server: thus SELECT*FROM t_wiki_doc_draft_text where DRAFT_ID=1 inquires the rough draft text; Also can execution in step S321, the entry central server makes up and sends according to described rough draft text and upgrade ordering to database server of draft and such as the sql statement that upgrades critical data table and rough draft contents table be respectively: the up-to-date time of update t_wiki_doc_draft set LAST_EDIT_TIME=' ', DRAFT_EDIT_REASON=' edits reason ', the interactive encyclopaedia of DRAFT_STATE=1where DOC_TITLE=' ' and USER_ID_ENCRYPT=' GdwFRBHZmXW9da0V8 '; Update t_wiki_doc_draft_text set DOC_TEXT=' rough draft content ' where DRAFT_ID=1 can inquire the DRAFT_ID value according to described user encryption ID and/or entry name.
S322, database server are updated to up-to-date draft according to above-mentioned update command with this entry of this user's correspondence.Here the field of Geng Xining is rough draft text in the rough draft contents table and the last edit session field in the critical data table.Such renewal draft mode is to cover preserving type, no longer preserves the entry version, so always deposits up-to-date article editing content in the draft as the rough draft text, has avoided the defective of version redundancy.
Step S330, the database server result that will handle then, namely which entry of which user is updated or creates and returns to the entry central server, and then by the entry central server result of database server processes is fed back to front-end server.Front-end server informs the result of the success of the processing under this flow process or failure to the user.
Below namely finished the operation of a draft.Wherein, front-end server is by RMI(Remote Method Invocation, i.e. remote method invocation (RMI)) form visit entry central server.
In step S33, when the user when article editing device relaying is sequeled volume described entry, the user manually preserves or sends the instruction of preserving rough draft automatically such as 5 minutes article editing devices at set intervals, then with current article editing content update to the draft to this entry that should the user.
Process flow diagram as shown in Figure 3, the present invention also provides a kind of entry dissemination method based on draft, the user clicks the issue button and carries out entry issue operation, the execution in step S30-of system step S32, namely whether this user has existed the draft of this entry and whether has had the step of creating or upgrading draft according to draft.Afterwards, execution S34, front-end server send the issue request of this entry to the entry central server, described entry central server returns the issue result to described front-end server, described front-end server judges according to this issue result whether issue is successful, if issue successfully, then carry out step S35, delete described rough draft; If issue failure (reason may contain the word etc. of violating a ban in the article editing content) is then carried out step S36 and is kept described draft.
Wherein step S35 further comprises: S351, described front-end server send removal request to described entry central server, and this removal request comprises the entry name of this user's user encryption ID He the entry of editing;
S352, described entry central server make up delete command and send this delete command to described database server.Represent with the sql statement form such as this delete command: update t_wiki_doc_draft set DRAFT_STATE=0where draft_ID=? wherein question mark "? " value be the major key ID value that inquires according to described user encryption ID and entry name.
S353, described database server are according to described delete command deletion draft.
Deletion action about draft, the present invention has designed this field of rough draft state as mode bit in the critical data table of draft, when this field value is 0, show this draft be invalid be deleted state, the user is hidden, when being 1, this field value shows that this draft is that effectively the user can see draft.Therefore, the deletion of the draft among the present invention is just to the change of its mode bit, rather than truly directly with this record deletion.Therefore be in particular in the sql statement of delete command, then only update mode bit field DRAFT_STATE to make its value be 0 to get final product.
The purpose that designs this field in the draft tables of data is that each user and each entry have and have only the record of a draft, when each user preserves rough draft, just preserve this user's a up-to-date draft content.
In step S36, front-end server can not send the request of the draft of this this entry of user of deletion again to the entry central server, has namely preserved the up-to-date rough draft text of this entry in the draft of this moment.The entry that can not cause user Hua Liao to edit for a long time like this disappears because of unexpected, has avoided the user is edited the injury of enthusiasm.
Except when entry is issued successfully, carry out outside the above-mentioned deletion action, the user also can carry out this deletion action when entering its draft tabulation.
Preferred embodiment one
Fig. 4 is based on the process flow diagram of the new term creation method of draft; When the user created new term, through user rs authentication, after Authority Verification etc. passed through, the user just can enter in the article editing device, and in the process that enters the article editing device, execution in step S30 judges whether this user has existed the draft of this new term; Step S10 then directly is loaded into the rough draft text in this draft in the article editing device when the draft that has this new term; S11, when the article editing device that does not have the blank that then directly starts this new term.
The user can continue step S33 in execution graph 1 backup method and the dissemination method of Fig. 3 then.
Preferred embodiment two
Fig. 5 is based on the process flow diagram of the existing article editing method of draft, and when the user clicked the existing entry of editor, through user rs authentication, after Authority Verification etc. passed through, execution in step S30 judged whether this user has existed the draft of this entry.S20, if there is no then starts the article editing device of this existing entry; If S21 exists, then point out this user whether to abandon this draft, if this user selects not abandon then starts the contrast edit page, if this user selects to abandon then execution in step S20.The contrast edit page is that the rough draft text with released version and this draft compares.
The user can continue step S33 in execution graph 1 backup method and the dissemination method of Fig. 3 then.
Preferred embodiment three
Withdraw under the situation of article editing device meet accident (reason may have network disconnection, the overdue browser of closing), at first withdraw from again behind the execution in step S30-S32.
Should be appreciated that the above detailed description of technical scheme of the present invention being carried out by preferred embodiment is illustrative and not restrictive.Those of ordinary skill in the art is reading on the basis of instructions of the present invention and can make amendment to the technical scheme that each embodiment puts down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the spirit and scope of various embodiments of the present invention technical scheme.Protection scope of the present invention is only limited by the claims of enclosing.