修改订单创建
This commit is contained in:
parent
6ae9395add
commit
a439342ba2
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,19 @@ var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
func (this *OrderCreateRecord) Validate() error {
|
||||
for _, item := range this.AddRecords {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("AddRecords", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *OrderCreateAddRecord) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *OrderRecordsRequestV2) Validate() error {
|
||||
return nil
|
||||
}
|
||||
@ -67,13 +80,6 @@ func (this *BundleProfile) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleProfileLang) Validate() error {
|
||||
for _, item := range this.ValueAddServiceLang {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ValueAddServiceLang", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SaveResponse) Validate() error {
|
||||
@ -118,13 +124,6 @@ func (this *BundleDetailResponseV2) Validate() error {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Bundle", err)
|
||||
}
|
||||
}
|
||||
for _, item := range this.SelectValueAddService {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("SelectValueAddService", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *OrderRecord) Validate() error {
|
||||
@ -259,9 +258,53 @@ func (this *ValueAddServiceDetailRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ValueAddServiceDetailResponse) Validate() error {
|
||||
if this.ValueAddServiceLang != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ValueAddServiceLang); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ValueAddServiceLang", err)
|
||||
if this.ValueAddService != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ValueAddService); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ValueAddService", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *CalculatePriceRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CalculatePriceResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleExtendRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleExtendResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleExtendRecordsListRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleExtendRecordsListResponse) 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
|
||||
}
|
||||
func (this *BundleExtendRecordItem) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetBundleBalanceReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
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
|
||||
|
@ -37,7 +37,7 @@ type BundleClient interface {
|
||||
BundleDetailV2(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleDetailResponseV2, common.ErrorWithAttachment)
|
||||
BundleList(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment)
|
||||
BundleDetail(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleDetailResponse, common.ErrorWithAttachment)
|
||||
CreateOrderRecord(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
CreateOrderRecord(ctx context.Context, in *OrderCreateRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
UpdateOrderRecord(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
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)
|
||||
@ -54,6 +54,12 @@ type BundleClient interface {
|
||||
SaveValueAddService(ctx context.Context, in *ValueAddServiceLang, opts ...grpc_go.CallOption) (*SaveResponse, common.ErrorWithAttachment)
|
||||
ValueAddServiceList(ctx context.Context, in *ValueAddServiceListRequest, opts ...grpc_go.CallOption) (*ValueAddServiceListResponse, common.ErrorWithAttachment)
|
||||
ValueAddServiceDetail(ctx context.Context, in *ValueAddServiceDetailRequest, opts ...grpc_go.CallOption) (*ValueAddServiceDetailResponse, common.ErrorWithAttachment)
|
||||
ValueAddServiceLangByUuidAndLanguage(ctx context.Context, in *ValueAddServiceDetailRequest, opts ...grpc_go.CallOption) (*ValueAddServiceLang, common.ErrorWithAttachment)
|
||||
CalculatePrice(ctx context.Context, in *CalculatePriceRequest, opts ...grpc_go.CallOption) (*CalculatePriceResponse, 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)
|
||||
GetBundleBalance(ctx context.Context, in *GetBundleBalanceReq, opts ...grpc_go.CallOption) (*GetBundleBalanceResp, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type bundleClient struct {
|
||||
@ -70,7 +76,7 @@ type BundleClientImpl struct {
|
||||
BundleDetailV2 func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponseV2, error)
|
||||
BundleList func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetail func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponse, error)
|
||||
CreateOrderRecord func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
CreateOrderRecord func(ctx context.Context, in *OrderCreateRecord) (*CommonResponse, error)
|
||||
UpdateOrderRecord func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
UpdateOrderRecordByOrderNo func(ctx context.Context, in *OrderRecord) (*CommonResponse, error)
|
||||
OrderRecordsList func(ctx context.Context, in *OrderRecordsRequest) (*OrderRecordsResponse, error)
|
||||
@ -85,6 +91,11 @@ type BundleClientImpl struct {
|
||||
SaveValueAddService func(ctx context.Context, in *ValueAddServiceLang) (*SaveResponse, error)
|
||||
ValueAddServiceList func(ctx context.Context, in *ValueAddServiceListRequest) (*ValueAddServiceListResponse, error)
|
||||
ValueAddServiceDetail func(ctx context.Context, in *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
|
||||
ValueAddServiceLangByUuidAndLanguage func(ctx context.Context, in *ValueAddServiceDetailRequest) (*ValueAddServiceLang, error)
|
||||
CalculatePrice func(ctx context.Context, in *CalculatePriceRequest) (*CalculatePriceResponse, error)
|
||||
BundleExtend func(ctx context.Context, in *BundleExtendRequest) (*BundleExtendResponse, 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 {
|
||||
@ -153,7 +164,7 @@ func (c *bundleClient) BundleDetail(ctx context.Context, in *BundleDetailRequest
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleDetail", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) CreateOrderRecord(ctx context.Context, in *OrderRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
func (c *bundleClient) CreateOrderRecord(ctx context.Context, in *OrderCreateRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateOrderRecord", in, out)
|
||||
@ -243,6 +254,36 @@ func (c *bundleClient) ValueAddServiceDetail(ctx context.Context, in *ValueAddSe
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ValueAddServiceDetail", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) ValueAddServiceLangByUuidAndLanguage(ctx context.Context, in *ValueAddServiceDetailRequest, opts ...grpc_go.CallOption) (*ValueAddServiceLang, common.ErrorWithAttachment) {
|
||||
out := new(ValueAddServiceLang)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ValueAddServiceLangByUuidAndLanguage", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) CalculatePrice(ctx context.Context, in *CalculatePriceRequest, opts ...grpc_go.CallOption) (*CalculatePriceResponse, common.ErrorWithAttachment) {
|
||||
out := new(CalculatePriceResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CalculatePrice", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) BundleExtend(ctx context.Context, in *BundleExtendRequest, opts ...grpc_go.CallOption) (*BundleExtendResponse, common.ErrorWithAttachment) {
|
||||
out := new(BundleExtendResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleExtend", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) BundleExtendRecordsList(ctx context.Context, in *BundleExtendRecordsListRequest, opts ...grpc_go.CallOption) (*BundleExtendRecordsListResponse, common.ErrorWithAttachment) {
|
||||
out := new(BundleExtendRecordsListResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
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.
|
||||
// All implementations must embed UnimplementedBundleServer
|
||||
// for forward compatibility
|
||||
@ -256,7 +297,7 @@ type BundleServer interface {
|
||||
BundleDetailV2(context.Context, *BundleDetailRequest) (*BundleDetailResponseV2, error)
|
||||
BundleList(context.Context, *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetail(context.Context, *BundleDetailRequest) (*BundleDetailResponse, error)
|
||||
CreateOrderRecord(context.Context, *OrderRecord) (*CommonResponse, error)
|
||||
CreateOrderRecord(context.Context, *OrderCreateRecord) (*CommonResponse, error)
|
||||
UpdateOrderRecord(context.Context, *OrderRecord) (*CommonResponse, error)
|
||||
UpdateOrderRecordByOrderNo(context.Context, *OrderRecord) (*CommonResponse, error)
|
||||
OrderRecordsList(context.Context, *OrderRecordsRequest) (*OrderRecordsResponse, error)
|
||||
@ -273,6 +314,12 @@ type BundleServer interface {
|
||||
SaveValueAddService(context.Context, *ValueAddServiceLang) (*SaveResponse, error)
|
||||
ValueAddServiceList(context.Context, *ValueAddServiceListRequest) (*ValueAddServiceListResponse, error)
|
||||
ValueAddServiceDetail(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
|
||||
ValueAddServiceLangByUuidAndLanguage(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceLang, error)
|
||||
CalculatePrice(context.Context, *CalculatePriceRequest) (*CalculatePriceResponse, error)
|
||||
// 余量管理
|
||||
BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error)
|
||||
BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
|
||||
GetBundleBalance(context.Context, *GetBundleBalanceReq) (*GetBundleBalanceResp, error)
|
||||
mustEmbedUnimplementedBundleServer()
|
||||
}
|
||||
|
||||
@ -308,7 +355,7 @@ func (UnimplementedBundleServer) BundleList(context.Context, *BundleListRequest)
|
||||
func (UnimplementedBundleServer) BundleDetail(context.Context, *BundleDetailRequest) (*BundleDetailResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleDetail not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) CreateOrderRecord(context.Context, *OrderRecord) (*CommonResponse, error) {
|
||||
func (UnimplementedBundleServer) CreateOrderRecord(context.Context, *OrderCreateRecord) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateOrderRecord not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) UpdateOrderRecord(context.Context, *OrderRecord) (*CommonResponse, error) {
|
||||
@ -353,6 +400,21 @@ func (UnimplementedBundleServer) ValueAddServiceList(context.Context, *ValueAddS
|
||||
func (UnimplementedBundleServer) ValueAddServiceDetail(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ValueAddServiceDetail not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) ValueAddServiceLangByUuidAndLanguage(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceLang, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ValueAddServiceLangByUuidAndLanguage not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) CalculatePrice(context.Context, *CalculatePriceRequest) (*CalculatePriceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CalculatePrice not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleExtend not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error) {
|
||||
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) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
@ -643,7 +705,7 @@ func _Bundle_BundleDetail_Handler(srv interface{}, ctx context.Context, dec func
|
||||
}
|
||||
|
||||
func _Bundle_CreateOrderRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(OrderRecord)
|
||||
in := new(OrderCreateRecord)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -1077,6 +1139,151 @@ func _Bundle_ValueAddServiceDetail_Handler(srv interface{}, ctx context.Context,
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_ValueAddServiceLangByUuidAndLanguage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ValueAddServiceDetailRequest)
|
||||
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("ValueAddServiceLangByUuidAndLanguage", 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_CalculatePrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CalculatePriceRequest)
|
||||
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("CalculatePrice", 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_BundleExtend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BundleExtendRequest)
|
||||
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("BundleExtend", 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_BundleExtendRecordsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BundleExtendRecordsListRequest)
|
||||
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("BundleExtendRecordsList", 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_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.
|
||||
// It's only intended for direct use with grpc_go.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -1180,6 +1387,26 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "ValueAddServiceDetail",
|
||||
Handler: _Bundle_ValueAddServiceDetail_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ValueAddServiceLangByUuidAndLanguage",
|
||||
Handler: _Bundle_ValueAddServiceLangByUuidAndLanguage_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CalculatePrice",
|
||||
Handler: _Bundle_CalculatePrice_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BundleExtend",
|
||||
Handler: _Bundle_BundleExtend_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BundleExtendRecordsList",
|
||||
Handler: _Bundle_BundleExtendRecordsList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetBundleBalance",
|
||||
Handler: _Bundle_GetBundleBalance_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "pb/bundle.proto",
|
||||
|
@ -63,7 +63,7 @@ func NewRouter() *gin.Engine {
|
||||
}
|
||||
webAcRouter := privateGroup.Group("/user")
|
||||
//webAcRouter.Use(middleware.CheckWebLogin(service.AccountProvider))
|
||||
webAcRouter.Use(middleware.CheckLogin(service.AccountFieeProvider))
|
||||
webAcRouter.Use(middleware.CheckWebLogin(service.AccountProvider))
|
||||
{
|
||||
webAcRouter.POST("list", account.UserList) //用户列表
|
||||
webAcRouter.POST("approval", account.UserApproval) //实名审核
|
||||
|
@ -79,77 +79,57 @@ func CreateBundleOrderAddSignature(c *gin.Context) {
|
||||
Options *bundle.ValueAddPriceOptions
|
||||
ID int32
|
||||
}
|
||||
|
||||
var (
|
||||
valueAddServices []ValueAddServiceInfo
|
||||
totalAmount float64
|
||||
mainDeadline = orderRecordResp.OrderRecord.ExpirationTime
|
||||
)
|
||||
for _, opt := range req.AddPriceOptionsList {
|
||||
valueAddInfo, err := service.BundleProvider.ValueAddServiceDetail(context.Background(), &bundle.ValueAddServiceDetailRequest{
|
||||
Uuid: opt.ValueUid,
|
||||
// 计算总金额和确定截止日期
|
||||
var expirationDate string
|
||||
var addPriceList []*bundle.AddPriceOptionsInfo
|
||||
var totalAmount float32
|
||||
for _, svc := range req.AddPriceOptionsList {
|
||||
valueAddInfo, err := service.BundleProvider.ValueAddServiceLangByUuidAndLanguage(context.Background(), &bundle.ValueAddServiceDetailRequest{
|
||||
Uuid: svc.ValueUid,
|
||||
Language: req.Language,
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
// 找到匹配的选项
|
||||
var selectedOption *bundle.ValueAddPriceOptions
|
||||
for _, option := range valueAddInfo.ValueAddServiceLang.Options {
|
||||
if int32(option.Id) == opt.Id {
|
||||
selectedOption = option
|
||||
break
|
||||
}
|
||||
}
|
||||
if selectedOption == nil {
|
||||
service.Error(c, errors.New("未找到匹配的价格选项"))
|
||||
return
|
||||
}
|
||||
valueAddServices = append(valueAddServices, ValueAddServiceInfo{
|
||||
Service: valueAddInfo.ValueAddServiceLang,
|
||||
Options: selectedOption,
|
||||
ID: opt.Id,
|
||||
valuePrice, err := service.BundleProvider.CalculatePrice(context.Background(), &bundle.CalculatePriceRequest{
|
||||
Uuid: svc.ValueUid,
|
||||
Num: svc.Num,
|
||||
Language: req.Language,
|
||||
})
|
||||
}
|
||||
// 计算总金额和确定截止日期
|
||||
var expirationDate string
|
||||
var addPriceList []*bundle.AddPriceOptionsInfo
|
||||
for _, svc := range valueAddServices {
|
||||
price, err := strconv.ParseFloat(svc.Options.Price, 64)
|
||||
if err != nil {
|
||||
service.Error(c, errors.New("价格格式错误"))
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
var nowAmount float64
|
||||
switch svc.Service.PriceMode {
|
||||
case 1: // 数量×单价模式
|
||||
nowAmount = float64(svc.Options.Num) * price
|
||||
totalAmount += float64(svc.Options.Num) * price
|
||||
case 2: // 固定价格模式
|
||||
nowAmount = price
|
||||
totalAmount += price
|
||||
}
|
||||
|
||||
totalAmount += valuePrice.Price
|
||||
addPriceList = append(addPriceList, &bundle.AddPriceOptionsInfo{
|
||||
ValueUid: svc.Service.Uuid,
|
||||
ServiceType: svc.Service.ServiceType,
|
||||
CurrencyType: svc.Service.PriceType,
|
||||
Amount: float32(nowAmount),
|
||||
Num: svc.Options.Num,
|
||||
Unit: svc.Service.Unit,
|
||||
ValueUid: valueAddInfo.Uuid,
|
||||
ServiceType: valueAddInfo.ServiceType,
|
||||
CurrencyType: valueAddInfo.PriceType,
|
||||
Amount: valuePrice.Price,
|
||||
Num: svc.Num,
|
||||
Unit: valueAddInfo.Unit,
|
||||
})
|
||||
// 如果是可用时长服务,计算新的截止日期
|
||||
if svc.Service.ServiceType == 5 {
|
||||
newDeadline := calculateExpirationDate(svc.Options.Num, svc.Service.Unit)
|
||||
if expirationDate == "" || newDeadline > expirationDate {
|
||||
expirationDate = newDeadline
|
||||
if valueAddInfo.ServiceType == 5 {
|
||||
endDate := orderRecordResp.OrderRecord.ExpirationTime
|
||||
if endDate == "9999-12-31" {
|
||||
service.Error(c, errors.New(common.ErrorPermanentPackage))
|
||||
return
|
||||
}
|
||||
t, err := time.Parse("2006-01-02", endDate)
|
||||
if err != nil {
|
||||
fmt.Println("解析时间出错:", err)
|
||||
return
|
||||
}
|
||||
newDeadline := calculateExpirationDate(t, svc.Num, valueAddInfo.Unit)
|
||||
expirationDate = newDeadline
|
||||
//}
|
||||
}
|
||||
}
|
||||
// 如果没有可用时长服务,使用主套餐截止日期
|
||||
if expirationDate == "" {
|
||||
expirationDate = mainDeadline
|
||||
expirationDate = orderRecordResp.OrderRecord.ExpirationTime
|
||||
}
|
||||
req.CustomerNum = userInfo.SubNum
|
||||
req.CustomerName = userInfo.Name
|
||||
@ -159,7 +139,7 @@ func CreateBundleOrderAddSignature(c *gin.Context) {
|
||||
req.ExpirationDate = expirationDate
|
||||
req.AddPriceOptionsList = addPriceList
|
||||
// 当前 未将 签名 写入合同中
|
||||
signContract, signContractErr := logic.SignContractV2(req.CustomerNum, bundleDetail.Bundle.Contract, float32(totalAmount), expirationDate)
|
||||
signContract, signContractErr := logic.SignContractV2(req.CustomerNum, bundleDetail.Bundle.Contract, totalAmount, expirationDate)
|
||||
if signContractErr != nil {
|
||||
service.Error(c, signContractErr)
|
||||
return
|
||||
@ -175,21 +155,21 @@ func CreateBundleOrderAddSignature(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 计算截止日期辅助函数
|
||||
func calculateExpirationDate(num int32, unit string) string {
|
||||
now := time.Now()
|
||||
func calculateExpirationDate(startDate time.Time, num int32, unit string) string {
|
||||
//now := time.Now()
|
||||
switch unit {
|
||||
case "天":
|
||||
return now.AddDate(0, 0, int(num)).Format("2006-01-02")
|
||||
return startDate.AddDate(0, 0, int(num)).Format("2006-01-02")
|
||||
case "月":
|
||||
return now.AddDate(0, int(num), 0).Format("2006-01-02")
|
||||
return startDate.AddDate(0, int(num), 0).Format("2006-01-02")
|
||||
case "年":
|
||||
return now.AddDate(int(num), 0, 0).Format("2006-01-02")
|
||||
return startDate.AddDate(int(num), 0, 0).Format("2006-01-02")
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
func CreateBundleOrderSignature(c *gin.Context) {
|
||||
var req bundle.OrderRecord
|
||||
var req bundle.OrderCreateRecord
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
@ -254,19 +234,12 @@ func CreateBundleOrderSignature(c *gin.Context) {
|
||||
service.Error(c, lastOrderRecordErr)
|
||||
return
|
||||
}
|
||||
|
||||
lastContractNo := ""
|
||||
|
||||
if lastOrderRecord.OrderRecords != nil {
|
||||
for _, lastOrder := range lastOrderRecord.OrderRecords {
|
||||
lastContractNo = lastOrder.ContractNo
|
||||
}
|
||||
}
|
||||
|
||||
req.CustomerNum = userInfo.SubNum
|
||||
req.CustomerName = userInfo.Name
|
||||
req.CustomerID = strconv.FormatUint(userInfo.ID, 10)
|
||||
|
||||
// 获取 套餐信息
|
||||
bundleDetailReq := &bundle.BundleDetailRequest{
|
||||
Uuid: req.BundleUuid,
|
||||
@ -276,69 +249,70 @@ func CreateBundleOrderSignature(c *gin.Context) {
|
||||
service.Error(c, detailErr)
|
||||
return
|
||||
}
|
||||
|
||||
//获取增值套餐信息
|
||||
//if req.ValueAddBundleUuid != "" {
|
||||
// valueAddBundleDetail, err := service.BundleProvider.ValueAddBundleDetail(context.Background(), &bundle.ValueAddBundleDetailRequest{
|
||||
// Uuid: req.ValueAddBundleUuid,
|
||||
// })
|
||||
// if err != nil {
|
||||
// service.Error(c, err)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// req.ValueAddBundleUuid = valueAddBundleDetail.Data.Uuid
|
||||
// req.ValueAddOriginalPrice = valueAddBundleDetail.Data.OriginalPrice
|
||||
// req.ValueAddDiscountPrice = valueAddBundleDetail.Data.DiscountPrice
|
||||
// req.AddBundleCommonUid = valueAddBundleDetail.Data.AddBundleCommonUid
|
||||
//
|
||||
// if valueAddBundleDetail.Data.Choose { // 可选条数
|
||||
// req.ValueAddBundleAmount = valueAddBundleDetail.Data.DiscountPrice * float32(req.Num)
|
||||
// discount, _ := new(big.Float).Sub(big.NewFloat(float64(valueAddBundleDetail.Data.OriginalPrice)), big.NewFloat(float64(valueAddBundleDetail.Data.DiscountPrice))).Float32()
|
||||
// req.ValueAddSavedAmount = discount * float32(req.Num)
|
||||
// } else { // 固定条数
|
||||
// req.ValueAddBundleAmount = valueAddBundleDetail.Data.TotalPrice
|
||||
// req.ValueAddSavedAmount = valueAddBundleDetail.Data.SavedAmount
|
||||
// }
|
||||
//
|
||||
// req.TotalAmount, _ = new(big.Float).Add(big.NewFloat(float64(req.ValueAddBundleAmount)), big.NewFloat(float64(bundleDetail.Bundle.Price))).Float32()
|
||||
//}
|
||||
|
||||
req.BundleName = bundleDetail.Bundle.Name
|
||||
req.Amount = bundleDetail.Bundle.Price
|
||||
req.AmountType = bundleDetail.Bundle.PriceType
|
||||
req.BundleCommonUid = bundleDetail.Bundle.BundleCommonUid
|
||||
req.TotalAmount = bundleDetail.Bundle.Price
|
||||
req.PayType = 1 // 默认 人民币
|
||||
//获取过期时间和增值服务金额
|
||||
PriceAndTime, err := service.BundleProvider.PackagePriceAndTime(context.Background(), &req)
|
||||
var addRecords []*bundle.OrderCreateAddRecord
|
||||
var addTotalPrice float32
|
||||
var expirationDay string
|
||||
for _, i := range req.AddRecords {
|
||||
price, err := service.BundleProvider.CalculatePrice(context.Background(), &bundle.CalculatePriceRequest{
|
||||
Uuid: i.ValueUid,
|
||||
Num: i.Num,
|
||||
Language: req.Language,
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
//套餐金额+增值服务金额
|
||||
totalAmount := PriceAndTime.Price + bundleDetail.Bundle.Price
|
||||
req.ContractNo = common.GenerateContractNo(lastContractNo)
|
||||
|
||||
addTotalPrice += price.Price
|
||||
addService, err := service.BundleProvider.ValueAddServiceLangByUuidAndLanguage(context.Background(), &bundle.ValueAddServiceDetailRequest{
|
||||
Uuid: i.ValueUid,
|
||||
Language: req.Language,
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
addRecords = append(addRecords, &bundle.OrderCreateAddRecord{
|
||||
ServiceType: addService.ServiceType,
|
||||
ValueUid: i.ValueUid,
|
||||
CurrencyType: addService.PriceType,
|
||||
Amount: price.Price,
|
||||
Num: i.Num,
|
||||
Unit: addService.Unit,
|
||||
Source: 1,
|
||||
PaymentStatus: 1,
|
||||
})
|
||||
//服务类型为时长 计算
|
||||
if addService.ServiceType == 5 {
|
||||
expirationDay = calculateExpirationDate(time.Now(), i.Num, addService.Unit)
|
||||
}
|
||||
}
|
||||
// 当前 未将 签名 写入合同中 todo 金额和有效时间待修改
|
||||
signContract, signContractErr := logic.SignContractV2(req.CustomerNum, bundleDetail.Bundle.Contract, totalAmount, PriceAndTime.Time)
|
||||
signContract, signContractErr := logic.SignContractV2(req.CustomerNum, bundleDetail.Bundle.Contract, addTotalPrice, expirationDay)
|
||||
if signContractErr != nil {
|
||||
service.Error(c, signContractErr)
|
||||
return
|
||||
}
|
||||
|
||||
req.CustomerNum = userInfo.SubNum
|
||||
req.CustomerName = userInfo.Name
|
||||
req.CustomerID = strconv.FormatUint(userInfo.ID, 10)
|
||||
req.BundleName = bundleDetail.Bundle.Name
|
||||
req.Amount = bundleDetail.Bundle.Price
|
||||
req.AmountType = bundleDetail.Bundle.PriceType
|
||||
req.BundleCommonUid = bundleDetail.Bundle.BundleCommonUid
|
||||
req.TotalAmount = bundleDetail.Bundle.Price + addTotalPrice
|
||||
req.ContractNo = common.GenerateContractNo(lastContractNo)
|
||||
req.SignContract = signContract
|
||||
|
||||
req.SignedTime = common.GetBeijingTime()
|
||||
|
||||
req.Status = bundleModel.OrderSigned
|
||||
req.AddRecords = addRecords
|
||||
req.ExpirationTime = expirationDay
|
||||
|
||||
res, err := service.BundleProvider.CreateOrderRecord(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ const (
|
||||
HadOrder = "您已购买过套餐,无法再次购买"
|
||||
InvalidValueAddBundleNum = "套餐数量无效"
|
||||
ThePackageHasExpired = "当前套餐已过期"
|
||||
ErrorPermanentPackage = "永久套餐无需购买"
|
||||
)
|
||||
|
||||
const (
|
||||
|
Loading…
Reference in New Issue
Block a user