app_active.go 547 B

123456789101112131415161718192021222324
  1. package show
  2. import (
  3. "context"
  4. "go-common/app/admin/main/feed/model/show"
  5. "go-common/library/log"
  6. "github.com/jinzhu/gorm"
  7. )
  8. // AAFindByID app active table find by id
  9. func (d *Dao) AAFindByID(c context.Context, id int64) (active *show.AppActive, err error) {
  10. active = &show.AppActive{}
  11. if err = d.DB.Model(&show.AppActive{}).Where("id = ?", id).First(active).Error; err != nil {
  12. if err == gorm.ErrRecordNotFound {
  13. active = nil
  14. err = nil
  15. } else {
  16. log.Error("dao.ormshow.app_active.findByID error(%v)", err)
  17. }
  18. }
  19. return
  20. }