本文整理汇总了Golang中github.com/QLeelulu/goku.HttpContext.NotFound方法的典型用法代码示例。如果您正苦于以下问题:Golang HttpContext.NotFound方法的具体用法?Golang HttpContext.NotFound怎么用?Golang HttpContext.NotFound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/QLeelulu/goku.HttpContext
的用法示例。
在下文中一共展示了HttpContext.NotFound方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: OnActionExecuting
func (f *ThirdPartyBindFilter) OnActionExecuting(ctx *goku.HttpContext) (ar goku.ActionResulter, err error) {
sessionIdBase, err := ctx.Request.Cookie(config.ThirdPartyCookieKey)
if err != nil || len(sessionIdBase.Value) == 0 {
ar = ctx.NotFound("no user binding context found.")
return
}
ctx.Data["thirdPartySessionIdBase"] = sessionIdBase.Value
profileSessionId := models.ThirdParty_GetThirdPartyProfileSessionId(sessionIdBase.Value)
profile := models.ThirdParty_GetThirdPartyProfileFromSession(profileSessionId)
if profile == nil {
ar = ctx.NotFound("no user binding context found.")
return
}
ctx.ViewData["profile"] = profile
if len(profile.Email) > 0 {
sensitiveInfoRemovedEmail := utils.GetSensitiveInfoRemovedEmail(profile.Email)
ctx.ViewData["directCreateEmail"] = sensitiveInfoRemovedEmail
}
var profileShow struct {
Avatar bool
Link bool
Name string
}
profileShow.Avatar = (len(profile.AvatarUrl) > 0)
profileShow.Link = (len(profile.Link) > 0)
profileShow.Name = profile.GetDisplayName()
ctx.ViewData["profileShow"] = profileShow
return
}
示例2: userRecoverPreProcess
func userRecoverPreProcess(ctx *goku.HttpContext) (user *models.User, ur *models.UserRecovery, r goku.ActionResulter) {
queryStrings := ctx.Request.URL.Query()
token := queryStrings.Get("token")
userId, _ := strconv.ParseInt(ctx.RouteData.Params["id"], 10, 64)
ctx.ViewData["recoverPwdToken"] = token
if ur = models.User_GetActiveRecoveryRequest(userId, token); ur == nil {
r = ctx.NotFound("invalid token")
return
}
user = models.User_GetById(userId)
if user == nil {
ur = nil
r = ctx.NotFound("user not found")
}
return
}