package logic import ( "context" "fmt" "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/rpc/pb" "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/api/internal/svc" "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/api/internal/types" . "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/public/service" "github.com/zeromicro/go-zero/core/logx" ) type BuyServiceLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewBuyServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BuyServiceLogic { return &BuyServiceLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *BuyServiceLogic) BuyService(req *types.BuyServiceReq) (resp *types.Reply, err error) { // todo: add your logic here and delete this line resp = &types.Reply{} threeMarketResp, err := ThreemarketRpc.BuyServices(l.ctx, &pb.BuyServicesReq{ Appid: req.AppId, BaseUserId: req.Base_user_id, BusinessId: req.Business_id, Need: req.Need, GoodsCode: req.Goods_code, Num: req.Num, Phone: req.Phone, }) if threeMarketResp.ErrorMsg != "" { resp.Error_msg = threeMarketResp.ErrorMsg resp.Error_code = -1 l.Error(fmt.Sprintf("%+v", req), resp.Error_msg) } resp.Data = map[string]interface{}{ "service_id": threeMarketResp.ServiceId, "status": threeMarketResp.Status, } return }