goodsupdlogic.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 GoodsUpdLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewGoodsUpdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsUpdLogic {
  17. return &GoodsUpdLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. func (l *GoodsUpdLogic) GoodsUpd(req *types.GoodsUpdReq) (resp *types.Reply, err error) {
  24. // todo: add your logic here and delete this line
  25. resp = &types.Reply{}
  26. goodsResp, err := service.GoodsCenterRpc.GoodsUpd(l.ctx, &pb.GoodsAddReq{
  27. Id: req.Id,
  28. Appid: req.AppId,
  29. Name: req.Name,
  30. StandClassifyCode: req.Stand_classify_code,
  31. BusinessClassifyCode: req.Business_classify_code,
  32. BusinessId: req.Business_id,
  33. PcLandpage: req.Pc_landpage,
  34. WxLandpage: req.Wx_landpage,
  35. AppLandpage: req.App_landpage,
  36. Logo: req.Logo,
  37. IntroduceImg_1: req.Introduce_img_1,
  38. IntroduceImg_2: req.Introduce_img_2,
  39. IntroduceImg_3: req.Introduce_img_3,
  40. Detail: req.Detail,
  41. Status: req.Status,
  42. CreatePersion: req.Create_persion,
  43. UpdatePerson: req.Update_person,
  44. Describe: req.Describe,
  45. Label: req.Label,
  46. Attributes: req.Attributes,
  47. })
  48. if goodsResp.ErrorMsg != "" {
  49. resp.Error_msg = goodsResp.ErrorMsg
  50. resp.Error_code = -1
  51. l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
  52. }
  53. resp.Data = map[string]interface{}{
  54. "status": goodsResp.Status,
  55. }
  56. return
  57. }