Example #1
0
	}).Filters(filters.NewRequireLoginFilter(), filters.NewAjaxFilter()).

	/**
	 * 查看用户信息页
	 */
	Get("show", func(ctx *goku.HttpContext) goku.ActionResulter {

		userId, _ := strconv.ParseInt(ctx.RouteData.Params["id"], 10, 64)
		user := models.User_GetById(userId)

		if user == nil {
			ctx.ViewData["errorMsg"] = "用户不存在"
			return ctx.Render("error", nil)
		}

		links := models.Link_ByUser(user.Id, 1, golink.PAGE_SIZE)
		friends, _ := models.UserFollow_Friends(user.Id, 1, 12)
		followers, _ := models.UserFollow_Followers(user.Id, 1, 12)
		followTopics, _ := models.User_GetFollowTopics(user.Id, 1, 12)

		ctx.ViewData["Links"] = models.Link_ToVLink(links, ctx)
		ctx.ViewData["Friends"] = friends
		ctx.ViewData["Followers"] = followers
		ctx.ViewData["FollowTopics"] = followTopics
		ctx.ViewData["HasMoreLink"] = len(links) >= golink.PAGE_SIZE
		return ctx.View(models.User_ToVUser(user, ctx))

	}).Filters(filters.NewRequireLoginFilter()).

	/**
	 * 获取用户信息
Example #2
0
	}).Filters(filters.NewRequireLoginFilter(), filters.NewAjaxFilter()).

	/**
	 * 查看用户信息页
	 */
	Get("show", func(ctx *goku.HttpContext) goku.ActionResulter {

		userId, _ := strconv.ParseInt(ctx.RouteData.Params["id"], 10, 64)
		user := models.User_GetById(userId)

		if user == nil {
			ctx.ViewData["errorMsg"] = "用户不存在"
			return ctx.Render("error", nil)
		}

		links := models.Link_ByUser(user.Id, 1, golink.PAGE_SIZE)
		friends, _ := models.UserFollow_Friends(user.Id, 1, 12)
		followers, _ := models.UserFollow_Followers(user.Id, 1, 12)
		followTopics, _ := models.User_GetFollowTopics(user.Id, 1, 12)

		ctx.ViewData["Links"] = models.Link_ToVLink(links, ctx)
		ctx.ViewData["Friends"] = friends
		ctx.ViewData["Followers"] = followers
		ctx.ViewData["FollowTopics"] = followTopics
		ctx.ViewData["HasMoreLink"] = len(links) >= golink.PAGE_SIZE
		return ctx.View(models.User_ToVUser(user, ctx))

	}).Filters(filters.NewRequireLoginFilter()).

	/**
	 * 查看用户设置页