本文整理匯總了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
}