goodsdellogic.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
  6. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/service"
  7. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/api/internal/svc"
  8. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/api/internal/types"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type GoodsDelLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewGoodsDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsDelLogic {
  17. return &GoodsDelLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. func (l *GoodsDelLogic) GoodsDel(req *types.GoodsIdReq) (resp *types.Reply, err error) {
  24. // todo: add your logic here and delete this line
  25. resp = &types.Reply{}
  26. goodsResp, err := service.GoodsCenterRpc.GoodsDel(l.ctx, &pb.GoodsDelReq{
  27. Appid: req.AppId,
  28. Id: req.Id,
  29. })
  30. if goodsResp.ErrorMsg != "" {
  31. resp.Error_msg = goodsResp.ErrorMsg
  32. resp.Error_code = -1
  33. l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
  34. }
  35. resp.Data = map[string]interface{}{
  36. "status": goodsResp.Status,
  37. }
  38. return
  39. }