clueaddlogic.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package logic
  2. import (
  3. "context"
  4. "bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
  5. "bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
  6. "bp.jydev.jianyu360.cn/CRM/application/service"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type ClueAddLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewClueAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClueAddLogic {
  15. return &ClueAddLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *ClueAddLogic) ClueAdd(req *types.ClueAddReq) (resp *types.Reply, err error) {
  22. // todo: add your logic here and delete this line
  23. resp = &types.Reply{}
  24. clue := &service.SaleClueService{
  25. AppId: req.AppId,
  26. PositionId: req.PositionId,
  27. EntId: req.EntId,
  28. EntUserId: req.EntUserId,
  29. AccountId: req.AccountId,
  30. ClueName: req.ClueName,
  31. CluesSource: req.CluesSource,
  32. Summary: req.Summary,
  33. EmployInfoId: req.EmployInfoId,
  34. Types: req.Types,
  35. User: req.User,
  36. FollowUpTime: req.FollowUpTime,
  37. CreateName: req.CreateName,
  38. BaseUserId: req.BaseUserId,
  39. EntDeptId: req.EntDeptId,
  40. Channel: req.Channel,
  41. }
  42. status, error_msg := service.CanAdd(req.EntId, "more_create_clue", req.EmployInfoId, 0, req.PositionId)
  43. if status <= 0 {
  44. resp.Error_code = -1
  45. resp.Error_msg = error_msg
  46. resp.Data = map[string]interface{}{
  47. "status": -1,
  48. }
  49. return
  50. }
  51. status, _ = clue.Add(l.ctx)
  52. resp.Data = map[string]interface{}{
  53. "status": status,
  54. }
  55. return
  56. }