followup_comment.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package plat
  2. import (
  3. "context"
  4. "dashoo.cn/common_definition/comm_def"
  5. "github.com/gogf/gf/frame/g"
  6. "github.com/gogf/gf/util/gvalid"
  7. model "dashoo.cn/micro/app/model/plat"
  8. server "dashoo.cn/micro/app/service/plat"
  9. )
  10. type FollowUpCommentHandler struct{}
  11. // GetList 获取列表
  12. func (h *FollowUpCommentHandler) GetList(ctx context.Context, req *model.SearchPlatFollowupCommentReq, rsp *comm_def.CommonMsg) error {
  13. followupCommentService, err := server.NewFollowupCommentService(ctx)
  14. if err != nil {
  15. return err
  16. }
  17. g.Log().Info("搜索值", req)
  18. total, list, err := followupCommentService.GetList(req)
  19. if err != nil {
  20. return err
  21. }
  22. rsp.Data = g.Map{"list": list, "total": total}
  23. return nil
  24. }
  25. // Create 添加跟进评论
  26. func (h *FollowUpCommentHandler) Create(ctx context.Context, req *model.AddPlatFollowupCommentReq, rsp *comm_def.CommonMsg) error {
  27. // 参数校验
  28. if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
  29. return err
  30. }
  31. followupCommentService, err := server.NewFollowupCommentService(ctx)
  32. if err != nil {
  33. return err
  34. }
  35. err = followupCommentService.Create(req)
  36. if err != nil {
  37. return err
  38. }
  39. return nil
  40. }