createcluelogic.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
  4. "context"
  5. "github.com/gogf/gf/v2/util/gconv"
  6. "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
  7. "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type CreateClueLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewCreateClueLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateClueLogic {
  16. return &CreateClueLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *CreateClueLogic) CreateClue(req *types.CreateClueReq) (resp *types.BiResp, err error) {
  23. if req.Phone == "" {
  24. return &types.BiResp{Error_code: -1, Error_msg: "手机号不能为空", Data: nil}, err
  25. }
  26. res, err := l.svcCtx.BiServiceRpc.CreateClueByPhone(l.ctx, &biservice.CreateCuleReq{
  27. AppId: req.AppId,
  28. PositionId: req.PositionId,
  29. UserId: req.UserId,
  30. Phone: req.Phone,
  31. })
  32. return &types.BiResp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg, Data: gconv.Map(gconv.UnsafeBytesToStr(res.Data))}, err
  33. }