package logic import ( "context" "fmt" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/api/internal/svc" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/api/internal/types" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/public/service" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/rpc/pb" "github.com/zeromicro/go-zero/core/logx" ) type AppointmentAddLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewAppointmentAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AppointmentAddLogic { return &AppointmentAddLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *AppointmentAddLogic) AppointmentAdd(req *types.AppointmentAddReq) (resp *types.Reply, err error) { // todo: add your logic here and delete this line resp = &types.Reply{} marketingResp, err := service.MarketingRpc.AppointmentAdd(l.ctx, &pb.AppointmentAddReq{ AppId: req.AppId, UserId: req.UserId, UseProductType: req.UseProductType, ProductId: req.ProductId, }) if err != nil { l.Error(fmt.Sprintf("%+v", req), resp.Error_msg) resp.Data = map[string]interface{}{ "status": -1, } resp.Error_code, resp.Error_msg = -1, "预约失败" } if marketingResp.ErrorMsg != "" { resp.Error_msg = marketingResp.ErrorMsg resp.Error_code = -1 l.Error(fmt.Sprintf("%+v", req), resp.Error_msg) } resp.Data = map[string]interface{}{ "status": marketingResp.Status, } return }