当前位置: 首页>>代码示例>>Golang>>正文


Golang models.User类代码示例

本文整理汇总了Golang中github.com/blackmady/NoneCMS/app/models.User的典型用法代码示例。如果您正苦于以下问题:Golang User类的具体用法?Golang User怎么用?Golang User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了User类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Move

//移动
func (c *User) Move(user *models.User) revel.Result {

	var groupid string = c.Params.Get("groupid")
	var ids string = c.Params.Get("ids")

	data := make(map[string]string)

	if len(ids) <= 0 {
		data["status"] = "0"
		data["message"] = "请至少选择一个!"
		return c.RenderJson(data)
	}

	if len(groupid) <= 0 {
		data["status"] = "0"
		data["message"] = "请选择会员组!"
		return c.RenderJson(data)
	}

	Groupid, err := strconv.ParseInt(groupid, 10, 64)
	if err != nil {
		revel.WARN.Println(err)
	}

	if user.Move(Groupid, ids) {
		data["status"] = "1"
		data["message"] = "移动成功!"
		return c.RenderJson(data)
	} else {
		data["status"] = "0"
		data["message"] = "移动失败!"
		return c.RenderJson(data)
	}
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:35,代码来源:user.go

示例2: UserInfo

//个人信息
func (c *User) UserInfo(user *models.User) revel.Result {
	title := "个人信息--GoCMS管理系统"

	var id string = c.Params.Get("id")

	if len(id) > 0 {
		Id, err := strconv.ParseInt(id, 10, 64)
		if err != nil {
			revel.WARN.Println(err)
		}

		//内容
		user_info := user.GetById(Id)

		c.Render(title, id, user_info)
	} else {
		c.Render(title, id)
	}
	return c.RenderTemplate("User/Manage/UserInfo.html")
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:21,代码来源:user.go

示例3: Index

//首页
func (c *User) Index(user *models.User) revel.Result {
	title := "会员首页--GoCMS管理系统"

	var page string = c.Params.Get("page")
	var search string = c.Params.Get("search")

	var Page int64 = 1

	if len(page) > 0 {
		Page, _ = strconv.ParseInt(page, 10, 64)
	}

	user_list, pages, where := user.GetUserList(search, Page, 10)

	//会员组
	user_group := new(models.User_Group)
	group_list := user_group.GetGroupList()

	c.Render(title, user_list, group_list, pages, where)
	return c.RenderTemplate("User/Manage/Index.html")
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:22,代码来源:user.go

示例4: Unlock

//解锁
func (c *User) Unlock(user *models.User) revel.Result {

	var ids string = c.Params.Get("ids")

	data := make(map[string]string)

	if len(ids) <= 0 {
		data["status"] = "0"
		data["message"] = "请至少选择一个!"
		return c.RenderJson(data)
	}

	if user.Unlock(ids) {
		data["status"] = "1"
		data["message"] = "解锁成功!"
		return c.RenderJson(data)
	} else {
		data["status"] = "0"
		data["message"] = "解锁失败!"
		return c.RenderJson(data)
	}
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:23,代码来源:user.go

示例5: Add

//添加会员
func (c *User) Add(user *models.User) revel.Result {

	if c.Request.Method == "GET" {

		title := "添加会员--GoCMS管理系统"

		//会员组
		user_group := new(models.User_Group)
		group_list := user_group.GetGroupList()

		c.Render(title, group_list)
		return c.RenderTemplate("User/Manage/Add.html")
	} else {

		data := make(map[string]string)

		var username string = c.Params.Get("username")
		if len(username) <= 0 {
			data["status"] = "0"
			data["message"] = "请输入用户名!"
			return c.RenderJson(data)
		} else {
			user.Username = username
		}

		if user.HasName() {
			data["status"] = "0"
			data["message"] = "用户名‘" + username + "’已有!"
			return c.RenderJson(data)
		}

		var email string = c.Params.Get("email")
		if len(email) <= 0 {
			data["status"] = "0"
			data["message"] = "请输入邮箱!"
			return c.RenderJson(data)
		} else {
			user.Email = email
		}

		if user.HasEmail() {
			data["status"] = "0"
			data["message"] = "邮箱‘" + email + "’已有!"
			return c.RenderJson(data)
		}

		var password string = c.Params.Get("password")
		if len(password) <= 0 {
			data["status"] = "0"
			data["message"] = "请输入密码!"
			return c.RenderJson(data)
		}

		var pwdconfirm string = c.Params.Get("pwdconfirm")
		if len(pwdconfirm) <= 0 {
			data["status"] = "0"
			data["message"] = "请输入确认密码!"
			return c.RenderJson(data)
		} else {
			if password != pwdconfirm {
				data["status"] = "0"
				data["message"] = "两次输入密码不一致!"
				return c.RenderJson(data)
			} else {
				user.Password = password
			}
		}

		var nickname string = c.Params.Get("nickname")
		if len(nickname) <= 0 {
			data["status"] = "0"
			data["message"] = "请输入昵称!"
			return c.RenderJson(data)
		} else {
			user.Nickname = nickname
		}

		var mobile string = c.Params.Get("mobile")
		if len(mobile) <= 0 {
			data["status"] = "0"
			data["message"] = "请输入手机号码!"
			return c.RenderJson(data)
		} else {
			user.Mobile = mobile
		}

		var groupid string = c.Params.Get("groupid")
		if len(groupid) <= 0 {
			data["status"] = "0"
			data["message"] = "请选择会员组!"
			return c.RenderJson(data)
		} else {
			Groupid, err := strconv.ParseInt(groupid, 10, 64)
			if err != nil {
				revel.WARN.Println(err)
			}

			user.Groupid = Groupid
		}
//.........这里部分代码省略.........
开发者ID:blackmady,项目名称:GoCMS,代码行数:101,代码来源:user.go

示例6: Edit

//编辑会员
func (c *User) Edit(user *models.User) revel.Result {

	if c.Request.Method == "GET" {

		title := "编辑会员--GoCMS管理系统"

		var id string = c.Params.Get("id")

		if len(id) > 0 {
			Id, err := strconv.ParseInt(id, 10, 64)
			if err != nil {
				revel.WARN.Println(err)
			}

			//内容
			user_info := user.GetById(Id)

			//会员组
			user_group := new(models.User_Group)
			group_list := user_group.GetGroupList()

			c.Render(title, id, group_list, user_info)
		} else {
			c.Render(title, id)
		}

		return c.RenderTemplate("User/Manage/Edit.html")
	} else {
		data := make(map[string]string)

		var id string = c.Params.Get("id")
		if len(id) <= 0 {
			data["status"] = "0"
			data["message"] = "参数错误,编辑失败!"
			return c.RenderJson(data)
		}

		Id, err := strconv.ParseInt(id, 10, 64)
		if err != nil {
			revel.WARN.Println(err)
		}

		var email string = c.Params.Get("email")
		if len(email) <= 0 {
			data["status"] = "0"
			data["message"] = "请输入邮箱!"
			return c.RenderJson(data)
		} else {
			user.Email = email
		}

		var password string = c.Params.Get("password")

		var pwdconfirm string = c.Params.Get("pwdconfirm")
		if len(pwdconfirm) > 0 {
			if password != pwdconfirm {
				data["status"] = "0"
				data["message"] = "两次输入密码不一致!"
				return c.RenderJson(data)
			} else {
				user.Password = password
			}
		}

		var nickname string = c.Params.Get("nickname")
		if len(nickname) <= 0 {
			data["status"] = "0"
			data["message"] = "请输入昵称!"
			return c.RenderJson(data)
		} else {
			user.Nickname = nickname
		}

		var mobile string = c.Params.Get("mobile")
		if len(mobile) <= 0 {
			data["status"] = "0"
			data["message"] = "请输入手机号码!"
			return c.RenderJson(data)
		} else {
			user.Mobile = mobile
		}

		var groupid string = c.Params.Get("groupid")
		if len(groupid) <= 0 {
			data["status"] = "0"
			data["message"] = "请选择会员组!"
			return c.RenderJson(data)
		} else {
			Groupid, err := strconv.ParseInt(groupid, 10, 64)
			if err != nil {
				revel.WARN.Println(err)
			}

			user.Groupid = Groupid
		}

		var islock string = c.Params.Get("islock")
		if len(islock) <= 0 {
			data["status"] = "0"
//.........这里部分代码省略.........
开发者ID:blackmady,项目名称:GoCMS,代码行数:101,代码来源:user.go


注:本文中的github.com/blackmady/NoneCMS/app/models.User类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。