group.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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/app/admin/main/workflow/model/search"
  6. "go-common/library/ecode"
  7. bm "go-common/library/net/http/blademaster"
  8. "go-common/library/net/http/blademaster/binding"
  9. )
  10. func setGroupStateV3(ctx *bm.Context) {
  11. gssp := &param.GroupStateSetParam{}
  12. if err := ctx.BindWith(gssp, binding.FormPost); err != nil {
  13. return
  14. }
  15. gssp.AdminID, gssp.AdminName = adminInfo(ctx)
  16. // check ban account operate 账号封禁不支持批处理
  17. if len(gssp.ID) > 1 && gssp.BlockDay != 0 {
  18. ctx.JSON(nil, ecode.WkfBanNotSupportBatchOperate)
  19. return
  20. }
  21. ctx.JSON(nil, wkfSvc.SetGroupState(ctx, gssp))
  22. }
  23. func groupListV3(ctx *bm.Context) {
  24. v := new(param.GroupListParamV3)
  25. if err := ctx.Bind(v); err != nil {
  26. return
  27. }
  28. gscc := &search.GroupSearchCommonCond{
  29. Fields: []string{"id", "oid", "typeid", "mid", "eid", "report_mid", "title", "first_user_tid"},
  30. Business: v.Business,
  31. Oids: v.Oid,
  32. Mids: v.Mid,
  33. States: v.State,
  34. TypeIDs: v.TypeID,
  35. Rounds: v.Round,
  36. RID: v.Rid,
  37. FID: v.Fid,
  38. EID: v.Eid,
  39. Tids: v.Tid,
  40. FirstUserTid: v.FirstUserTid,
  41. Order: v.Order,
  42. Sort: v.Sort,
  43. PN: v.PN,
  44. PS: v.PS,
  45. KWPriority: v.KWPriority,
  46. KW: v.KW,
  47. KWFields: v.KWField,
  48. CTimeFrom: v.CTimeFrom,
  49. CTimeTo: v.CTimeTo,
  50. ReportMID: v.ReportMid,
  51. }
  52. ctx.JSON(wkfSvc.GroupListV3(ctx, gscc))
  53. }
  54. func setGroupRole(ctx *bm.Context) {
  55. grsp := &param.GroupRoleSetParam{}
  56. if err := ctx.BindWith(grsp, binding.FormPost); err != nil {
  57. return
  58. }
  59. grsp.AdminID, grsp.AdminName = adminInfo(ctx)
  60. ctx.JSON(nil, wkfSvc.UpGroupRole(ctx, grsp))
  61. }
  62. func upGroupExtra(ctx *bm.Context) {
  63. uep := &param.UpExtraParam{}
  64. if err := ctx.BindWith(uep, binding.Form); err != nil {
  65. return
  66. }
  67. uep.AdminID, uep.AdminName = adminInfo(ctx)
  68. ctx.JSON(nil, wkfSvc.UpGroupExtra(ctx, uep))
  69. }
  70. func setPublicReferee(ctx *bm.Context) {
  71. gspr := &param.GroupStatePublicReferee{}
  72. if err := ctx.BindWith(gspr, binding.FormPost); err != nil {
  73. return
  74. }
  75. // if bid support public judge
  76. if gspr.Business != model.CommentComplain {
  77. ctx.JSON(nil, ecode.WkfBidNotSupportPublicReferee)
  78. }
  79. gspr.AdminID, gspr.AdminName = adminInfo(ctx)
  80. ctx.JSON(nil, wkfSvc.SetPublicReferee(ctx, gspr))
  81. }
  82. func countPendingGroup(ctx *bm.Context) {
  83. gpp := &param.GroupPendingParam{}
  84. if err := ctx.Bind(gpp); err != nil {
  85. return
  86. }
  87. gscc := &search.GroupSearchCommonCond{
  88. Fields: []string{"id"},
  89. Business: gpp.Business,
  90. RID: gpp.Rid,
  91. States: []int8{model.Pending},
  92. PS: 1,
  93. PN: 1,
  94. Order: "id",
  95. Sort: "desc",
  96. }
  97. ctx.JSON(wkfSvc.GroupPendingCount(ctx, gscc))
  98. }