package plat import ( "context" "dashoo.cn/opms_libary/myerrors" "dashoo.cn/common_definition/comm_def" "github.com/gogf/gf/frame/g" "github.com/gogf/gf/util/gvalid" model "dashoo.cn/micro/app/model/plat" server "dashoo.cn/micro/app/service/plat" ) type FollowUpCommentHandler struct{} // GetList 获取列表 // Swagger:FollowUpComment 跟进 评论列表 func (h *FollowUpCommentHandler) GetList(ctx context.Context, req *model.SearchPlatFollowupCommentReq, rsp *comm_def.CommonMsg) error { followupCommentService, err := server.NewFollowupCommentService(ctx) if err != nil { return err } g.Log().Info("搜索值", req) total, list, err := followupCommentService.GetList(req) if err != nil { return err } rsp.Data = g.Map{"list": list, "total": total} return nil } // GetNeedReplyComments 获取本人需要回复的评论列表 // Swagger:FollowUpComment 跟进 获取本人需要回复的评论列表 func (h *FollowUpCommentHandler) GetNeedReplyComments(ctx context.Context, req *model.SearchNeedReplyCommentsReq, rsp *comm_def.CommonMsg) error { followupCommentService, err := server.NewFollowupCommentService(ctx) if err != nil { return err } g.Log().Info("搜索值", req) total, list, err := followupCommentService.NeedReplyList(req) if err != nil { return err } rsp.Data = g.Map{"list": list, "total": total} return nil } // GetNeedReplyCount 获取本人需要回复的评论数量 // Swagger:FollowUpComment 跟进 获取本人需要回复的评论数量 func (h *FollowUpCommentHandler) GetNeedReplyCount(ctx context.Context, req *model.SearchNeedReplyCommentsReq, rsp *comm_def.CommonMsg) error { followupCommentService, err := server.NewFollowupCommentService(ctx) if err != nil { return err } g.Log().Info("搜索值", req) total, err := followupCommentService.NeedReplyCount(req) if err != nil { return err } rsp.Data = g.Map{"total": total} return nil } // GetLatestComments 获取最新50条数据 // Swagger:FollowUpComment 跟进 获取最新50条数据 func (h *FollowUpCommentHandler) GetLatestComments(ctx context.Context, req *model.SearchPlatFollowupCommentReq, rsp *comm_def.CommonMsg) error { followupCommentService, err := server.NewFollowupCommentService(ctx) if err != nil { return err } g.Log().Info("搜索值", req) total, list, err := followupCommentService.LatestComments(req) if err != nil { return err } rsp.Data = g.Map{"list": list, "total": total} return nil } // Create 添加跟进评论 // Swagger:FollowUpComment 跟进 评论添加 func (h *FollowUpCommentHandler) Create(ctx context.Context, req *model.AddPlatFollowupCommentReq, rsp *comm_def.CommonMsg) error { // 参数校验 if err := gvalid.CheckStruct(ctx, req, nil); err != nil { return err } followupCommentService, err := server.NewFollowupCommentService(ctx) if err != nil { return err } err = followupCommentService.Create(req) if err != nil { return err } return nil } // Reply 回复跟进评论 // Swagger:FollowUpComment 跟进 回复跟进评论 func (h *FollowUpCommentHandler) Reply(ctx context.Context, req *model.AddPlatFollowupCommentReq, rsp *comm_def.CommonMsg) error { // 参数校验 if err := gvalid.CheckStruct(ctx, req, nil); err != nil { return err } // 参数校验 if req.Pid == 0 { return myerrors.TipsError("回复的评论Id不能为空") } followupCommentService, err := server.NewFollowupCommentService(ctx) if err != nil { return err } err = followupCommentService.Reply(req) if err != nil { return err } return nil }