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


Golang User.Overduedate方法代碼示例

本文整理匯總了Golang中github.com/blackmady/NoneCMS/app/models.User.Overduedate方法的典型用法代碼示例。如果您正苦於以下問題:Golang User.Overduedate方法的具體用法?Golang User.Overduedate怎麽用?Golang User.Overduedate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/blackmady/NoneCMS/app/models.User的用法示例。


在下文中一共展示了User.Overduedate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Add


//.........這裏部分代碼省略.........
			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"
			data["message"] = "請選擇是否定鎖!"
			return c.RenderJson(data)
		} else {
			Islock, err := strconv.ParseInt(islock, 10, 64)
			if err != nil {
				revel.WARN.Println(err)
			}

			user.Islock = Islock
		}

		var point string = c.Params.Get("point")
		if len(point) <= 0 {
			data["status"] = "0"
			data["message"] = "請輸入積分點數!"
			return c.RenderJson(data)
		} else {
			Point, err := strconv.ParseInt(point, 10, 64)
			if err != nil {
				revel.WARN.Println(err)
			}

			user.Point = Point
		}

		var birthday string = c.Params.Get("birthday")
		if len(birthday) <= 0 {
			user.Birthday = "0000-00-00"
		} else {
			user.Birthday = birthday
		}

		var vip string = c.Params.Get("vip")
		if vip == "1" {
			user.Vip = 1

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

			if len(overduedate) <= 0 {
				data["status"] = "0"
				data["message"] = "請選擇過期時間!"
				return c.RenderJson(data)
			} else {
				user.Overduedate = overduedate
			}

		} else {
			user.Vip = 0
			user.Overduedate = time.Now().Format("2006-01-02 15:04:04")
		}

		if ip := c.Request.Header.Get("X-Forwarded-For"); ip != "" {
			ips := strings.Split(ip, ",")
			if len(ips) > 0 && ips[0] != "" {
				rip := strings.Split(ips[0], ":")
				user.Regip = rip[0]
			}
		} else {
			ip := strings.Split(c.Request.RemoteAddr, ":")
			if len(ip) > 0 {
				if ip[0] != "[" {
					user.Regip = ip[0]
				}
			}
		}

		if user.Save() {
			data["status"] = "1"
			data["message"] = "添加會員成功!"
			return c.RenderJson(data)
		} else {
			data["status"] = "0"
			data["message"] = "添加會員失敗!"
			return c.RenderJson(data)
		}
	}
}
開發者ID:blackmady,項目名稱:GoCMS,代碼行數:101,代碼來源:user.go

示例2: Edit


//.........這裏部分代碼省略.........
				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"
			data["message"] = "請選擇是否定鎖!"
			return c.RenderJson(data)
		} else {
			Islock, err := strconv.ParseInt(islock, 10, 64)
			if err != nil {
				revel.WARN.Println(err)
			}

			user.Islock = Islock
		}

		var point string = c.Params.Get("point")
		if len(point) <= 0 {
			data["status"] = "0"
			data["message"] = "請輸入積分點數!"
			return c.RenderJson(data)
		} else {
			Point, err := strconv.ParseInt(point, 10, 64)
			if err != nil {
				revel.WARN.Println(err)
			}

			user.Point = Point
		}

		var birthday string = c.Params.Get("birthday")
		if len(birthday) <= 0 {
			user.Birthday = "0000-00-00"
		} else {
			user.Birthday = birthday
		}

		var vip string = c.Params.Get("vip")
		if vip == "1" {
			var overduedate string = c.Params.Get("overduedate")

			if len(overduedate) <= 0 {
				data["status"] = "0"
				data["message"] = "請選擇過期時間!"
				return c.RenderJson(data)
			} else {
				user.Vip = 1
				user.Overduedate = overduedate
			}

		} else {
			user.Vip = 0
			user.Overduedate = "0000-00-00 00:00:00"
		}

		if user.Edit(Id) {
			data["status"] = "1"
			data["message"] = "編輯會員成功!"
			return c.RenderJson(data)
		} else {
			data["status"] = "0"
			data["message"] = "編輯會員失敗!"
			return c.RenderJson(data)
		}
	}
}
開發者ID:blackmady,項目名稱:GoCMS,代碼行數:101,代碼來源:user.go


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