calllogic.go 989 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package logic
  2. import (
  3. "context"
  4. "bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
  5. "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
  6. "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type CallLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewCallLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CallLogic {
  15. return &CallLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *CallLogic) Call(req *types.CallReq) (resp *types.Resp, err error) {
  22. resp = &types.Resp{}
  23. callresp, err := l.svcCtx.BiServiceRpc.Call(l.ctx, &pb.CallReq{
  24. PositionId: req.PositionId,
  25. Phone: req.Phone,
  26. })
  27. if callresp == nil || err != nil {
  28. resp.Error_msg = "暂无数据"
  29. resp.Error_code = -1
  30. resp.Data = map[string]interface{}{
  31. "status": -1,
  32. }
  33. }
  34. resp.Data = map[string]interface{}{
  35. "status": callresp.Status,
  36. }
  37. return
  38. }