Failed to generate name for field. Make sure the field name is valid #201
This commit is contained in:
@ -162,27 +162,8 @@ func (c Note) GetNoteContent(noteId string) revel.Result {
|
|||||||
return c.RenderJson(noteContent)
|
return c.RenderJson(noteContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新note或content
|
|
||||||
// 肯定会传userId(谁的), NoteId
|
|
||||||
// 会传Title, Content, Tags, 一种或几种
|
|
||||||
type NoteOrContent struct {
|
|
||||||
NotebookId string
|
|
||||||
NoteId string
|
|
||||||
UserId string
|
|
||||||
Title string
|
|
||||||
Desc string
|
|
||||||
ImgSrc string
|
|
||||||
Tags string
|
|
||||||
Content string
|
|
||||||
Abstract string
|
|
||||||
IsNew bool
|
|
||||||
IsMarkdown bool
|
|
||||||
FromUserId string // 为共享而新建
|
|
||||||
IsBlog bool // 是否是blog, 更新note不需要修改, 添加note时才有可能用到, 此时需要判断notebook是否设为Blog
|
|
||||||
}
|
|
||||||
|
|
||||||
// 这里不能用json, 要用post
|
// 这里不能用json, 要用post
|
||||||
func (c Note) UpdateNoteOrContent(noteOrContent NoteOrContent) revel.Result {
|
func (c Note) UpdateNoteOrContent(noteOrContent info.NoteOrContent) revel.Result {
|
||||||
// 新添加note
|
// 新添加note
|
||||||
if noteOrContent.IsNew {
|
if noteOrContent.IsNew {
|
||||||
userId := c.GetObjectUserId()
|
userId := c.GetObjectUserId()
|
||||||
|
@ -54,9 +54,9 @@ func (c Notebook) UpdateNotebookTitle(notebookId, title string) revel.Result {
|
|||||||
|
|
||||||
// 排序
|
// 排序
|
||||||
// 无用
|
// 无用
|
||||||
func (c Notebook) SortNotebooks(notebookId2Seqs map[string]int) revel.Result {
|
// func (c Notebook) SortNotebooks(notebookId2Seqs map[string]int) revel.Result {
|
||||||
return c.RenderJson(notebookService.SortNotebooks(c.GetUserId(), notebookId2Seqs))
|
// return c.RenderJson(notebookService.SortNotebooks(c.GetUserId(), notebookId2Seqs))
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 调整notebooks, 可能是排序, 可能是移动到其它笔记本下
|
// 调整notebooks, 可能是排序, 可能是移动到其它笔记本下
|
||||||
type DragNotebooksInfo struct {
|
type DragNotebooksInfo struct {
|
||||||
|
@ -80,3 +80,24 @@ type NoteContentHistory struct {
|
|||||||
UserId bson.ObjectId `bson:"UserId"` // 所属者
|
UserId bson.ObjectId `bson:"UserId"` // 所属者
|
||||||
Histories []EachHistory `Histories`
|
Histories []EachHistory `Histories`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 为了NoteController接收参数
|
||||||
|
|
||||||
|
// 更新note或content
|
||||||
|
// 肯定会传userId(谁的), NoteId
|
||||||
|
// 会传Title, Content, Tags, 一种或几种
|
||||||
|
type NoteOrContent struct {
|
||||||
|
NotebookId string
|
||||||
|
NoteId string
|
||||||
|
UserId string
|
||||||
|
Title string
|
||||||
|
Desc string
|
||||||
|
ImgSrc string
|
||||||
|
Tags string
|
||||||
|
Content string
|
||||||
|
Abstract string
|
||||||
|
IsNew bool
|
||||||
|
IsMarkdown bool
|
||||||
|
FromUserId string // 为共享而新建
|
||||||
|
IsBlog bool // 是否是blog, 更新note不需要修改, 添加note时才有可能用到, 此时需要判断notebook是否设为Blog
|
||||||
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package binder
|
package binder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/leanote/leanote/app/controllers"
|
|
||||||
"github.com/leanote/leanote/app/info"
|
"github.com/leanote/leanote/app/info"
|
||||||
"github.com/revel/revel"
|
"github.com/revel/revel"
|
||||||
// "github.com/leanote/leanote/app/controllers/api"
|
// "github.com/leanote/leanote/app/controllers/api"
|
||||||
@ -65,11 +64,11 @@ var leanoteStructBinder = revel.Binder{
|
|||||||
// name = files[0], files[1], noteContent
|
// name = files[0], files[1], noteContent
|
||||||
// fmt.Println(params.Values)
|
// fmt.Println(params.Values)
|
||||||
/*
|
/*
|
||||||
map[Title:[test1] METHOD:[POST] NotebookId:[54c4f51705fcd14031000002]
|
map[Title:[test1] METHOD:[POST] NotebookId:[54c4f51705fcd14031000002]
|
||||||
files[1][FileId]:[]
|
files[1][FileId]:[]
|
||||||
controller:[note]
|
controller:[note]
|
||||||
files[1][LocalFileId]:[54c7ae27d98d0329dd000000] files[1][HasBody]:[true] files[0][FileId]:[] files[0][LocalFileId]:[54c7ae855e94ea2dba000000] action:[addNote] Content:[<p>lifedddddd</p><p><img src="app://leanote/data/54bdc65599c37b0da9000002/images/1422368307147_2.png" alt="" data-mce-src="app://leanote/data/54bdc65599c37b0da9000002/images/1422368307147_2.png" style="display: block; margin-left: auto; margin-right: auto;"></p><p><img src="http://127.0.0.1:8008/api/file/getImage?fileId=54c7ae27d98d0329dd000000" alt="" data-mce-src="http://127.0.0.1:8008/api/file/getImg?fileId=54c7ae27d98d0329dd000000"></p><p><br></p><p><img src="http://127.0.0.1:8008/api/file/getImage?fileId=54c7ae855e94ea2dba000000" alt="" data-mce-src="http://127.0.0.1:8008/api/file/getImage?fileId=54c7ae855e94ea2dba000000" style="display: block; margin-left: auto; margin-right: auto;"></p><p><br></p><p><br></p>] IsBlog:[false] token:[user1]
|
files[1][LocalFileId]:[54c7ae27d98d0329dd000000] files[1][HasBody]:[true] files[0][FileId]:[] files[0][LocalFileId]:[54c7ae855e94ea2dba000000] action:[addNote] Content:[<p>lifedddddd</p><p><img src="app://leanote/data/54bdc65599c37b0da9000002/images/1422368307147_2.png" alt="" data-mce-src="app://leanote/data/54bdc65599c37b0da9000002/images/1422368307147_2.png" style="display: block; margin-left: auto; margin-right: auto;"></p><p><img src="http://127.0.0.1:8008/api/file/getImage?fileId=54c7ae27d98d0329dd000000" alt="" data-mce-src="http://127.0.0.1:8008/api/file/getImg?fileId=54c7ae27d98d0329dd000000"></p><p><br></p><p><img src="http://127.0.0.1:8008/api/file/getImage?fileId=54c7ae855e94ea2dba000000" alt="" data-mce-src="http://127.0.0.1:8008/api/file/getImage?fileId=54c7ae855e94ea2dba000000" style="display: block; margin-left: auto; margin-right: auto;"></p><p><br></p><p><br></p>] IsBlog:[false] token:[user1]
|
||||||
files[0][HasBody]:[true]]
|
files[0][HasBody]:[true]]
|
||||||
*/
|
*/
|
||||||
nameIsSlice := strings.Contains(name, "[")
|
nameIsSlice := strings.Contains(name, "[")
|
||||||
// fmt.Println(params.Values["files[1]"])
|
// fmt.Println(params.Values["files[1]"])
|
||||||
@ -151,7 +150,7 @@ func init() {
|
|||||||
revel.TypeBinders[reflect.TypeOf(info.UserBlogStyle{})] = leanoteStructBinder
|
revel.TypeBinders[reflect.TypeOf(info.UserBlogStyle{})] = leanoteStructBinder
|
||||||
revel.TypeBinders[reflect.TypeOf(info.Notebook{})] = leanoteStructBinder
|
revel.TypeBinders[reflect.TypeOf(info.Notebook{})] = leanoteStructBinder
|
||||||
revel.TypeBinders[reflect.TypeOf(info.UserAccount{})] = leanoteStructBinder
|
revel.TypeBinders[reflect.TypeOf(info.UserAccount{})] = leanoteStructBinder
|
||||||
revel.TypeBinders[reflect.TypeOf(controllers.NoteOrContent{})] = leanoteStructBinder
|
revel.TypeBinders[reflect.TypeOf(info.NoteOrContent{})] = leanoteStructBinder
|
||||||
revel.TypeBinders[reflect.TypeOf(info.ApiNote{})] = leanoteStructBinder
|
revel.TypeBinders[reflect.TypeOf(info.ApiNote{})] = leanoteStructBinder
|
||||||
revel.TypeBinders[reflect.TypeOf(info.NoteFile{})] = leanoteStructBinder
|
revel.TypeBinders[reflect.TypeOf(info.NoteFile{})] = leanoteStructBinder
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user