fix: 调整创建订单的uuid

This commit is contained in:
周俊耀 2026-02-04 12:13:27 +08:00
parent 573ad1b147
commit 54b15344e0
4 changed files with 784 additions and 612 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,11 +5,11 @@ package bundle
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators"
_ "google.golang.org/protobuf/types/descriptorpb"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
_ "google.golang.org/protobuf/types/descriptorpb"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
@ -994,3 +994,6 @@ func (this *ExportWorkCastInfoResp) Validate() error {
}
return nil
}
func (this *OrderInfoByOrderUuidRequest) Validate() error {
return nil
}

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.21.1
// - protoc v5.26.1
// source: pb/bundle.proto
package bundle
@ -132,6 +132,8 @@ type BundleClient interface {
GetContractDetail(ctx context.Context, in *ContractDetailRequest, opts ...grpc_go.CallOption) (*ContractDetailResponse, common.ErrorWithAttachment)
GetDevelopmentCyclesByContractUUID(ctx context.Context, in *GetDevelopmentCyclesByContractUUIDRequest, opts ...grpc_go.CallOption) (*GetDevelopmentCyclesByContractUUIDResponse, common.ErrorWithAttachment)
GetPaymentCyclesByContractUUID(ctx context.Context, in *GetPaymentCyclesByContractUUIDRequest, opts ...grpc_go.CallOption) (*GetPaymentCyclesByContractUUIDResponse, common.ErrorWithAttachment)
UpdateOrderRecordByOrderUuid(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
OrderListByOrderUuid(ctx context.Context, in *OrderInfoByOrderUuidRequest, opts ...grpc_go.CallOption) (*OrderInfoByOrderNoResp, common.ErrorWithAttachment)
}
type bundleClient struct {
@ -232,6 +234,8 @@ type BundleClientImpl struct {
GetContractDetail func(ctx context.Context, in *ContractDetailRequest) (*ContractDetailResponse, error)
GetDevelopmentCyclesByContractUUID func(ctx context.Context, in *GetDevelopmentCyclesByContractUUIDRequest) (*GetDevelopmentCyclesByContractUUIDResponse, error)
GetPaymentCyclesByContractUUID func(ctx context.Context, in *GetPaymentCyclesByContractUUIDRequest) (*GetPaymentCyclesByContractUUIDResponse, error)
UpdateOrderRecordByOrderUuid func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
OrderListByOrderUuid func(ctx context.Context, in *OrderInfoByOrderUuidRequest) (*OrderInfoByOrderNoResp, error)
}
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
@ -804,6 +808,18 @@ func (c *bundleClient) GetPaymentCyclesByContractUUID(ctx context.Context, in *G
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetPaymentCyclesByContractUUID", in, out)
}
func (c *bundleClient) UpdateOrderRecordByOrderUuid(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateOrderRecordByOrderUuid", in, out)
}
func (c *bundleClient) OrderListByOrderUuid(ctx context.Context, in *OrderInfoByOrderUuidRequest, opts ...grpc_go.CallOption) (*OrderInfoByOrderNoResp, common.ErrorWithAttachment) {
out := new(OrderInfoByOrderNoResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OrderListByOrderUuid", in, out)
}
// BundleServer is the server API for Bundle service.
// All implementations must embed UnimplementedBundleServer
// for forward compatibility
@ -912,6 +928,8 @@ type BundleServer interface {
GetContractDetail(context.Context, *ContractDetailRequest) (*ContractDetailResponse, error)
GetDevelopmentCyclesByContractUUID(context.Context, *GetDevelopmentCyclesByContractUUIDRequest) (*GetDevelopmentCyclesByContractUUIDResponse, error)
GetPaymentCyclesByContractUUID(context.Context, *GetPaymentCyclesByContractUUIDRequest) (*GetPaymentCyclesByContractUUIDResponse, error)
UpdateOrderRecordByOrderUuid(context.Context, *OrderRecord) (*CommonResponse, error)
OrderListByOrderUuid(context.Context, *OrderInfoByOrderUuidRequest) (*OrderInfoByOrderNoResp, error)
mustEmbedUnimplementedBundleServer()
}
@ -1199,6 +1217,12 @@ func (UnimplementedBundleServer) GetDevelopmentCyclesByContractUUID(context.Cont
func (UnimplementedBundleServer) GetPaymentCyclesByContractUUID(context.Context, *GetPaymentCyclesByContractUUIDRequest) (*GetPaymentCyclesByContractUUIDResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPaymentCyclesByContractUUID not implemented")
}
func (UnimplementedBundleServer) UpdateOrderRecordByOrderUuid(context.Context, *OrderRecord) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateOrderRecordByOrderUuid not implemented")
}
func (UnimplementedBundleServer) OrderListByOrderUuid(context.Context, *OrderInfoByOrderUuidRequest) (*OrderInfoByOrderNoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method OrderListByOrderUuid not implemented")
}
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
@ -3924,6 +3948,64 @@ func _Bundle_GetPaymentCyclesByContractUUID_Handler(srv interface{}, ctx context
return interceptor(ctx, in, info, handler)
}
func _Bundle_UpdateOrderRecordByOrderUuid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(OrderRecord)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("UpdateOrderRecordByOrderUuid", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_OrderListByOrderUuid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(OrderInfoByOrderUuidRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("OrderListByOrderUuid", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
// Bundle_ServiceDesc is the grpc_go.ServiceDesc for Bundle service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -4303,6 +4385,14 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "GetPaymentCyclesByContractUUID",
Handler: _Bundle_GetPaymentCyclesByContractUUID_Handler,
},
{
MethodName: "UpdateOrderRecordByOrderUuid",
Handler: _Bundle_UpdateOrderRecordByOrderUuid_Handler,
},
{
MethodName: "OrderListByOrderUuid",
Handler: _Bundle_OrderListByOrderUuid_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "pb/bundle.proto",

View File

@ -15,7 +15,6 @@ import (
"fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/bundle/common"
bundleModel "fonchain-fiee/pkg/service/bundle/model"
uuid "github.com/satori/go.uuid"
"io"
"math"
"net/http"
@ -450,13 +449,14 @@ func CreateAntomPay(c *gin.Context) {
antomReq.Amount = req.ProductAllPrice
antomReq.Currency = req.ProductPriceCurrency
//antomReq.OutTradeNo = req.OutTradeNo
uuidV4, err := uuid.NewV4()
if err != nil {
fmt.Println("生成错误", err)
service.Error(c, errors.New("订单编号生成失败"))
return
}
antomReq.OutTradeNo = uuidV4.String()
//uuidV4, err := uuid.NewV4()
//if err != nil {
// fmt.Println("生成错误", err)
// service.Error(c, errors.New("订单编号生成失败"))
// return
//}
//antomReq.OutTradeNo = uuidV4.String()
antomReq.OutTradeNo = orderLimit.OrderUUID
antomReq.ReturnUrl = req.SuccessUrl
//调用微服务获取支付地址
@ -611,8 +611,8 @@ func AntomWebhook(c *gin.Context) {
fmt.Println("resp.Status:", resp.Status)
if resp.Status == "paid" {
//支付成功
_, updateStatusErr := service.BundleProvider.UpdateOrderRecordByOrderNo(context.Background(), &bundle.OrderRecord{
OrderNo: resp.OutTradeNo,
_, updateStatusErr := service.BundleProvider.UpdateOrderRecordByOrderUuid(context.Background(), &bundle.OrderRecord{
Uuid: resp.OutTradeNo,
PayTime: common.GetBeijingTime(),
Status: bundleModel.OrderPaid,
})
@ -634,8 +634,8 @@ func AntomWebhook(c *gin.Context) {
}
//添加余额
orderLimit, err := service.BundleProvider.OrderListByOrderNo(context.Background(), &bundle.OrderInfoByOrderNoRequest{
OrderNo: resp.OutTradeNo,
orderLimit, err := service.BundleProvider.OrderListByOrderUuid(context.Background(), &bundle.OrderInfoByOrderUuidRequest{
OrderUuid: resp.OutTradeNo,
})
if err != nil {
service.Error(c, err)