diff --git a/comm/imodule.go b/comm/imodule.go index d1199bc30..25358871e 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -620,6 +620,7 @@ type ( //推送礼包 IPushgiftbag interface { IBuriedUpdateNotify + IPayDelivery } IUiGame interface { HDPSTodayConsum(uid string, ps int32) // 今日消耗的体力 diff --git a/modules/pay/module.go b/modules/pay/module.go index d5cce3e45..83e56e5e6 100644 --- a/modules/pay/module.go +++ b/modules/pay/module.go @@ -36,6 +36,7 @@ type Pay struct { warorder comm.IWarorder //战令 shopcenter comm.IPayDelivery //购物中心 addrecharge comm.IAddrecharge //累充系统 + pushgiftbag comm.IPushgiftbag //推送礼包 configure *configureComp } @@ -69,6 +70,10 @@ func (this *Pay) Start() (err error) { return } this.addrecharge = module.(comm.IAddrecharge) + if module, err = this.service.GetModule(comm.ModulePushgiftbag); err != nil { + return + } + this.pushgiftbag = module.(comm.IPushgiftbag) this.service.RegisterFunctionName(string(comm.Rpc_ModulePayDelivery), this.Rpc_ModulePayDelivery) return } @@ -172,6 +177,12 @@ func (this *Pay) Rpc_ModulePayDelivery(ctx context.Context, args *pb.PayDelivery return } break + case 7: + if errdata, items = this.pushgiftbag.Delivery(session, args.Productid); errdata != nil { + reply.Code = errdata.Code + return + } + break } this.addrecharge.RechargeIntegral(session, conf.Integral) //记录累充积分 for _, v := range res { @@ -275,6 +286,11 @@ func (this *Pay) ModulePayDelivery(session comm.IUserSession, Productid string, if errdata, items = this.shopcenter.Delivery(session, Productid); errdata != nil { return } + case 7: + if errdata, items = this.pushgiftbag.Delivery(session, Productid); errdata != nil { + return + } + break } for _, v := range res { items = append(items, &pb.UserAssets{A: v.A, T: v.T, N: v.N}) diff --git a/modules/pushgiftbag/module.go b/modules/pushgiftbag/module.go index beecfc31b..ee71f13f6 100644 --- a/modules/pushgiftbag/module.go +++ b/modules/pushgiftbag/module.go @@ -1,6 +1,7 @@ package pushgiftbag import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/log" @@ -70,8 +71,18 @@ func (this *PushGiftbag) Delivery(session comm.IUserSession, pid string) (errdat } if conf == nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.String(), + Message: fmt.Sprintf("no found pid:%s", pid), + } return } + + if errdata = this.DispenseRes(session, conf.Lbid, true); err != nil { + return + } + for i, v := range info.Item { if v.Id == conf.Id { info.Item = append(info.Item[0:i], info.Item[i+1:]...)