service.go 770 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package kfc
  2. import (
  3. "context"
  4. "go-common/app/admin/main/activity/conf"
  5. kfcDao "go-common/app/admin/main/activity/dao/kfc"
  6. kfcmdl "go-common/app/admin/main/activity/model/kfc"
  7. "go-common/library/log"
  8. )
  9. // Service struct
  10. type Service struct {
  11. c *conf.Config
  12. dao *kfcDao.Dao
  13. }
  14. // Close service
  15. func (s *Service) Close() {
  16. if s.dao != nil {
  17. s.dao.Close()
  18. }
  19. }
  20. // New Service
  21. func New(c *conf.Config) (s *Service) {
  22. s = &Service{
  23. c: c,
  24. dao: kfcDao.New(c),
  25. }
  26. return
  27. }
  28. // List .
  29. func (s *Service) List(c context.Context, arg *kfcmdl.ListParams) (list []*kfcmdl.BnjKfcCoupon, err error) {
  30. if list, err = s.dao.SearchList(c, arg.CouponCode, arg.Mid, arg.Pn, arg.Ps); err != nil {
  31. log.Error("s.dao.SearchList(%v) error(%+v)", arg, err)
  32. }
  33. return
  34. }