Beispiel #1
0
func ListChapter(hs *routing.HTTPSession) routing.HResult {
	var id int64 = 0
	err := hs.ValidRVal(`
		id,R|I,R:-1~10
		`, &id)
	if err != nil {
		return hs.MsgResE(1, err.Error())
	}
	is := []Item{}
	for i := 0; i < 10; i++ {
		it := Item{}
		it.Id = i
		it.Name = fmt.Sprintf("ch-%d-%d", id, i)
		is = append(is, it)
	}
	return hs.MsgRes(is)
}