flow.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package http
  2. import (
  3. "go-common/library/ecode"
  4. "go-common/library/log"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func addByMid(c *bm.Context) {
  8. v := new(struct {
  9. Business int8 `form:"business"`
  10. Mid int64 `form:"mid" validate:"required"`
  11. Oid int64 `form:"oid" validate:"required"`
  12. State int8 `form:"state"`
  13. })
  14. if err := c.Bind(v); err != nil {
  15. return
  16. }
  17. log.Info("flowDesign data(%v)", v)
  18. c.JSON(nil, vdpSvc.AddByMid(c, v.Business, v.Mid, v.Oid, v.State))
  19. }
  20. func addByOid(c *bm.Context) {
  21. v := new(struct {
  22. Business int8 `form:"business" validate:"required"`
  23. OID int64 `form:"oid" validate:"required"`
  24. UID int64 `form:"uid" default:"399"`
  25. NoTimeline int32 `form:"no_timeline" default:"-1"`
  26. NoOtt int32 `form:"no_ott" default:"-1"`
  27. NoRank int32 `form:"no_rank" default:"-1"`
  28. NoRecommend int32 `form:"no_recommend" default:"-1"`
  29. })
  30. if err := c.Bind(v); err != nil {
  31. return
  32. }
  33. log.Info("flowDesign data(%v)", v)
  34. c.JSON(nil, vdpSvc.AddByOid(c, v.Business, v.OID, v.UID, map[string]int32{
  35. "notimeline": v.NoTimeline,
  36. "noott": v.NoOtt,
  37. "norank": v.NoRank,
  38. "norecommend": v.NoRecommend,
  39. }))
  40. }
  41. func queryByOid(c *bm.Context) {
  42. v := new(struct {
  43. Business int8 `form:"business" validate:"required"`
  44. Oid int64 `form:"oid" validate:"required"`
  45. })
  46. if err := c.Bind(v); err != nil {
  47. return
  48. }
  49. log.Info("flowDesign data(%v)", v)
  50. c.JSON(vdpSvc.HitFlowGroups(c, v.Oid, []int8{v.Business}))
  51. }
  52. func listJudgeFlows(c *bm.Context) {
  53. //按照禁止项过滤 对外 一个禁止项属于一个groupId
  54. v := new(struct {
  55. Business int64 `form:"business" validate:"required"`
  56. Gid int64 `form:"gid" validate:"required"`
  57. Oids []int64 `form:"oids,split" validate:"required"`
  58. })
  59. if err := c.Bind(v); err != nil {
  60. return
  61. }
  62. if len(v.Oids) > 200 {
  63. c.JSON(nil, ecode.RequestErr)
  64. return
  65. }
  66. log.Info("flowDesign data(%v)", v)
  67. c.JSON(vdpSvc.TagrgetFlows(c, v.Business, v.Gid, v.Oids))
  68. }
  69. func listFlows(c *bm.Context) {
  70. //按照禁止项过滤 对外 一个禁止项属于一个groupId
  71. v := new(struct {
  72. Business int64 `form:"business" validate:"required"`
  73. Gid int64 `form:"gid" validate:"required"`
  74. Pn int64 `form:"page" default:"1"`
  75. Ps int64 `form:"pagesize" default:"100" validate:"max=1000"`
  76. })
  77. if err := c.Bind(v); err != nil {
  78. return
  79. }
  80. log.Info("flowDesign data(%v)", v)
  81. c.JSON(vdpSvc.FlowPage(c, v.Business, v.Gid, v.Pn, v.Ps))
  82. }