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 GoodsSpecPowerAddLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewGoodsSpecPowerAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsSpecPowerAddLogic { return &GoodsSpecPowerAddLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } // 新增商品规格权益 func (l *GoodsSpecPowerAddLogic) GoodsSpecPowerAdd(in *pb.GoodsSpecPowerAddReq) (*pb.StatusResp, error) { // todo: add your logic here and delete this line resp := &pb.StatusResp{} spec_power := &entity.Base_goods_spec_power_struct{ Appid: in.Appid, Goods_function_id: in.GoodsFunctionId, //商品功能id Goods_code: in.GoodsCode, //商品代码 Spec_id: in.SpecId, //规格id Function_code: in.FunctionCode, //功能代码 Limit_strategy: in.LimitStrategy, //限制频率 Cycle: in.Cycle, //周期 Strategy_count: in.StrategyCount, //频率数量 Max_num: in.MaxNum, //最大数量 不可修改,从原始表带过来 Use_count: in.UseCount, //数量 Power_type: in.PowerType, //权益所属类型 1:个人 2:企业 Count_type: in.CountType, //数量类型 1:固定值 2:计算公式(生成权益时需要计算,比如:超级订阅送画像) Power_count: in.PowerCount, //授权数量 Judge_repeat_mechanism: in.JudgeRepeatMechanism, //判重机制 0:无 1:通用判重 2:应用判重 Judge_repeat_scope: in.JudgeRepeatScope, //判重范围 Judge_repeat_flag: in.JudgeRepeatFlag, //判重标识 _id、projectid Judge_repeat_strategy: in.JudgeRepeatStrategy, //判重策略 0:无需判重 1:通用判重 2:应用自己判重 } status, err := spec_power.Add() if err != nil { l.Error(fmt.Sprintf("%+v", in), err.Error()) resp.ErrorMsg = err.Error() resp.ErrorCode = -1 } resp.Status = status return resp, nil }