reply.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package http
  2. import (
  3. "go-common/app/admin/main/workflow/model"
  4. "go-common/app/admin/main/workflow/model/param"
  5. "go-common/library/ecode"
  6. "go-common/library/log"
  7. bm "go-common/library/net/http/blademaster"
  8. "go-common/library/net/http/blademaster/binding"
  9. )
  10. func addReply(ctx *bm.Context) {
  11. var (
  12. eid int64
  13. err error
  14. )
  15. e := &param.EventParam{}
  16. if err = ctx.BindWith(e, binding.FormPost); err != nil {
  17. return
  18. }
  19. e.AdminID, e.AdminName = adminInfo(ctx)
  20. if eid, err = wkfSvc.AddEvent(ctx, e); err != nil {
  21. ctx.JSON(nil, err)
  22. return
  23. }
  24. // 管理员回复同步修改 business_state
  25. if e.Event == 1 {
  26. if err = wkfSvc.UpChallBusState(ctx, e.Cid, e.AdminID, e.AdminName, model.FeedbackReplyNotRead); err != nil {
  27. ctx.JSON(nil, err)
  28. return
  29. }
  30. }
  31. ctx.JSON(map[string]int64{
  32. "eventNo": eid,
  33. }, nil)
  34. }
  35. func batchAddReply(ctx *bm.Context) {
  36. var (
  37. eids []int64
  38. err error
  39. )
  40. bep := &param.BatchEventParam{}
  41. if err = ctx.BindWith(bep, binding.FormPost); err != nil {
  42. return
  43. }
  44. bep.AdminID, bep.AdminName = adminInfo(ctx)
  45. eids, err = wkfSvc.BatchAddEvent(ctx, bep)
  46. if err != nil {
  47. log.Error("wkfSvc.BatchAddEvent(%v) error(%v)", bep, err)
  48. ctx.JSON(nil, ecode.RequestErr)
  49. return
  50. }
  51. // 管理员回复同步修改 business_state
  52. if bep.Event == 1 {
  53. if err = wkfSvc.BatchUpChallBusState(ctx, bep.Cids, bep.AdminID, bep.AdminName, model.FeedbackReplyNotRead); err != nil {
  54. ctx.JSON(nil, err)
  55. return
  56. }
  57. }
  58. ctx.JSON(map[string][]int64{
  59. "eventNo": eids,
  60. }, nil)
  61. }