1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package logic
- import (
- "context"
- "fmt"
- "bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
- "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
- "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type GoodsUpdLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewGoodsUpdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsUpdLogic {
- return &GoodsUpdLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- // 修改商品
- func (l *GoodsUpdLogic) GoodsUpd(in *pb.GoodsAddReq) (*pb.StatusResp, error) {
- // todo: add your logic here and delete this line
- resp := &pb.StatusResp{}
- // todo: add your logic here and delete this line
- basegoods := &entity.Base_goods_struct{
- Id: in.Id,
- Appid: in.Appid,
- Name: in.Name, //商品名称
- Code: in.Code, //商品代码
- Describe: in.Describe, //描述
- Stand_classify_code: in.StandClassifyCode, //标准分类代码
- Business_classify_code: in.BusinessClassifyCode, //商户分类代码
- Business_id: in.BusinessId, //商家id
- Pc_landpage: in.PcLandpage, //pc端落地页
- Wx_landpage: in.WxLandpage, //wx端落地页
- App_landpage: in.AppLandpage, //app端落地页
- Logo: in.Logo, //产品logo
- Version: in.Version, //版本号
- Introduce_img_1: in.IntroduceImg_1, //产品介绍图1
- Introduce_img_2: in.IntroduceImg_2, //产品介绍图
- Introduce_img_3: in.IntroduceImg_3, //产品介绍图
- Detail: in.Detail, //详情
- Status: in.Status, //状态
- Update_person: in.UpdatePerson,
- Label: in.Label, //标签 多个,隔开
- Attribute: in.Attributes,
- }
- status, err := basegoods.Update()
- if err != nil {
- l.Error(fmt.Sprintf("%+v", in), err.Error())
- resp.ErrorMsg = err.Error()
- resp.ErrorCode = -1
- }
- resp.Status = status
- return resp, nil
- }
|