callback.go 715 B

1234567891011121314151617181920212223242526272829303132333435
  1. package http
  2. import (
  3. "go-common/app/admin/main/workflow/model/param"
  4. "go-common/library/ecode"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. "go-common/library/net/http/blademaster/binding"
  8. )
  9. func listCallback(ctx *bm.Context) {
  10. ctx.JSON(wkfSvc.ListCallback(ctx))
  11. }
  12. func addOrUpCallback(ctx *bm.Context) {
  13. cbp := &param.AddCallbackParam{}
  14. if err := ctx.BindWith(cbp, binding.JSON); err != nil {
  15. return
  16. }
  17. if cbp.State > 0 {
  18. cbp.State = 1
  19. }
  20. cbID, err := wkfSvc.AddOrUpCallback(ctx, cbp)
  21. if err != nil {
  22. log.Error("wkfSvc.AddUpCallback(%+v) error(%v)", cbp, err)
  23. ctx.JSON(nil, ecode.RequestErr)
  24. return
  25. }
  26. ctx.JSON(map[string]int32{
  27. "callbackNo": cbID,
  28. }, nil)
  29. }