package logic import ( "context" "fmt" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/service" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/api/internal/svc" "bp.jydev.jianyu360.cn/BaseService/goodsCenter/api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type GoodsSpecPowerAddLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewGoodsSpecPowerAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsSpecPowerAddLogic { return &GoodsSpecPowerAddLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *GoodsSpecPowerAddLogic) GoodsSpecPowerAdd(req *types.GoodsSpecPowerAddReq) (resp *types.Reply, err error) { // todo: add your logic here and delete this line resp = &types.Reply{} goodsResp, err := service.GoodsCenterRpc.GoodsSpecPowerAdd(l.ctx, &pb.GoodsSpecPowerAddReq{ Appid: req.Appid, GoodsFunctionId: req.Goods_function_id, GoodsCode: req.Goods_code, SpecId: req.Spec_id, FunctionCode: req.Function_code, LimitStrategy: req.Limit_strategy, Cycle: req.Cycle, StrategyCount: req.Strategy_count, MaxNum: req.Max_num, UseCount: req.Use_count, PowerType: req.Power_type, CountType: req.Count_type, PowerCount: req.Power_count, JudgeRepeatMechanism: req.Judge_repeat_mechanism, JudgeRepeatScope: req.Judge_repeat_scope, JudgeRepeatFlag: req.Judge_repeat_flag, JudgeRepeatStrategy: req.Judge_repeat_strategy, }) if goodsResp.ErrorMsg != "" { resp.Error_msg = goodsResp.ErrorMsg resp.Error_code = -1 l.Error(fmt.Sprintf("%+v", req), resp.Error_msg) } resp.Data = map[string]interface{}{ "status": goodsResp.Status, } return }