コード例 #1
0
ファイル: youth.go プロジェクト: cwen-coder/youth
func userSiginCheck(info SiginIfo, session sessions.Session) string {
	var result bool
	info.UserName, result = check.CheckUserName(info.UserName)
	if result != true {
		return "-1"
	}

	info.UserNumber, result = check.CheckNumber(info.UserNumber)
	if result != true {
		return "-2"
	}

	isSelected := model.CheckSelected(info.UserNumber)
	if isSelected == false {
		return "-3"
	}

	resultSigin := model.Sigin(info.UserName, info.UserNumber)
	if resultSigin != true {
		return "-4"
	} else {
		session.Set("user_name", info.UserName)
		session.Set("user_number", info.UserNumber)

		return "1"
	}
}
コード例 #2
0
ファイル: youth.go プロジェクト: cwen-coder/youth
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")
}
コード例 #3
0
ファイル: youth.go プロジェクト: cwen-coder/youth
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)
}