package logic import ( "context" "fmt" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/service" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/api/internal/svc" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type GoodsSpecGetLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewGoodsSpecGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsSpecGetLogic { return &GoodsSpecGetLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *GoodsSpecGetLogic) GoodsSpecGet(req *types.GoodSpecIdReq) (resp *types.Reply, err error) { // todo: add your logic here and delete this line resp = &types.Reply{} goodsResp, err := service.GoodsCenterRpc.GoodsSpecGet(l.ctx, &pb.GoodsSpecGetReq{ Appid: req.AppId, SpecId: req.Spec_id, }) if goodsResp.ErrorMsg != "" { resp.Error_msg = goodsResp.ErrorMsg resp.Error_code = -1 l.Error(fmt.Sprintf("%+v", req), resp.Error_msg) } else { resp.Data = &types.GoodsSpec{ AppId: goodsResp.Appid, Name: goodsResp.Name, Goods_code: goodsResp.GoodsCode, Origin_price: goodsResp.OriginPrice, Sku_max: goodsResp.SkuMax, Calculation_type: goodsResp.CalculationType, Calculation_mode: goodsResp.CalculationMode, Calculation_formula: goodsResp.CalculationFormula, Tag: goodsResp.Tag, Remark: goodsResp.Remark, Actual_price: goodsResp.ActualPrice, } } return }