| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package plat
- import (
- "context"
- "dashoo.cn/opms_libary/myerrors"
- "github.com/gogf/gf/frame/g"
- "github.com/gogf/gf/util/gconv"
- "dashoo.cn/micro/app/dao/plat"
- model "dashoo.cn/micro/app/model/plat"
- "dashoo.cn/micro/app/service"
- )
- type followupCommentService struct {
- *service.ContextService
- Dao *plat.PlatFollowupCommentDao
- }
- func NewFollowupCommentService(ctx context.Context) (svc *followupCommentService, err error) {
- svc = new(followupCommentService)
- if svc.ContextService, err = svc.Init(ctx); err != nil {
- return nil, err
- }
- svc.Dao = plat.NewPlatFollowupCommentDao(svc.Tenant)
- return svc, nil
- }
- // 跟进记录留言信息列表
- func (s *followupCommentService) GetList(req *model.SearchPlatFollowupCommentReq) (total int, followupCommentList []*model.PlatFollowupComment, err error) {
- followupCommentModel := s.Dao.M
- if req.FollowId != "" {
- followupCommentModel = followupCommentModel.Where("follow_id", req.FollowId)
- }
- if req.Pid != "" {
- followupCommentModel = followupCommentModel.Where("pid", req.Pid)
- }
- total, err = followupCommentModel.Count()
- if err != nil {
- g.Log().Error(err)
- err = myerrors.DbError("获取总行数失败。")
- return
- }
- err = followupCommentModel.Order("created_time DESC").Scan(&followupCommentList)
- return
- }
- // 添加信息
- func (s *followupCommentService) Create(req *model.AddPlatFollowupCommentReq) (err error) {
- platFollowupComment := new(model.PlatFollowupComment)
- if err = gconv.Struct(req, platFollowupComment); err != nil {
- return
- }
- // 填充创建信息
- service.SetCreatedInfo(platFollowupComment, s.GetCxtUserId(), s.GetCxtUserName())
- // 填充更新信息
- //service.SetUpdatedInfo(platFollowupComment, s.GetCxtUserId(), s.GetCxtUserName())
- _, err = s.Dao.Insert(platFollowupComment)
- if err != nil {
- return
- }
- return
- }
|