12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- 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 GoodsGetLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewGoodsGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsGetLogic {
- return &GoodsGetLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *GoodsGetLogic) GoodsGet(req *types.GoodsIdReq) (resp *types.Reply, err error) {
- // todo: add your logic here and delete this line
- resp = &types.Reply{}
- goodsResp, err := service.GoodsCenterRpc.GoodsGet(l.ctx, &pb.GoodsGetReq{
- Appid: req.AppId,
- Id: req.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.GoodsAddReq{
- Name: goodsResp.Name,
- Code: goodsResp.Code,
- Stand_classify_code: goodsResp.StandClassifyCode,
- Business_classify_code: goodsResp.BusinessClassifyCode,
- Business_id: goodsResp.BusinessId,
- Pc_landpage: goodsResp.PcLandpage,
- Wx_landpage: goodsResp.WxLandpage,
- App_landpage: goodsResp.AppLandpage,
- Logo: goodsResp.Logo,
- Introduce_img_1: goodsResp.IntroduceImg_1,
- Introduce_img_2: goodsResp.IntroduceImg_2,
- Introduce_img_3: goodsResp.IntroduceImg_3,
- Detail: goodsResp.Detail,
- Status: goodsResp.Status,
- Create_persion: goodsResp.CreatePersion,
- Update_person: goodsResp.UpdatePerson,
- Describe: goodsResp.Describes,
- Label: goodsResp.Label,
- Attributes: goodsResp.Attributes,
- }
- }
- return
- }
|