From bb365b268ac39591f42c6daad2b42b6176cca790 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 10 Nov 2022 14:25:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=85=85=E5=80=BC=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pay/module.go | 25 ++++++++++++++++++++----- pb/pay_msg.pb.go | 40 ++++++++++++++++++++++++++++++---------- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/modules/pay/module.go b/modules/pay/module.go index a4bf4113b..111f1e6fc 100644 --- a/modules/pay/module.go +++ b/modules/pay/module.go @@ -67,6 +67,7 @@ func (this *Pay) Rpc_ModulePayDelivery(ctx context.Context, args *pb.PayDelivery conf *cfg.GameRechargeData info *pb.DBUserPay res []*cfg.Gameatn + items []*pb.UserAssets session comm.IUserSession online bool ) @@ -89,10 +90,7 @@ func (this *Pay) Rpc_ModulePayDelivery(ctx context.Context, args *pb.PayDelivery if reply.Code = this.DispenseRes(session, res, true); reply.Code != pb.ErrorCode_Success { return } - if err = session.Push(); err != nil { - this.Errorln(err) - return - } + } else { session = comm.NewUserSessionByPools(this.service) session.SetSession("", "", "", "", args.Uid) @@ -110,12 +108,29 @@ func (this *Pay) Rpc_ModulePayDelivery(ctx context.Context, args *pb.PayDelivery return } this.modelPayUser.updateUserPay(info) + switch conf.RechargeType { case 1: break case 2: - reply.Code, _ = this.modelDaily.delivery(session, args.Productid) + reply.Code, items = this.modelDaily.delivery(session, args.Productid) break } + for _, v := range res { + items = append(items, &pb.UserAssets{A: v.A, T: v.T, N: v.N}) + } + session.SendMsg(string(this.GetType()), "shipped", &pb.PayShippedPush{ + Pid: args.Productid, + Orderid: args.Orderid, + Items: items, + Info: info, + }) + if online { + if err = session.Push(); err != nil { + this.Errorln(err) + return + } + } + return } diff --git a/pb/pay_msg.pb.go b/pb/pay_msg.pb.go index 810da9d9d..5d705b3cb 100644 --- a/pb/pay_msg.pb.go +++ b/pb/pay_msg.pb.go @@ -305,6 +305,7 @@ type PayShippedPush struct { Pid string `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid"` Orderid string `protobuf:"bytes,2,opt,name=orderid,proto3" json:"orderid"` Items []*UserAssets `protobuf:"bytes,3,rep,name=items,proto3" json:"items"` + Info *DBUserPay `protobuf:"bytes,4,opt,name=info,proto3" json:"info"` } func (x *PayShippedPush) Reset() { @@ -360,6 +361,13 @@ func (x *PayShippedPush) GetItems() []*UserAssets { return nil } +func (x *PayShippedPush) GetInfo() *DBUserPay { + if x != nil { + return x.Info + } + return nil +} + ///支付系统发货请求 type PayDeliveryReq struct { state protoimpl.MessageState @@ -432,6 +440,7 @@ type PayDeliveryResp struct { Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=ErrorCode" json:"code"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"` + Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data"` } func (x *PayDeliveryResp) Reset() { @@ -480,6 +489,13 @@ func (x *PayDeliveryResp) GetMsg() string { return "" } +func (x *PayDeliveryResp) GetData() string { + if x != nil { + return x.Data + } + return "" +} + var File_pay_pay_msg_proto protoreflect.FileDescriptor var file_pay_pay_msg_proto_rawDesc = []byte{ @@ -502,24 +518,27 @@ var file_pay_pay_msg_proto_rawDesc = []byte{ 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x75, 0x63, 0x63, 0x12, 0x21, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, - 0x5f, 0x0a, 0x0e, 0x50, 0x61, 0x79, 0x53, 0x68, 0x69, 0x70, 0x70, 0x65, 0x64, 0x50, 0x75, 0x73, + 0x7f, 0x0a, 0x0e, 0x50, 0x61, 0x79, 0x53, 0x68, 0x69, 0x70, 0x70, 0x65, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x12, 0x1e, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, + 0x2e, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x79, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x5a, 0x0a, 0x0e, 0x50, 0x61, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x64, 0x22, 0x43, 0x0a, 0x0f, + 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x64, 0x22, 0x57, 0x0a, 0x0f, 0x50, 0x61, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, - 0x67, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x67, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -555,12 +574,13 @@ var file_pay_pay_msg_proto_depIdxs = []int32{ 10, // 1: PayInfoResp.info:type_name -> DBPayDaily 11, // 2: PayDailyBuyResp.items:type_name -> UserAssets 11, // 3: PayShippedPush.items:type_name -> UserAssets - 12, // 4: PayDeliveryResp.code:type_name -> ErrorCode - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 9, // 4: PayShippedPush.info:type_name -> DBUserPay + 12, // 5: PayDeliveryResp.code:type_name -> ErrorCode + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_pay_pay_msg_proto_init() }