增加增值套餐服务
This commit is contained in:
parent
695d676dce
commit
f0acd9503d
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,14 @@ service Bundle {
|
||||
rpc OrderRecordsList(OrderRecordsRequest) returns (OrderRecordsResponse) {}
|
||||
rpc OrderRecordsDetail(OrderRecordsDetailRequest) returns (OrderRecordsDetailResponse) {}
|
||||
|
||||
//增值套餐
|
||||
rpc CreateValueAddBundle(ValueAddBundleProfile) returns (CommonResponse) {}
|
||||
rpc UpdateValueAddBundle(ValueAddBundleProfile) returns (CommonResponse) {}
|
||||
rpc DeleteValueAddBundle(DelValueAddBundleRequest) returns (CommonResponse) {}
|
||||
rpc ValueAddBundleList(ValueAddBundleListRequest) returns (ValueAddBundleListResponse) {}
|
||||
rpc ValueAddBundleDetail(ValueAddBundleDetailRequest) returns (ValueAddBundleDetailResponse) {}
|
||||
rpc ValueAddBundleRecordDetail(ValueAddBundleDetailRequest) returns(ValueAddBundleDetailResponse) {}
|
||||
|
||||
}
|
||||
|
||||
message CommonResponse {
|
||||
@ -84,6 +92,16 @@ message OrderRecord {
|
||||
string orderNo = 16 [json_name = "orderNo"];
|
||||
string bundleName = 17 [json_name = "bundleName"];
|
||||
string contractNo = 18 [json_name = "contractNo"];
|
||||
|
||||
bool isHaveValueAdd = 19 [json_name = "isHaveValueAdd"]; //是否有增值套餐
|
||||
bool isValueAddCustom= 20 [json_name = "isValueAddCustom"]; //是否自定义增值套餐条数
|
||||
string valueAddBundleUuid= 21 [json_name= "valueAddBundleUuid"]; //增值套餐UUID
|
||||
int64 ValueAddBundleNum= 22 [json_name= "ValueAddBundleNum"]; //增值套餐条数
|
||||
float OriginalPrice= 23 [json_name= "OriginalPrice"]; //增值套餐原单价
|
||||
float DiscountPrice= 24 [json_name= "DiscountPrice"]; //增值套餐优惠单价
|
||||
float ValueAddBundleAmount= 25 [json_name= "ValueAddBundleAmount"]; //增值套餐总价
|
||||
float SavedAmount= 26 [json_name= "SavedAmount"]; //增值套餐节省金额
|
||||
float totalAmount = 27 [json_name = "totalAmount"]; //总金额
|
||||
}
|
||||
|
||||
message OrderRecordsRequest {
|
||||
@ -100,6 +118,7 @@ message OrderRecordsRequest {
|
||||
string startPayTime = 11 [json_name = "startPayTime"];
|
||||
string endPayTime = 12 [json_name = "endPayTime"];
|
||||
string customerID = 13 [json_name = "customerID"];
|
||||
string IsHaveValueAdd = 14 [json_name = "IsHaveValueAdd"];//有无增值选项
|
||||
}
|
||||
|
||||
message OrderRecordsResponse {
|
||||
@ -116,4 +135,50 @@ message OrderRecordsDetailRequest {
|
||||
message OrderRecordsDetailResponse {
|
||||
OrderRecord orderRecord = 1 [json_name = "orderRecord"];
|
||||
string msg = 2 [json_name = "msg"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 增值套餐
|
||||
message ValueAddBundleProfile {
|
||||
string uuid = 1 [json_name = "uuid"];
|
||||
string name = 2 [json_name = "name"];
|
||||
int64 num = 3 [json_name = "num"];
|
||||
float originalPrice = 4 [json_name = "originalPrice"];
|
||||
float discountPrice = 5 [json_name = "discountPrice"];
|
||||
float totalPrice = 6 [json_name = "totalPrice"];
|
||||
float savedAmount = 7 [json_name = "savedAmount"];
|
||||
string language = 11 [json_name = "language"];
|
||||
string createdAt = 12 [json_name = "createdAt"];
|
||||
string updatedAt = 13 [json_name = "updatedAt"];
|
||||
}
|
||||
|
||||
|
||||
message DelValueAddBundleRequest {
|
||||
string uuid = 1 [json_name = "uuid"];
|
||||
}
|
||||
|
||||
// 增值套餐列表请求
|
||||
message ValueAddBundleListRequest {
|
||||
int32 page = 1 [json_name = "page"];
|
||||
int32 pageSize = 2 [json_name = "pageSize"];
|
||||
string name = 3 [json_name = "name"];
|
||||
int64 num = 4 [json_name = "num"];
|
||||
float originalPrice = 5 [json_name = "originalPrice"];
|
||||
float discountPrice = 6 [json_name = "discountPrice"];
|
||||
float totalPrice = 7 [json_name = "totalPrice"];
|
||||
float savedAmount = 8 [json_name = "savedAmount"];
|
||||
string language = 9 [json_name = "language"];
|
||||
|
||||
}
|
||||
message ValueAddBundleListResponse {
|
||||
repeated ValueAddBundleProfile bundles = 1 [json_name = "bundles"];
|
||||
int32 total = 2 [json_name = "total"];
|
||||
}
|
||||
message ValueAddBundleDetailRequest {
|
||||
string uuid = 1 [json_name = "uuid"];
|
||||
}
|
||||
message ValueAddBundleDetailResponse {
|
||||
ValueAddBundleProfile bundle = 1 [json_name = "bundle"];
|
||||
string msg = 2 [json_name = "msg"];
|
||||
}
|
@ -75,3 +75,33 @@ func (this *OrderRecordsDetailResponse) Validate() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ValueAddBundleProfile) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *DelValueAddBundleRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ValueAddBundleListRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ValueAddBundleListResponse) Validate() error {
|
||||
for _, item := range this.Bundles {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Bundles", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ValueAddBundleDetailRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ValueAddBundleDetailResponse) Validate() error {
|
||||
if this.Bundle != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Bundle); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Bundle", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v3.10.1
|
||||
// - protoc v5.29.2
|
||||
// source: pb/bundle.proto
|
||||
|
||||
package bundle
|
||||
@ -38,6 +38,13 @@ type BundleClient interface {
|
||||
UpdateOrderRecordByOrderNo(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
OrderRecordsList(ctx context.Context, in *OrderRecordsRequest, opts ...grpc_go.CallOption) (*OrderRecordsResponse, common.ErrorWithAttachment)
|
||||
OrderRecordsDetail(ctx context.Context, in *OrderRecordsDetailRequest, opts ...grpc_go.CallOption) (*OrderRecordsDetailResponse, common.ErrorWithAttachment)
|
||||
//增值套餐
|
||||
CreateValueAddBundle(ctx context.Context, in *ValueAddBundleProfile, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
UpdateValueAddBundle(ctx context.Context, in *ValueAddBundleProfile, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
DeleteValueAddBundle(ctx context.Context, in *DelValueAddBundleRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment)
|
||||
ValueAddBundleDetail(ctx context.Context, in *ValueAddBundleDetailRequest, opts ...grpc_go.CallOption) (*ValueAddBundleDetailResponse, common.ErrorWithAttachment)
|
||||
ValueAddBundleRecordDetail(ctx context.Context, in *ValueAddBundleDetailRequest, opts ...grpc_go.CallOption) (*ValueAddBundleDetailResponse, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type bundleClient struct {
|
||||
@ -55,6 +62,12 @@ type BundleClientImpl struct {
|
||||
UpdateOrderRecordByOrderNo func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
OrderRecordsList func(ctx context.Context, in *OrderRecordsRequest) (*OrderRecordsResponse, error)
|
||||
OrderRecordsDetail func(ctx context.Context, in *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
|
||||
CreateValueAddBundle func(ctx context.Context, in *ValueAddBundleProfile) (*CommonResponse, error)
|
||||
UpdateValueAddBundle func(ctx context.Context, in *ValueAddBundleProfile) (*CommonResponse, error)
|
||||
DeleteValueAddBundle func(ctx context.Context, in *DelValueAddBundleRequest) (*CommonResponse, error)
|
||||
ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||
ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||
ValueAddBundleRecordDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||
}
|
||||
|
||||
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
||||
@ -129,6 +142,42 @@ func (c *bundleClient) OrderRecordsDetail(ctx context.Context, in *OrderRecordsD
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OrderRecordsDetail", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) CreateValueAddBundle(ctx context.Context, in *ValueAddBundleProfile, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateValueAddBundle", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) UpdateValueAddBundle(ctx context.Context, in *ValueAddBundleProfile, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateValueAddBundle", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) DeleteValueAddBundle(ctx context.Context, in *DelValueAddBundleRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/DeleteValueAddBundle", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment) {
|
||||
out := new(ValueAddBundleListResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ValueAddBundleList", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) ValueAddBundleDetail(ctx context.Context, in *ValueAddBundleDetailRequest, opts ...grpc_go.CallOption) (*ValueAddBundleDetailResponse, common.ErrorWithAttachment) {
|
||||
out := new(ValueAddBundleDetailResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ValueAddBundleDetail", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) ValueAddBundleRecordDetail(ctx context.Context, in *ValueAddBundleDetailRequest, opts ...grpc_go.CallOption) (*ValueAddBundleDetailResponse, common.ErrorWithAttachment) {
|
||||
out := new(ValueAddBundleDetailResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ValueAddBundleRecordDetail", in, out)
|
||||
}
|
||||
|
||||
// BundleServer is the server API for Bundle service.
|
||||
// All implementations must embed UnimplementedBundleServer
|
||||
// for forward compatibility
|
||||
@ -143,6 +192,13 @@ type BundleServer interface {
|
||||
UpdateOrderRecordByOrderNo(context.Context, *OrderRecord) (*CommonResponse, error)
|
||||
OrderRecordsList(context.Context, *OrderRecordsRequest) (*OrderRecordsResponse, error)
|
||||
OrderRecordsDetail(context.Context, *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
|
||||
//增值套餐
|
||||
CreateValueAddBundle(context.Context, *ValueAddBundleProfile) (*CommonResponse, error)
|
||||
UpdateValueAddBundle(context.Context, *ValueAddBundleProfile) (*CommonResponse, error)
|
||||
DeleteValueAddBundle(context.Context, *DelValueAddBundleRequest) (*CommonResponse, error)
|
||||
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||
ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||
ValueAddBundleRecordDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||
mustEmbedUnimplementedBundleServer()
|
||||
}
|
||||
|
||||
@ -181,6 +237,24 @@ func (UnimplementedBundleServer) OrderRecordsList(context.Context, *OrderRecords
|
||||
func (UnimplementedBundleServer) OrderRecordsDetail(context.Context, *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OrderRecordsDetail not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) CreateValueAddBundle(context.Context, *ValueAddBundleProfile) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateValueAddBundle not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) UpdateValueAddBundle(context.Context, *ValueAddBundleProfile) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateValueAddBundle not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) DeleteValueAddBundle(context.Context, *DelValueAddBundleRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteValueAddBundle not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ValueAddBundleList not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ValueAddBundleDetail not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) ValueAddBundleRecordDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ValueAddBundleRecordDetail not implemented")
|
||||
}
|
||||
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
@ -499,6 +573,180 @@ func _Bundle_OrderRecordsDetail_Handler(srv interface{}, ctx context.Context, de
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_CreateValueAddBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ValueAddBundleProfile)
|
||||
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("CreateValueAddBundle", 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_UpdateValueAddBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ValueAddBundleProfile)
|
||||
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("UpdateValueAddBundle", 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_DeleteValueAddBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DelValueAddBundleRequest)
|
||||
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("DeleteValueAddBundle", 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_ValueAddBundleList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ValueAddBundleListRequest)
|
||||
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("ValueAddBundleList", 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_ValueAddBundleDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ValueAddBundleDetailRequest)
|
||||
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("ValueAddBundleDetail", 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_ValueAddBundleRecordDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ValueAddBundleDetailRequest)
|
||||
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("ValueAddBundleRecordDetail", 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)
|
||||
@ -546,6 +794,30 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "OrderRecordsDetail",
|
||||
Handler: _Bundle_OrderRecordsDetail_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateValueAddBundle",
|
||||
Handler: _Bundle_CreateValueAddBundle_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateValueAddBundle",
|
||||
Handler: _Bundle_UpdateValueAddBundle_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteValueAddBundle",
|
||||
Handler: _Bundle_DeleteValueAddBundle_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ValueAddBundleList",
|
||||
Handler: _Bundle_ValueAddBundleList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ValueAddBundleDetail",
|
||||
Handler: _Bundle_ValueAddBundleDetail_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ValueAddBundleRecordDetail",
|
||||
Handler: _Bundle_ValueAddBundleRecordDetail_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "pb/bundle.proto",
|
||||
|
@ -10,9 +10,10 @@ import (
|
||||
"fonchain-fiee/pkg/service/redirect"
|
||||
"fonchain-fiee/pkg/service/upload"
|
||||
"fonchain-fiee/pkg/service/version"
|
||||
"github.com/gin-contrib/gzip"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-contrib/gzip"
|
||||
|
||||
"github.com/gin-contrib/pprof"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@ -39,6 +40,7 @@ func NewRouter() *gin.Engine {
|
||||
|
||||
BundleRouter(privateGroup)
|
||||
BundleOrderRouter(privateGroup)
|
||||
ValueAddBundleRouter(privateGroup)
|
||||
|
||||
{
|
||||
v1.POST("version", version.Version) //版本号公共
|
||||
|
32
pkg/router/valueAddBundle.go
Normal file
32
pkg/router/valueAddBundle.go
Normal file
@ -0,0 +1,32 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"fonchain-fiee/pkg/service/bundle"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func ValueAddBundleRouter(r *gin.RouterGroup) {
|
||||
valueAddBundleRoute := r.Group("valueAdd-bundle")
|
||||
|
||||
// 增值套餐
|
||||
{
|
||||
bundleClientRoute := valueAddBundleRoute.Group("system")
|
||||
{
|
||||
bundleClientRoute.POST("create", bundle.CreateBundle)
|
||||
bundleClientRoute.POST("update", bundle.UpdateBundle)
|
||||
bundleClientRoute.POST("remove", bundle.DeleteBundle)
|
||||
}
|
||||
|
||||
bundleAppRoute := valueAddBundleRoute.Group("common")
|
||||
{
|
||||
bundleAppRoute.POST("valueAdd-bundle-list", bundle.BundleList)
|
||||
}
|
||||
bundleCalcRoute := valueAddBundleRoute.Group("calc")
|
||||
{
|
||||
bundleCalcRoute.POST("price", bundle.CalculateBundlePrice)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -10,9 +10,10 @@ import (
|
||||
"fonchain-fiee/pkg/service/bundle/common"
|
||||
"fonchain-fiee/pkg/service/bundle/logic"
|
||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func CreateBundleOrderSignature(c *gin.Context) {
|
||||
@ -27,7 +28,6 @@ func CreateBundleOrderSignature(c *gin.Context) {
|
||||
service.Error(c, errors.New(common.MissBundleUUID))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Signature == "" {
|
||||
service.Error(c, errors.New(common.MissOrderSignature))
|
||||
return
|
||||
@ -88,10 +88,34 @@ func CreateBundleOrderSignature(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
//获取增值套餐信息
|
||||
if req.ValueAddBundleUuid != "" {
|
||||
req.IsHaveValueAdd = true
|
||||
valueAddBundleDetail, err := service.BundleProvider.ValueAddBundleDetail(context.Background(), &bundle.ValueAddBundleDetailRequest{
|
||||
Uuid: req.ValueAddBundleUuid,
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
//如果是增值套餐条数大于等于30 则手动计算价格
|
||||
if req.IsValueAddCustom {
|
||||
valueAddBundleDetail.Bundle.TotalPrice = valueAddBundleDetail.Bundle.DiscountPrice * float32(req.ValueAddBundleNum)
|
||||
req.SavedAmount = (valueAddBundleDetail.Bundle.OriginalPrice - valueAddBundleDetail.Bundle.DiscountPrice) * float32(req.ValueAddBundleNum)
|
||||
} else {
|
||||
req.ValueAddBundleNum = int64(valueAddBundleDetail.Bundle.Num)
|
||||
req.SavedAmount = valueAddBundleDetail.Bundle.SavedAmount
|
||||
}
|
||||
req.OriginalPrice = valueAddBundleDetail.Bundle.OriginalPrice
|
||||
req.DiscountPrice = valueAddBundleDetail.Bundle.DiscountPrice
|
||||
req.ValueAddBundleAmount = valueAddBundleDetail.Bundle.TotalPrice
|
||||
}
|
||||
|
||||
req.BundleName = bundleDetail.Bundle.Name
|
||||
req.Amount = bundleDetail.Bundle.Price
|
||||
req.AmountType = bundleDetail.Bundle.PriceType
|
||||
|
||||
req.TotalAmount = req.Amount + req.ValueAddBundleAmount
|
||||
req.PayType = 1 // 默认 人民币
|
||||
|
||||
req.ContractNo = common.GenerateContractNo(lastContractNo)
|
||||
@ -240,3 +264,32 @@ func OrderRecordsDetail(c *gin.Context) {
|
||||
|
||||
service.Success(c, res)
|
||||
}
|
||||
func CalculateBundlePrice(c *gin.Context) {
|
||||
var req bundle.ValueAddBundleProfile
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
detail, err := service.BundleProvider.ValueAddBundleDetail(context.Background(), &bundle.ValueAddBundleDetailRequest{
|
||||
Uuid: req.Uuid,
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
price := detail.Bundle.DiscountPrice * float32(req.Num)
|
||||
service.Success(c, price)
|
||||
}
|
||||
func ValueAddBundleRecordDetail(c *gin.Context) {
|
||||
var req bundle.ValueAddBundleDetailRequest
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
detail, err := service.BundleProvider.ValueAddBundleRecordDetail(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
service.Success(c, detail)
|
||||
}
|
||||
|
@ -12,7 +12,8 @@ const (
|
||||
MissOrderNo = "缺少订单号"
|
||||
MissOrderUUID = "缺少订单信息"
|
||||
|
||||
NotMatchOrderInfo = "非当前用户订单信息不可操作"
|
||||
NotMatchOrderInfo = "非当前用户订单信息不可操作"
|
||||
InvalidOrderAmount = "订单金额错误"
|
||||
|
||||
HadPay = "订单已支付"
|
||||
|
||||
|
@ -11,11 +11,12 @@ import (
|
||||
"fonchain-fiee/pkg/service"
|
||||
"fonchain-fiee/pkg/service/bundle/common"
|
||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
|
||||
func CreateStripeCheckoutSession(c *gin.Context) {
|
||||
@ -44,6 +45,11 @@ func CreateStripeCheckoutSession(c *gin.Context) {
|
||||
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
||||
return
|
||||
}
|
||||
//金额校验
|
||||
if detail.OrderRecord.TotalAmount != float32(req.ProductAllPrice) {
|
||||
service.Error(c, errors.New(common.InvalidOrderAmount))
|
||||
return
|
||||
}
|
||||
|
||||
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
||||
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
|
||||
|
79
pkg/service/bundle/valueAddBundle.go
Normal file
79
pkg/service/bundle/valueAddBundle.go
Normal file
@ -0,0 +1,79 @@
|
||||
package bundle
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fonchain-fiee/api/bundle"
|
||||
"fonchain-fiee/pkg/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
|
||||
func CreateValueAddBundle(c *gin.Context) {
|
||||
var req bundle.ValueAddBundleProfile
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
res, err := service.BundleProvider.CreateValueAddBundle(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
}
|
||||
|
||||
func UpdateValueAddBundle(c *gin.Context) {
|
||||
var req bundle.ValueAddBundleProfile
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
res, err := service.BundleProvider.UpdateValueAddBundle(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
|
||||
}
|
||||
|
||||
func DeleteValueAddBundle(c *gin.Context) {
|
||||
var req bundle.DelValueAddBundleRequest
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
res, err := service.BundleProvider.DeleteValueAddBundle(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
}
|
||||
|
||||
func ValueAddBundleList(c *gin.Context) {
|
||||
var req bundle.ValueAddBundleListRequest
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
res, err := service.BundleProvider.ValueAddBundleList(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
}
|
Loading…
Reference in New Issue
Block a user