| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- 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
- }
|