Merge branch 'dev'
This commit is contained in:
commit
5b163feada
6
.idea/git_toolbox_blame.xml
Normal file
6
.idea/git_toolbox_blame.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GitToolBoxBlameSettings">
|
||||||
|
<option name="version" value="2" />
|
||||||
|
</component>
|
||||||
|
</project>
|
File diff suppressed because it is too large
Load Diff
@ -1,119 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package bundle;
|
|
||||||
option go_package = "./bundle";
|
|
||||||
|
|
||||||
service Bundle {
|
|
||||||
rpc CreateBundle(BundleProfile) returns (CommonResponse) {}
|
|
||||||
rpc UpdateBundle(BundleProfile) returns (CommonResponse) {}
|
|
||||||
rpc DeleteBundle(DelBundleRequest) returns (CommonResponse) {}
|
|
||||||
|
|
||||||
rpc BundleList(BundleListRequest) returns (BundleListResponse) {}
|
|
||||||
rpc BundleDetail(BundleDetailRequest) returns (BundleDetailResponse) {}
|
|
||||||
|
|
||||||
rpc CreateOrderRecord(OrderRecord) returns (CommonResponse) {}
|
|
||||||
rpc UpdateOrderRecord(OrderRecord) returns (CommonResponse) {}
|
|
||||||
rpc UpdateOrderRecordByOrderNo(OrderRecord) returns (CommonResponse) {}
|
|
||||||
rpc OrderRecordsList(OrderRecordsRequest) returns (OrderRecordsResponse) {}
|
|
||||||
rpc OrderRecordsDetail(OrderRecordsDetailRequest) returns (OrderRecordsDetailResponse) {}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
message CommonResponse {
|
|
||||||
string msg = 1 [json_name = "msg"];
|
|
||||||
string uuid = 2 [json_name = "uuid"];
|
|
||||||
string orderNo = 3 [json_name = "orderNo"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message BundleProfile {
|
|
||||||
string uuid = 1 [json_name = "uuid"];
|
|
||||||
string name = 2 [json_name = "name"];
|
|
||||||
float price = 3 [json_name = "price"];
|
|
||||||
int64 PriceType = 4 [json_name = "priceType"];
|
|
||||||
string content = 5 [json_name = "content"];
|
|
||||||
string contract = 6 [json_name = "contract"];
|
|
||||||
string language = 7 [json_name = "language"];
|
|
||||||
string createdAt = 8 [json_name = "createdAt"];
|
|
||||||
string updatedAt = 9 [json_name = "updatedAt"];
|
|
||||||
string companySign = 10 [json_name = "companySign"];
|
|
||||||
int64 contractDuration = 11 [json_name = "contractDuration"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message DelBundleRequest {
|
|
||||||
string uuid = 1 [json_name = "uuid"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message BundleListRequest {
|
|
||||||
int32 page = 1 [json_name = "page"];
|
|
||||||
int32 pageSize = 2 [json_name = "pageSize"];
|
|
||||||
string name = 3 [json_name = "name"];
|
|
||||||
string content = 4 [json_name = "content"];
|
|
||||||
string language = 5 [json_name = "language"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message BundleListResponse {
|
|
||||||
repeated BundleProfile bundles = 1 [json_name = "bundles"];
|
|
||||||
int32 total = 2 [json_name = "total"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message BundleDetailRequest {
|
|
||||||
string uuid = 1 [json_name = "uuid"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message BundleDetailResponse {
|
|
||||||
BundleProfile bundle = 1 [json_name = "bundle"];
|
|
||||||
string msg = 2 [json_name = "msg"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message OrderRecord {
|
|
||||||
string uuid = 1 [json_name = "uuid"];
|
|
||||||
string bundleUuid = 2 [json_name = "bundleUuid"];
|
|
||||||
string customerID = 3 [json_name = "customerID"];
|
|
||||||
string customerNum = 4 [json_name = "customerNum"];
|
|
||||||
string customerName = 5 [json_name = "customerName"];
|
|
||||||
float amount = 6 [json_name = "amount"];
|
|
||||||
int64 amountType = 7 [json_name = "amountType"];
|
|
||||||
string signContract = 8 [json_name = "signContract"];
|
|
||||||
string signature = 9 [json_name = "signature"];
|
|
||||||
string signedTime = 10 [json_name = "signedTime"];
|
|
||||||
int64 payType = 11 [json_name = "payType"];
|
|
||||||
string payTime = 12 [json_name = "payTime"];
|
|
||||||
string checkoutSessionId = 13 [json_name = "checkoutSessionId"];
|
|
||||||
string checkoutSessionUrl = 14 [json_name = "checkoutSessionUrl"];
|
|
||||||
int64 status = 15 [json_name = "status"];
|
|
||||||
string orderNo = 16 [json_name = "orderNo"];
|
|
||||||
string bundleName = 17 [json_name = "bundleName"];
|
|
||||||
string contractNo = 18 [json_name = "contractNo"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message OrderRecordsRequest {
|
|
||||||
int32 page = 1 [json_name = "page"];
|
|
||||||
int32 pageSize = 2 [json_name = "pageSize"];
|
|
||||||
string customerNum = 3 [json_name = "customerNum"];
|
|
||||||
string customerName = 4 [json_name = "customerName"];
|
|
||||||
string bundleUUID = 5 [json_name = "bundleUUID"];
|
|
||||||
string orderNo = 6 [json_name = "orderNo"];
|
|
||||||
int64 status = 7 [json_name = "status"];
|
|
||||||
string bundleName = 8 [json_name = "bundleName"];
|
|
||||||
string startSignedTime = 9 [json_name = "startSignedTime"];
|
|
||||||
string endSignedTime = 10 [json_name = "endSignedTime"];
|
|
||||||
string startPayTime = 11 [json_name = "startPayTime"];
|
|
||||||
string endPayTime = 12 [json_name = "endPayTime"];
|
|
||||||
string customerID = 13 [json_name = "customerID"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message OrderRecordsResponse {
|
|
||||||
repeated OrderRecord orderRecords = 1 [json_name = "orderRecords"];
|
|
||||||
int32 total = 2 [json_name = "total"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message OrderRecordsDetailRequest {
|
|
||||||
string uuid = 1 [json_name = "uuid"];
|
|
||||||
string orderNo = 2 [json_name = "orderNo"];
|
|
||||||
string customerID = 3 [json_name = "customerID"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message OrderRecordsDetailResponse {
|
|
||||||
OrderRecord orderRecord = 1 [json_name = "orderRecord"];
|
|
||||||
string msg = 2 [json_name = "msg"];
|
|
||||||
}
|
|
@ -7,6 +7,8 @@ import (
|
|||||||
fmt "fmt"
|
fmt "fmt"
|
||||||
math "math"
|
math "math"
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
_ "google.golang.org/protobuf/types/descriptorpb"
|
||||||
|
_ "github.com/mwitkow/go-proto-validators"
|
||||||
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -75,3 +77,42 @@ func (this *OrderRecordsDetailResponse) Validate() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (this *ValueAddBundleProfile) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CreateValueAddBundleRequest) Validate() error {
|
||||||
|
if !(this.Num > 29) {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("Num", fmt.Errorf(`至少数为30,最多数为100`))
|
||||||
|
}
|
||||||
|
if !(this.Num < 101) {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("Num", fmt.Errorf(`至少数为30,最多数为100`))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CreateValueAddBundleResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *ValueAddBundleListRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *ValueAddBundleListResponse) 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 *ValueAddBundleDetailRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *ValueAddBundleDetailResponse) Validate() error {
|
||||||
|
if this.Data != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Data); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -38,6 +38,10 @@ type BundleClient interface {
|
|||||||
UpdateOrderRecordByOrderNo(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)
|
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)
|
OrderRecordsDetail(ctx context.Context, in *OrderRecordsDetailRequest, opts ...grpc_go.CallOption) (*OrderRecordsDetailResponse, common.ErrorWithAttachment)
|
||||||
|
//增值套餐
|
||||||
|
CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
type bundleClient struct {
|
type bundleClient struct {
|
||||||
@ -55,6 +59,9 @@ type BundleClientImpl struct {
|
|||||||
UpdateOrderRecordByOrderNo 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)
|
OrderRecordsList func(ctx context.Context, in *OrderRecordsRequest) (*OrderRecordsResponse, error)
|
||||||
OrderRecordsDetail func(ctx context.Context, in *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
|
OrderRecordsDetail func(ctx context.Context, in *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
|
||||||
|
CreateValueAddBundle func(ctx context.Context, in *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||||
|
ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||||
|
ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
||||||
@ -129,6 +136,24 @@ func (c *bundleClient) OrderRecordsDetail(ctx context.Context, in *OrderRecordsD
|
|||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OrderRecordsDetail", in, out)
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OrderRecordsDetail", in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *bundleClient) CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment) {
|
||||||
|
out := new(CreateValueAddBundleResponse)
|
||||||
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateValueAddBundle", 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)
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
||||||
@ -143,6 +168,10 @@ type BundleServer interface {
|
|||||||
UpdateOrderRecordByOrderNo(context.Context, *OrderRecord) (*CommonResponse, error)
|
UpdateOrderRecordByOrderNo(context.Context, *OrderRecord) (*CommonResponse, error)
|
||||||
OrderRecordsList(context.Context, *OrderRecordsRequest) (*OrderRecordsResponse, error)
|
OrderRecordsList(context.Context, *OrderRecordsRequest) (*OrderRecordsResponse, error)
|
||||||
OrderRecordsDetail(context.Context, *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
|
OrderRecordsDetail(context.Context, *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
|
||||||
|
//增值套餐
|
||||||
|
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||||
|
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||||
|
ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||||
mustEmbedUnimplementedBundleServer()
|
mustEmbedUnimplementedBundleServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,6 +210,15 @@ func (UnimplementedBundleServer) OrderRecordsList(context.Context, *OrderRecords
|
|||||||
func (UnimplementedBundleServer) OrderRecordsDetail(context.Context, *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error) {
|
func (UnimplementedBundleServer) OrderRecordsDetail(context.Context, *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method OrderRecordsDetail not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method OrderRecordsDetail not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedBundleServer) CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method CreateValueAddBundle 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 (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||||
s.proxyImpl = impl
|
s.proxyImpl = impl
|
||||||
}
|
}
|
||||||
@ -499,6 +537,93 @@ func _Bundle_OrderRecordsDetail_Handler(srv interface{}, ctx context.Context, de
|
|||||||
return interceptor(ctx, in, info, handler)
|
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(CreateValueAddBundleRequest)
|
||||||
|
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_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)
|
||||||
|
}
|
||||||
|
|
||||||
// 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)
|
||||||
@ -546,6 +671,18 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
MethodName: "OrderRecordsDetail",
|
MethodName: "OrderRecordsDetail",
|
||||||
Handler: _Bundle_OrderRecordsDetail_Handler,
|
Handler: _Bundle_OrderRecordsDetail_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "CreateValueAddBundle",
|
||||||
|
Handler: _Bundle_CreateValueAddBundle_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ValueAddBundleList",
|
||||||
|
Handler: _Bundle_ValueAddBundleList_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ValueAddBundleDetail",
|
||||||
|
Handler: _Bundle_ValueAddBundleDetail_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc_go.StreamDesc{},
|
Streams: []grpc_go.StreamDesc{},
|
||||||
Metadata: "pb/bundle.proto",
|
Metadata: "pb/bundle.proto",
|
||||||
|
BIN
cmd/runtime/20250327190746.pdf
Normal file
BIN
cmd/runtime/20250327190746.pdf
Normal file
Binary file not shown.
BIN
cmd/runtime/20250327190821.pdf
Normal file
BIN
cmd/runtime/20250327190821.pdf
Normal file
Binary file not shown.
BIN
cmd/runtime/20250328174612.pdf
Normal file
BIN
cmd/runtime/20250328174612.pdf
Normal file
Binary file not shown.
BIN
cmd/runtime/20250328174729.pdf
Normal file
BIN
cmd/runtime/20250328174729.pdf
Normal file
Binary file not shown.
@ -33,4 +33,4 @@ TelNum = "18021272627"
|
|||||||
Password = "Gy.123456"
|
Password = "Gy.123456"
|
||||||
|
|
||||||
[stripe]
|
[stripe]
|
||||||
Webhookkey = "whsec_5ru2Z9KsFixSvamAHgcvCBxufRTuHsyQ"
|
Webhookkey = "whsec_uOQpG6IZTqtfLuePIDtfLCGJPqedSCCN"
|
||||||
|
@ -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"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10,9 +10,10 @@ import (
|
|||||||
"fonchain-fiee/pkg/service/redirect"
|
"fonchain-fiee/pkg/service/redirect"
|
||||||
"fonchain-fiee/pkg/service/upload"
|
"fonchain-fiee/pkg/service/upload"
|
||||||
"fonchain-fiee/pkg/service/version"
|
"fonchain-fiee/pkg/service/version"
|
||||||
"github.com/gin-contrib/gzip"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-contrib/gzip"
|
||||||
|
|
||||||
"github.com/gin-contrib/pprof"
|
"github.com/gin-contrib/pprof"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
@ -39,6 +40,7 @@ func NewRouter() *gin.Engine {
|
|||||||
|
|
||||||
BundleRouter(privateGroup)
|
BundleRouter(privateGroup)
|
||||||
BundleOrderRouter(privateGroup)
|
BundleOrderRouter(privateGroup)
|
||||||
|
ValueAddBundleRouter(privateGroup)
|
||||||
|
|
||||||
{
|
{
|
||||||
v1.POST("version", version.Version) //版本号公共
|
v1.POST("version", version.Version) //版本号公共
|
||||||
|
26
pkg/router/valueAddBundle.go
Normal file
26
pkg/router/valueAddBundle.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package router
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fonchain-fiee/pkg/middleware"
|
||||||
|
"fonchain-fiee/pkg/service"
|
||||||
|
"fonchain-fiee/pkg/service/bundle"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ValueAddBundleRouter(r *gin.RouterGroup) {
|
||||||
|
valueAddBundleRoute := r.Group("valueAdd-bundle")
|
||||||
|
valueAddBundleRoute.Use(middleware.CheckLogin(service.AccountProvider))
|
||||||
|
|
||||||
|
// 增值套餐
|
||||||
|
{
|
||||||
|
bundleClientRoute := valueAddBundleRoute.Group("system")
|
||||||
|
{
|
||||||
|
bundleClientRoute.POST("create", bundle.CreateValueAddBundle)
|
||||||
|
bundleClientRoute.POST("list", bundle.ValueAddBundleList)
|
||||||
|
bundleClientRoute.POST("detail", bundle.ValueAddBundleDetail)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -39,6 +39,23 @@ func Success(c *gin.Context, datas ...interface{}) {
|
|||||||
c.Abort()
|
c.Abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Success1(c *gin.Context, msg string, datas ...interface{}) {
|
||||||
|
var data interface{}
|
||||||
|
|
||||||
|
if datas != nil {
|
||||||
|
data = datas[0]
|
||||||
|
} else {
|
||||||
|
data = struct{}{}
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, Response{
|
||||||
|
Status: Ok,
|
||||||
|
Code: Ok,
|
||||||
|
Data: data,
|
||||||
|
Msg: msg,
|
||||||
|
})
|
||||||
|
c.Abort()
|
||||||
|
}
|
||||||
|
|
||||||
// Error 统一错误返回
|
// Error 统一错误返回
|
||||||
func Error(c *gin.Context, err error) {
|
func Error(c *gin.Context, err error) {
|
||||||
|
|
||||||
@ -57,6 +74,19 @@ func Error(c *gin.Context, err error) {
|
|||||||
c.Abort()
|
c.Abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Error 统一错误返回
|
||||||
|
func Error1(c *gin.Context, err error) {
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, Response{
|
||||||
|
Code: Failed,
|
||||||
|
Status: Failed,
|
||||||
|
Msg: err.Error(),
|
||||||
|
Data: struct{}{},
|
||||||
|
})
|
||||||
|
|
||||||
|
c.Abort()
|
||||||
|
}
|
||||||
|
|
||||||
// 重试
|
// 重试
|
||||||
func Retry(c *gin.Context, err error) {
|
func Retry(c *gin.Context, err error) {
|
||||||
errMsg := ""
|
errMsg := ""
|
||||||
|
@ -3,6 +3,7 @@ package bundle
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fonchain-fiee/api/account"
|
||||||
"fonchain-fiee/api/bundle"
|
"fonchain-fiee/api/bundle"
|
||||||
"fonchain-fiee/api/order"
|
"fonchain-fiee/api/order"
|
||||||
"fonchain-fiee/pkg/model/login"
|
"fonchain-fiee/pkg/model/login"
|
||||||
@ -10,9 +11,11 @@ import (
|
|||||||
"fonchain-fiee/pkg/service/bundle/common"
|
"fonchain-fiee/pkg/service/bundle/common"
|
||||||
"fonchain-fiee/pkg/service/bundle/logic"
|
"fonchain-fiee/pkg/service/bundle/logic"
|
||||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||||
|
"math/big"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/gin-gonic/gin/binding"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateBundleOrderSignature(c *gin.Context) {
|
func CreateBundleOrderSignature(c *gin.Context) {
|
||||||
@ -28,10 +31,11 @@ func CreateBundleOrderSignature(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.Signature == "" {
|
// 不去校验 签名
|
||||||
|
/*if req.Signature == "" {
|
||||||
service.Error(c, errors.New(common.MissOrderSignature))
|
service.Error(c, errors.New(common.MissOrderSignature))
|
||||||
return
|
return
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 获取 用户信息
|
// 获取 用户信息
|
||||||
userInfo := login.GetUserInfoFromC(c)
|
userInfo := login.GetUserInfoFromC(c)
|
||||||
@ -88,16 +92,44 @@ func CreateBundleOrderSignature(c *gin.Context) {
|
|||||||
return
|
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.BundleName = bundleDetail.Bundle.Name
|
||||||
req.Amount = bundleDetail.Bundle.Price
|
req.Amount = bundleDetail.Bundle.Price
|
||||||
req.AmountType = bundleDetail.Bundle.PriceType
|
req.AmountType = bundleDetail.Bundle.PriceType
|
||||||
|
req.BundleCommonUid = bundleDetail.Bundle.BundleCommonUid
|
||||||
|
req.TotalAmount = req.Amount + req.ValueAddBundleAmount
|
||||||
req.PayType = 1 // 默认 人民币
|
req.PayType = 1 // 默认 人民币
|
||||||
|
|
||||||
req.ContractNo = common.GenerateContractNo(lastContractNo)
|
req.ContractNo = common.GenerateContractNo(lastContractNo)
|
||||||
|
|
||||||
// 当前 未将 签名 写入合同中
|
// 当前 未将 签名 写入合同中
|
||||||
signContract, signContractErr := logic.SignContract(req.CustomerNum, bundleDetail.Bundle.Contract, req.Signature, bundleDetail.Bundle.CompanySign, req.ContractNo, userInfo.Name, userInfo.SubscriberNumber, userInfo.TelNum, userInfo.PlaceOfResidence, bundleDetail.Bundle.Price, bundleDetail.Bundle.ContractDuration)
|
signContract, signContractErr := logic.SignContractV2(req.CustomerNum, bundleDetail.Bundle.Contract, req.TotalAmount, bundleDetail.Bundle.ContractDuration)
|
||||||
if signContractErr != nil {
|
if signContractErr != nil {
|
||||||
service.Error(c, signContractErr)
|
service.Error(c, signContractErr)
|
||||||
return
|
return
|
||||||
@ -216,6 +248,30 @@ func OrderRecordsList(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, orderRecord := range res.OrderRecords {
|
||||||
|
if orderRecord.CustomerID != "" {
|
||||||
|
var userID uint64
|
||||||
|
userID, err = strconv.ParseUint(orderRecord.CustomerID, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
err = nil
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
userInfo, _ := service.AccountProvider.Info(context.Background(), &account.InfoRequest{
|
||||||
|
Domain: "app",
|
||||||
|
ID: userID,
|
||||||
|
})
|
||||||
|
if userInfo != nil {
|
||||||
|
orderRecord.Sex = userInfo.Sex
|
||||||
|
orderRecord.Nationality = userInfo.Nationality
|
||||||
|
orderRecord.CertificatePicture = userInfo.CertificatePicture
|
||||||
|
orderRecord.PlaceOfResidence = userInfo.PlaceOfResidence
|
||||||
|
orderRecord.GroupPhoto = userInfo.GroupPhoto
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
service.Success(c, res)
|
service.Success(c, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,10 +13,12 @@ const (
|
|||||||
MissOrderUUID = "缺少订单信息"
|
MissOrderUUID = "缺少订单信息"
|
||||||
|
|
||||||
NotMatchOrderInfo = "非当前用户订单信息不可操作"
|
NotMatchOrderInfo = "非当前用户订单信息不可操作"
|
||||||
|
InvalidOrderAmount = "订单金额错误"
|
||||||
|
|
||||||
HadPay = "订单已支付"
|
HadPay = "订单已支付"
|
||||||
|
|
||||||
HadOrder = "您已购买过套餐,无法再次购买"
|
HadOrder = "您已购买过套餐,无法再次购买"
|
||||||
|
InvalidValueAddBundleNum = "套餐数量无效"
|
||||||
)
|
)
|
||||||
|
|
||||||
// stripe
|
// stripe
|
||||||
|
117
pkg/service/bundle/logic/signContractV2.go
Normal file
117
pkg/service/bundle/logic/signContractV2.go
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"fonchain-fiee/pkg/model"
|
||||||
|
"fonchain-fiee/pkg/service/bundle/common"
|
||||||
|
"fonchain-fiee/pkg/service/upload"
|
||||||
|
"github.com/signintech/gopdf"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SignContractV2(customerNum, contract string, price float32, contractDuration int64) (outputUrl string, err error) {
|
||||||
|
filePath := model.MediaPath + customerNum + time.Now().Format("20060102150405") + ".pdf"
|
||||||
|
downloadFileErr := DownloadFile(filePath, contract)
|
||||||
|
if downloadFileErr != nil {
|
||||||
|
zap.L().Error("download file error: ", zap.Error(downloadFileErr))
|
||||||
|
//service.Error(c, errors.New(common.ErrorDownloadFile))
|
||||||
|
return outputUrl, errors.New(common.ErrorDownloadFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
signFile := model.MediaPath + customerNum + "signed" + time.Now().Format("20060102150405") + ".pdf"
|
||||||
|
|
||||||
|
/*signErr := InsertSignature(filePath, signFile, signImgPath, contractNo, idNo, telNum, address, price)
|
||||||
|
if signErr != nil {
|
||||||
|
zap.L().Error("insert signature error: ", zap.Error(signErr))
|
||||||
|
return outputUrl, errors.New(common.ErrorInsertSignature)
|
||||||
|
}*/
|
||||||
|
|
||||||
|
signErr := InsertSignatureV2(filePath, signFile, price, contractDuration)
|
||||||
|
if signErr != nil {
|
||||||
|
zap.L().Error("insert signature error: ", zap.Error(signErr))
|
||||||
|
return outputUrl, errors.New(common.ErrorInsertSignature)
|
||||||
|
}
|
||||||
|
|
||||||
|
os.Remove(filePath)
|
||||||
|
|
||||||
|
outputUrl, ossErr := upload.PutBos(signFile, upload.PdfType, true)
|
||||||
|
if ossErr != nil {
|
||||||
|
return "", errors.New(common.ErrorUploadFile)
|
||||||
|
}
|
||||||
|
return outputUrl, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func InsertSignatureV2(templatePath, outputPath string, price float32, contractDuration int64) error {
|
||||||
|
pdf := gopdf.GoPdf{}
|
||||||
|
pdf.Start(gopdf.Config{PageSize: *gopdf.PageSizeA4})
|
||||||
|
|
||||||
|
// 导入模板文件中的页面
|
||||||
|
err := pdf.ImportPagesFromSource(templatePath, "/MediaBox")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("无法导入页面: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取模板文件的总页数
|
||||||
|
totalPages := pdf.GetNumberOfPages()
|
||||||
|
fmt.Printf("模板文件的总页数: %d\n", totalPages)
|
||||||
|
|
||||||
|
pricePage := 3
|
||||||
|
|
||||||
|
limitTimePage := 4
|
||||||
|
|
||||||
|
tffErr := pdf.AddTTFFont("simfang", "./data/simfang.ttf")
|
||||||
|
if tffErr != nil {
|
||||||
|
fmt.Printf("加载中文字体失败: %v\n", tffErr)
|
||||||
|
log.Fatalf("加载中文字体失败: %v", tffErr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置字体和字号
|
||||||
|
err = pdf.SetFont("simfang", "", 14)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("设置字体失败: %v\n", err)
|
||||||
|
log.Fatalf("设置字体失败: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 填 金额
|
||||||
|
pdf.SetPage(pricePage)
|
||||||
|
pdf.SetX(383)
|
||||||
|
pdf.SetY(351)
|
||||||
|
pdf.Cell(nil, strconv.FormatFloat(float64(price), 'f', 2, 64))
|
||||||
|
|
||||||
|
pdf.SetX(345)
|
||||||
|
pdf.SetY(383)
|
||||||
|
pdf.Cell(nil, strconv.FormatFloat(float64(price), 'f', 2, 64))
|
||||||
|
// 写 有效期
|
||||||
|
pdf.SetPage(limitTimePage)
|
||||||
|
|
||||||
|
// 英文格式的时间
|
||||||
|
t := time.Now().AddDate(int(contractDuration), 0, 0)
|
||||||
|
pdf.SetX(160)
|
||||||
|
pdf.SetY(387)
|
||||||
|
pdf.Cell(nil, t.Format("2006-01-02"))
|
||||||
|
|
||||||
|
pdf.SetX(330)
|
||||||
|
pdf.SetY(403)
|
||||||
|
pdf.Cell(nil, t.Format("2006"))
|
||||||
|
|
||||||
|
pdf.SetX(396)
|
||||||
|
pdf.SetY(403)
|
||||||
|
pdf.Cell(nil, t.Format("01"))
|
||||||
|
|
||||||
|
pdf.SetX(443)
|
||||||
|
pdf.SetY(403)
|
||||||
|
pdf.Cell(nil, t.Format("02"))
|
||||||
|
|
||||||
|
// 生成新的 PDF
|
||||||
|
if err = pdf.WritePdf(outputPath); err != nil {
|
||||||
|
//zap.L().Error("WritePdf err", zap.Error(err))
|
||||||
|
return errors.New("error writing final PDF")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -11,11 +11,12 @@ import (
|
|||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
"fonchain-fiee/pkg/service/bundle/common"
|
"fonchain-fiee/pkg/service/bundle/common"
|
||||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/gin-gonic/gin/binding"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/gin-gonic/gin/binding"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateStripeCheckoutSession(c *gin.Context) {
|
func CreateStripeCheckoutSession(c *gin.Context) {
|
||||||
@ -29,6 +30,8 @@ func CreateStripeCheckoutSession(c *gin.Context) {
|
|||||||
// 获取 用户信息
|
// 获取 用户信息
|
||||||
userInfo := login.GetUserInfoFromC(c)
|
userInfo := login.GetUserInfoFromC(c)
|
||||||
|
|
||||||
|
fmt.Println("userInfo.ID:", userInfo.ID)
|
||||||
|
|
||||||
// 检查 订单信息
|
// 检查 订单信息
|
||||||
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
|
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
|
||||||
OrderNo: req.OutTradeNo,
|
OrderNo: req.OutTradeNo,
|
||||||
@ -39,12 +42,20 @@ func CreateStripeCheckoutSession(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("detail: %+v\n", detail)
|
||||||
|
|
||||||
// 判断 是否是 本人操作
|
// 判断 是否是 本人操作
|
||||||
if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID {
|
if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID {
|
||||||
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//金额校验
|
||||||
|
if detail.OrderRecord.TotalAmount*100 != float32(req.ProductAllPrice) {
|
||||||
|
service.Error(c, errors.New(common.InvalidOrderAmount))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
||||||
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
|
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
|
||||||
// 查询支付结果
|
// 查询支付结果
|
||||||
|
69
pkg/service/bundle/valueAddBundle.go
Normal file
69
pkg/service/bundle/valueAddBundle.go
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
package bundle
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"fonchain-fiee/api/bundle"
|
||||||
|
"fonchain-fiee/pkg/model/login"
|
||||||
|
"fonchain-fiee/pkg/service"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/gin-gonic/gin/binding"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CreateValueAddBundle(c *gin.Context) {
|
||||||
|
var req bundle.CreateValueAddBundleRequest
|
||||||
|
|
||||||
|
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||||
|
service.Error1(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := service.BundleProvider.CreateValueAddBundle(context.Background(), &req)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
service.Error1(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
service.Success1(c, res.Msg, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ValueAddBundleList(c *gin.Context) {
|
||||||
|
var req bundle.ValueAddBundleListRequest
|
||||||
|
|
||||||
|
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||||
|
service.Error1(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取 用户信息
|
||||||
|
userInfo := login.GetUserInfoFromC(c)
|
||||||
|
req.UserId = int32(userInfo.ID)
|
||||||
|
//req.UserId = 39
|
||||||
|
|
||||||
|
res, err := service.BundleProvider.ValueAddBundleList(context.Background(), &req)
|
||||||
|
if err != nil {
|
||||||
|
service.Error1(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
service.Success1(c, res.Msg, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ValueAddBundleDetail(c *gin.Context) {
|
||||||
|
var req bundle.ValueAddBundleDetailRequest
|
||||||
|
|
||||||
|
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||||
|
service.Error1(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := service.BundleProvider.ValueAddBundleDetail(context.Background(), &req)
|
||||||
|
if err != nil {
|
||||||
|
service.Error1(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
service.Success1(c, res.Msg, res)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user