kfc.go 617 B

1234567891011121314151617181920212223242526272829
  1. package service
  2. import (
  3. "context"
  4. "go-common/library/log"
  5. )
  6. // kfcActionDeal.
  7. func (s *Service) kfcActionDeal(j int) {
  8. defer s.waiter.Done()
  9. var (
  10. ch = s.kfcActionCh[j]
  11. c = context.Background()
  12. )
  13. log.Info("kfcActionDeal goroutine(%d) start", j)
  14. for {
  15. ms, ok := <-ch
  16. if !ok {
  17. log.Warn("kfcActionDeal(%d): quit", j)
  18. return
  19. }
  20. if err := s.kfcDao.KfcDelver(c, ms.CouponID, ms.UID); err != nil {
  21. log.Error("kfcActionDeal(%d):s.kfcDao.KfcDelver(%d %d) error(%v)", j, ms.CouponID, ms.UID, err)
  22. return
  23. }
  24. log.Info("kfcActionDeal(%d) success id(%d) uid(%d)", j, ms.CouponID, ms.UID)
  25. }
  26. }