diff --git a/wx_payment/wx_payment.pb.go b/wx_payment/wx_payment.pb.go index e9a97e2..02b1b9b 100644 --- a/wx_payment/wx_payment.pb.go +++ b/wx_payment/wx_payment.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v5.27.1 +// protoc-gen-go v1.33.0 +// protoc v5.27.0 // source: wx_payment/wx_payment.proto package wx_payment @@ -326,6 +326,7 @@ type JsApiRequest struct { unknownFields protoimpl.UnknownFields Openid string `protobuf:"bytes,1,opt,name=openid,proto3" json:"openid,omitempty"` + Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` // 订单金额,单位是分 } func (x *JsApiRequest) Reset() { @@ -367,6 +368,13 @@ func (x *JsApiRequest) GetOpenid() string { return "" } +func (x *JsApiRequest) GetAmount() uint64 { + if x != nil { + return x.Amount + } + return 0 +} + type JsApiResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -955,35 +963,36 @@ var file_wx_payment_wx_payment_proto_rawDesc = []byte{ 0x6f, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x72, 0x6c, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x0a, 0x0c, 0x4a, 0x73, 0x41, 0x70, 0x69, 0x52, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x0a, 0x0c, 0x4a, 0x73, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x69, 0x64, 0x22, 0x9c, - 0x01, 0x0a, 0x0d, 0x4a, 0x73, 0x41, 0x70, 0x69, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1b, - 0x0a, 0x09, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, - 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x32, 0x62, 0x0a, - 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x51, - 0x0a, 0x10, 0x6a, 0x73, 0x61, 0x70, 0x69, 0x5f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x5f, 0x75, - 0x72, 0x6c, 0x12, 0x1c, 0x2e, 0x77, 0x78, 0x5f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, - 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x72, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1d, 0x2e, 0x77, 0x78, 0x5f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4e, 0x6f, - 0x74, 0x69, 0x66, 0x79, 0x55, 0x72, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x32, 0x52, 0x0a, 0x10, 0x57, 0x78, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x05, 0x6a, 0x73, 0x61, 0x70, 0x69, 0x12, 0x18, - 0x2e, 0x77, 0x78, 0x5f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4a, 0x73, 0x41, 0x70, - 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x77, 0x78, 0x5f, 0x70, 0x61, - 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4a, 0x73, 0x41, 0x70, 0x69, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x75, 0x73, 0x75, 0x6e, 0x6a, 0x79, 0x2f, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x69, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x77, 0x78, 0x5f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x69, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9c, 0x01, 0x0a, 0x0d, 0x4a, 0x73, 0x41, 0x70, 0x69, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x5f, + 0x73, 0x74, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x6e, 0x63, 0x65, + 0x53, 0x74, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, + 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, + 0x79, 0x53, 0x69, 0x67, 0x6e, 0x32, 0x62, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x51, 0x0a, 0x10, 0x6a, 0x73, 0x61, 0x70, 0x69, 0x5f, + 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x5f, 0x75, 0x72, 0x6c, 0x12, 0x1c, 0x2e, 0x77, 0x78, 0x5f, + 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x72, + 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x77, 0x78, 0x5f, 0x70, 0x61, + 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x72, 0x6c, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0x52, 0x0a, 0x10, 0x57, 0x78, 0x50, + 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, + 0x05, 0x6a, 0x73, 0x61, 0x70, 0x69, 0x12, 0x18, 0x2e, 0x77, 0x78, 0x5f, 0x70, 0x61, 0x79, 0x6d, + 0x65, 0x6e, 0x74, 0x2e, 0x4a, 0x73, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x19, 0x2e, 0x77, 0x78, 0x5f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4a, 0x73, + 0x41, 0x70, 0x69, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x34, 0x5a, + 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x75, 0x73, + 0x75, 0x6e, 0x6a, 0x79, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x69, 0x2d, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x77, 0x78, 0x5f, 0x70, 0x61, 0x79, 0x6d, + 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/wx_payment/wx_payment.pb.gw.go b/wx_payment/wx_payment.pb.gw.go index c3b3970..f249f85 100644 --- a/wx_payment/wx_payment.pb.gw.go +++ b/wx_payment/wx_payment.pb.gw.go @@ -154,21 +154,21 @@ func RegisterWxPaymentServiceHandlerServer(ctx context.Context, mux *runtime.Ser // RegisterNotifyServiceHandlerFromEndpoint is same as RegisterNotifyServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterNotifyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.NewClient(endpoint, opts...) + conn, err := grpc.DialContext(ctx, endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) } }() }() @@ -225,21 +225,21 @@ var ( // RegisterWxPaymentServiceHandlerFromEndpoint is same as RegisterWxPaymentServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterWxPaymentServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.NewClient(endpoint, opts...) + conn, err := grpc.DialContext(ctx, endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) } }() }() diff --git a/wx_payment/wx_payment.proto b/wx_payment/wx_payment.proto index e7b1d73..0efd0da 100644 --- a/wx_payment/wx_payment.proto +++ b/wx_payment/wx_payment.proto @@ -72,6 +72,7 @@ service NotifyService { message JsApiRequest { string openid = 1; + uint64 amount = 2; // 订单金额,单位是分 }; message JsApiResponse { diff --git a/wx_payment/wx_payment_grpc.pb.go b/wx_payment/wx_payment_grpc.pb.go index 6b5625d..d014523 100644 --- a/wx_payment/wx_payment_grpc.pb.go +++ b/wx_payment/wx_payment_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.1 +// - protoc-gen-go-grpc v1.3.0 +// - protoc v5.27.0 // source: wx_payment/wx_payment.proto package wx_payment @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( NotifyService_JsapiNotifyUrl_FullMethodName = "/wx_payment.NotifyService/jsapi_notify_url" @@ -38,9 +38,8 @@ func NewNotifyServiceClient(cc grpc.ClientConnInterface) NotifyServiceClient { } func (c *notifyServiceClient) JsapiNotifyUrl(ctx context.Context, in *NotifyUrlRequest, opts ...grpc.CallOption) (*NotifyUrlResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(NotifyUrlResponse) - err := c.cc.Invoke(ctx, NotifyService_JsapiNotifyUrl_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, NotifyService_JsapiNotifyUrl_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -129,9 +128,8 @@ func NewWxPaymentServiceClient(cc grpc.ClientConnInterface) WxPaymentServiceClie } func (c *wxPaymentServiceClient) Jsapi(ctx context.Context, in *JsApiRequest, opts ...grpc.CallOption) (*JsApiResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(JsApiResponse) - err := c.cc.Invoke(ctx, WxPaymentService_Jsapi_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, WxPaymentService_Jsapi_FullMethodName, in, out, opts...) if err != nil { return nil, err }