예제 #1
0
func (p *PreferenceIndex) SetupRender() {
	p.Title = "Admin | Preference"

	if p.Edit > 0 {
		constModel, err := constdao.GetById(p.Edit)
		if err != nil {
			fmt.Printf("Err is %v\n", err) // panic(err)
		}
		p.Const = constModel
	} else {
		p.Const = new(model.Const)
	}
}
예제 #2
0
func (s *ConstService) DeleteById(id int64) (int64, error) {
	var err error
	c, err := constdao.GetById(id)
	if err != nil {
		panic(err)
	}
	if aff, err := constdao.DeleteById(id); err != nil {
		return aff, err
	}
	// udpate cache
	err = s.deletecache(c.Name, c.Key)
	return 0, err
}