添加扩展和余量接口
This commit is contained in:
parent
44d5704606
commit
11b0192a23
File diff suppressed because it is too large
Load Diff
@ -99,6 +99,16 @@ func (this *BundleDetailResponseV2) Validate() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (this *OrderRecord) Validate() error {
|
func (this *OrderRecord) Validate() error {
|
||||||
|
for _, item := range this.PriceOptionsInfo {
|
||||||
|
if item != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("PriceOptionsInfo", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *PriceOptionsInfo) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (this *OrderRecordsRequest) Validate() error {
|
func (this *OrderRecordsRequest) Validate() error {
|
||||||
@ -236,9 +246,19 @@ func (this *BundleExtendRecordsListResponse) Validate() error {
|
|||||||
func (this *BundleExtendRecordItem) Validate() error {
|
func (this *BundleExtendRecordItem) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (this *SetBundleBalanceRequest) Validate() error {
|
func (this *GetBundleBalanceReq) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (this *SetBundleBalanceResponse) Validate() error {
|
func (this *BundleBalanceItem) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *GetBundleBalanceResp) Validate() error {
|
||||||
|
for _, item := range this.Data {
|
||||||
|
if item != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ type BundleClient interface {
|
|||||||
// 余量管理
|
// 余量管理
|
||||||
BundleExtend(ctx context.Context, in *BundleExtendRequest, opts ...grpc_go.CallOption) (*BundleExtendResponse, common.ErrorWithAttachment)
|
BundleExtend(ctx context.Context, in *BundleExtendRequest, opts ...grpc_go.CallOption) (*BundleExtendResponse, common.ErrorWithAttachment)
|
||||||
BundleExtendRecordsList(ctx context.Context, in *BundleExtendRecordsListRequest, opts ...grpc_go.CallOption) (*BundleExtendRecordsListResponse, common.ErrorWithAttachment)
|
BundleExtendRecordsList(ctx context.Context, in *BundleExtendRecordsListRequest, opts ...grpc_go.CallOption) (*BundleExtendRecordsListResponse, common.ErrorWithAttachment)
|
||||||
|
GetBundleBalance(ctx context.Context, in *GetBundleBalanceReq, opts ...grpc_go.CallOption) (*GetBundleBalanceResp, common.ErrorWithAttachment)
|
||||||
}
|
}
|
||||||
|
|
||||||
type bundleClient struct {
|
type bundleClient struct {
|
||||||
@ -84,6 +85,7 @@ type BundleClientImpl struct {
|
|||||||
ValueAddServiceDetail func(ctx context.Context, in *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
|
ValueAddServiceDetail func(ctx context.Context, in *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
|
||||||
BundleExtend func(ctx context.Context, in *BundleExtendRequest) (*BundleExtendResponse, error)
|
BundleExtend func(ctx context.Context, in *BundleExtendRequest) (*BundleExtendResponse, error)
|
||||||
BundleExtendRecordsList func(ctx context.Context, in *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
|
BundleExtendRecordsList func(ctx context.Context, in *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
|
||||||
|
GetBundleBalance func(ctx context.Context, in *GetBundleBalanceReq) (*GetBundleBalanceResp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
||||||
@ -236,6 +238,12 @@ func (c *bundleClient) BundleExtendRecordsList(ctx context.Context, in *BundleEx
|
|||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleExtendRecordsList", in, out)
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleExtendRecordsList", in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *bundleClient) GetBundleBalance(ctx context.Context, in *GetBundleBalanceReq, opts ...grpc_go.CallOption) (*GetBundleBalanceResp, common.ErrorWithAttachment) {
|
||||||
|
out := new(GetBundleBalanceResp)
|
||||||
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetBundleBalance", in, out)
|
||||||
|
}
|
||||||
|
|
||||||
// BundleServer is the server API for Bundle service.
|
// BundleServer is the server API for Bundle service.
|
||||||
// All implementations must embed UnimplementedBundleServer
|
// All implementations must embed UnimplementedBundleServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
@ -266,6 +274,7 @@ type BundleServer interface {
|
|||||||
// 余量管理
|
// 余量管理
|
||||||
BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error)
|
BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error)
|
||||||
BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
|
BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
|
||||||
|
GetBundleBalance(context.Context, *GetBundleBalanceReq) (*GetBundleBalanceResp, error)
|
||||||
mustEmbedUnimplementedBundleServer()
|
mustEmbedUnimplementedBundleServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,6 +352,9 @@ func (UnimplementedBundleServer) BundleExtend(context.Context, *BundleExtendRequ
|
|||||||
func (UnimplementedBundleServer) BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error) {
|
func (UnimplementedBundleServer) BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method BundleExtendRecordsList not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method BundleExtendRecordsList not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedBundleServer) GetBundleBalance(context.Context, *GetBundleBalanceReq) (*GetBundleBalanceResp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetBundleBalance not implemented")
|
||||||
|
}
|
||||||
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||||
s.proxyImpl = impl
|
s.proxyImpl = impl
|
||||||
}
|
}
|
||||||
@ -1038,6 +1050,35 @@ func _Bundle_BundleExtendRecordsList_Handler(srv interface{}, ctx context.Contex
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Bundle_GetBundleBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetBundleBalanceReq)
|
||||||
|
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("GetBundleBalance", 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.
|
// Bundle_ServiceDesc is the grpc_go.ServiceDesc for Bundle service.
|
||||||
// It's only intended for direct use with grpc_go.RegisterService,
|
// It's only intended for direct use with grpc_go.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@ -1137,6 +1178,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
MethodName: "BundleExtendRecordsList",
|
MethodName: "BundleExtendRecordsList",
|
||||||
Handler: _Bundle_BundleExtendRecordsList_Handler,
|
Handler: _Bundle_BundleExtendRecordsList_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetBundleBalance",
|
||||||
|
Handler: _Bundle_GetBundleBalance_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc_go.StreamDesc{},
|
Streams: []grpc_go.StreamDesc{},
|
||||||
Metadata: "pb/bundle.proto",
|
Metadata: "pb/bundle.proto",
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"fonchain-fiee/pkg/middleware"
|
"fonchain-fiee/pkg/middleware"
|
||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
"fonchain-fiee/pkg/service/bundle"
|
"fonchain-fiee/pkg/service/bundle"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,6 +28,12 @@ func BundleRouter(r *gin.RouterGroup) {
|
|||||||
bundleAppRoute.POST("bundle-list", bundle.BundleList)
|
bundleAppRoute.POST("bundle-list", bundle.BundleList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bundleExtend := bundleAppRoute.Group("extend")
|
||||||
|
{
|
||||||
|
bundleExtend.POST("", bundle.BundleExtend)
|
||||||
|
bundleExtend.POST("list", bundle.BundleExtendRecordsList)
|
||||||
|
bundleExtend.POST("balance", bundle.GetBundleBalance)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,11 @@ import (
|
|||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func BundleExtend(c *gin.Context) {
|
func BundleExtend(c *gin.Context) {
|
||||||
var req bundle.BundleExtendRequest
|
var req bundle.BundleExtendRequest
|
||||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
service.Error(c, err)
|
service.Error(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -25,7 +24,7 @@ func BundleExtend(c *gin.Context) {
|
|||||||
|
|
||||||
func BundleExtendRecordsList(c *gin.Context) {
|
func BundleExtendRecordsList(c *gin.Context) {
|
||||||
var req bundle.BundleExtendRecordsListRequest
|
var req bundle.BundleExtendRecordsListRequest
|
||||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
service.Error(c, err)
|
service.Error(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -36,3 +35,17 @@ func BundleExtendRecordsList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
service.Success(c, res)
|
service.Success(c, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetBundleBalance(c *gin.Context) {
|
||||||
|
var req bundle.GetBundleBalanceReq
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res, err := service.BundleProvider.GetBundleBalance(context.Background(), &req)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
service.Success(c, res)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user