callback.go 532 B

123456789101112131415161718192021
  1. package dao
  2. import (
  3. "context"
  4. "errors"
  5. "go-common/app/service/main/workflow/model"
  6. "go-common/library/log"
  7. )
  8. // Callback callback message
  9. func (d *Dao) Callback(c context.Context, chall *model.Challenge, businessID int8) (err error) {
  10. if URL, ok := d.callbackMap[businessID]; ok {
  11. if err = d.callback.Post(context.Background(), URL, "", nil, &chall); err != nil {
  12. log.Error("d.CallbackSetting(%s) error(%v)", chall, err)
  13. return
  14. }
  15. return
  16. }
  17. return errors.New("Callback cannot find businessID in callbackMap")
  18. }