本文整理汇总了Golang中github.com/QLeelulu/goku.HttpContext.RenderPartial方法的典型用法代码示例。如果您正苦于以下问题:Golang HttpContext.RenderPartial方法的具体用法?Golang HttpContext.RenderPartial怎么用?Golang HttpContext.RenderPartial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/QLeelulu/goku.HttpContext
的用法示例。
在下文中一共展示了HttpContext.RenderPartial方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: discover_loadMoreLink
// 加载更多link
func discover_loadMoreLink(ctx *goku.HttpContext) goku.ActionResulter {
page, err := strconv.Atoi(ctx.Get("page"))
success, hasmore := false, false
errorMsgs, html := "", ""
if err == nil && page > 1 {
ot := ctx.Get("o")
if ot == "" {
ot = "hot"
}
dt, _ := strconv.Atoi(ctx.Get("dt"))
links, _ := models.LinkForHome_GetByPage(ot, dt, page, golink.PAGE_SIZE)
if links != nil && len(links) > 0 {
ctx.ViewData["Links"] = models.Link_ToVLink(links, ctx)
vr := ctx.RenderPartial("loadmorelink", nil)
vr.Render(ctx, vr.Body)
html = vr.Body.String()
hasmore = len(links) >= golink.PAGE_SIZE
}
success = true
} else {
errorMsgs = "参数错误"
}
r := map[string]interface{}{
"success": success,
"errors": errorMsgs,
"html": html,
"hasmore": hasmore,
}
return ctx.Json(r)
}
示例2: favorite_loadMoreLink
func favorite_loadMoreLink(ctx *goku.HttpContext) goku.ActionResulter {
page, err := strconv.Atoi(ctx.Get("page"))
success, hasmore := false, false
errorMsgs, html := "", ""
if err == nil && page > 1 {
user := ctx.Data["user"].(*models.User)
links := models.FavoriteLink_ByUser(user.Id, page, golink.PAGE_SIZE)
if links != nil && len(links) > 0 {
ctx.ViewData["Links"] = models.Link_ToVLink(links, ctx)
vr := ctx.RenderPartial("loadmorelink", nil)
vr.Render(ctx, vr.Body)
html = vr.Body.String()
hasmore = len(links) >= golink.PAGE_SIZE
}
success = true
} else {
errorMsgs = "参数错误"
}
r := map[string]interface{}{
"success": success,
"errors": errorMsgs,
"html": html,
"hasmore": hasmore,
}
return ctx.Json(r)
}
示例3: link_search_loadMore
// 加载更多的搜索link
func link_search_loadMore(ctx *goku.HttpContext) goku.ActionResulter {
term, _ := url.QueryUnescape(ctx.Get("term"))
page, err := strconv.Atoi(ctx.Get("page"))
success, hasmore := false, false
errorMsgs, html := "", ""
if err == nil && page > 1 {
ls := utils.LinkSearch{}
searchResult, err := ls.SearchLink(term, page, golink.PAGE_SIZE)
if err == nil && searchResult.TimedOut == false && searchResult.HitResult.HitArray != nil {
if len(searchResult.HitResult.HitArray) > 0 {
links, _ := models.Link_GetByIdList(searchResult.HitResult.HitArray)
if links != nil && len(links) > 0 {
ctx.ViewData["Links"] = models.Link_ToVLink(links, ctx)
vr := ctx.RenderPartial("loadmorelink", nil)
vr.Render(ctx, vr.Body)
html = vr.Body.String()
hasmore = len(links) >= golink.PAGE_SIZE
}
}
success = true
}
} else {
errorMsgs = "参数错误"
}
r := map[string]interface{}{
"success": success,
"errors": errorMsgs,
"html": html,
"hasmore": hasmore,
}
return ctx.Json(r)
}
示例4: actionPopupBoxInfo
/**
* 获取用户信息
* 用于浮动层
*/
func actionPopupBoxInfo(ctx *goku.HttpContext) goku.ActionResulter {
topicName := ctx.Get("t")
topic, _ := models.Topic_GetByName(topicName)
if topic != nil {
return ctx.RenderPartial("pop-info", models.Topic_ToVTopic(topic, ctx))
}
return ctx.Html("")
}