Ejemplo n.º 1
0
// 查看粉丝
func user_Fans(ctx *goku.HttpContext) goku.ActionResulter {

	userId, _ := strconv.ParseInt(ctx.RouteData.Params["id"], 10, 64)
	var user *models.User
	if userId > 0 {
		user = models.User_GetById(userId)
	} else {
		if u, ok := ctx.Data["user"]; ok {
			user = u.(*models.User)
			ctx.ViewData["UserMenu"] = "um-fans"
		}
	}

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

	page, pagesize := utils.PagerParams(ctx.Request)
	followers, _ := models.UserFollow_Followers(user.Id, page, pagesize)

	ctx.ViewData["Followers"] = models.User_ToVUsers(followers, ctx)
	ctx.ViewData["HasMoreFollowers"] = len(followers) >= pagesize
	return ctx.View(models.User_ToVUser(user, ctx))

}
Ejemplo n.º 2
0
		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()).

	/**
	 * 获取用户信息
	 * 用于浮动层
	 */
	Get("pbox-info", func(ctx *goku.HttpContext) goku.ActionResulter {

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

		if user != nil {
			return ctx.RenderPartial("pop-info", models.User_ToVUser(user, ctx))
		}
Ejemplo n.º 3
0
		ctx.ViewData["getpwdErrors"] = errorMsgs
		ctx.ViewData["getpwdValues"] = f.Values()
		ctx.ViewData["key"] = f.Values()["key"]
		return ctx.Render("getpwd", nil)
	}).
	/**
	 * 重置密码
	 */
	Get("recover", func(ctx *goku.HttpContext) goku.ActionResulter {
		user, _, r := userRecoverPreProcess(ctx)
		if r != nil {
			return r
		}

		return ctx.View(models.User_ToVUser(user, ctx))
	}).
	Post("recover", func(ctx *goku.HttpContext) goku.ActionResulter {
		user, ur, r := userRecoverPreProcess(ctx)
		if r != nil {
			return r
		}

		f := createResetPasswordForm()
		f.FillByRequest(ctx.Request)

		errorMsgs := make([]string, 0)
		if f.Valid() {
			m := f.CleanValues()
			if m["new-pwd"] == m["new-pwd2"] {
				saveMap := map[string]interface{}{"pwd": utils.PasswordHash(m["new-pwd"].(string))}