getbasegoodsstandclassifylogic.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "log"
  6. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
  7. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
  8. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type GetBaseGoodsStandClassifyLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewGetBaseGoodsStandClassifyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetBaseGoodsStandClassifyLogic {
  17. return &GetBaseGoodsStandClassifyLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. // 查看标准商品分类
  24. func (l *GetBaseGoodsStandClassifyLogic) GetBaseGoodsStandClassify(in *pb.ClassifyReq) (*pb.ClassifyResp, error) {
  25. // todo: add your logic here and delete this line
  26. resp := &pb.ClassifyResp{}
  27. if in.Appid == "" {
  28. l.Error(fmt.Sprintf("%+v", in), "无效的参数appid")
  29. return resp, nil
  30. }
  31. ret := entity.Base_goods_stand_classify.GetBaseGoodsStandClass(in.Appid)
  32. // resp.Classify = JsonUnmarshal(ret, []*pb.Classify{}).([]*pb.Classify)
  33. log.Println(ret)
  34. resp.Classify = ret
  35. return resp, nil
  36. }