This commit is contained in:
徐俊杰 2025-06-16 14:04:00 +08:00
commit 48a85b000c
18 changed files with 2992 additions and 2103 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,11 +5,11 @@ package bundle
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "google.golang.org/protobuf/types/descriptorpb"
_ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
_ "google.golang.org/protobuf/types/descriptorpb"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
@ -303,6 +303,19 @@ func (this *CalculatePriceRequest) Validate() error {
func (this *CalculatePriceResponse) Validate() error {
return nil
}
func (this *BatchGetValueAddServiceLangRequest) Validate() error {
return nil
}
func (this *BatchGetValueAddServiceLangResponse) Validate() error {
for _, item := range this.ValueAddServiceLangList {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("ValueAddServiceLangList", err)
}
}
}
return nil
}
func (this *BundleExtendRequest) Validate() error {
return nil
}
@ -422,3 +435,6 @@ func (this *OnlyAddValueListByOrderNoResp) Validate() error {
func (this *AddBundleInfo) Validate() error {
return nil
}
func (this *UpdateStatusAndPayTimeBySerialNumber) Validate() error {
return nil
}

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v5.26.1
// - protoc v3.20.3
// source: pb/bundle.proto
package bundle
@ -58,6 +58,7 @@ type BundleClient interface {
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)
BatchGetValueAddServiceLang(ctx context.Context, in *BatchGetValueAddServiceLangRequest, opts ...grpc_go.CallOption) (*BatchGetValueAddServiceLangResponse, 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)
@ -74,6 +75,7 @@ type BundleClient interface {
GetReconciliationList(ctx context.Context, in *GetReconciliationListReq, opts ...grpc_go.CallOption) (*GetReconciliationListResp, common.ErrorWithAttachment)
CreateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
UpdateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
UpdateReconciliationStatusBySerialNumber(ctx context.Context, in *UpdateStatusAndPayTimeBySerialNumber, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
}
type bundleClient struct {
@ -81,47 +83,49 @@ type bundleClient struct {
}
type BundleClientImpl struct {
CreateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error)
UpdateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error)
DeleteBundle func(ctx context.Context, in *DelBundleRequest) (*CommonResponse, error)
HandShelf func(ctx context.Context, in *HandShelfRequest) (*CommonResponse, error)
SaveBundle func(ctx context.Context, in *BundleProfile) (*SaveResponse, error)
BundleListV2 func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
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 *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)
OrderRecordsDetail func(ctx context.Context, in *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
UpdateFinancialConfirmationStatus func(ctx context.Context, in *FinancialConfirmationRequest) (*CommonResponse, error)
CreateOrderAddRecord func(ctx context.Context, in *OrderAddRecord) (*CommonResponse, error)
PackagePriceAndTime func(ctx context.Context, in *OrderRecord) (*PackagePriceAndTimeResponse, error)
OrderRecordsListV2 func(ctx context.Context, in *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
OrderListByOrderNo func(ctx context.Context, in *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
OnlyAddValueListByOrderNo func(ctx context.Context, in *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, 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)
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)
GetBundleBalanceList func(ctx context.Context, in *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error)
GetBundleBalanceByUserId func(ctx context.Context, in *GetBundleBalanceByUserIdReq) (*GetBundleBalanceByUserIdResp, error)
CreateBundleBalance func(ctx context.Context, in *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
AddBundleBalance func(ctx context.Context, in *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
GetUsedRecordList func(ctx context.Context, in *GetUsedRecordListReq) (*GetUsedRecordListResp, error)
GetImageWorkDetail func(ctx context.Context, in *GetImageWorkDetailReq) (*GetImageWorkDetailResp, error)
GetVedioWorkDetail func(ctx context.Context, in *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
ToBeComfirmedWorks func(ctx context.Context, in *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
GetReconciliationList func(ctx context.Context, in *GetReconciliationListReq) (*GetReconciliationListResp, error)
CreateReconciliation func(ctx context.Context, in *ReconciliationInfo) (*CommonResponse, error)
UpdateReconciliation func(ctx context.Context, in *ReconciliationInfo) (*CommonResponse, error)
CreateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error)
UpdateBundle func(ctx context.Context, in *BundleProfile) (*CommonResponse, error)
DeleteBundle func(ctx context.Context, in *DelBundleRequest) (*CommonResponse, error)
HandShelf func(ctx context.Context, in *HandShelfRequest) (*CommonResponse, error)
SaveBundle func(ctx context.Context, in *BundleProfile) (*SaveResponse, error)
BundleListV2 func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
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 *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)
OrderRecordsDetail func(ctx context.Context, in *OrderRecordsDetailRequest) (*OrderRecordsDetailResponse, error)
UpdateFinancialConfirmationStatus func(ctx context.Context, in *FinancialConfirmationRequest) (*CommonResponse, error)
CreateOrderAddRecord func(ctx context.Context, in *OrderAddRecord) (*CommonResponse, error)
PackagePriceAndTime func(ctx context.Context, in *OrderRecord) (*PackagePriceAndTimeResponse, error)
OrderRecordsListV2 func(ctx context.Context, in *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
OrderListByOrderNo func(ctx context.Context, in *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
OnlyAddValueListByOrderNo func(ctx context.Context, in *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, 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)
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)
BatchGetValueAddServiceLang func(ctx context.Context, in *BatchGetValueAddServiceLangRequest) (*BatchGetValueAddServiceLangResponse, error)
BundleExtend func(ctx context.Context, in *BundleExtendRequest) (*BundleExtendResponse, error)
BundleExtendRecordsList func(ctx context.Context, in *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
GetBundleBalanceList func(ctx context.Context, in *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error)
GetBundleBalanceByUserId func(ctx context.Context, in *GetBundleBalanceByUserIdReq) (*GetBundleBalanceByUserIdResp, error)
CreateBundleBalance func(ctx context.Context, in *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
AddBundleBalance func(ctx context.Context, in *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
GetUsedRecordList func(ctx context.Context, in *GetUsedRecordListReq) (*GetUsedRecordListResp, error)
GetImageWorkDetail func(ctx context.Context, in *GetImageWorkDetailReq) (*GetImageWorkDetailResp, error)
GetVedioWorkDetail func(ctx context.Context, in *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
ToBeComfirmedWorks func(ctx context.Context, in *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
GetReconciliationList func(ctx context.Context, in *GetReconciliationListReq) (*GetReconciliationListResp, error)
CreateReconciliation func(ctx context.Context, in *ReconciliationInfo) (*CommonResponse, error)
UpdateReconciliation func(ctx context.Context, in *ReconciliationInfo) (*CommonResponse, error)
UpdateReconciliationStatusBySerialNumber func(ctx context.Context, in *UpdateStatusAndPayTimeBySerialNumber) (*CommonResponse, error)
}
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
@ -304,6 +308,12 @@ func (c *bundleClient) CalculatePrice(ctx context.Context, in *CalculatePriceReq
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CalculatePrice", in, out)
}
func (c *bundleClient) BatchGetValueAddServiceLang(ctx context.Context, in *BatchGetValueAddServiceLangRequest, opts ...grpc_go.CallOption) (*BatchGetValueAddServiceLangResponse, common.ErrorWithAttachment) {
out := new(BatchGetValueAddServiceLangResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BatchGetValueAddServiceLang", 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)
@ -382,6 +392,12 @@ func (c *bundleClient) UpdateReconciliation(ctx context.Context, in *Reconciliat
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateReconciliation", in, out)
}
func (c *bundleClient) UpdateReconciliationStatusBySerialNumber(ctx context.Context, in *UpdateStatusAndPayTimeBySerialNumber, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateReconciliationStatusBySerialNumber", in, out)
}
// BundleServer is the server API for Bundle service.
// All implementations must embed UnimplementedBundleServer
// for forward compatibility
@ -416,6 +432,7 @@ type BundleServer interface {
ValueAddServiceDetail(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
ValueAddServiceLangByUuidAndLanguage(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceLang, error)
CalculatePrice(context.Context, *CalculatePriceRequest) (*CalculatePriceResponse, error)
BatchGetValueAddServiceLang(context.Context, *BatchGetValueAddServiceLangRequest) (*BatchGetValueAddServiceLangResponse, error)
// 余量管理
BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error)
BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
@ -432,6 +449,7 @@ type BundleServer interface {
GetReconciliationList(context.Context, *GetReconciliationListReq) (*GetReconciliationListResp, error)
CreateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
UpdateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
UpdateReconciliationStatusBySerialNumber(context.Context, *UpdateStatusAndPayTimeBySerialNumber) (*CommonResponse, error)
mustEmbedUnimplementedBundleServer()
}
@ -524,6 +542,9 @@ func (UnimplementedBundleServer) ValueAddServiceLangByUuidAndLanguage(context.Co
func (UnimplementedBundleServer) CalculatePrice(context.Context, *CalculatePriceRequest) (*CalculatePriceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CalculatePrice not implemented")
}
func (UnimplementedBundleServer) BatchGetValueAddServiceLang(context.Context, *BatchGetValueAddServiceLangRequest) (*BatchGetValueAddServiceLangResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BatchGetValueAddServiceLang not implemented")
}
func (UnimplementedBundleServer) BundleExtend(context.Context, *BundleExtendRequest) (*BundleExtendResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BundleExtend not implemented")
}
@ -563,6 +584,9 @@ func (UnimplementedBundleServer) CreateReconciliation(context.Context, *Reconcil
func (UnimplementedBundleServer) UpdateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateReconciliation not implemented")
}
func (UnimplementedBundleServer) UpdateReconciliationStatusBySerialNumber(context.Context, *UpdateStatusAndPayTimeBySerialNumber) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateReconciliationStatusBySerialNumber not implemented")
}
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
@ -1403,6 +1427,35 @@ func _Bundle_CalculatePrice_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
func _Bundle_BatchGetValueAddServiceLang_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(BatchGetValueAddServiceLangRequest)
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("BatchGetValueAddServiceLang", 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 {
@ -1780,6 +1833,35 @@ func _Bundle_UpdateReconciliation_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _Bundle_UpdateReconciliationStatusBySerialNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateStatusAndPayTimeBySerialNumber)
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("UpdateReconciliationStatusBySerialNumber", 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)
@ -1899,6 +1981,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "CalculatePrice",
Handler: _Bundle_CalculatePrice_Handler,
},
{
MethodName: "BatchGetValueAddServiceLang",
Handler: _Bundle_BatchGetValueAddServiceLang_Handler,
},
{
MethodName: "BundleExtend",
Handler: _Bundle_BundleExtend_Handler,
@ -1951,6 +2037,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "UpdateReconciliation",
Handler: _Bundle_UpdateReconciliation_Handler,
},
{
MethodName: "UpdateReconciliationStatusBySerialNumber",
Handler: _Bundle_UpdateReconciliationStatusBySerialNumber_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "pb/bundle.proto",

File diff suppressed because it is too large Load Diff

View File

@ -149,6 +149,122 @@ var _ interface {
ErrorName() string
} = MediaUserListReqValidationError{}
// Validate checks the field values on MediaUserInfo with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *MediaUserInfo) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on MediaUserInfo with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in MediaUserInfoMultiError, or
// nil if none found.
func (m *MediaUserInfo) ValidateAll() error {
return m.validate(true)
}
func (m *MediaUserInfo) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for PlatformUserName
// no validation rules for PlatformID
// no validation rules for ArtistName
// no validation rules for ArtistPhone
// no validation rules for ArtistUuid
// no validation rules for ManagerUserName
// no validation rules for ManagerUuid
// no validation rules for MediaAccountUuid
if len(errors) > 0 {
return MediaUserInfoMultiError(errors)
}
return nil
}
// MediaUserInfoMultiError is an error wrapping multiple validation errors
// returned by MediaUserInfo.ValidateAll() if the designated constraints
// aren't met.
type MediaUserInfoMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m MediaUserInfoMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m MediaUserInfoMultiError) AllErrors() []error { return m }
// MediaUserInfoValidationError is the validation error returned by
// MediaUserInfo.Validate if the designated constraints aren't met.
type MediaUserInfoValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e MediaUserInfoValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e MediaUserInfoValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e MediaUserInfoValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e MediaUserInfoValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e MediaUserInfoValidationError) ErrorName() string { return "MediaUserInfoValidationError" }
// Error satisfies the builtin error interface
func (e MediaUserInfoValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sMediaUserInfo.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = MediaUserInfoValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = MediaUserInfoValidationError{}
// Validate checks the field values on MediaUserListResp with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
@ -2083,6 +2199,52 @@ func (m *WorkDetailResp) validate(all bool) error {
// no validation rules for WorkCategory
{
sorted_keys := make([]string, len(m.GetMediaAccData()))
i := 0
for key := range m.GetMediaAccData() {
sorted_keys[i] = key
i++
}
sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
for _, key := range sorted_keys {
val := m.GetMediaAccData()[key]
_ = val
// no validation rules for MediaAccData[key]
if all {
switch v := interface{}(val).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, WorkDetailRespValidationError{
field: fmt.Sprintf("MediaAccData[%v]", key),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, WorkDetailRespValidationError{
field: fmt.Sprintf("MediaAccData[%v]", key),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return WorkDetailRespValidationError{
field: fmt.Sprintf("MediaAccData[%v]", key),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
if len(errors) > 0 {
return WorkDetailRespMultiError(errors)
}
@ -2751,58 +2913,44 @@ var _ interface {
ErrorName() string
} = MediaWorksRespValidationError{}
// Validate checks the field values on MediaUserListResp_Info with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *MediaUserListResp_Info) Validate() error {
// Validate checks the field values on OAuthYoutubeReq with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *OAuthYoutubeReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on MediaUserListResp_Info with the rules
// ValidateAll checks the field values on OAuthYoutubeReq with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// MediaUserListResp_InfoMultiError, or nil if none found.
func (m *MediaUserListResp_Info) ValidateAll() error {
// OAuthYoutubeReqMultiError, or nil if none found.
func (m *OAuthYoutubeReq) ValidateAll() error {
return m.validate(true)
}
func (m *MediaUserListResp_Info) validate(all bool) error {
func (m *OAuthYoutubeReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for PlatformUserName
// no validation rules for PlatformID
// no validation rules for ArtistName
// no validation rules for ArtistPhone
// no validation rules for ArtistUuid
// no validation rules for ManagerUserName
// no validation rules for ManagerUuid
// no validation rules for MediaAccountUuid
// no validation rules for Code
if len(errors) > 0 {
return MediaUserListResp_InfoMultiError(errors)
return OAuthYoutubeReqMultiError(errors)
}
return nil
}
// MediaUserListResp_InfoMultiError is an error wrapping multiple validation
// errors returned by MediaUserListResp_Info.ValidateAll() if the designated
// constraints aren't met.
type MediaUserListResp_InfoMultiError []error
// OAuthYoutubeReqMultiError is an error wrapping multiple validation errors
// returned by OAuthYoutubeReq.ValidateAll() if the designated constraints
// aren't met.
type OAuthYoutubeReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m MediaUserListResp_InfoMultiError) Error() string {
func (m OAuthYoutubeReqMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
@ -2811,11 +2959,11 @@ func (m MediaUserListResp_InfoMultiError) Error() string {
}
// AllErrors returns a list of validation violation errors.
func (m MediaUserListResp_InfoMultiError) AllErrors() []error { return m }
func (m OAuthYoutubeReqMultiError) AllErrors() []error { return m }
// MediaUserListResp_InfoValidationError is the validation error returned by
// MediaUserListResp_Info.Validate if the designated constraints aren't met.
type MediaUserListResp_InfoValidationError struct {
// OAuthYoutubeReqValidationError is the validation error returned by
// OAuthYoutubeReq.Validate if the designated constraints aren't met.
type OAuthYoutubeReqValidationError struct {
field string
reason string
cause error
@ -2823,24 +2971,22 @@ type MediaUserListResp_InfoValidationError struct {
}
// Field function returns field value.
func (e MediaUserListResp_InfoValidationError) Field() string { return e.field }
func (e OAuthYoutubeReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e MediaUserListResp_InfoValidationError) Reason() string { return e.reason }
func (e OAuthYoutubeReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e MediaUserListResp_InfoValidationError) Cause() error { return e.cause }
func (e OAuthYoutubeReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e MediaUserListResp_InfoValidationError) Key() bool { return e.key }
func (e OAuthYoutubeReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e MediaUserListResp_InfoValidationError) ErrorName() string {
return "MediaUserListResp_InfoValidationError"
}
func (e OAuthYoutubeReqValidationError) ErrorName() string { return "OAuthYoutubeReqValidationError" }
// Error satisfies the builtin error interface
func (e MediaUserListResp_InfoValidationError) Error() string {
func (e OAuthYoutubeReqValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
@ -2852,14 +2998,14 @@ func (e MediaUserListResp_InfoValidationError) Error() string {
}
return fmt.Sprintf(
"invalid %sMediaUserListResp_Info.%s: %s%s",
"invalid %sOAuthYoutubeReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = MediaUserListResp_InfoValidationError{}
var _ error = OAuthYoutubeReqValidationError{}
var _ interface {
Field() string
@ -2867,7 +3013,109 @@ var _ interface {
Key() bool
Cause() error
ErrorName() string
} = MediaUserListResp_InfoValidationError{}
} = OAuthYoutubeReqValidationError{}
// Validate checks the field values on OAuthYoutubeResp with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *OAuthYoutubeResp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on OAuthYoutubeResp with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// OAuthYoutubeRespMultiError, or nil if none found.
func (m *OAuthYoutubeResp) ValidateAll() error {
return m.validate(true)
}
func (m *OAuthYoutubeResp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Url
if len(errors) > 0 {
return OAuthYoutubeRespMultiError(errors)
}
return nil
}
// OAuthYoutubeRespMultiError is an error wrapping multiple validation errors
// returned by OAuthYoutubeResp.ValidateAll() if the designated constraints
// aren't met.
type OAuthYoutubeRespMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m OAuthYoutubeRespMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m OAuthYoutubeRespMultiError) AllErrors() []error { return m }
// OAuthYoutubeRespValidationError is the validation error returned by
// OAuthYoutubeResp.Validate if the designated constraints aren't met.
type OAuthYoutubeRespValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e OAuthYoutubeRespValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e OAuthYoutubeRespValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e OAuthYoutubeRespValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e OAuthYoutubeRespValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e OAuthYoutubeRespValidationError) ErrorName() string { return "OAuthYoutubeRespValidationError" }
// Error satisfies the builtin error interface
func (e OAuthYoutubeRespValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sOAuthYoutubeResp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = OAuthYoutubeRespValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = OAuthYoutubeRespValidationError{}
// Validate checks the field values on WorkListResp_Info with the rules defined
// in the proto definition for this message. If any rules are violated, the

View File

@ -40,6 +40,7 @@ type CastClient interface {
UpdateStatus(ctx context.Context, in *UpdateStatusReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
MediaAccounts(ctx context.Context, in *MediaAccountsReq, opts ...grpc_go.CallOption) (*MediaAccountsResp, common.ErrorWithAttachment)
MediaWorks(ctx context.Context, in *MediaWorksReq, opts ...grpc_go.CallOption) (*MediaWorksResp, common.ErrorWithAttachment)
OAuthYoutube(ctx context.Context, in *OAuthYoutubeReq, opts ...grpc_go.CallOption) (*OAuthYoutubeResp, common.ErrorWithAttachment)
}
type castClient struct {
@ -58,6 +59,7 @@ type CastClientImpl struct {
UpdateStatus func(ctx context.Context, in *UpdateStatusReq) (*emptypb.Empty, error)
MediaAccounts func(ctx context.Context, in *MediaAccountsReq) (*MediaAccountsResp, error)
MediaWorks func(ctx context.Context, in *MediaWorksReq) (*MediaWorksResp, error)
OAuthYoutube func(ctx context.Context, in *OAuthYoutubeReq) (*OAuthYoutubeResp, error)
}
func (c *CastClientImpl) GetDubboStub(cc *triple.TripleConn) CastClient {
@ -138,6 +140,12 @@ func (c *castClient) MediaWorks(ctx context.Context, in *MediaWorksReq, opts ...
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/MediaWorks", in, out)
}
func (c *castClient) OAuthYoutube(ctx context.Context, in *OAuthYoutubeReq, opts ...grpc_go.CallOption) (*OAuthYoutubeResp, common.ErrorWithAttachment) {
out := new(OAuthYoutubeResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OAuthYoutube", in, out)
}
// CastServer is the server API for Cast service.
// All implementations must embed UnimplementedCastServer
// for forward compatibility
@ -153,6 +161,7 @@ type CastServer interface {
UpdateStatus(context.Context, *UpdateStatusReq) (*emptypb.Empty, error)
MediaAccounts(context.Context, *MediaAccountsReq) (*MediaAccountsResp, error)
MediaWorks(context.Context, *MediaWorksReq) (*MediaWorksResp, error)
OAuthYoutube(context.Context, *OAuthYoutubeReq) (*OAuthYoutubeResp, error)
mustEmbedUnimplementedCastServer()
}
@ -194,6 +203,9 @@ func (UnimplementedCastServer) MediaAccounts(context.Context, *MediaAccountsReq)
func (UnimplementedCastServer) MediaWorks(context.Context, *MediaWorksReq) (*MediaWorksResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method MediaWorks not implemented")
}
func (UnimplementedCastServer) OAuthYoutube(context.Context, *OAuthYoutubeReq) (*OAuthYoutubeResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method OAuthYoutube not implemented")
}
func (s *UnimplementedCastServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
@ -541,6 +553,35 @@ func _Cast_MediaWorks_Handler(srv interface{}, ctx context.Context, dec func(int
return interceptor(ctx, in, info, handler)
}
func _Cast_OAuthYoutube_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(OAuthYoutubeReq)
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("OAuthYoutube", 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)
}
// Cast_ServiceDesc is the grpc_go.ServiceDesc for Cast service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -592,6 +633,10 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "MediaWorks",
Handler: _Cast_MediaWorks_Handler,
},
{
MethodName: "OAuthYoutube",
Handler: _Cast_OAuthYoutube_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "pb/fiee/cast.proto",

View File

@ -151,7 +151,8 @@ var MsgFlags = map[int]string{
}
const (
ErrorCreateFeedback = "请勿重复提交"
ErrorCreateFeedback = "请勿重复提交"
ErrorBalanceInsufficient = "余额不足"
)
// GetMsg 获取状态码对应信息

10
pkg/model/cast/oauth.go Normal file
View File

@ -0,0 +1,10 @@
package cast
type OAuthPlatformReq struct {
MediaAccountUuid string `json:"mediaAccountUuid" form:"mediaAccountUuid" binding:"required"`
PlatformID int `json:"platformID" form:"platformID" binding:"required"`
}
type OAuthPlatformResp struct {
Url string `json:"url"`
}

View File

@ -49,6 +49,7 @@ func BundleRouter(r *gin.RouterGroup) {
{
bundleAppRouteV2.POST("bundle-list", bundle.BundleListV2)
bundleAppRouteV2.POST("bundle-detail", bundle.BundleDetailV2)
bundleAppRouteV2.POST("add-value/only", bundle.OnlyAddValueListByOrderNo)
bundleAppRoute.POST("pending-confirmation-list", bundle.GetToBeComfirmedWorks)
bundleAppRoute.POST("balance", bundle.GetUserBalance)

View File

@ -17,6 +17,7 @@ func MediaRouter(r *gin.RouterGroup) {
media.POST("unbind-manager", serviceCast.UnbindManager)
media.POST("bind-manager", serviceCast.BindManager)
media.POST("update-account", serviceCast.UpdateMediaAccount)
media.POST("oauth-platform", serviceCast.OAuthPlatform)
}
work := auth.Group("work")

View File

@ -154,7 +154,7 @@ func NewRouter() *gin.Engine {
resourceRoute.POST("/tus/upload", file.TusUpload)
resourceRoute.GET("/raw", file.Raw)
resourceRoute.GET("/raw/dir", file.DirDownload)
resourceRoute.GET("/preview", file.Preview)
resourceRoute.GET("/preview/:size/*path", file.Preview)
resourceRoute.GET("/list", file.List)
resourceRoute.GET("/usage", file.Usage)
}

View File

@ -183,13 +183,7 @@ func WorkConfirm(c *gin.Context) { // 确认作品并扣除余量
service.Error(c, errors.New("作品不是待确认状态"))
return
}
var workCategory int // 1 图文 2 视频
if len(wordInfoRes.Images) == 0 { // 临时判断
workCategory = 2
} else {
workCategory = 1
}
var workCategory = wordInfoRes.WorkCategory
var addBalanceReq bundle.AddBundleBalanceReq
addBalanceReq.UserId = int32(userInfo.ID)

View File

@ -30,8 +30,10 @@ func CreateBundleOrderAddSignature(c *gin.Context) {
}
if req.Language == "" {
req.Language = c.GetHeader("Accept-Language")
service.Error(c, errors.New(common.MissLanguageTypes))
return
if req.Language == "" {
service.Error(c, errors.New(common.MissLanguageTypes))
return
}
}
if req.BundleUuid == "" {
service.Error(c, errors.New(common.MissOrderNo))
@ -185,8 +187,10 @@ func CreateBundleOrderSignature(c *gin.Context) {
}
if req.Language == "" {
req.Language = c.GetHeader("Accept-Language")
service.Error(c, errors.New(common.MissLanguageTypes))
return
if req.Language == "" {
service.Error(c, errors.New(common.MissLanguageTypes))
return
}
}
// 不去校验 签名
/*if req.Signature == "" {

View File

@ -153,6 +153,8 @@ func CreateAntomPay(c *gin.Context) {
return
}
bundleName := "" // 套餐名称
if orderLimit != nil && orderLimit.Type == 1 { // 这儿的type实际就是source
// 检查 订单信息 type是1说明既有主套餐又有增值服务
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
@ -168,6 +170,9 @@ func CreateAntomPay(c *gin.Context) {
fmt.Println("detail.OrderRecord.Status :", detail.OrderRecord.Status)
fmt.Println("detail.OrderRecord.CheckoutSessionId :", detail.OrderRecord.CheckoutSessionId)
fmt.Println("detail.OrderRecord.PayTime :", detail.OrderRecord.PayTime)
bundleName = detail.OrderRecord.BundleName
// 主套餐
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
@ -354,18 +359,34 @@ func CreateAntomPay(c *gin.Context) {
}
fmt.Println("resp:", resp)
currencyType := 0
if req.ProductPriceCurrency == "cny" || req.ProductPriceCurrency == "CNY" {
currencyType = 1
}
if req.ProductPriceCurrency == "usd" || req.ProductPriceCurrency == "USD" {
currencyType = 2
}
////创建对账单 todo 待修改
//_, err = service.BundleProvider.CreateReconciliation(context.Background(), &bundle.ReconciliationInfo{
// BundleOrderOn: detail.OrderRecord.OrderNo,
// BundleAddOrderOn: detail.OrderRecord.OrderNo,
// UserName: userInfo.Name,
// UserTel: userInfo.TelNum,
// BundleName: detail.OrderRecord.BundleName,
// Amount: detail.OrderRecord.TotalAmount,
// CurrencyType: int32(detail.OrderRecord.AmountType),
// PayStatus: 1,
// UserId: userInfo.ID,
//})
_, err = service.BundleProvider.CreateReconciliation(context.Background(), &bundle.ReconciliationInfo{
BundleOrderOn: req.OutTradeNo,
BundleAddOrderOn: req.OutTradeNo,
UserName: userInfo.Name,
UserTel: userInfo.TelNum,
BundleName: bundleName,
PayAmount: float32(req.ProductAllPrice),
CurrencyType: int32(currencyType),
PayStatus: 1,
UserID: userInfo.ID,
SerialNumber: result.CheckoutSessionId,
})
if err != nil {
fmt.Println("=============== antom创建支付创建对账单报错", err)
logger.Errorf("=============== antom创建支付创建对账单报错", err)
service.Error(c, err)
return
}
service.Success(c, resp)
}
@ -478,6 +499,19 @@ func AntomWebhook(c *gin.Context) {
service.Error(c, err)
return
}
// 更新对账单
_, err = service.BundleProvider.UpdateReconciliationStatusBySerialNumber(context.Background(), &bundle.UpdateStatusAndPayTimeBySerialNumber{
PayTime: paymentTime,
PaymentStatus: 2,
SerialNumber: requestId,
})
if err != nil {
fmt.Println("=============== antom回调更新对账单报错", err)
logger.Errorf("=============== antom回调更新对账单报错", err)
service.Error(c, err)
return
}
//添加余额
orderLimit, err := service.BundleProvider.OrderListByOrderNo(context.Background(), &bundle.OrderInfoByOrderNoRequest{
OrderNo: resp.OutTradeNo,

37
pkg/service/cast/oauth.go Normal file
View File

@ -0,0 +1,37 @@
package cast
import (
"fonchain-fiee/api/cast"
"fonchain-fiee/pkg/service"
modelCast "fonchain-fiee/pkg/model/cast"
"github.com/gin-gonic/gin"
"context"
)
func OAuthPlatform(ctx *gin.Context) {
var (
err error
req *modelCast.OAuthPlatformReq
resp *modelCast.OAuthPlatformResp
)
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
if req.PlatformID == int(cast.PlatformIDENUM_YOUTUBE) {
respOAuth, _err := service.CastProvider.OAuthYoutube(context.Background(), &cast.OAuthYoutubeReq{
Code: "",
})
if _err != nil {
service.Error(ctx, _err)
return
}
resp.Url = respOAuth.Url
}
//resp, err := service.CastProvider.OAuthPlatform(ctx, req)
//if err != nil {
// service.Error(ctx, err)
//}
service.Success(ctx, resp)
return
}

View File

@ -3,6 +3,7 @@ package cast
import (
"context"
"errors"
"fmt"
"fonchain-fiee/api/accountFiee"
"fonchain-fiee/api/bundle"
"fonchain-fiee/api/cast"
@ -10,6 +11,7 @@ import (
"fonchain-fiee/pkg/e"
"fonchain-fiee/pkg/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"strconv"
)
@ -164,8 +166,10 @@ func CheckUserBundleBalance(userID int32) (err error) {
if err != nil {
return
}
zap.L().Info("CheckUserBundleBalance", zap.Any("resp", resp))
fmt.Println("CheckUserBundleBalance resp", resp)
if resp.AccountNumber-resp.AccountConsumptionNumber <= 0 {
err = errors.New(e.ErrNoBalance)
err = errors.New(e.ErrorBalanceInsufficient)
return
}
return

View File

@ -169,7 +169,19 @@ func TusUpload(ctx *gin.Context) {
service.Error(ctx, fmt.Errorf("invalid upload offset: %w", err))
return
}
b, err := io.ReadAll(ctx.Request.Body)
mf, err := ctx.MultipartForm()
if err != nil {
service.Error(ctx, fmt.Errorf("invalid upload offset: %w", err))
return
}
f, err := mf.File["file"][0].Open()
if err != nil {
service.Error(ctx, fmt.Errorf("invalid upload offset: %w", err))
return
}
defer f.Close()
b, err := io.ReadAll(f)
// b, err := io.ReadAll(ctx.Request.Body)
if !ok {
service.Error(ctx, err)
return
@ -190,12 +202,12 @@ func TusUpload(ctx *gin.Context) {
func Preview(ctx *gin.Context) {
var size int
size, err := strconv.Atoi(ctx.Query("size"))
size, err := strconv.Atoi(ctx.Param("size"))
if err != nil {
size = 1
}
resp, err := service.FilesProvider.Preview(ctx, &files.PreviewReq{
Path: ctx.Query("path"),
Path: ctx.Param("path"),
UserSpacePath: getUserSpacePath(ctx),
Size: uint32(size),
})

View File

@ -9,6 +9,7 @@ import (
"fonchain-fiee/pkg/service"
"net/http"
"net/url"
"strconv"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
@ -107,8 +108,8 @@ func DeleteSecFiling(c *gin.Context) {
type GetSecFilingsReq struct {
FilingDate string `json:"filingDate"`
Page string `json:"page"`
Limit string `json:"limit"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type GetSecFilingsData struct {
Symbol string `json:"symbol"`
@ -145,21 +146,22 @@ func GetSecFilings(c *gin.Context) {
symbol := "MINM"
beginDate := req.FilingDate
endDate := req.FilingDate
page := "0"
limit := "100"
if req.Page != "" {
page := 0
pageSize := 100
if req.Page != 0 {
page = req.Page
}
if req.Limit != "" {
limit = req.Limit
if req.PageSize != 0 {
pageSize = req.PageSize
}
baseURL := "https://financialmodelingprep.com/stable/sec-filings-search/symbol"
params := url.Values{}
params.Add("symbol", symbol)
params.Add("from", beginDate)
params.Add("to", endDate)
params.Add("page", page)
params.Add("limit", limit)
params.Add("page", strconv.Itoa(page))
params.Add("limit", strconv.Itoa(pageSize))
params.Add("apikey", "lBQWUwdjRmfHVZ7e3I1trWe4jw0ZtDct")
fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())