package logic import ( "context" "fmt" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb" "github.com/zeromicro/go-zero/core/logx" ) type GoodsSpecGetLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewGoodsSpecGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsSpecGetLogic { return &GoodsSpecGetLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } // 查看商品规格 func (l *GoodsSpecGetLogic) GoodsSpecGet(in *pb.GoodsSpecGetReq) (*pb.GoodsSpecGetResp, error) { // todo: add your logic here and delete this line resp := &pb.GoodsSpecGetResp{} goods_spec := &entity.Base_goods_spec_struct{ Appid: in.Appid, Id: in.SpecId, } goods_spec_detail, err := goods_spec.Get() if err != nil { l.Error(fmt.Sprintf("%+v", in), err.Error()) resp.ErrorMsg = err.Error() resp.ErrorCode = -1 } resp.SpecId = goods_spec_detail.Id resp.ActualPrice = goods_spec_detail.Actual_price resp.CalculationFormula = goods_spec_detail.Calculation_formula resp.CalculationMode = goods_spec_detail.Calculation_mode resp.CalculationType = goods_spec_detail.Calculation_mode resp.CreateTime = goods_spec_detail.Create_time resp.GoodsCode = goods_spec_detail.Goods_code resp.Name = goods_spec_detail.Name resp.OriginPrice = goods_spec_detail.Origin_price resp.Remark = goods_spec_detail.Remark resp.SkuMax = goods_spec_detail.Sku_max resp.Tag = goods_spec_detail.Tag resp.Appid = goods_spec_detail.Appid return resp, nil }