1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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 GoodsSpecUpdLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewGoodsSpecUpdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsSpecUpdLogic {
- return &GoodsSpecUpdLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *GoodsSpecUpdLogic) GoodsSpecUpd(req *types.GoodsSpecUpdReq) (resp *types.Reply, err error) {
- // todo: add your logic here and delete this line
- resp = &types.Reply{}
- goodsResp, err := service.GoodsCenterRpc.GoodsSpecUpd(l.ctx, &pb.GoodsSpecAddReq{
- GoodsSpec: &pb.GoodsSpec{
- Id: req.Id,
- Appid: req.AppId,
- Name: req.Name,
- GoodsCode: req.Goods_code,
- OriginPrice: req.Origin_price,
- SkuMax: req.Sku_max,
- CalculationType: req.Calculation_type,
- CalculationMode: req.Calculation_mode,
- CalculationFormula: req.Calculation_formula,
- Tag: req.Tag,
- Remark: req.Remark,
- ActualPrice: req.Actual_price,
- },
- })
- if goodsResp.ErrorMsg != "" {
- resp.Error_msg = goodsResp.ErrorMsg
- resp.Error_code = -1
- l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
- }
- resp.Data = map[string]interface{}{
- "status": goodsResp.Status,
- }
- return
- }
|