followup_comment.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. // Swagger:FollowUpComment 跟进 评论列表
  13. func (h *FollowUpCommentHandler) GetList(ctx context.Context, req *model.SearchPlatFollowupCommentReq, rsp *comm_def.CommonMsg) error {
  14. followupCommentService, err := server.NewFollowupCommentService(ctx)
  15. if err != nil {
  16. return err
  17. }
  18. g.Log().Info("搜索值", req)
  19. total, list, err := followupCommentService.GetList(req)
  20. if err != nil {
  21. return err
  22. }
  23. rsp.Data = g.Map{"list": list, "total": total}
  24. return nil
  25. }
  26. // Create 添加跟进评论
  27. // Swagger:FollowUpComment 跟进 评论添加
  28. func (h *FollowUpCommentHandler) Create(ctx context.Context, req *model.AddPlatFollowupCommentReq, rsp *comm_def.CommonMsg) error {
  29. // 参数校验
  30. if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
  31. return err
  32. }
  33. followupCommentService, err := server.NewFollowupCommentService(ctx)
  34. if err != nil {
  35. return err
  36. }
  37. err = followupCommentService.Create(req)
  38. if err != nil {
  39. return err
  40. }
  41. return nil
  42. }