本文整理匯總了Golang中admin/app/models.User.Email方法的典型用法代碼示例。如果您正苦於以下問題:Golang User.Email方法的具體用法?Golang User.Email怎麽用?Golang User.Email使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類admin/app/models.User
的用法示例。
在下文中一共展示了User.Email方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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
}
//.........這裏部分代碼省略.........
示例2: 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"
//.........這裏部分代碼省略.........