package logic import ( "context" "fmt" "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/public/entity" "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/rpc/internal/svc" "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/rpc/pb" "github.com/zeromicro/go-zero/core/logx" ) type BuyServicesLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewBuyServicesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BuyServicesLogic { return &BuyServicesLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } // 购买服务 func (l *BuyServicesLogic) BuyServices(in *pb.BuyServicesReq) (*pb.BuyServicesResp, error) { // todo: add your logic here and delete this line resp := &pb.BuyServicesResp{} tripartite_market_service := &entity.Tripartite_market_service_struct{ Appid: in.Appid, Business_id: in.BusinessId, Goods_code: in.GoodsCode, Content: in.Need, Piece: in.Num, Phone: in.Phone, User_id: in.BaseUserId, } status, service_id, err := tripartite_market_service.Add() if err != nil { l.Error(fmt.Sprintf("%+v", in), err.Error()) resp.ErrorMsg = err.Error() resp.ErrorCode = -1 } else { resp.ServiceId = service_id } resp.Status = status return resp, nil }