goodsupdlogic.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
  6. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
  7. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type GoodsUpdLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. func NewGoodsUpdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsUpdLogic {
  16. return &GoodsUpdLogic{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. Logger: logx.WithContext(ctx),
  20. }
  21. }
  22. // 修改商品
  23. func (l *GoodsUpdLogic) GoodsUpd(in *pb.GoodsAddReq) (*pb.StatusResp, error) {
  24. // todo: add your logic here and delete this line
  25. resp := &pb.StatusResp{}
  26. // todo: add your logic here and delete this line
  27. basegoods := &entity.Base_goods_struct{
  28. Id: in.Id,
  29. Appid: in.Appid,
  30. Name: in.Name, //商品名称
  31. Code: in.Code, //商品代码
  32. Describe: in.Describe, //描述
  33. Stand_classify_code: in.StandClassifyCode, //标准分类代码
  34. Business_classify_code: in.BusinessClassifyCode, //商户分类代码
  35. Business_id: in.BusinessId, //商家id
  36. Pc_landpage: in.PcLandpage, //pc端落地页
  37. Wx_landpage: in.WxLandpage, //wx端落地页
  38. App_landpage: in.AppLandpage, //app端落地页
  39. Logo: in.Logo, //产品logo
  40. Version: in.Version, //版本号
  41. Introduce_img_1: in.IntroduceImg_1, //产品介绍图1
  42. Introduce_img_2: in.IntroduceImg_2, //产品介绍图
  43. Introduce_img_3: in.IntroduceImg_3, //产品介绍图
  44. Detail: in.Detail, //详情
  45. Status: in.Status, //状态
  46. Update_person: in.UpdatePerson,
  47. Label: in.Label, //标签 多个,隔开
  48. Attribute: in.Attributes,
  49. }
  50. status, err := basegoods.Update()
  51. if err != nil {
  52. l.Error(fmt.Sprintf("%+v", in), err.Error())
  53. resp.ErrorMsg = err.Error()
  54. resp.ErrorCode = -1
  55. }
  56. resp.Status = status
  57. return resp, nil
  58. }