上传支付系统

This commit is contained in:
liwei1dao 2022-11-03 18:45:28 +08:00
parent 7f9bda681d
commit b971e714ae
7 changed files with 481 additions and 2 deletions

View File

@ -23,7 +23,7 @@ const (
)
const (
RDS_SESSION = "online"
RDS_SESSION = "online"
)
//ERR
@ -205,6 +205,10 @@ const ( //Rpc
// arena
Rpc_ModuleArenaRaceSettlement core.Rpc_Key = "Rpc_ModuleArenaRaceSettlement" //竞技场比赛结算信息
// 充值发货
Rpc_ModulePayDelivery core.Rpc_Key = "Rpc_ModuleArenaRaceSettlement" //充值发货
)
//事件类型定义处

View File

@ -1,9 +1,13 @@
package pay
import (
"context"
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
/*
@ -18,6 +22,7 @@ func NewModule() core.IModule {
type Pay struct {
modules.ModuleBase
service base.IRPCXService
configure *configureComp
}
@ -29,6 +34,12 @@ func (this *Pay) GetType() core.M_Modules {
//模块初始化接口 注册用户创建角色事件
func (this *Pay) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService)
return
}
func (this *Pay) Start() (err error) {
err = this.ModuleBase.Start()
this.service.RegisterFunctionName(string(comm.Rpc_ModulePayDelivery), this.Rpc_ModulePayDelivery)
return
}
@ -37,3 +48,11 @@ func (this *Pay) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
//RPC-----------------------------------------------------------------------------------------------------------------------
func (this *Pay) Rpc_ModulePayDelivery(ctx context.Context, args *pb.PayDeliveryReq, reply *pb.PayDeliveryResp) (err error) {
this.Debug("Rpc_ModulePayDelivery", log.Field{Key: "args", Value: args.String()})
return
}

View File

@ -0,0 +1,44 @@
package web
import (
"context"
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/gin"
"go_dreamfactory/lego/sys/gin/engine"
"go_dreamfactory/pb"
"net/http"
)
type PayDelivery struct {
pb.DBSystemNotify
Order string `json:"orderid"`
ProductID string `json:"productid"`
Uid string `json:"uid"`
Sign string `json:"sign"`
}
//充值发货
func (this *Api_Comp) PayDelivery(c *engine.Context) {
req := &PayDelivery{}
err := c.BindJSON(&req)
this.module.Debugf("PayDelivery:%+v err:%v", req, err)
var (
payreq *pb.PayDeliveryReq = &pb.PayDeliveryReq{}
payresp *pb.PayDeliveryResp = &pb.PayDeliveryResp{}
)
defer c.JSON(http.StatusOK, &Respond{Code: payresp.Code, Message: payresp.Msg, Data: nil})
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{"orderid": req.Order, "productid": req.ProductID, "uid": req.Uid}); sign != req.Sign {
this.module.Errorf("PayDelivery SignError sgin:%s", sign)
payresp.Code = pb.ErrorCode_SignError
return
}
if err = this.module.service.RpcCall(
context.Background(),
comm.Service_Worker,
string(comm.Rpc_ModulePayDelivery),
payreq,
payresp); err != nil {
this.module.Errorln(err)
payresp.Code = pb.ErrorCode_RpcFuncExecutionError
}
}

View File

@ -3,6 +3,7 @@ package web
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log"
@ -21,6 +22,7 @@ func NewModule() core.IModule {
type Web struct {
cbase.ModuleBase
options *Options
service base.IRPCXService
api_comp *Api_Comp //提供weba pi服务的组件
modelUser *modelUserComp
modelNotify *modelNotifyComp
@ -40,6 +42,7 @@ func (this *Web) NewOptions() (options core.IModuleOptions) {
func (this *Web) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService)
this.options = options.(*Options)
return
}

View File

@ -161,7 +161,7 @@ type HoroscopeUpgradeResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Nid int32 `protobuf:"varint,1,opt,name=nid,proto3" json:"nid"` //成长线id 配置文件里面的 节点id 字段
Nid int32 `protobuf:"varint,1,opt,name=nid,proto3" json:"nid"` //成长线id 配置文件里面的 节点 字段
Lv int32 `protobuf:"varint,2,opt,name=lv,proto3" json:"lv"`
}

170
pb/pay_db.pb.go Normal file
View File

@ -0,0 +1,170 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: pay/pay_db.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
//支付订单数据表
type DBPayOrder struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Orderid string `protobuf:"bytes,1,opt,name=orderid,proto3" json:"orderid"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"`
Productid string `protobuf:"bytes,3,opt,name=productid,proto3" json:"productid"`
Ctime int64 `protobuf:"varint,4,opt,name=ctime,proto3" json:"ctime"`
}
func (x *DBPayOrder) Reset() {
*x = DBPayOrder{}
if protoimpl.UnsafeEnabled {
mi := &file_pay_pay_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBPayOrder) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBPayOrder) ProtoMessage() {}
func (x *DBPayOrder) ProtoReflect() protoreflect.Message {
mi := &file_pay_pay_db_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DBPayOrder.ProtoReflect.Descriptor instead.
func (*DBPayOrder) Descriptor() ([]byte, []int) {
return file_pay_pay_db_proto_rawDescGZIP(), []int{0}
}
func (x *DBPayOrder) GetOrderid() string {
if x != nil {
return x.Orderid
}
return ""
}
func (x *DBPayOrder) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBPayOrder) GetProductid() string {
if x != nil {
return x.Productid
}
return ""
}
func (x *DBPayOrder) GetCtime() int64 {
if x != nil {
return x.Ctime
}
return 0
}
var File_pay_pay_db_proto protoreflect.FileDescriptor
var file_pay_pay_db_proto_rawDesc = []byte{
0x0a, 0x10, 0x70, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0x6c, 0x0a, 0x0a, 0x44, 0x42, 0x50, 0x61, 0x79, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 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, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65,
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_pay_pay_db_proto_rawDescOnce sync.Once
file_pay_pay_db_proto_rawDescData = file_pay_pay_db_proto_rawDesc
)
func file_pay_pay_db_proto_rawDescGZIP() []byte {
file_pay_pay_db_proto_rawDescOnce.Do(func() {
file_pay_pay_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_pay_pay_db_proto_rawDescData)
})
return file_pay_pay_db_proto_rawDescData
}
var file_pay_pay_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_pay_pay_db_proto_goTypes = []interface{}{
(*DBPayOrder)(nil), // 0: DBPayOrder
}
var file_pay_pay_db_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_pay_pay_db_proto_init() }
func file_pay_pay_db_proto_init() {
if File_pay_pay_db_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_pay_pay_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBPayOrder); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pay_pay_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_pay_pay_db_proto_goTypes,
DependencyIndexes: file_pay_pay_db_proto_depIdxs,
MessageInfos: file_pay_pay_db_proto_msgTypes,
}.Build()
File_pay_pay_db_proto = out.File
file_pay_pay_db_proto_rawDesc = nil
file_pay_pay_db_proto_goTypes = nil
file_pay_pay_db_proto_depIdxs = nil
}

239
pb/pay_msg.pb.go Normal file
View File

@ -0,0 +1,239 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: pay/pay_msg.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
///支付系统发货请求
type PayDeliveryReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
Orderid string `protobuf:"bytes,2,opt,name=orderid,proto3" json:"orderid"`
Productid string `protobuf:"bytes,3,opt,name=productid,proto3" json:"productid"`
}
func (x *PayDeliveryReq) Reset() {
*x = PayDeliveryReq{}
if protoimpl.UnsafeEnabled {
mi := &file_pay_pay_msg_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PayDeliveryReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PayDeliveryReq) ProtoMessage() {}
func (x *PayDeliveryReq) ProtoReflect() protoreflect.Message {
mi := &file_pay_pay_msg_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PayDeliveryReq.ProtoReflect.Descriptor instead.
func (*PayDeliveryReq) Descriptor() ([]byte, []int) {
return file_pay_pay_msg_proto_rawDescGZIP(), []int{0}
}
func (x *PayDeliveryReq) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *PayDeliveryReq) GetOrderid() string {
if x != nil {
return x.Orderid
}
return ""
}
func (x *PayDeliveryReq) GetProductid() string {
if x != nil {
return x.Productid
}
return ""
}
///支付系统发货请求 回应
type PayDeliveryResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=ErrorCode" json:"code"`
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
}
func (x *PayDeliveryResp) Reset() {
*x = PayDeliveryResp{}
if protoimpl.UnsafeEnabled {
mi := &file_pay_pay_msg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PayDeliveryResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PayDeliveryResp) ProtoMessage() {}
func (x *PayDeliveryResp) ProtoReflect() protoreflect.Message {
mi := &file_pay_pay_msg_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PayDeliveryResp.ProtoReflect.Descriptor instead.
func (*PayDeliveryResp) Descriptor() ([]byte, []int) {
return file_pay_pay_msg_proto_rawDescGZIP(), []int{1}
}
func (x *PayDeliveryResp) GetCode() ErrorCode {
if x != nil {
return x.Code
}
return ErrorCode_Success
}
func (x *PayDeliveryResp) GetMsg() string {
if x != nil {
return x.Msg
}
return ""
}
var File_pay_pay_msg_proto protoreflect.FileDescriptor
var file_pay_pay_msg_proto_rawDesc = []byte{
0x0a, 0x11, 0x70, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 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, 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,
}
var (
file_pay_pay_msg_proto_rawDescOnce sync.Once
file_pay_pay_msg_proto_rawDescData = file_pay_pay_msg_proto_rawDesc
)
func file_pay_pay_msg_proto_rawDescGZIP() []byte {
file_pay_pay_msg_proto_rawDescOnce.Do(func() {
file_pay_pay_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_pay_pay_msg_proto_rawDescData)
})
return file_pay_pay_msg_proto_rawDescData
}
var file_pay_pay_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_pay_pay_msg_proto_goTypes = []interface{}{
(*PayDeliveryReq)(nil), // 0: PayDeliveryReq
(*PayDeliveryResp)(nil), // 1: PayDeliveryResp
(ErrorCode)(0), // 2: ErrorCode
}
var file_pay_pay_msg_proto_depIdxs = []int32{
2, // 0: PayDeliveryResp.code:type_name -> ErrorCode
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_pay_pay_msg_proto_init() }
func file_pay_pay_msg_proto_init() {
if File_pay_pay_msg_proto != nil {
return
}
file_errorcode_proto_init()
if !protoimpl.UnsafeEnabled {
file_pay_pay_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PayDeliveryReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pay_pay_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PayDeliveryResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pay_pay_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_pay_pay_msg_proto_goTypes,
DependencyIndexes: file_pay_pay_msg_proto_depIdxs,
MessageInfos: file_pay_pay_msg_proto_msgTypes,
}.Build()
File_pay_pay_msg_proto = out.File
file_pay_pay_msg_proto_rawDesc = nil
file_pay_pay_msg_proto_goTypes = nil
file_pay_pay_msg_proto_depIdxs = nil
}