review.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package http
  2. import (
  3. "go-common/app/admin/main/member/model"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func review(ctx *bm.Context) {
  8. arg := &model.ArgReview{}
  9. if err := ctx.Bind(arg); err != nil {
  10. return
  11. }
  12. ctx.JSON(svc.Review(ctx, arg))
  13. }
  14. func reviewList(ctx *bm.Context) {
  15. arg := &model.ArgReviewList{}
  16. if err := ctx.Bind(arg); err != nil {
  17. return
  18. }
  19. arg.IsMonitor = true
  20. if arg.Pn <= 0 {
  21. arg.Pn = 1
  22. }
  23. if arg.Ps <= 0 {
  24. arg.Ps = 10
  25. }
  26. rws, total, err := svc.Reviews(ctx, arg)
  27. if err != nil {
  28. ctx.JSON(nil, err)
  29. return
  30. }
  31. res := map[string]interface{}{
  32. "reviews": rws,
  33. "page": map[string]int{
  34. "num": arg.Pn,
  35. "size": arg.Ps,
  36. "total": total,
  37. },
  38. }
  39. ctx.JSON(res, nil)
  40. }
  41. func reviewFaceList(ctx *bm.Context) {
  42. arg := &model.ArgReviewList{}
  43. if err := ctx.Bind(arg); err != nil {
  44. return
  45. }
  46. arg.IsMonitor = false
  47. arg.Property = []int8{model.ReviewPropertyFace}
  48. if arg.Pn <= 0 {
  49. arg.Pn = 1
  50. }
  51. if arg.Ps <= 0 {
  52. arg.Ps = 10
  53. }
  54. rws, total, err := svc.Reviews(ctx, arg)
  55. if err != nil {
  56. ctx.JSON(nil, err)
  57. return
  58. }
  59. res := map[string]interface{}{
  60. "reviews": rws,
  61. "page": map[string]int{
  62. "num": arg.Pn,
  63. "size": arg.Ps,
  64. "total": total,
  65. },
  66. }
  67. ctx.JSON(res, nil)
  68. }
  69. func reviewAudit(ctx *bm.Context) {
  70. arg := &model.ArgReviewAudit{}
  71. if err := ctx.Bind(arg); err != nil {
  72. return
  73. }
  74. if arg.BlockUser {
  75. blockArg := model.ArgBatchBlock{}
  76. if err := ctx.Bind(&blockArg); err != nil {
  77. return
  78. }
  79. // yuzheng: 头像这里的封禁都作为小黑屋封禁
  80. blockArg.Source = 2
  81. if !blockArg.Validate() {
  82. ctx.JSON(nil, ecode.RequestErr)
  83. return
  84. }
  85. arg.ArgBatchBlock = blockArg
  86. }
  87. ctx.JSON(nil, svc.ReviewAudit(ctx, arg))
  88. }