Example #1
0
func userInforEditPost(user model.User, r render.Render) {
	var result bool
	user.UserName, result = check.CheckUserName(user.UserName)
	if result != true {
		r.Redirect("/editReruenInfo/error")
		return
	}

	user.UserNumber, result = check.CheckNumber(user.UserNumber)
	if result != true {
		r.Redirect("/editReruenInfo/error")
		return
	}

	isSelected := model.CheckSelected(user.UserNumber)
	if isSelected != true {
		r.Redirect("/editReruenInfo/error")
		return
	}

	var result1 bool
	var result2 bool
	var result3 bool
	var result4 bool

	user.UserSex, result1 = check.CheckSex(user.UserSex)
	user.UserBrand, result2 = check.CheckBrand(user.UserBrand)
	user.UserColor, result3 = check.CheckColor(user.UserColor)
	user.UserSize, result4 = check.CheckSize(user.UserSize)
	// result1 != true || result2 != true || result3 != true || result4 != true
	if result1 != true || result2 != true || result3 != true || result4 != true {
		r.Redirect("/editReruenInfo/error")
		return
	}
	user.IsSelected = true
	model.Update(user)
	r.Redirect("/editReruenInfo/success")
}
Example #2
0
func firtConfirmPost(user model.User, r render.Render) {
	var result bool
	user.UserName, result = check.CheckUserName(user.UserName)
	if result != true {
		msgInfo := msg{
			ErrorStatue:   true,
			SuccessStatue: false,
			SuccessInfo:   "成功",
			ErrorInfo:     "对不起!你输入的姓名有误",
		}
		r.HTML(200, "firtConfirm", msgInfo)
		return
	}

	user.UserNumber, result = check.CheckNumber(user.UserNumber)
	if result != true {
		msgInfo := msg{
			ErrorStatue:   true,
			SuccessStatue: false,
			SuccessInfo:   "成功",
			ErrorInfo:     "对不起!你不在名单中,请仔细检查重新填写",
		}
		r.HTML(200, "firtConfirm", msgInfo)
		return
	}

	isSelected := model.CheckSelected(user.UserNumber)
	if isSelected == true {
		msgInfo := msg{
			ErrorStatue:   true,
			SuccessStatue: false,
			SuccessInfo:   "成功",
			ErrorInfo:     "对不起!你不是首次确认信息,如要修改请返回首页点击【修改确认】",
		}
		r.HTML(200, "firtConfirm", msgInfo)
		return
	}

	var result1 bool
	var result2 bool
	var result3 bool
	var result4 bool

	user.UserSex, result1 = check.CheckSex(user.UserSex)
	user.UserBrand, result2 = check.CheckBrand(user.UserBrand)
	user.UserColor, result3 = check.CheckColor(user.UserColor)
	user.UserSize, result4 = check.CheckSize(user.UserSize)
	// result1 != true || result2 != true || result3 != true || result4 != true
	if result1 != true || result2 != true || result3 != true || result4 != true {
		msgInfo := msg{
			ErrorStatue:   true,
			SuccessStatue: false,
			SuccessInfo:   "成功",
			ErrorInfo:     "对不起!你填写的信息有误",
		}
		r.HTML(200, "firtConfirm", msgInfo)
		return
	}
	user.IsSelected = true
	model.Update(user)
	msgInfo := msg{
		ErrorStatue:   false,
		SuccessStatue: true,
		SuccessInfo:   "恭喜你!确认成功",
		ErrorInfo:     "对不起!你填写的信息有误",
	}
	r.HTML(200, "firtConfirm", msgInfo)
}