@@ -157,7 +157,7 @@ func (d *Document) GetDocumentMaxSequence(parentId string, spaceId string) (sequ
157157}
158158
159159// delete document by document_id
160- func (d * Document ) DeleteDBAndFile (documentId string , userId string , pageFile string , docType string ) (err error ) {
160+ func (d * Document ) DeleteDBAndFile (documentId string , spaceId string , userId string , pageFile string , docType string ) (err error ) {
161161 db := G .DB ()
162162 tx , err := db .Begin (db .Config )
163163 if err != nil {
@@ -188,12 +188,12 @@ func (d *Document) DeleteDBAndFile(documentId string, userId string, pageFile st
188188 }
189189
190190 // create document log
191- go func (userId , documentId string ) {
192- _ , err := LogDocumentModel .DeleteAction (userId , documentId )
191+ go func (userId , documentId string , spaceId string ) {
192+ _ , err := LogDocumentModel .DeleteAction (userId , documentId , spaceId )
193193 if err != nil {
194194 logs .Error ("delete document add log err=%s" , err .Error ())
195195 }
196- }(userId , documentId )
196+ }(userId , documentId , spaceId )
197197
198198 // delete follow doc
199199 go func (documentId string ) {
@@ -285,7 +285,7 @@ func (d *Document) Insert(documentValue map[string]interface{}) (id int64, err e
285285}
286286
287287// update document by document_id
288- func (d * Document ) Update (documentId string , documentValue map [string ]interface {}, comment string ) (id int64 , err error ) {
288+ func (d * Document ) Update (documentId string , documentValue map [string ]interface {}, comment string , spaceId string ) (id int64 , err error ) {
289289 db := G .DB ()
290290 var rs * mysql.ResultSet
291291 documentValue ["update_time" ] = time .Now ().Unix ()
@@ -299,12 +299,12 @@ func (d *Document) Update(documentId string, documentValue map[string]interface{
299299 id = rs .LastInsertId
300300
301301 // update document log
302- go func (editUserId string , documentId string , comment string ) {
303- _ , err := LogDocumentModel .UpdateAction (editUserId , documentId , comment )
302+ go func (editUserId string , documentId string , comment string , spaceId string ) {
303+ _ , err := LogDocumentModel .UpdateAction (editUserId , documentId , comment , spaceId )
304304 if err != nil {
305305 logs .Error ("update document add log err=%s" , err .Error ())
306306 }
307- }(documentValue ["edit_user_id" ].(string ), documentId , comment )
307+ }(documentValue ["edit_user_id" ].(string ), documentId , comment , spaceId )
308308
309309 // follow document
310310 go func (editUserId string , documentId string ) {
@@ -340,7 +340,8 @@ func (d *Document) MoveSequenceBySpaceIdAndGtSequence(spaceId string, startSeque
340340}
341341
342342// move document
343- func (d * Document ) MoveDBAndFile (documentId string , updateValue map [string ]interface {}, oldPageFile string , newPageFile string , docType string , comment string ) (id int64 , err error ) {
343+ func (d * Document ) MoveDBAndFile (documentId string , spaceId string , updateValue map [string ]interface {},
344+ oldPageFile string , newPageFile string , docType string , comment string ) (id int64 , err error ) {
344345
345346 db := G .DB ()
346347 tx , err := db .Begin (db .Config )
@@ -370,18 +371,18 @@ func (d *Document) MoveDBAndFile(documentId string, updateValue map[string]inter
370371 }
371372
372373 // create document log
373- go func (userId , documentId , comment string ) {
374- _ , err := LogDocumentModel .UpdateAction (updateValue ["edit_user_id" ].(string ), documentId , comment )
374+ go func (userId , documentId , comment string , spaceId string ) {
375+ _ , err := LogDocumentModel .UpdateAction (updateValue ["edit_user_id" ].(string ), documentId , comment , spaceId )
375376 if err != nil {
376377 logs .Error ("update document add log err=%s" , err .Error ())
377378 }
378- }(updateValue ["edit_user_id" ].(string ), documentId , comment )
379+ }(updateValue ["edit_user_id" ].(string ), documentId , comment , spaceId )
379380
380381 return
381382}
382383
383384// update document by document_id
384- func (d * Document ) UpdateDBAndFile (documentId string , document map [string ]string , documentContent string , updateValue map [string ]interface {}, comment string ) (id int64 , err error ) {
385+ func (d * Document ) UpdateDBAndFile (documentId string , spaceId string , document map [string ]string , documentContent string , updateValue map [string ]interface {}, comment string ) (id int64 , err error ) {
385386
386387 // get document page file
387388 _ , oldPageFile , err := DocumentModel .GetParentDocumentsByDocument (document )
@@ -425,14 +426,14 @@ func (d *Document) UpdateDBAndFile(documentId string, document map[string]string
425426 }
426427
427428 // create document log
428- go func () {
429- LogDocumentModel .UpdateAction (updateValue ["edit_user_id" ].(string ), documentId , comment )
430- }()
429+ go func (documentId string , comment string , spaceId string ) {
430+ _ , _ = LogDocumentModel .UpdateAction (updateValue ["edit_user_id" ].(string ), documentId , comment , spaceId )
431+ }(documentId , comment , spaceId )
431432
432433 // create follow doc
433- go func () {
434- FollowModel .CreateAutoFollowDocument (updateValue ["edit_user_id" ].(string ), documentId )
435- }()
434+ go func (documentId string ) {
435+ _ , _ = FollowModel .CreateAutoFollowDocument (updateValue ["edit_user_id" ].(string ), documentId )
436+ }(documentId )
436437
437438 return
438439}
0 commit comments