controller 支持传递时间

This commit is contained in:
lealife
2015-11-28 13:47:59 +08:00
parent 6a1e84da0c
commit d13447e6d0
2 changed files with 30 additions and 16 deletions

View File

@ -3,7 +3,6 @@ package controllers
import (
"github.com/revel/revel"
// "encoding/json"
"fmt"
"github.com/leanote/leanote/app/info"
. "github.com/leanote/leanote/app/lea"
"gopkg.in/mgo.v2/bson"
@ -14,6 +13,7 @@ import (
"time"
// "github.com/leanote/leanote/app/types"
// "io/ioutil"
"fmt"
// "bytes"
// "os"
)
@ -248,7 +248,8 @@ func (c Note) UpdateNoteOrContent(noteOrContent NoteOrContent) revel.Result {
// noteService.UpdateNoteContent(noteOrContent.UserId, c.GetUserId(),
// noteOrContent.NoteId, noteOrContent.Content, noteOrContent.Abstract)
contentOk, contentMsg, afterContentUsn = noteService.UpdateNoteContent(c.GetUserId(),
noteOrContent.NoteId, noteOrContent.Content, noteOrContent.Abstract, needUpdateNote, -1)
noteOrContent.NoteId, noteOrContent.Content, noteOrContent.Abstract,
needUpdateNote, -1, time.Now())
}
Log(afterContentUsn)

View File

@ -85,7 +85,6 @@ func (c ApiNote) GetTrashNotes() revel.Result {
"Title": "asdfadsf--=",
"Desc": "",
"Tags": [
""
],
"Abstract": "",
"Content": "",
@ -95,7 +94,7 @@ func (c ApiNote) GetTrashNotes() revel.Result {
"Usn": 8,
"Files": [
{
"FileId": "551975d599c37b970f000002",
"FileId": "551975d599c37b970f000000",
"LocalFileId": "",
"Type": "",
"Title": "",
@ -103,18 +102,18 @@ func (c ApiNote) GetTrashNotes() revel.Result {
"IsAttach": false
},
{
"FileId": "551975de99c37b970f000003",
"FileId": "551975de99c37b970f000001",
"LocalFileId": "",
"Type": "doc",
"Title": "李铁-简历-ali-print-en.doc",
"Title": "李铁-print-en.doc",
"HasBody": false,
"IsAttach": true
},
{
"FileId": "551975de99c37b970f000004",
"FileId": "551975de99c37b970f000002",
"LocalFileId": "",
"Type": "doc",
"Title": "李铁-简历-ali-print.doc",
"Title": "李铁-print.doc",
"HasBody": false,
"IsAttach": true
}
@ -327,15 +326,20 @@ func (c ApiNote) AddNote(noteOrContent info.ApiNote) revel.Result {
Tags: noteOrContent.Tags,
Desc: noteOrContent.Desc,
// ImgSrc: noteOrContent.ImgSrc,
IsBlog: noteOrContent.IsBlog,
IsMarkdown: noteOrContent.IsMarkdown,
AttachNum: attachNum,
IsBlog: noteOrContent.IsBlog,
IsMarkdown: noteOrContent.IsMarkdown,
AttachNum: attachNum,
CreatedTime: noteOrContent.CreatedTime,
UpdatedTime: noteOrContent.UpdatedTime,
}
noteContent := info.NoteContent{NoteId: note.NoteId,
UserId: userId,
IsBlog: note.IsBlog,
Content: noteOrContent.Content,
Abstract: noteOrContent.Abstract}
UserId: userId,
IsBlog: note.IsBlog,
Content: noteOrContent.Content,
Abstract: noteOrContent.Abstract,
CreatedTime: noteOrContent.CreatedTime,
UpdatedTime: noteOrContent.UpdatedTime,
}
// 通过内容得到Desc, abstract
if noteOrContent.Abstract == "" {
@ -447,6 +451,7 @@ func (c ApiNote) UpdateNote(noteOrContent info.ApiNote) revel.Result {
// Log("after upload")
// LogJ(noteOrContent.Files)
}
// 移到外面来, 删除最后一个file时也要处理, 不然总删不掉
@ -509,6 +514,8 @@ func (c ApiNote) UpdateNote(noteOrContent info.ApiNote) revel.Result {
}
}
noteUpdate["UpdatedTime"] = noteOrContent.UpdatedTime
afterNoteUsn := 0
noteOk := false
noteMsg := ""
@ -532,10 +539,16 @@ func (c ApiNote) UpdateNote(noteOrContent info.ApiNote) revel.Result {
if noteOrContent.Abstract == "" {
noteOrContent.Abstract = SubStringHTML(noteOrContent.Content, 200, "")
}
// Log("--------> afte fixed")
// Log(noteOrContent.Content)
contentOk, contentMsg, afterContentUsn = noteService.UpdateNoteContent(c.getUserId(),
noteOrContent.NoteId, noteOrContent.Content, noteOrContent.Abstract, needUpdateNote, noteOrContent.Usn)
noteOrContent.NoteId,
noteOrContent.Content,
noteOrContent.Abstract,
needUpdateNote,
noteOrContent.Usn,
noteOrContent.UpdatedTime)
}
if needUpdateNote {