當前位置: 首頁>>代碼示例>>Golang>>正文


Golang HttpContext.NotFound方法代碼示例

本文整理匯總了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
}
開發者ID:cloudcache,項目名稱:ohlala,代碼行數:35,代碼來源:third_party_bind.go

示例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
}
開發者ID:yonglehou,項目名稱:ohlala,代碼行數:19,代碼來源:user_reg_login.go


注:本文中的github.com/QLeelulu/goku.HttpContext.NotFound方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。