本文整理匯總了Golang中github.com/fuxiaohei/GoInk.Context.Int方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.Int方法的具體用法?Golang Context.Int怎麽用?Golang Context.Int使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/fuxiaohei/GoInk.Context
的用法示例。
在下文中一共展示了Context.Int方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: AdminArticle
func AdminArticle(context *GoInk.Context) {
articles, pager := model.GetArticleList(context.Int("page"), 10)
context.Layout("admin/admin")
context.Render("admin/articles", map[string]interface{}{
"Title": "文章",
"Articles": articles,
"Pager": pager,
})
}
示例2: AdminPage
func AdminPage(context *GoInk.Context) {
pages, pager := model.GetPageList(context.Int("page"), 10)
context.Layout("admin/admin")
context.Render("admin/pages", map[string]interface{}{
"Title": "頁麵",
"Pages": pages,
"Pager": pager,
})
}
示例3: AdminMessageRead
func AdminMessageRead(context *GoInk.Context) {
id := context.Int("id")
if id < 0 {
Json(context, false).End()
return
}
m := model.GetMessage(id)
if m == nil {
Json(context, false).End()
return
}
model.SaveMessageRead(m)
Json(context, true).End()
}
示例4: AdminFiles
func AdminFiles(context *GoInk.Context) {
if context.Method == "DELETE" {
id := context.Int("id")
model.RemoveFile(id)
Json(context, true).End()
context.Do("attach_delete", id)
return
}
files, pager := model.GetFileList(context.Int("page"), 10)
context.Layout("admin/admin")
context.Render("admin/files", map[string]interface{}{
"Title": "媒體文件",
"Files": files,
"Pager": pager,
})
}
示例5: AdminComments
func AdminComments(context *GoInk.Context) {
if context.Method == "DELETE" {
id := context.Int("id")
cmt := model.GetCommentById(id)
model.RemoveComment(cmt.Cid, id)
Json(context, true).End()
context.Do("comment_delete", id)
return
}
if context.Method == "PUT" {
id := context.Int("id")
cmt2 := model.GetCommentById(id)
cmt2.Status = "approved"
cmt2.GetReader().Active = true
model.SaveComment(cmt2)
Json(context, true).End()
context.Do("comment_change_status", cmt2)
return
}
if context.Method == "POST" {
// get required data
pid := context.Int("pid")
cid := model.GetCommentById(pid).Cid
uid, _ := strconv.Atoi(context.Cookie("token-user"))
user := model.GetUserById(uid)
co := new(model.Comment)
co.Author = user.Nick
co.Email = user.Email
co.Url = user.Url
co.Content = context.String("content")
co.Avatar = utils.Gravatar(co.Email, "50")
co.Pid = pid
co.Ip = context.Ip
co.UserAgent = context.UserAgent
co.IsAdmin = true
model.CreateComment(cid, co)
Json(context, true).Set("comment", co.ToJson()).End()
model.CreateMessage("comment", co)
context.Do("comment_reply", co)
return
}
page := context.IntOr("page", 1)
comments, pager := model.GetCommentList(page, 10)
context.Layout("admin/admin")
context.Render("admin/comments", map[string]interface{}{
"Title": "評論",
"Comments": comments,
"Pager": pager,
})
}