Exemple #1
0
func (v *RadioValidator) ValidateUpdateRequest(params *revel.Params) (*models.UpdateRequest, error) {
	var request_str string = ""
	params.Bind(&request_str, "request")
	if request_str == "" {
		return nil, fmt.Errorf("Illegal param [request]!")
	}

	request_str, err := url.QueryUnescape(request_str)
	if err != nil {
		return nil, fmt.Errorf("Illegal format [request] : %s", err)
	}
	request, err := ParseRequest(request_str)
	return request, err
}
Exemple #2
0
func bind2Task(p *revel.Params, t *models.Task) (err error) {
	p.Bind(&t.Subject, "subject")
	p.Bind(&t.Content, "content")
	p.Bind(&t.Recipient, "recipient")
	p.Bind(&t.SendTime, "sendtime")
	p.Bind(&t.SendType, "sendtype")
	if t.SendType == "" && (t.SendType != "notice" || t.SendType != "fanout") {
		t.SendType = "fanout"
	}
	t.Type = "email"
	t.Created_At = time.Now()
	t.Recipient = strings.Trim(t.Recipient, ", ")
	return
}