Compare commits

..

4 Commits
main ... jng

Author SHA1 Message Date
JNG
6a3a565564 修改 2025-10-20 15:20:46 +08:00
JNG
fe6eaa5c6e Update reconciliation.go 2025-09-24 15:50:16 +08:00
JNG
07a606c59f 修改 2025-09-18 09:36:08 +08:00
JNG
3ced669383 fiee二期迭代 2025-09-17 16:50:49 +08:00
33 changed files with 6323 additions and 7946 deletions

View File

@ -1,13 +0,0 @@
## 测试服后台
http://172.16.100.99:9028/
13580848136
https://erp.fiee.com/older_list
13580848136
Aa.123456
测试h5
## https://saas-test.szjixun.cn
正式h5
https://saas.fiee.com

File diff suppressed because it is too large Load Diff

View File

@ -95,6 +95,13 @@ func (this *BundleProfile) Validate() error {
} }
} }
} }
for _, item := range this.SelectValueAdditionalService {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("SelectValueAdditionalService", err)
}
}
}
for _, item := range this.BundleProfileLang { for _, item := range this.BundleProfileLang {
if item != nil { if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
@ -105,6 +112,16 @@ func (this *BundleProfile) Validate() error {
return nil return nil
} }
func (this *BundleProfileLang) Validate() error { func (this *BundleProfileLang) Validate() error {
for _, item := range this.ServiceLangInfo {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("ServiceLangInfo", err)
}
}
}
return nil
}
func (this *ServiceLangInfo) Validate() error {
return nil return nil
} }
func (this *SaveResponse) Validate() error { func (this *SaveResponse) Validate() error {
@ -113,6 +130,9 @@ func (this *SaveResponse) Validate() error {
func (this *SelectValueAddService) Validate() error { func (this *SelectValueAddService) Validate() error {
return nil return nil
} }
func (this *SelectValueAdditionalService) Validate() error {
return nil
}
func (this *DelBundleRequest) Validate() error { func (this *DelBundleRequest) Validate() error {
return nil return nil
} }
@ -466,3 +486,72 @@ func (this *UnfinishedInfo) Validate() error {
func (this *SoftDeleteUnfinishedInfoRequest) Validate() error { func (this *SoftDeleteUnfinishedInfoRequest) Validate() error {
return nil return nil
} }
func (this *TaskQueryRequest) Validate() error {
return nil
}
func (this *TaskQueryResponse) Validate() error {
for _, item := range this.Tasks {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Tasks", err)
}
}
}
return nil
}
func (this *TaskManagementInfo) Validate() error {
return nil
}
func (this *TaskAssignRequest) Validate() error {
return nil
}
func (this *UpdatePendingCountRequest) Validate() error {
return nil
}
func (this *RecentAssignRecordsRequest) Validate() error {
return nil
}
func (this *RecentAssignRecordsResponse) Validate() error {
return nil
}
func (this *EmployeeTaskQueryRequest) Validate() error {
return nil
}
func (this *EmployeeTaskQueryResponse) Validate() error {
for _, item := range this.Records {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Records", err)
}
}
}
return nil
}
func (this *TaskAssignRecordInfo) Validate() error {
return nil
}
func (this *CompleteTaskManuallyRequest) Validate() error {
return nil
}
func (this *UpdateTaskProgressRequest) Validate() error {
return nil
}
func (this *TaskAssignRecordsQueryRequest) Validate() error {
return nil
}
func (this *TaskAssignRecordsQueryResponse) Validate() error {
for _, item := range this.Records {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Records", err)
}
}
}
return nil
}
func (this *ArtistBundleBalanceRequest) Validate() error {
return nil
}
func (this *ArtistBundleBalanceResponse) Validate() error {
return nil
}

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT. // Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-triple v1.0.8 // - protoc-gen-go-triple v1.0.5
// - protoc v3.12.4 // - protoc v6.32.0
// source: pb/bundle.proto // source: pb/bundle.proto
package bundle package bundle
@ -83,6 +83,16 @@ type BundleClient interface {
// 查出没处理的数据 // 查出没处理的数据
ListUnfinishedInfos(ctx context.Context, in *AutoCreateUserAndOrderRequest, opts ...grpc_go.CallOption) (*UnfinishedInfos, common.ErrorWithAttachment) ListUnfinishedInfos(ctx context.Context, in *AutoCreateUserAndOrderRequest, opts ...grpc_go.CallOption) (*UnfinishedInfos, common.ErrorWithAttachment)
SoftDeleteUnfinishedInfo(ctx context.Context, in *SoftDeleteUnfinishedInfoRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) SoftDeleteUnfinishedInfo(ctx context.Context, in *SoftDeleteUnfinishedInfoRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
// 任务台
GetPendingTaskList(ctx context.Context, in *TaskQueryRequest, opts ...grpc_go.CallOption) (*TaskQueryResponse, common.ErrorWithAttachment)
AssignTask(ctx context.Context, in *TaskAssignRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
UpdatePendingCount(ctx context.Context, in *UpdatePendingCountRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
GetRecentAssignRecords(ctx context.Context, in *RecentAssignRecordsRequest, opts ...grpc_go.CallOption) (*RecentAssignRecordsResponse, common.ErrorWithAttachment)
GetEmployeeAssignedTasks(ctx context.Context, in *EmployeeTaskQueryRequest, opts ...grpc_go.CallOption) (*EmployeeTaskQueryResponse, common.ErrorWithAttachment)
CompleteTaskManually(ctx context.Context, in *CompleteTaskManuallyRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
UpdateTaskProgress(ctx context.Context, in *UpdateTaskProgressRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
GetTaskAssignRecordsList(ctx context.Context, in *TaskAssignRecordsQueryRequest, opts ...grpc_go.CallOption) (*TaskAssignRecordsQueryResponse, common.ErrorWithAttachment)
GetArtistBundleBalance(ctx context.Context, in *ArtistBundleBalanceRequest, opts ...grpc_go.CallOption) (*ArtistBundleBalanceResponse, common.ErrorWithAttachment)
} }
type bundleClient struct { type bundleClient struct {
@ -139,6 +149,15 @@ type BundleClientImpl struct {
UpdateReconciliationStatusBySerialNumber func(ctx context.Context, in *UpdateStatusAndPayTimeBySerialNumber) (*CommonResponse, error) UpdateReconciliationStatusBySerialNumber func(ctx context.Context, in *UpdateStatusAndPayTimeBySerialNumber) (*CommonResponse, error)
ListUnfinishedInfos func(ctx context.Context, in *AutoCreateUserAndOrderRequest) (*UnfinishedInfos, error) ListUnfinishedInfos func(ctx context.Context, in *AutoCreateUserAndOrderRequest) (*UnfinishedInfos, error)
SoftDeleteUnfinishedInfo func(ctx context.Context, in *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error) SoftDeleteUnfinishedInfo func(ctx context.Context, in *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error)
GetPendingTaskList func(ctx context.Context, in *TaskQueryRequest) (*TaskQueryResponse, error)
AssignTask func(ctx context.Context, in *TaskAssignRequest) (*CommonResponse, error)
UpdatePendingCount func(ctx context.Context, in *UpdatePendingCountRequest) (*CommonResponse, error)
GetRecentAssignRecords func(ctx context.Context, in *RecentAssignRecordsRequest) (*RecentAssignRecordsResponse, error)
GetEmployeeAssignedTasks func(ctx context.Context, in *EmployeeTaskQueryRequest) (*EmployeeTaskQueryResponse, error)
CompleteTaskManually func(ctx context.Context, in *CompleteTaskManuallyRequest) (*CommonResponse, error)
UpdateTaskProgress func(ctx context.Context, in *UpdateTaskProgressRequest) (*CommonResponse, error)
GetTaskAssignRecordsList func(ctx context.Context, in *TaskAssignRecordsQueryRequest) (*TaskAssignRecordsQueryResponse, error)
GetArtistBundleBalance func(ctx context.Context, in *ArtistBundleBalanceRequest) (*ArtistBundleBalanceResponse, error)
} }
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient { func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
@ -447,6 +466,60 @@ func (c *bundleClient) SoftDeleteUnfinishedInfo(ctx context.Context, in *SoftDel
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SoftDeleteUnfinishedInfo", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SoftDeleteUnfinishedInfo", in, out)
} }
func (c *bundleClient) GetPendingTaskList(ctx context.Context, in *TaskQueryRequest, opts ...grpc_go.CallOption) (*TaskQueryResponse, common.ErrorWithAttachment) {
out := new(TaskQueryResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetPendingTaskList", in, out)
}
func (c *bundleClient) AssignTask(ctx context.Context, in *TaskAssignRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/AssignTask", in, out)
}
func (c *bundleClient) UpdatePendingCount(ctx context.Context, in *UpdatePendingCountRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdatePendingCount", in, out)
}
func (c *bundleClient) GetRecentAssignRecords(ctx context.Context, in *RecentAssignRecordsRequest, opts ...grpc_go.CallOption) (*RecentAssignRecordsResponse, common.ErrorWithAttachment) {
out := new(RecentAssignRecordsResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetRecentAssignRecords", in, out)
}
func (c *bundleClient) GetEmployeeAssignedTasks(ctx context.Context, in *EmployeeTaskQueryRequest, opts ...grpc_go.CallOption) (*EmployeeTaskQueryResponse, common.ErrorWithAttachment) {
out := new(EmployeeTaskQueryResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetEmployeeAssignedTasks", in, out)
}
func (c *bundleClient) CompleteTaskManually(ctx context.Context, in *CompleteTaskManuallyRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CompleteTaskManually", in, out)
}
func (c *bundleClient) UpdateTaskProgress(ctx context.Context, in *UpdateTaskProgressRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateTaskProgress", in, out)
}
func (c *bundleClient) GetTaskAssignRecordsList(ctx context.Context, in *TaskAssignRecordsQueryRequest, opts ...grpc_go.CallOption) (*TaskAssignRecordsQueryResponse, common.ErrorWithAttachment) {
out := new(TaskAssignRecordsQueryResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetTaskAssignRecordsList", in, out)
}
func (c *bundleClient) GetArtistBundleBalance(ctx context.Context, in *ArtistBundleBalanceRequest, opts ...grpc_go.CallOption) (*ArtistBundleBalanceResponse, common.ErrorWithAttachment) {
out := new(ArtistBundleBalanceResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetArtistBundleBalance", 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
@ -506,6 +579,16 @@ type BundleServer interface {
// 查出没处理的数据 // 查出没处理的数据
ListUnfinishedInfos(context.Context, *AutoCreateUserAndOrderRequest) (*UnfinishedInfos, error) ListUnfinishedInfos(context.Context, *AutoCreateUserAndOrderRequest) (*UnfinishedInfos, error)
SoftDeleteUnfinishedInfo(context.Context, *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error) SoftDeleteUnfinishedInfo(context.Context, *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error)
// 任务台
GetPendingTaskList(context.Context, *TaskQueryRequest) (*TaskQueryResponse, error)
AssignTask(context.Context, *TaskAssignRequest) (*CommonResponse, error)
UpdatePendingCount(context.Context, *UpdatePendingCountRequest) (*CommonResponse, error)
GetRecentAssignRecords(context.Context, *RecentAssignRecordsRequest) (*RecentAssignRecordsResponse, error)
GetEmployeeAssignedTasks(context.Context, *EmployeeTaskQueryRequest) (*EmployeeTaskQueryResponse, error)
CompleteTaskManually(context.Context, *CompleteTaskManuallyRequest) (*CommonResponse, error)
UpdateTaskProgress(context.Context, *UpdateTaskProgressRequest) (*CommonResponse, error)
GetTaskAssignRecordsList(context.Context, *TaskAssignRecordsQueryRequest) (*TaskAssignRecordsQueryResponse, error)
GetArtistBundleBalance(context.Context, *ArtistBundleBalanceRequest) (*ArtistBundleBalanceResponse, error)
mustEmbedUnimplementedBundleServer() mustEmbedUnimplementedBundleServer()
} }
@ -661,6 +744,33 @@ func (UnimplementedBundleServer) ListUnfinishedInfos(context.Context, *AutoCreat
func (UnimplementedBundleServer) SoftDeleteUnfinishedInfo(context.Context, *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error) { func (UnimplementedBundleServer) SoftDeleteUnfinishedInfo(context.Context, *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SoftDeleteUnfinishedInfo not implemented") return nil, status.Errorf(codes.Unimplemented, "method SoftDeleteUnfinishedInfo not implemented")
} }
func (UnimplementedBundleServer) GetPendingTaskList(context.Context, *TaskQueryRequest) (*TaskQueryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPendingTaskList not implemented")
}
func (UnimplementedBundleServer) AssignTask(context.Context, *TaskAssignRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AssignTask not implemented")
}
func (UnimplementedBundleServer) UpdatePendingCount(context.Context, *UpdatePendingCountRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdatePendingCount not implemented")
}
func (UnimplementedBundleServer) GetRecentAssignRecords(context.Context, *RecentAssignRecordsRequest) (*RecentAssignRecordsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetRecentAssignRecords not implemented")
}
func (UnimplementedBundleServer) GetEmployeeAssignedTasks(context.Context, *EmployeeTaskQueryRequest) (*EmployeeTaskQueryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetEmployeeAssignedTasks not implemented")
}
func (UnimplementedBundleServer) CompleteTaskManually(context.Context, *CompleteTaskManuallyRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CompleteTaskManually not implemented")
}
func (UnimplementedBundleServer) UpdateTaskProgress(context.Context, *UpdateTaskProgressRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateTaskProgress not implemented")
}
func (UnimplementedBundleServer) GetTaskAssignRecordsList(context.Context, *TaskAssignRecordsQueryRequest) (*TaskAssignRecordsQueryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTaskAssignRecordsList not implemented")
}
func (UnimplementedBundleServer) GetArtistBundleBalance(context.Context, *ArtistBundleBalanceRequest) (*ArtistBundleBalanceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetArtistBundleBalance not implemented")
}
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) { func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl s.proxyImpl = impl
} }
@ -2110,6 +2220,267 @@ func _Bundle_SoftDeleteUnfinishedInfo_Handler(srv interface{}, ctx context.Conte
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Bundle_GetPendingTaskList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(TaskQueryRequest)
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("GetPendingTaskList", 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_AssignTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(TaskAssignRequest)
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("AssignTask", 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_UpdatePendingCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdatePendingCountRequest)
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("UpdatePendingCount", 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_GetRecentAssignRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(RecentAssignRecordsRequest)
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("GetRecentAssignRecords", 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_GetEmployeeAssignedTasks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(EmployeeTaskQueryRequest)
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("GetEmployeeAssignedTasks", 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_CompleteTaskManually_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CompleteTaskManuallyRequest)
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("CompleteTaskManually", 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_UpdateTaskProgress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateTaskProgressRequest)
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("UpdateTaskProgress", 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_GetTaskAssignRecordsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(TaskAssignRecordsQueryRequest)
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("GetTaskAssignRecordsList", 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_GetArtistBundleBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ArtistBundleBalanceRequest)
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("GetArtistBundleBalance", 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)
@ -2313,6 +2684,42 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "SoftDeleteUnfinishedInfo", MethodName: "SoftDeleteUnfinishedInfo",
Handler: _Bundle_SoftDeleteUnfinishedInfo_Handler, Handler: _Bundle_SoftDeleteUnfinishedInfo_Handler,
}, },
{
MethodName: "GetPendingTaskList",
Handler: _Bundle_GetPendingTaskList_Handler,
},
{
MethodName: "AssignTask",
Handler: _Bundle_AssignTask_Handler,
},
{
MethodName: "UpdatePendingCount",
Handler: _Bundle_UpdatePendingCount_Handler,
},
{
MethodName: "GetRecentAssignRecords",
Handler: _Bundle_GetRecentAssignRecords_Handler,
},
{
MethodName: "GetEmployeeAssignedTasks",
Handler: _Bundle_GetEmployeeAssignedTasks_Handler,
},
{
MethodName: "CompleteTaskManually",
Handler: _Bundle_CompleteTaskManually_Handler,
},
{
MethodName: "UpdateTaskProgress",
Handler: _Bundle_UpdateTaskProgress_Handler,
},
{
MethodName: "GetTaskAssignRecordsList",
Handler: _Bundle_GetTaskAssignRecordsList_Handler,
},
{
MethodName: "GetArtistBundleBalance",
Handler: _Bundle_GetArtistBundleBalance_Handler,
},
}, },
Streams: []grpc_go.StreamDesc{}, Streams: []grpc_go.StreamDesc{},
Metadata: "pb/bundle.proto", Metadata: "pb/bundle.proto",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -43,11 +43,8 @@ type CastClient interface {
RePublish(ctx context.Context, in *RePublishReq, opts ...grpc_go.CallOption) (*RePublishResp, common.ErrorWithAttachment) RePublish(ctx context.Context, in *RePublishReq, opts ...grpc_go.CallOption) (*RePublishResp, common.ErrorWithAttachment)
DelWork(ctx context.Context, in *DelWorkReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment) DelWork(ctx context.Context, in *DelWorkReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
WorkInfo(ctx context.Context, in *WorkInfoReq, opts ...grpc_go.CallOption) (*WorkInfoResp, common.ErrorWithAttachment) WorkInfo(ctx context.Context, in *WorkInfoReq, opts ...grpc_go.CallOption) (*WorkInfoResp, common.ErrorWithAttachment)
OAuthAccount(ctx context.Context, in *OAuthAccountReq, opts ...grpc_go.CallOption) (*OAuthAccountResp, common.ErrorWithAttachment) OAuthYoutubeUrl(ctx context.Context, in *OAuthYoutubeUrlReq, opts ...grpc_go.CallOption) (*OAuthYoutubeUrlResp, common.ErrorWithAttachment)
OAuthCodeToToken(ctx context.Context, in *OAuthCodeToTokenReq, opts ...grpc_go.CallOption) (*OAuthCodeToTokenResp, common.ErrorWithAttachment) OAuthYoutubeToken(ctx context.Context, in *OAuthYoutubeTokenReq, opts ...grpc_go.CallOption) (*OAuthYoutubeTokenResp, common.ErrorWithAttachment)
RefreshToken(ctx context.Context, in *RefreshTokenReq, opts ...grpc_go.CallOption) (*RefreshTokenResp, common.ErrorWithAttachment)
PublishMediaInfo(ctx context.Context, in *PublishMediaInfoReq, opts ...grpc_go.CallOption) (*PublishMediaInfoResp, common.ErrorWithAttachment)
Test(ctx context.Context, in *emptypb.Empty, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
} }
type castClient struct { type castClient struct {
@ -69,11 +66,8 @@ type CastClientImpl struct {
RePublish func(ctx context.Context, in *RePublishReq) (*RePublishResp, error) RePublish func(ctx context.Context, in *RePublishReq) (*RePublishResp, error)
DelWork func(ctx context.Context, in *DelWorkReq) (*emptypb.Empty, error) DelWork func(ctx context.Context, in *DelWorkReq) (*emptypb.Empty, error)
WorkInfo func(ctx context.Context, in *WorkInfoReq) (*WorkInfoResp, error) WorkInfo func(ctx context.Context, in *WorkInfoReq) (*WorkInfoResp, error)
OAuthAccount func(ctx context.Context, in *OAuthAccountReq) (*OAuthAccountResp, error) OAuthYoutubeUrl func(ctx context.Context, in *OAuthYoutubeUrlReq) (*OAuthYoutubeUrlResp, error)
OAuthCodeToToken func(ctx context.Context, in *OAuthCodeToTokenReq) (*OAuthCodeToTokenResp, error) OAuthYoutubeToken func(ctx context.Context, in *OAuthYoutubeTokenReq) (*OAuthYoutubeTokenResp, error)
RefreshToken func(ctx context.Context, in *RefreshTokenReq) (*RefreshTokenResp, error)
PublishMediaInfo func(ctx context.Context, in *PublishMediaInfoReq) (*PublishMediaInfoResp, error)
Test func(ctx context.Context, in *emptypb.Empty) (*emptypb.Empty, error)
} }
func (c *CastClientImpl) GetDubboStub(cc *triple.TripleConn) CastClient { func (c *CastClientImpl) GetDubboStub(cc *triple.TripleConn) CastClient {
@ -172,34 +166,16 @@ func (c *castClient) WorkInfo(ctx context.Context, in *WorkInfoReq, opts ...grpc
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/WorkInfo", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/WorkInfo", in, out)
} }
func (c *castClient) OAuthAccount(ctx context.Context, in *OAuthAccountReq, opts ...grpc_go.CallOption) (*OAuthAccountResp, common.ErrorWithAttachment) { func (c *castClient) OAuthYoutubeUrl(ctx context.Context, in *OAuthYoutubeUrlReq, opts ...grpc_go.CallOption) (*OAuthYoutubeUrlResp, common.ErrorWithAttachment) {
out := new(OAuthAccountResp) out := new(OAuthYoutubeUrlResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string) interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OAuthAccount", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OAuthYoutubeUrl", in, out)
} }
func (c *castClient) OAuthCodeToToken(ctx context.Context, in *OAuthCodeToTokenReq, opts ...grpc_go.CallOption) (*OAuthCodeToTokenResp, common.ErrorWithAttachment) { func (c *castClient) OAuthYoutubeToken(ctx context.Context, in *OAuthYoutubeTokenReq, opts ...grpc_go.CallOption) (*OAuthYoutubeTokenResp, common.ErrorWithAttachment) {
out := new(OAuthCodeToTokenResp) out := new(OAuthYoutubeTokenResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string) interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OAuthCodeToToken", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OAuthYoutubeToken", in, out)
}
func (c *castClient) RefreshToken(ctx context.Context, in *RefreshTokenReq, opts ...grpc_go.CallOption) (*RefreshTokenResp, common.ErrorWithAttachment) {
out := new(RefreshTokenResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/RefreshToken", in, out)
}
func (c *castClient) PublishMediaInfo(ctx context.Context, in *PublishMediaInfoReq, opts ...grpc_go.CallOption) (*PublishMediaInfoResp, common.ErrorWithAttachment) {
out := new(PublishMediaInfoResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/PublishMediaInfo", in, out)
}
func (c *castClient) Test(ctx context.Context, in *emptypb.Empty, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment) {
out := new(emptypb.Empty)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Test", in, out)
} }
// CastServer is the server API for Cast service. // CastServer is the server API for Cast service.
@ -220,11 +196,8 @@ type CastServer interface {
RePublish(context.Context, *RePublishReq) (*RePublishResp, error) RePublish(context.Context, *RePublishReq) (*RePublishResp, error)
DelWork(context.Context, *DelWorkReq) (*emptypb.Empty, error) DelWork(context.Context, *DelWorkReq) (*emptypb.Empty, error)
WorkInfo(context.Context, *WorkInfoReq) (*WorkInfoResp, error) WorkInfo(context.Context, *WorkInfoReq) (*WorkInfoResp, error)
OAuthAccount(context.Context, *OAuthAccountReq) (*OAuthAccountResp, error) OAuthYoutubeUrl(context.Context, *OAuthYoutubeUrlReq) (*OAuthYoutubeUrlResp, error)
OAuthCodeToToken(context.Context, *OAuthCodeToTokenReq) (*OAuthCodeToTokenResp, error) OAuthYoutubeToken(context.Context, *OAuthYoutubeTokenReq) (*OAuthYoutubeTokenResp, error)
RefreshToken(context.Context, *RefreshTokenReq) (*RefreshTokenResp, error)
PublishMediaInfo(context.Context, *PublishMediaInfoReq) (*PublishMediaInfoResp, error)
Test(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
mustEmbedUnimplementedCastServer() mustEmbedUnimplementedCastServer()
} }
@ -275,20 +248,11 @@ func (UnimplementedCastServer) DelWork(context.Context, *DelWorkReq) (*emptypb.E
func (UnimplementedCastServer) WorkInfo(context.Context, *WorkInfoReq) (*WorkInfoResp, error) { func (UnimplementedCastServer) WorkInfo(context.Context, *WorkInfoReq) (*WorkInfoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method WorkInfo not implemented") return nil, status.Errorf(codes.Unimplemented, "method WorkInfo not implemented")
} }
func (UnimplementedCastServer) OAuthAccount(context.Context, *OAuthAccountReq) (*OAuthAccountResp, error) { func (UnimplementedCastServer) OAuthYoutubeUrl(context.Context, *OAuthYoutubeUrlReq) (*OAuthYoutubeUrlResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method OAuthAccount not implemented") return nil, status.Errorf(codes.Unimplemented, "method OAuthYoutubeUrl not implemented")
} }
func (UnimplementedCastServer) OAuthCodeToToken(context.Context, *OAuthCodeToTokenReq) (*OAuthCodeToTokenResp, error) { func (UnimplementedCastServer) OAuthYoutubeToken(context.Context, *OAuthYoutubeTokenReq) (*OAuthYoutubeTokenResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method OAuthCodeToToken not implemented") return nil, status.Errorf(codes.Unimplemented, "method OAuthYoutubeToken not implemented")
}
func (UnimplementedCastServer) RefreshToken(context.Context, *RefreshTokenReq) (*RefreshTokenResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method RefreshToken not implemented")
}
func (UnimplementedCastServer) PublishMediaInfo(context.Context, *PublishMediaInfoReq) (*PublishMediaInfoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method PublishMediaInfo not implemented")
}
func (UnimplementedCastServer) Test(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Test not implemented")
} }
func (s *UnimplementedCastServer) XXX_SetProxyImpl(impl protocol.Invoker) { func (s *UnimplementedCastServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl s.proxyImpl = impl
@ -724,8 +688,8 @@ func _Cast_WorkInfo_Handler(srv interface{}, ctx context.Context, dec func(inter
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Cast_OAuthAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { func _Cast_OAuthYoutubeUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(OAuthAccountReq) in := new(OAuthYoutubeUrlReq)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -737,7 +701,7 @@ func _Cast_OAuthAccount_Handler(srv interface{}, ctx context.Context, dec func(i
for k, v := range md { for k, v := range md {
invAttachment[k] = v invAttachment[k] = v
} }
invo := invocation.NewRPCInvocation("OAuthAccount", args, invAttachment) invo := invocation.NewRPCInvocation("OAuthYoutubeUrl", args, invAttachment)
if interceptor == nil { if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo) result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error() return result, result.Error()
@ -753,8 +717,8 @@ func _Cast_OAuthAccount_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Cast_OAuthCodeToToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { func _Cast_OAuthYoutubeToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(OAuthCodeToTokenReq) in := new(OAuthYoutubeTokenReq)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -766,94 +730,7 @@ func _Cast_OAuthCodeToToken_Handler(srv interface{}, ctx context.Context, dec fu
for k, v := range md { for k, v := range md {
invAttachment[k] = v invAttachment[k] = v
} }
invo := invocation.NewRPCInvocation("OAuthCodeToToken", args, invAttachment) invo := invocation.NewRPCInvocation("OAuthYoutubeToken", 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 _Cast_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(RefreshTokenReq)
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("RefreshToken", 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 _Cast_PublishMediaInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(PublishMediaInfoReq)
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("PublishMediaInfo", 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 _Cast_Test_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(emptypb.Empty)
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("Test", args, invAttachment)
if interceptor == nil { if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo) result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error() return result, result.Error()
@ -933,24 +810,12 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
Handler: _Cast_WorkInfo_Handler, Handler: _Cast_WorkInfo_Handler,
}, },
{ {
MethodName: "OAuthAccount", MethodName: "OAuthYoutubeUrl",
Handler: _Cast_OAuthAccount_Handler, Handler: _Cast_OAuthYoutubeUrl_Handler,
}, },
{ {
MethodName: "OAuthCodeToToken", MethodName: "OAuthYoutubeToken",
Handler: _Cast_OAuthCodeToToken_Handler, Handler: _Cast_OAuthYoutubeToken_Handler,
},
{
MethodName: "RefreshToken",
Handler: _Cast_RefreshToken_Handler,
},
{
MethodName: "PublishMediaInfo",
Handler: _Cast_PublishMediaInfo_Handler,
},
{
MethodName: "Test",
Handler: _Cast_Test_Handler,
}, },
}, },
Streams: []grpc_go.StreamDesc{}, Streams: []grpc_go.StreamDesc{},

View File

@ -21,7 +21,6 @@ import (
"fmt" "fmt"
"fonchain-fiee/cmd/config" "fonchain-fiee/cmd/config"
"fonchain-fiee/pkg/cache" "fonchain-fiee/pkg/cache"
"fonchain-fiee/pkg/common"
"fonchain-fiee/pkg/logger" "fonchain-fiee/pkg/logger"
"fonchain-fiee/pkg/router" "fonchain-fiee/pkg/router"
) )
@ -56,7 +55,6 @@ func bootstrap() (err error) {
} }
cache.LoadRedis(redisConfig) cache.LoadRedis(redisConfig)
common.Init()
// //
//gpt.InitSet(configEnv.Ai.Host, configEnv.Ai.TelNum, configEnv.Ai.Password) //gpt.InitSet(configEnv.Ai.Host, configEnv.Ai.TelNum, configEnv.Ai.Password)
return nil return nil

View File

@ -4,11 +4,10 @@ import (
"errors" "errors"
"fmt" "fmt"
"fonchain-fiee/pkg/common" "fonchain-fiee/pkg/common"
"os"
"strconv"
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
"os"
"strconv"
) )
var ( var (
@ -118,7 +117,6 @@ type System struct {
Domain string Domain string
ErpHost string ErpHost string
FieeHost string FieeHost string
AuthRedirectUrl string
} }
type Oss struct { type Oss struct {
AccessKeyId string AccessKeyId string

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>隐私政策</title>
<style>
body { font-family: Arial, sans-serif; line-height: 1.6; }
</style>
</head>
<body>
<p>H5系统隐私政策</p><p>生效日期2025年9月2日</p><p>1. 信息收集与使用</p><p>收集的个人信息类型</p><p>基础信息手机号、微信昵称、头像、设备信息IMEI、操作系统版本</p><p>支付信息:订单号、支付金额、交易时间(通过加密方式传输,不存储银行卡信息)。</p><p>自媒体平台授权信息,例如:</p><p>抖音API接口权限仅限内容同步</p><p>内容生成数据:用户输入的关键词、风格偏好、历史生成内容。</p><p>收集目的</p><p>账号验证与支付:手机号用于身份核验,支付信息用于完成交易。</p><p>内容发布通过授权信息调用第三方平台API执行用户指令。</p><p>2. 信息共享与转让</p><p>第三方平台接口仅在用户授权范围内调用API不共享用户平台账号密码。</p><p>支付合作方:与微信支付、支付宝等服务商共享订单信息以完成交易。</p><p>法律要求:如配合司法机关调查或响应政府要求,可能披露必要信息。</p><p>3. 用户权利</p><p>访问与控制:</p><p>可随时在“个人中心”查看历史生成内容、订单记录及授权状态。</p><p>删除与撤回:</p><p>可申请删除个人账户及生成内容(不包含已同步至第三方平台的内容)。</p><p>4. 数据安全</p><p>技术措施采用HTTPS加密传输、数据库脱敏存储定期进行安全漏洞检测。</p><p>第三方SDK仅接入必要SDK如微信登录、地图服务等并签署数据保密协议。</p><p>5. 隐私政策更新</p><p>如涉及重大变更(如新增数据收集项),将通过短信/邮件通知并要求重新授权。</p><p>6. 联系我们</p><p>如有疑问,请通过以下方式联系:</p><p>客服邮箱develop@fiee.com</p>
</body>
</html>

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>服务条款</title>
<style>
body { font-family: Arial, sans-serif; line-height: 1.6; }
</style>
</head>
<body>
<p>服务条款</p><p>生效日期2025年9月2日</p><p>1. 接受条款</p><p>通过注册或使用本系统(以下简称“服务”),您确认已阅读、理解并同意以下条款。若您不同意本条款,请立即停止使用本服务。</p><p>2. 服务内容</p><p>本系统提供自媒体内容生成与发布服务,用户可购买套餐后生成图文、短视频等原创内容,并通过系统接口同步至指定自媒体平台(如微信公众号、抖音、小红书等)。</p><p>服务包含AI辅助创作、内容优化建议、一键发布功能具体内容以实际功能模块为准。</p><p>3. 用户权利与义务</p><p>账号与支付</p><p>注册需提供手机号或微信授权,购买套餐需通过系统支持的支付方式(如微信支付、支付宝)。</p><p>您需确保支付账户信息真实有效,因虚假信息导致的损失由您自行承担。</p><p>内容生成与发布</p><p>生成内容为原创作品,最终发布权归用户所有。</p><p>用户需对生成内容进行人工审核,确认无误后方可发布。因内容违规导致的平台处罚或法律纠纷,责任由用户承担。</p><p>系统不对用户未审核内容的合规性负责,但有权对明显违法内容(如涉黄、涉政)进行过滤拦截。</p><p>第三方平台接口</p><p>用户需授权系统调用其自媒体平台API如tiktok开发者接口授权范围限于内容发布及数据同步。</p><p>授权信息仅用于执行用户指令,系统不存储用户平台账号密码等敏感信息。</p><p>4. 套餐与退款</p><p>套餐有效期自购买成功日起计算,逾期未使用的套餐不支持退款。</p><p>如因系统故障或服务瑕疵导致无法正常使用,可联系客服协商退款。</p><p>5. 知识产权</p><p>由系统生成的内容(如文案、图片)默认无版权归属限制,但用户需遵守以下规则:</p><p>不得将内容用于商业用途(如转售、批量分发);</p><p>不得篡改系统生成内容的署名或标识;</p><p>若内容包含第三方素材(如音乐、图片),用户需自行确保使用合法性。</p><p>6. 责任限制</p><p>系统不对以下情形承担责任:</p><p>用户未审核内容导致的平台封禁、投诉或法律风险;</p><p>第三方平台接口变更或服务中断;</p><p>因不可抗力(如网络故障)导致的发布延迟。</p><p>7. 其他</p><p>本条款解释权归服务提供方所有,更新后将在系统内公示,用户继续使用即视为同意。</p>
</body>
</html>

View File

@ -6,8 +6,6 @@ Host = "https://common.szjixun.cn"
RedirectUri = "/api/redirect/url" RedirectUri = "/api/redirect/url"
ErpHost = "http://114.218.158.24:9020" ErpHost = "http://114.218.158.24:9020"
FieeHost = "http://114.218.158.24:9020" FieeHost = "http://114.218.158.24:9020"
AuthRedirectUrl = "http://172.16.100.99:9028/media_account"
[bos] [bos]
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe" Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
Sk = "d2ecaa9d75114d3b9f42b99014198306" Sk = "d2ecaa9d75114d3b9f42b99014198306"

View File

@ -6,7 +6,6 @@ Host = "https://common.szjixun.cn"
RedirectUri = "/api/redirect/url" RedirectUri = "/api/redirect/url"
ErpHost = "https://erpapi.fontree.cn" ErpHost = "https://erpapi.fontree.cn"
FieeHost = "https://erpapi.fiee.com" FieeHost = "https://erpapi.fiee.com"
AuthRedirectUrl = "https://erp.fiee.com/media_account"
[bos] [bos]
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe" Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
Sk = "d2ecaa9d75114d3b9f42b99014198306" Sk = "d2ecaa9d75114d3b9f42b99014198306"

View File

@ -6,8 +6,6 @@ Host = "https://common.szjixun.cn"
RedirectUri = "/api/redirect/url" RedirectUri = "/api/redirect/url"
ErpHost = "http://114.218.158.24:9020" ErpHost = "http://114.218.158.24:9020"
FieeHost = "http://114.218.158.24:9020" FieeHost = "http://114.218.158.24:9020"
FieeApiHost = "https://saas-test.szjixun.cn"
AuthRedirectUrl = "http://172.16.100.99:9028/media_account"
[bos] [bos]
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe" Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
Sk = "d2ecaa9d75114d3b9f42b99014198306" Sk = "d2ecaa9d75114d3b9f42b99014198306"

View File

@ -1,11 +0,0 @@
package common
import "fonchain-fiee/pkg/utils"
func Init() {
_ = utils.CreateDirPath("./runtime")
utils.CopyFile("./data/policy.html", "./runtime")
utils.CopyFile("./data/service.html", "./runtime")
utils.CopyFile("../data/policy.html", "./runtime")
utils.CopyFile("../data/service.html", "./runtime")
}

View File

@ -44,7 +44,7 @@ func BundleOrderRouter(r *gin.RouterGroup) {
bundleOrderAppRoute := bundleOrderRoute.Group("app") bundleOrderAppRoute := bundleOrderRoute.Group("app")
{ {
bundleOrderAppRoute.POST("order-signature", bundle.CreateBundleOrderSignature) bundleOrderAppRoute.POST("order-signature", bundle.CreateBundleOrderSignature)
bundleOrderAppRoute.POST("order-add-signature", bundle.CreateBundleOrderAddSignature) //bundleOrderAppRoute.POST("order-add-signature", bundle.CreateBundleOrderAddSignature)
bundleOrderAppRoute.POST("order-del", bundle.DeleteBundleOrder) bundleOrderAppRoute.POST("order-del", bundle.DeleteBundleOrder)
bundleOrderAppRoute.POST("update-pay", bundle.UpdateBundleOrderStatusPaid) bundleOrderAppRoute.POST("update-pay", bundle.UpdateBundleOrderStatusPaid)
bundleOrderAppRoute.POST("order-detail", bundle.OrderRecordsDetail) bundleOrderAppRoute.POST("order-detail", bundle.OrderRecordsDetail)

View File

@ -4,12 +4,11 @@ import (
"fonchain-fiee/pkg/middleware" "fonchain-fiee/pkg/middleware"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
serviceCast "fonchain-fiee/pkg/service/cast" serviceCast "fonchain-fiee/pkg/service/cast"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
func MediaRouter(r *gin.RouterGroup) { func MediaRouter(r *gin.RouterGroup) {
noAuth := r.Group("") //noAuth := r.Group("")
auth := r.Group("") auth := r.Group("")
auth.Use(middleware.CheckWebLogin(service.AccountProvider)) auth.Use(middleware.CheckWebLogin(service.AccountProvider))
media := auth.Group("media") media := auth.Group("media")
@ -18,14 +17,12 @@ func MediaRouter(r *gin.RouterGroup) {
media.POST("unbind-manager", serviceCast.UnbindManager) media.POST("unbind-manager", serviceCast.UnbindManager)
media.POST("bind-manager", serviceCast.BindManager) media.POST("bind-manager", serviceCast.BindManager)
media.POST("update-account", serviceCast.UpdateMediaAccount) media.POST("update-account", serviceCast.UpdateMediaAccount)
media.POST("oauth-account", serviceCast.OAuthAccount) media.POST("oauth-url", serviceCast.OAuthUrl)
media.POST("refresh-token", serviceCast.RefreshToken)
} }
mediaNoLogin := r.Group("media") mediaNoLogin := r.Group("media")
{ {
mediaNoLogin.GET("oauth2callback", serviceCast.OAuth2Callback) mediaNoLogin.GET("oauth2callback", serviceCast.OAuth2Callback)
mediaNoLogin.Any("test", serviceCast.Test) mediaNoLogin.GET("test", serviceCast.Test)
//mediaNoLogin.GET("dmoauth2callback", serviceCast.DMOAuth2Callback)
} }
work := auth.Group("work") work := auth.Group("work")
@ -38,11 +35,5 @@ func MediaRouter(r *gin.RouterGroup) {
work.POST("republish", serviceCast.RePublish) work.POST("republish", serviceCast.RePublish)
work.POST("delete", serviceCast.DelWork) work.POST("delete", serviceCast.DelWork)
work.POST("remind", serviceCast.Remind) work.POST("remind", serviceCast.Remind)
work.POST("publish-info", serviceCast.PublishInfo)
}
social := noAuth.Group("social")
{
social.GET("tiktok-redirect", serviceCast.TikTokRedirect)
} }
} }

View File

@ -192,8 +192,6 @@ func NewRouter() *gin.Engine {
importRoute.Use(middleware.CheckWebLogin(service.AccountProvider)) importRoute.Use(middleware.CheckWebLogin(service.AccountProvider))
importRoute.POST("data/bind", imports.ImportBind) importRoute.POST("data/bind", imports.ImportBind)
importRoute.POST("data/publish", imports.ImportPublish) importRoute.POST("data/publish", imports.ImportPublish)
importRoute.POST("data/publish2", imports.ImportPublishV2)
importRoute.POST("data/publish3", imports.ImportPublishV3)
importRoute.POST("data/confirm", imports.WorkConfirm) importRoute.POST("data/confirm", imports.WorkConfirm)
} }
//静态文件 //静态文件

View File

@ -193,161 +193,69 @@ func calculateExpirationDate(startDate time.Time, num int32, unit string) string
} }
func CreateBundleOrderSignature(c *gin.Context) { func CreateBundleOrderSignature(c *gin.Context) {
var req bundle.OrderCreateRecord var req bundle.OrderCreateRecord
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil { if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err) service.Error(c, err)
return return
} }
if req.BundleUuid == "" { // 参数校验
service.Error(c, errors.New(common.MissBundleUUID)) if err := logic.ValidateRequest(c, &req); err != nil {
service.Error(c, err)
return return
} }
if req.Language == "" {
req.Language = c.GetHeader("Accept-Language") // 获取用户信息并校验状态
if req.Language == "" {
service.Error(c, errors.New(common.MissLanguageTypes))
return
}
}
// 不去校验 签名
/*if req.Signature == "" {
service.Error(c, errors.New(common.MissOrderSignature))
return
}*/
statusMessages := map[int32]string{
1: common.Unnamed,
2: common.UnderReview,
3: common.ReviewFailed,
}
// 获取 用户信息
userInfo := login.GetUserInfoFromC(c) userInfo := login.GetUserInfoFromC(c)
if userInfo.Status != 4 { if err := logic.ValidateUserStatus(userInfo); err != nil {
if msg, exists := statusMessages[userInfo.Status]; exists { service.Error(c, err)
service.Error(c, errors.New(msg))
return return
} else {
service.Error(c, errors.New(common.UnknownStatus))
return
}
}
// 校验 当前用户只能买一次套餐
orderRecordsListReq := bundle.OrderRecordsRequest{
CustomerID: strconv.FormatUint(userInfo.ID, 10),
}
orderRecordsList, orderRecordsListErr := service.BundleProvider.OrderRecordsList(context.Background(), &orderRecordsListReq)
if orderRecordsListErr != nil {
service.Error(c, orderRecordsListErr)
return
}
//有套餐并且套餐未过期
if orderRecordsList.OrderRecords != nil {
for _, orderInfo := range orderRecordsList.OrderRecords {
if orderInfo.CustomerID == strconv.FormatUint(userInfo.ID, 10) && orderInfo.Status == 1 {
service.Error(c, errors.New(common.ThereAreOutstandingOrders))
return
}
if orderInfo.CustomerID == strconv.FormatUint(userInfo.ID, 10) && orderInfo.ExpirationTime > time.Now().Format("2006-01-02 15:04:05") {
service.Error(c, errors.New(common.HadOrder))
return
}
}
} }
// 获取 最后一次的 合同编号 // 校验套餐是否已购买
lastOrderRecord, lastOrderRecordErr := service.BundleProvider.OrderRecordsList(context.Background(), &bundle.OrderRecordsRequest{ if err := logic.CheckUserOrder(userInfo.ID); err != nil {
PageSize: 1, service.Error(c, err)
Page: 1, return
}) }
if lastOrderRecordErr != nil { // 获取最后一次合同编号
service.Error(c, lastOrderRecordErr) lastContractNo, err := logic.GetLastContractNo()
return
}
lastContractNo := ""
if lastOrderRecord.OrderRecords != nil {
for _, lastOrder := range lastOrderRecord.OrderRecords {
lastContractNo = lastOrder.ContractNo
}
}
// 获取 套餐信息
bundleDetailReq := &bundle.BundleDetailRequest{
Uuid: req.BundleUuid,
Language: req.Language,
}
bundleDetail, detailErr := service.BundleProvider.BundleLangDetailV2(context.Background(), bundleDetailReq)
if detailErr != nil {
service.Error(c, detailErr)
return
}
//获取过期时间和增值服务金额
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 { if err != nil {
service.Error(c, err) service.Error(c, err)
return return
} }
addTotalPrice += price.Price
addService, err := service.BundleProvider.ValueAddServiceLangByUuidAndLanguage(context.Background(), &bundle.ValueAddServiceDetailRequest{ // 获取套餐详情
Uuid: i.ValueUid, bundleDetail, err := logic.GetBundleDetail(req.BundleUuid, req.Language)
Language: req.Language,
})
if err != nil { if err != nil {
service.Error(c, err) service.Error(c, err)
return return
} }
addRecords = append(addRecords, &bundle.OrderCreateAddRecord{
ServiceType: addService.ServiceType, // 组装服务内容(套餐权益 + 附加权益)
ValueUid: i.ValueUid, addRecords, addTotalPrice, expirationDay, err := logic.BuildServiceRecords(&req, bundleDetail)
CurrencyType: addService.PriceType, if err != nil {
Amount: price.Price, service.Error(c, err)
Num: i.Num,
Unit: addService.Unit,
Source: 1,
PaymentStatus: 1,
})
//服务类型为时长 计算
if addService.ServiceType == 5 {
expirationDay = calculateExpirationDate(time.Now(), i.Num, addService.Unit)
} else {
expirationDay = time.Now().AddDate(0, 0, 7).Format("2006-01-02")
}
}
// 当前 未将 签名 写入合同中 todo 金额和有效时间待修改
signContract, signContractErr := logic.SignContractV2(req.CustomerNum, bundleDetail.Contract, bundleDetail.Price+addTotalPrice, expirationDay)
if signContractErr != nil {
service.Error(c, signContractErr)
return return
} }
req.CustomerNum = userInfo.SubNum
req.CustomerName = userInfo.Name
req.CustomerID = strconv.FormatUint(userInfo.ID, 10)
req.BundleName = bundleDetail.Name
req.Amount = bundleDetail.Price
req.AmountType = bundleDetail.PriceType
//req.BundleCommonUid = bundleDetail.BundleCommonUid
req.TotalAmount = bundleDetail.Price + addTotalPrice
req.ContractNo = common.GenerateContractNo(lastContractNo)
req.SignContract = signContract
req.SignedTime = common.GetBeijingTime()
req.Status = bundleModel.OrderSigned
req.AddRecords = addRecords
//req.ExpirationTime = expirationDay //过期日期取消 在完成支付是更新
req.PayType = 1
// 签合同(金额 + 有效期)
signContract, err := logic.SignContractV2(req.CustomerNum, bundleDetail.Contract, bundleDetail.Price+addTotalPrice, expirationDay)
if err != nil {
service.Error(c, err)
return
}
// 组装订单信息
req = logic.BuildOrderRequest(req, userInfo, bundleDetail, addRecords, addTotalPrice, lastContractNo, signContract)
// 创建订单
res, err := service.BundleProvider.CreateOrderRecord(context.Background(), &req) res, err := service.BundleProvider.CreateOrderRecord(context.Background(), &req)
if err != nil { if err != nil {
service.Error(c, err) service.Error(c, err)
return return
} }
service.Success(c, res) service.Success(c, res)
return
} }
func UpdateBundleOrderStatusPaid(c *gin.Context) { func UpdateBundleOrderStatusPaid(c *gin.Context) {

View File

@ -50,6 +50,10 @@ const (
ReviewFailed = "实名审核失败" ReviewFailed = "实名审核失败"
UnknownStatus = "未知实名状态" UnknownStatus = "未知实名状态"
) )
const (
UnknownAddServiceUUID = "未知增值服务"
BundleUnBindingAddService = "套餐未绑定增值服务"
)
/*var EnMessages = map[string]string{ /*var EnMessages = map[string]string{
"创建套餐信息失败": "Failed to create bundle information", "创建套餐信息失败": "Failed to create bundle information",

View File

@ -0,0 +1,211 @@
package logic
import (
"context"
"errors"
"fonchain-fiee/api/bundle"
"fonchain-fiee/pkg/model/login"
"fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/bundle/common"
bundleModel "fonchain-fiee/pkg/service/bundle/model"
"strconv"
"time"
"github.com/gin-gonic/gin"
)
// 校验参数
func ValidateRequest(c *gin.Context, req *bundle.OrderCreateRecord) error {
if req.BundleUuid == "" {
return errors.New(common.MissBundleUUID)
}
if req.Language == "" {
req.Language = c.GetHeader("Accept-Language")
if req.Language == "" {
return errors.New(common.MissLanguageTypes)
}
}
return nil
}
// 校验用户状态
func ValidateUserStatus(userInfo login.Info) error {
statusMessages := map[int32]string{
1: common.Unnamed,
2: common.UnderReview,
3: common.ReviewFailed,
}
if userInfo.Status != 4 {
if msg, ok := statusMessages[userInfo.Status]; ok {
return errors.New(msg)
}
return errors.New(common.UnknownStatus)
}
return nil
}
// 校验用户是否已有套餐
func CheckUserOrder(userID uint64) error {
req := bundle.OrderRecordsRequest{CustomerID: strconv.FormatUint(userID, 10)}
records, err := service.BundleProvider.OrderRecordsList(context.Background(), &req)
if err != nil {
return err
}
for _, order := range records.OrderRecords {
if order.CustomerID == strconv.FormatUint(userID, 10) && order.Status == 1 {
return errors.New(common.ThereAreOutstandingOrders)
}
if order.CustomerID == strconv.FormatUint(userID, 10) && order.ExpirationTime > time.Now().Format("2006-01-02 15:04:05") {
return errors.New(common.HadOrder)
}
}
return nil
}
// 获取最后一次合同编号
func GetLastContractNo() (string, error) {
records, err := service.BundleProvider.OrderRecordsList(context.Background(), &bundle.OrderRecordsRequest{
PageSize: 1,
Page: 1,
})
if err != nil {
return "", err
}
if len(records.OrderRecords) > 0 {
return records.OrderRecords[0].ContractNo, nil
}
return "", nil
}
// 获取套餐详情
func GetBundleDetail(uuid, lang string) (*bundle.BundleProfileLang, error) {
return service.BundleProvider.BundleLangDetailV2(context.Background(), &bundle.BundleDetailRequest{
Uuid: uuid,
Language: lang,
})
}
// 组装服务内容(套餐权益和附加权益)
func BuildServiceRecords(req *bundle.OrderCreateRecord, bundleDetail *bundle.BundleProfileLang) ([]*bundle.OrderCreateAddRecord, float32, string, error) {
var (
addRecords []*bundle.OrderCreateAddRecord
addTotalPrice float32
expirationDay string
addUidService = make(map[string]bool)
bundleUidService = make(map[string]bool)
)
// 分类权益
for _, i := range bundleDetail.ServiceLangInfo {
switch i.BenefitsType {
case 1:
bundleUidService[i.ValueAddUuid] = true
case 2:
addUidService[i.ValueAddUuid] = true
}
}
if len(bundleUidService) == 0 {
return nil, 0, "", errors.New(common.BundleUnBindingAddService)
}
// 附加权益
for _, i := range req.AddRecords {
if !addUidService[i.ValueUid] {
return nil, 0, "", errors.New(common.UnknownAddServiceUUID)
}
price, err := service.BundleProvider.CalculatePrice(context.Background(), &bundle.CalculatePriceRequest{
Uuid: i.ValueUid,
Num: i.Num,
Language: req.Language,
})
if err != nil {
return nil, 0, "", err
}
addTotalPrice += price.Price
addService, err := service.BundleProvider.ValueAddServiceLangByUuidAndLanguage(context.Background(),
&bundle.ValueAddServiceDetailRequest{Uuid: i.ValueUid, Language: req.Language})
if err != nil {
return nil, 0, "", err
}
addRecords = append(addRecords, buildAddRecord(addService, i.ValueUid, price.Price, i.Num, 2))
}
// 套餐权益
for uid := range bundleUidService {
addService, err := service.BundleProvider.ValueAddServiceLangByUuidAndLanguage(context.Background(),
&bundle.ValueAddServiceDetailRequest{Uuid: uid, Language: req.Language})
if err != nil {
return nil, 0, "", err
}
var num int32
for _, s := range addService.Options {
if s.IsDefault {
num = s.Num
break
}
}
addRecords = append(addRecords, buildAddRecord(addService, uid, 0, num, 1))
// 计算到期时间
if addService.ServiceType == 5 {
expirationDay = calculateExpirationDate(time.Now(), num, addService.Unit)
} else {
expirationDay = time.Now().AddDate(0, 0, 7).Format("2006-01-02")
}
}
return addRecords, addTotalPrice, expirationDay, nil
}
// 构建单条服务记录
func buildAddRecord(addService *bundle.ValueAddServiceLang, uid string, price float32, num int32, equityType int32) *bundle.OrderCreateAddRecord {
return &bundle.OrderCreateAddRecord{
ServiceType: addService.ServiceType,
ValueUid: uid,
CurrencyType: addService.PriceType,
Amount: price,
Num: num,
Unit: addService.Unit,
Source: 1,
PaymentStatus: 1,
EquityType: equityType,
QuotaType: addService.QuotaType,
QuotaValue: addService.QuotaValue,
IsExpired: addService.IsExpired,
}
}
// 组装订单请求
func BuildOrderRequest(req bundle.OrderCreateRecord, userInfo login.Info,
bundleDetail *bundle.BundleProfileLang, addRecords []*bundle.OrderCreateAddRecord,
addTotalPrice float32, lastContractNo, signContract string) bundle.OrderCreateRecord {
req.CustomerNum = userInfo.SubNum
req.CustomerName = userInfo.Name
req.CustomerID = strconv.FormatUint(userInfo.ID, 10)
req.BundleName = bundleDetail.Name
req.Amount = bundleDetail.Price
req.AmountType = bundleDetail.PriceType
req.TotalAmount = bundleDetail.Price + addTotalPrice
req.ContractNo = common.GenerateContractNo(lastContractNo)
req.SignContract = signContract
req.SignedTime = common.GetBeijingTime()
req.Status = bundleModel.OrderSigned
req.AddRecords = addRecords
req.PayType = 1
return req
}
func calculateExpirationDate(startDate time.Time, num int32, unit string) string {
//now := time.Now()
switch unit {
case "天":
return startDate.AddDate(0, 0, int(num)).Format("2006-01-02")
case "月":
return startDate.AddDate(0, int(num), 0).Format("2006-01-02")
case "年":
return startDate.AddDate(int(num), 0, 0).Format("2006-01-02")
default:
return ""
}
}

View File

@ -6,12 +6,13 @@ import (
"fonchain-fiee/pkg/model" "fonchain-fiee/pkg/model"
"fonchain-fiee/pkg/service/bundle/common" "fonchain-fiee/pkg/service/bundle/common"
"fonchain-fiee/pkg/service/upload" "fonchain-fiee/pkg/service/upload"
"github.com/signintech/gopdf"
"go.uber.org/zap"
"log" "log"
"os" "os"
"strconv" "strconv"
"time" "time"
"github.com/signintech/gopdf"
"go.uber.org/zap"
) )
func SignContractV2(customerNum, contract string, price float32, expirationDate string) (outputUrl string, err error) { func SignContractV2(customerNum, contract string, price float32, expirationDate string) (outputUrl string, err error) {

View File

@ -24,33 +24,6 @@ func GetReconciliationList(c *gin.Context) {
service.Error(c, err) service.Error(c, err)
return return
} }
res := &bundle.GetReconciliationListResp{}
// Step 1: 如果有姓名/电话筛选,先查用户列表
if req.UserName != "" {
userListResp, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
BlurNameTel: req.UserName,
Domain: "app",
})
if err != nil {
service.Error(c, err)
return
}
if len(userListResp.UserList) == 0 {
// 没查到用户,直接返回空结果
res.Page = req.Page
res.PageSize = req.PageSize
res.Total = 0
service.Success(c, res)
return
}
// 提取用户ID列表
for _, u := range userListResp.UserList {
req.UserIDS = append(req.UserIDS, u.Id)
}
}
req.UserName = ""
detail, detailErr := service.BundleProvider.GetReconciliationList(context.Background(), &req) detail, detailErr := service.BundleProvider.GetReconciliationList(context.Background(), &req)
if detailErr != nil { if detailErr != nil {
service.Error(c, detailErr) service.Error(c, detailErr)
@ -90,31 +63,6 @@ func GetReconciliationListDownload(c *gin.Context) {
service.Error(c, err) service.Error(c, err)
return return
} }
res := &bundle.GetReconciliationListResp{}
if req.UserName != "" {
userListResp, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
BlurNameTel: req.UserName,
Domain: "app",
})
if err != nil {
service.Error(c, err)
return
}
if len(userListResp.UserList) == 0 {
// 没查到用户,直接返回空结果
res.Page = req.Page
res.PageSize = req.PageSize
res.Total = 0
service.Success(c, res)
return
}
// 提取用户ID列表
for _, u := range userListResp.UserList {
req.UserIDS = append(req.UserIDS, u.Id)
}
}
detail, detailErr := service.BundleProvider.GetReconciliationList(context.Background(), &req) detail, detailErr := service.BundleProvider.GetReconciliationList(context.Background(), &req)
if detailErr != nil { if detailErr != nil {
service.Error(c, detailErr) service.Error(c, detailErr)
@ -358,7 +306,7 @@ func AutoCreateUserAndOrder(c *gin.Context) {
) )
// 当前 未将 签名 写入合同中 todo 金额和有效时间待修改 // 当前 未将 签名 写入合同中 todo 金额和有效时间待修改
contract := "https://e-cdn.fontree.cn/fonchain-main/prod/file/saas/contract/template-25032801.pdf" contract := "https://e-cdn.fontree.cn/fonchain-main/prod/file/saas/contract/template-25032801.pdf"
expirationDay = t.AddDate(1, 0, 0).Format("2006-01-02") expirationDay = t.AddDate(10, 0, 0).Format("2006-01-02")
signContract, signContractErr := logic.SignContractV2(userReq.UserNum, contract, TotalPrice, expirationDay) signContract, signContractErr := logic.SignContractV2(userReq.UserNum, contract, TotalPrice, expirationDay)
if signContractErr != nil { if signContractErr != nil {
service.Error(c, signContractErr) service.Error(c, signContractErr)

View File

@ -3,7 +3,6 @@ package cast
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"fonchain-fiee/api/accountFiee" "fonchain-fiee/api/accountFiee"
"fonchain-fiee/api/bundle" "fonchain-fiee/api/bundle"
"fonchain-fiee/api/cast" "fonchain-fiee/api/cast"
@ -11,13 +10,9 @@ import (
"fonchain-fiee/pkg/e" "fonchain-fiee/pkg/e"
modelCast "fonchain-fiee/pkg/model/cast" modelCast "fonchain-fiee/pkg/model/cast"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"net/http"
"net/url"
"strconv"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
"google.golang.org/protobuf/types/known/emptypb" "strconv"
) )
func MediaUserList(ctx *gin.Context) { func MediaUserList(ctx *gin.Context) {
@ -165,10 +160,9 @@ func UpdateMediaAccount(ctx *gin.Context) {
return return
} }
// 账号授权 func OAuthUrl(ctx *gin.Context) {
func OAuthAccount(ctx *gin.Context) { var req *cast.OAuthYoutubeUrlReq
var req *cast.OAuthAccountReq var resp *cast.OAuthYoutubeUrlResp
var resp *cast.OAuthAccountResp
var err error var err error
if err = ctx.ShouldBind(&req); err != nil { if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err) service.Error(ctx, err)
@ -178,7 +172,7 @@ func OAuthAccount(ctx *gin.Context) {
service.Error(ctx, err) service.Error(ctx, err)
return return
} }
if resp, err = service.CastProvider.OAuthAccount(ctx, req); err != nil { if resp, err = service.CastProvider.OAuthYoutubeUrl(ctx, req); err != nil {
service.Error(ctx, err) service.Error(ctx, err)
return return
} }
@ -187,63 +181,15 @@ func OAuthAccount(ctx *gin.Context) {
} }
func OAuth2Callback(ctx *gin.Context) { func OAuth2Callback(ctx *gin.Context) {
var (
platformIds string
userID string
)
code := ctx.Query("code") code := ctx.Query("code")
state := ctx.Query("state") state := ctx.Query("state")
stateMM, _ := url.ParseQuery(state) //scope := ctx.Query("scope")
if len(stateMM["platform_id"]) > 0 { resp, err := service.CastProvider.OAuthYoutubeToken(ctx, &cast.OAuthYoutubeTokenReq{
platformIds = stateMM["platform_id"][0] MediaAccountUuid: state,
}
if len(stateMM["user_id"]) > 0 {
userID = stateMM["user_id"][0]
}
platformID, _ := strconv.ParseInt(platformIds, 10, 64)
req := &cast.OAuthCodeToTokenReq{
Code: code, Code: code,
UserID: userID, //scope: scope,
} })
switch platformID {
case int64(cast.PlatformIDENUM_DM):
req.PlatformID = cast.PlatformIDENUM_DM
case int64(cast.PlatformIDENUM_TIKTOK):
req.PlatformID = cast.PlatformIDENUM_TIKTOK
default:
service.Error(ctx, errors.New(e.GetMsg(e.InvalidParams)))
return
}
zap.L().Info("OAuth2Callback", zap.Any("req", req), zap.Any("code", code), zap.Any("state", state))
_, err := service.CastProvider.OAuthCodeToToken(ctx, req)
if err != nil { if err != nil {
zap.L().Info("OAuth2Callback error", zap.Error(err))
ctx.Redirect(http.StatusFound, fmt.Sprintf("%s?%s", config.AppConfig.System.AuthRedirectUrl, "status=1"))
return
}
// TODO 跳转到前端页面
ctx.Redirect(http.StatusFound, fmt.Sprintf("%s?%s", config.AppConfig.System.AuthRedirectUrl, "status=0"))
//service.Success(ctx, map[string]interface{}{
// "req": req,
// "resp": resp,
//})
return
}
func RefreshToken(ctx *gin.Context) {
var req *cast.RefreshTokenReq
var resp *cast.RefreshTokenResp
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
if err = req.Validate(); err != nil {
service.Error(ctx, err)
return
}
if resp, err = service.CastProvider.RefreshToken(ctx, req); err != nil {
service.Error(ctx, err) service.Error(ctx, err)
return return
} }
@ -252,6 +198,6 @@ func RefreshToken(ctx *gin.Context) {
} }
func Test(ctx *gin.Context) { func Test(ctx *gin.Context) {
service.CastProvider.Test(ctx, &emptypb.Empty{}) service.Success(ctx, nil)
return return
} }

View File

@ -0,0 +1 @@
package cast

View File

@ -1,38 +0,0 @@
package cast
import (
"fmt"
"fonchain-fiee/pkg/service"
"net/url"
"github.com/gin-gonic/gin"
)
func TikTokRedirect(ctx *gin.Context) {
var state, decodeParams, code string
var err error
var values url.Values
fmt.Println(code)
state = ctx.Query("state")
decodeParams, err = url.QueryUnescape(state)
values, err = url.ParseQuery(decodeParams)
if err != nil {
service.Error(ctx, err)
return
}
switch values.Get("source") {
case "authcode":
code = ctx.Query("code")
/*resp, _err := service.CastProvider.OAuthTikTokToken(ctx, &cast.OAuthTikTokTokenReq{
Code: code,
UserID: values.Get("userid"),
})
if _err != nil {
service.Error(ctx, _err)
return
}
service.Success(ctx, resp)*/
}
return
}

View File

@ -11,9 +11,7 @@ import (
"fonchain-fiee/pkg/e" "fonchain-fiee/pkg/e"
modelCast "fonchain-fiee/pkg/model/cast" modelCast "fonchain-fiee/pkg/model/cast"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/utils/stime"
"strconv" "strconv"
"time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
@ -33,7 +31,6 @@ func UpdateWorkImage(ctx *gin.Context) {
ID: artistId, ID: artistId,
Domain: "app", Domain: "app",
}) })
zap.L().Info("UpdateWorkImage infoResp", zap.Any("infoResp", infoResp))
if err != nil { if err != nil {
service.Error(ctx, err) service.Error(ctx, err)
return return
@ -56,7 +53,6 @@ func UpdateWorkImage(ctx *gin.Context) {
newCtx := NewCtxWithUserInfo(ctx) newCtx := NewCtxWithUserInfo(ctx)
req.Source = 1 req.Source = 1
resp, err := service.CastProvider.UpdateWorkImage(newCtx, req) resp, err := service.CastProvider.UpdateWorkImage(newCtx, req)
zap.L().Info("UpdateWorkImage resp", zap.Any("resp", resp))
if err != nil { if err != nil {
service.Error(ctx, err) service.Error(ctx, err)
return return
@ -79,7 +75,6 @@ func UpdateWorkVideo(ctx *gin.Context) {
ID: artistId, ID: artistId,
Domain: "app", Domain: "app",
}) })
zap.L().Info("UpdateWorkVideo", zap.Any("infoResp", infoResp))
if err != nil { if err != nil {
service.Error(ctx, err) service.Error(ctx, err)
return return
@ -102,7 +97,6 @@ func UpdateWorkVideo(ctx *gin.Context) {
newCtx := NewCtxWithUserInfo(ctx) newCtx := NewCtxWithUserInfo(ctx)
req.Source = 1 req.Source = 1
resp, err := service.CastProvider.UpdateWorkVideo(newCtx, req) resp, err := service.CastProvider.UpdateWorkVideo(newCtx, req)
zap.L().Info("UpdateWorkVideo", zap.Any("resp", resp))
if err != nil { if err != nil {
service.Error(ctx, err) service.Error(ctx, err)
return return
@ -152,14 +146,6 @@ func WorkList(ctx *gin.Context) {
approvalID, _ := strconv.ParseUint(v.ApprovalID, 10, 64) approvalID, _ := strconv.ParseUint(v.ApprovalID, 10, 64)
workUuidApprovalIDMap[int(approvalID)] = v.WorkUuid workUuidApprovalIDMap[int(approvalID)] = v.WorkUuid
} }
statusUpdateDate, _ := stime.DatetimeToTimes(v.StatusUpdateTime, "2006-01-02 15:04:05")
if v.WorkStatus == 6 && (time.Now().Unix()-int64(statusUpdateDate) < 300) {
go func() {
_, _ = service.CastProvider.PublishMediaInfo(context.Background(), &cast.PublishMediaInfoReq{
WorkUuid: v.WorkUuid,
})
}()
}
} }
if len(workUuidApprovalIDMap) > 0 { if len(workUuidApprovalIDMap) > 0 {
_ = RefreshWorkApprovalStatus(ctx, workUuidApprovalIDMap) _ = RefreshWorkApprovalStatus(ctx, workUuidApprovalIDMap)
@ -190,10 +176,8 @@ func WorkDetail(ctx *gin.Context) {
} }
func CheckUserBundleBalance(userID int32, balanceType modelCast.BalanceTypeEnum) (err error) { func CheckUserBundleBalance(userID int32, balanceType modelCast.BalanceTypeEnum) (err error) {
zap.L().Info("CheckUserBundleBalance", zap.Any("userID", userID))
resp, err := service.BundleProvider.GetBundleBalanceByUserId(context.Background(), &bundle.GetBundleBalanceByUserIdReq{UserId: userID}) resp, err := service.BundleProvider.GetBundleBalanceByUserId(context.Background(), &bundle.GetBundleBalanceByUserIdReq{UserId: userID})
if err != nil { if err != nil {
zap.L().Error("CheckUserBundleBalance", zap.Any("err", err))
return return
} }
zap.L().Info("CheckUserBundleBalance", zap.Any("resp", resp)) zap.L().Info("CheckUserBundleBalance", zap.Any("resp", resp))
@ -222,7 +206,6 @@ func RePublish(ctx *gin.Context) {
var ( var (
req *cast.RePublishReq req *cast.RePublishReq
resp *cast.RePublishResp resp *cast.RePublishResp
//workInfoResp *cast.WorkInfoResp
) )
var err error var err error
if err = ctx.ShouldBind(&req); err != nil { if err = ctx.ShouldBind(&req); err != nil {
@ -230,39 +213,28 @@ func RePublish(ctx *gin.Context) {
return return
} }
newCtx := NewCtxWithUserInfo(ctx) newCtx := NewCtxWithUserInfo(ctx)
/* workInfoResp, err = service.CastProvider.WorkInfo(context.Background(), &cast.WorkInfoReq{
WorkUuid: req.WorkUuid,
})
if err != nil {
service.Error(ctx, err)
return
}
fmt.Println(workInfoResp)*/
/*artistID, _ := strconv.ParseInt(workInfoResp.ArtistUuid, 10, 64)
if err = CheckUserBundleBalance(int32(artistID), modelCast.BalanceTypeVideoValue); err != nil {
service.Error(ctx, err)
return
}
balanceReq := &bundle.AddBundleBalanceReq{
UserId: int32(artistID),
}
if workInfoResp.WorkCategory == 1 {
balanceReq.ImageConsumptionNumber = 1
}
if workInfoResp.WorkCategory == 2 {
balanceReq.VideoConsumptionNumber = 1
}
_, err = service.BundleProvider.AddBundleBalance(context.Background(), balanceReq)
if err != nil {
service.Error(ctx, err)
return
}*/
resp, err = service.CastProvider.RePublish(newCtx, req) resp, err = service.CastProvider.RePublish(newCtx, req)
if err != nil { if err != nil {
service.Error(ctx, err) service.Error(ctx, err)
return return
} }
service.Success(ctx, resp) artistID, _ := strconv.ParseUint(resp.ArtistUuid, 10, 64)
balanceReq := &bundle.AddBundleBalanceReq{
UserId: int32(artistID),
}
if resp.WorkCategory == 1 {
balanceReq.ImageConsumptionNumber = 1
}
if resp.WorkCategory == 2 {
balanceReq.VideoConsumptionNumber = 1
}
_, err = service.BundleProvider.AddBundleBalance(context.Background(), balanceReq)
if err != nil {
service.Error(ctx, err)
//FIXME 进行回滚
return
}
service.Success(ctx, nil)
return return
} }
@ -392,20 +364,3 @@ func Remind(ctx *gin.Context) {
service.Success(ctx, nil) service.Success(ctx, nil)
return return
} }
func PublishInfo(ctx *gin.Context) {
var req *cast.PublishMediaInfoReq
var resp *cast.PublishMediaInfoResp
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
resp, err = service.CastProvider.PublishMediaInfo(context.Background(), req)
if err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, resp)
return
}

View File

@ -4,20 +4,13 @@ import (
apiCast "fonchain-fiee/api/cast" apiCast "fonchain-fiee/api/cast"
) )
type AccountInfo struct {
NickName string `json:"nickName"`
AccountId string `json:"accountId"`
}
type ArtistAccount struct { type ArtistAccount struct {
Index string `json:"index"`
Name string `json:"name"` Name string `json:"name"`
SubNum string `json:"subNum"` Account map[apiCast.PlatformIDENUM]string `json:"account"`
Account map[apiCast.PlatformIDENUM]AccountInfo `json:"account"`
} }
type ArtistMedia struct { type ArtistMedia struct {
Id string `json:"id"` Id string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
SubNum string `json:"subNum"`
Title string `json:"title"` Title string `json:"title"`
Img string `json:"img"` Img string `json:"img"`
Video string `json:"video"` Video string `json:"video"`
@ -38,8 +31,6 @@ type ArtistVideoDetail struct {
Youtube string `json:"youtube"` Youtube string `json:"youtube"`
Instagram string `json:"instagram"` Instagram string `json:"instagram"`
TikTok string `json:"tiktok"` TikTok string `json:"tiktok"`
ArtistId string `json:"artistId"`
SubNum string `json:"subNum"`
} }
type CreateRequest struct { type CreateRequest struct {
Type string `json:"Type"` Type string `json:"Type"`

View File

@ -13,7 +13,6 @@ import (
modelCast "fonchain-fiee/pkg/model/cast" modelCast "fonchain-fiee/pkg/model/cast"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/cast" "fonchain-fiee/pkg/service/cast"
"fonchain-fiee/pkg/service/upload"
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
@ -24,9 +23,11 @@ import (
"github.com/xuri/excelize/v2" "github.com/xuri/excelize/v2"
) )
type artu struct {
}
func ImportBind(c *gin.Context) { func ImportBind(c *gin.Context) {
var failedRecords []FailedRecord var failedRecords []FailedRecord
var record []*apiCast.UpdateMediaAccountReq
// 1. 上传文件 // 1. 上传文件
excelFile, err := c.FormFile("excel") excelFile, err := c.FormFile("excel")
if err != nil { if err != nil {
@ -58,7 +59,6 @@ func ImportBind(c *gin.Context) {
} }
res, err := service.AccountFieeProvider.UserList(context.Background(), &account.UserListRequest{ res, err := service.AccountFieeProvider.UserList(context.Background(), &account.UserListRequest{
Name: artist.Name, Name: artist.Name,
SubNum: artist.SubNum,
}) })
if err != nil { if err != nil {
failedRecords = append(failedRecords, FailedRecord{ failedRecords = append(failedRecords, FailedRecord{
@ -68,14 +68,6 @@ func ImportBind(c *gin.Context) {
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error())) log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue continue
} }
if res.Count == 0 {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: "未找到用户信息",
})
log.Printf("未找到用户信息")
continue
}
if res != nil && len(res.UserList) > 0 { if res != nil && len(res.UserList) > 0 {
var infoResp *account.UserInfoResponse var infoResp *account.UserInfoResponse
var err error var err error
@ -127,11 +119,11 @@ func ImportBind(c *gin.Context) {
log.Printf(fmt.Sprintf("增加账户数量失败: %s", err.Error())) log.Printf(fmt.Sprintf("增加账户数量失败: %s", err.Error()))
continue continue
} }
mediaAccountInfoRes, err := service.CastProvider.UpdateMediaAccount(c, &apiCast.UpdateMediaAccountReq{ _, err = service.CastProvider.UpdateMediaAccount(c, &apiCast.UpdateMediaAccountReq{
ArtistUuid: strconv.FormatUint(res.UserList[0].Id, 10), ArtistUuid: strconv.FormatUint(res.UserList[0].Id, 10),
PlatformID: accountType, PlatformID: accountType,
PlatformUserName: accountInfo.NickName, PlatformUserName: artist.Name,
PlatformUserID: accountInfo.AccountId, PlatformUserID: accountInfo,
ArtistName: infoResp.Name, ArtistName: infoResp.Name,
ArtistPhone: infoResp.TelNum, ArtistPhone: infoResp.TelNum,
ArtistPhoneAreaCode: infoResp.TelAreaCode, ArtistPhoneAreaCode: infoResp.TelAreaCode,
@ -142,39 +134,23 @@ func ImportBind(c *gin.Context) {
Msg: fmt.Sprintf("绑定账户信息失败: %s", err.Error()), Msg: fmt.Sprintf("绑定账户信息失败: %s", err.Error()),
}) })
log.Printf(fmt.Sprintf("绑定账户信息失败: %s", err.Error())) log.Printf(fmt.Sprintf("绑定账户信息失败: %s", err.Error()))
_, err1 := service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{ _, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
UserId: int32(res.UserList[0].Id), UserId: int32(res.UserList[0].Id),
AccountConsumptionNumber: -1, AccountConsumptionNumber: -1,
}) })
if err1 != nil {
failedRecords = append(failedRecords, FailedRecord{ failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name, Name: artist.Name,
Msg: fmt.Sprintf("绑定失败后减少余额失败: %s", err1.Error()), Msg: fmt.Sprintf("绑定失败后减少余额失败: %s", err.Error()),
}) })
log.Println(fmt.Sprintf("绑定失败后减少余额失败: %s", err1.Error()), errors.New(e.GetMsg(e.InvalidParams))) log.Println(fmt.Sprintf("绑定失败后减少余额失败: %s", err.Error()), errors.New(e.GetMsg(e.InvalidParams)))
}
continue continue
}
record = append(record, &apiCast.UpdateMediaAccountReq{ }
MediaAccountUuid: mediaAccountInfoRes.MediaAccountUuid,
ArtistUuid: strconv.FormatUint(res.UserList[0].Id, 10),
PlatformID: accountType,
PlatformUserName: accountInfo.NickName,
PlatformUserID: accountInfo.AccountId,
ArtistName: infoResp.Name,
ArtistPhone: infoResp.TelNum,
ArtistPhoneAreaCode: infoResp.TelAreaCode,
})
} }
} }
} }
excelUrl, err := exportBindingRecordsToExcel(record)
// 5. 返回结果 // 5. 返回结果
service.Success(c, map[string]interface{}{ service.Success(c, failedRecords)
"excelUrl": excelUrl,
"failedRecords": failedRecords,
"accountInfo": artists,
})
} }
func readArtistAccountInfo(excelPath string) ([]ArtistAccount, error) { func readArtistAccountInfo(excelPath string) ([]ArtistAccount, error) {
@ -195,96 +171,29 @@ func readArtistAccountInfo(excelPath string) ([]ArtistAccount, error) {
if i == 0 || len(row) < 2 { if i == 0 || len(row) < 2 {
continue continue
} }
if i == 58 {
break
}
tmp := ArtistAccount{ tmp := ArtistAccount{
Account: make(map[apiCast.PlatformIDENUM]AccountInfo), Account: make(map[apiCast.PlatformIDENUM]string),
Index: strings.TrimSpace(row[0]),
Name: strings.TrimSpace(row[1]), Name: strings.TrimSpace(row[1]),
SubNum: strings.TrimSpace(row[2]),
} }
youtubeId, _ := f.GetCellValue(sheetName, fmt.Sprintf("D%d", i+1)) youtube, _ := f.GetCellValue(sheetName, fmt.Sprintf("C%d", i+1))
youtubeNickName, _ := f.GetCellValue(sheetName, fmt.Sprintf("E%d", i+1)) if youtube != "" {
youtube := AccountInfo{ tmp.Account[2] = strings.TrimSpace(youtube)
AccountId: strings.TrimSpace(youtubeId),
NickName: strings.TrimSpace(youtubeNickName),
}
tmp.Account[2] = youtube
insId, _ := f.GetCellValue(sheetName, fmt.Sprintf("F%d", i+1))
insNickName, _ := f.GetCellValue(sheetName, fmt.Sprintf("G%d", i+1))
ins := AccountInfo{
AccountId: strings.TrimSpace(insId),
NickName: strings.TrimSpace(insNickName),
} }
tmp.Account[3] = ins ins, _ := f.GetCellValue(sheetName, fmt.Sprintf("D%d", i+1))
if ins != "" {
tmp.Account[3] = strings.TrimSpace(ins)
tiktokId, _ := f.GetCellValue(sheetName, fmt.Sprintf("H%d", i+1))
tiktokNiackName, _ := f.GetCellValue(sheetName, fmt.Sprintf("I%d", i+1))
tiktok := AccountInfo{
AccountId: strings.TrimSpace(tiktokId),
NickName: strings.TrimSpace(tiktokNiackName),
} }
tmp.Account[1] = tiktok tiktok, _ := f.GetCellValue(sheetName, fmt.Sprintf("E%d", i+1))
if tiktok != "" {
tmp.Account[1] = strings.TrimSpace(tiktok)
}
artists = append(artists, tmp) artists = append(artists, tmp)
} }
return artists, nil return artists, nil
} }
func exportBindingRecordsToExcel(records []*apiCast.UpdateMediaAccountReq) (string, error) {
fileDir := "./runtime/import/"
filename := "绑定账户记录.xlsx"
filePath := filepath.Join(fileDir, filename)
// 创建目录
_ = os.MkdirAll(fileDir, os.ModePerm)
var f *excelize.File
sheet := "Sheet1"
// 判断文件是否存在
if _, err := os.Stat(filePath); os.IsNotExist(err) {
f = excelize.NewFile()
f.NewSheet(sheet)
headers := []string{"序号", "MediaAccountUuid", "ArtistUuid", "PlatformID", "PlatformUserName", "PlatformUserID", "ArtistName", "ArtistPhone", "ArtistPhoneAreaCode"}
for col, h := range headers {
_ = f.SetCellValue(sheet, fmt.Sprintf("%c1", 'A'+col), h)
}
} else {
var err error
f, err = excelize.OpenFile(filePath)
if err != nil {
return "", err
}
}
// 找到最后一行
rows, err := f.GetRows(sheet)
if err != nil {
return "", err
}
startRow := len(rows) + 1
// 写入数据
for i, r := range records {
row := startRow + i
_ = f.SetCellValue(sheet, fmt.Sprintf("A%d", row), i+1)
_ = f.SetCellValue(sheet, fmt.Sprintf("B%d", row), r.MediaAccountUuid)
_ = f.SetCellValue(sheet, fmt.Sprintf("C%d", row), r.ArtistUuid)
_ = f.SetCellValue(sheet, fmt.Sprintf("D%d", row), r.PlatformID)
_ = f.SetCellValue(sheet, fmt.Sprintf("E%d", row), r.PlatformUserName)
_ = f.SetCellValue(sheet, fmt.Sprintf("F%d", row), r.PlatformUserID)
_ = f.SetCellValue(sheet, fmt.Sprintf("G%d", row), r.ArtistName)
_ = f.SetCellValue(sheet, fmt.Sprintf("H%d", row), r.ArtistPhone)
_ = f.SetCellValue(sheet, fmt.Sprintf("I%d", row), r.ArtistPhoneAreaCode)
}
// 保存
if err = f.SaveAs(filePath); err != nil {
return "", err
}
// 上传
excelUrl, err := upload.PutBos(filePath, "excel", true)
if err != nil {
return "", err
}
return excelUrl, nil
}

View File

@ -1,53 +1,52 @@
package imports package imports
import ( import (
"context"
"errors"
"fmt" "fmt"
account "fonchain-fiee/api/accountFiee"
"fonchain-fiee/api/bundle" "fonchain-fiee/api/bundle"
apiCast "fonchain-fiee/api/cast" apiCast "fonchain-fiee/api/cast"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/cast"
"log" "log"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/xuri/excelize/v2"
) )
func WorkConfirm(c *gin.Context) { // 确认作品并扣除余量 func WorkConfirm(c *gin.Context) { // 确认作品并扣除余量
excelFile, err := c.FormFile("excel") newCtx := cast.NewCtxWithUserInfo(c)
list, err := service.CastProvider.WorkList(newCtx, &apiCast.WorkListReq{
WorkStatus: 4,
Page: 1,
PageSize: 999,
})
if err != nil { if err != nil {
c.JSON(400, gin.H{"error": "缺少 Excel 文件 excel"}) service.Error(c, err)
return return
} }
// 2. 保存临时文件 if len(list.Data) == 0 {
tempDir := "tmp" service.Error(c, errors.New("没有待确认的作品"))
os.MkdirAll(tempDir, 0755)
excelPath := filepath.Join(tempDir, "artists.xlsx")
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
c.JSON(500, gin.H{"error": "保存 Excel 失败"})
return
}
defer os.RemoveAll(tempDir)
// 3. 读取 Excel 视频发布信息
artists, err := readCastWorkList(excelPath)
if err != nil {
c.JSON(500, gin.H{"error": "读取 Excel 失败"})
return return
} }
//遍历更新状态 //遍历更新状态
var failedRecords []FailedRecord var failedRecords []FailedRecord
for _, v := range artists { for _, v := range list.Data {
artistId, err := strconv.ParseUint(v.ArtistId, 10, 32) res, err := service.AccountFieeProvider.UserList(context.Background(), &account.UserListRequest{
Name: v.ArtistName,
})
if err != nil { if err != nil {
failedRecords = append(failedRecords, FailedRecord{ failedRecords = append(failedRecords, FailedRecord{
Name: v.ArtistName, Name: v.ArtistName,
Msg: fmt.Sprintf("解析用户ID失败: %s", err.Error()), Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
}) })
log.Printf(fmt.Sprintf("解析用户ID失败: %s", err.Error())) log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue continue
} }
var artistId uint64
if res != nil && len(res.UserList) > 0 {
artistId = res.UserList[0].Id
}
_, err = service.BundleProvider.AddBundleBalance(c, &bundle.AddBundleBalanceReq{ _, err = service.BundleProvider.AddBundleBalance(c, &bundle.AddBundleBalanceReq{
UserId: int32(artistId), UserId: int32(artistId),
VideoConsumptionNumber: 1, VideoConsumptionNumber: 1,
@ -65,7 +64,6 @@ func WorkConfirm(c *gin.Context) { // 确认作品并扣除余量
WorkUuid: v.WorkUuid, WorkUuid: v.WorkUuid,
ConfirmRemark: "", ConfirmRemark: "",
ConfirmStatus: 1, ConfirmStatus: 1,
AutoPublish: apiCast.AutoPublishENUM_AutoPublish_FALSE,
}) })
if err != nil { if err != nil {
failedRecords = append(failedRecords, FailedRecord{ failedRecords = append(failedRecords, FailedRecord{
@ -78,30 +76,3 @@ func WorkConfirm(c *gin.Context) { // 确认作品并扣除余量
} }
service.Success(c, failedRecords) service.Success(c, failedRecords)
} }
func readCastWorkList(excelPath string) ([]ArtistVideoDetail, error) {
f, err := excelize.OpenFile(excelPath)
if err != nil {
return nil, err
}
defer f.Close()
sheetName := f.GetSheetName(0)
rows, err := f.GetRows(sheetName)
if err != nil {
return nil, err
}
log.Println("start read excel...")
var artistVideos []ArtistVideoDetail
for i, row := range rows {
if i == 0 || len(row) < 2 {
continue
}
tmp := ArtistVideoDetail{
ArtistId: strings.TrimSpace(row[0]),
ArtistName: strings.TrimSpace(row[1]),
WorkUuid: strings.TrimSpace(row[2]),
}
artistVideos = append(artistVideos, tmp)
}
return artistVideos, nil
}

View File

@ -1,18 +1,23 @@
package imports package imports
import ( import (
"bytes"
"context" "context"
"encoding/json"
"fmt" "fmt"
"fonchain-fiee/api/accountFiee" "fonchain-fiee/api/accountFiee"
"fonchain-fiee/api/bundle"
apiCast "fonchain-fiee/api/cast" apiCast "fonchain-fiee/api/cast"
"fonchain-fiee/api/files" "fonchain-fiee/api/files"
"fonchain-fiee/cmd/config" "fonchain-fiee/pkg/config"
"fonchain-fiee/pkg/model" "fonchain-fiee/pkg/model"
modelCast "fonchain-fiee/pkg/model/cast" modelCast "fonchain-fiee/pkg/model/cast"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/cast" "fonchain-fiee/pkg/service/cast"
"fonchain-fiee/pkg/service/upload" "fonchain-fiee/pkg/service/upload"
"io"
"log" "log"
"net/http"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
@ -42,18 +47,16 @@ func ImportPublish(c *gin.Context) {
os.MkdirAll(tempDir, 0755) os.MkdirAll(tempDir, 0755)
excelPath := filepath.Join(tempDir, "artists.xlsx") excelPath := filepath.Join(tempDir, "artists.xlsx")
zipPath := filepath.Join(tempDir, "archive.zip") zipPath := filepath.Join(tempDir, "archive.zip")
fmt.Println("before save excel...")
now := time.Now()
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil { if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
c.JSON(500, gin.H{"error": "保存 Excel 失败"}) c.JSON(500, gin.H{"error": "保存 Excel 失败"})
return return
} }
fmt.Println("save excel success", time.Since(now))
if err = c.SaveUploadedFile(zipFile, zipPath); err != nil { if err = c.SaveUploadedFile(zipFile, zipPath); err != nil {
c.JSON(500, gin.H{"error": "保存 ZIP 文件失败"}) c.JSON(500, gin.H{"error": "保存 ZIP 文件失败"})
return return
} }
fmt.Println("save zip success", time.Since(now))
// 3. 解压 ZIP // 3. 解压 ZIP
unzipPath := filepath.Join(tempDir, "unzipped") unzipPath := filepath.Join(tempDir, "unzipped")
if _, err = os.Stat(unzipPath); err == nil { if _, err = os.Stat(unzipPath); err == nil {
@ -63,7 +66,6 @@ func ImportPublish(c *gin.Context) {
return return
} }
} }
fmt.Println("开始解压...")
os.MkdirAll(unzipPath, 0755) os.MkdirAll(unzipPath, 0755)
if err = archiver.Unarchive(zipPath, unzipPath); err != nil { if err = archiver.Unarchive(zipPath, unzipPath); err != nil {
c.JSON(500, gin.H{"error": "解压 ZIP 失败: " + err.Error()}) c.JSON(500, gin.H{"error": "解压 ZIP 失败: " + err.Error()})
@ -74,11 +76,11 @@ func ImportPublish(c *gin.Context) {
c.JSON(500, gin.H{"error": "读取解压目录失败或目录为空"}) c.JSON(500, gin.H{"error": "读取解压目录失败或目录为空"})
return return
} }
if len(entries) == 1 && entries[0].IsDir() { if len(entries) == 1 && entries[0].IsDir() {
// 说明解压后多了一层目录,把它设为新的 unzipPath // 说明解压后多了一层目录,把它设为新的 unzipPath
unzipPath = filepath.Join(unzipPath, entries[0].Name()) unzipPath = filepath.Join(unzipPath, entries[0].Name())
} }
fmt.Println("开始读取excel...")
defer os.RemoveAll(tempDir) defer os.RemoveAll(tempDir)
// 4. 读取 Excel 画家名单, 匹配视频和图片 // 4. 读取 Excel 画家名单, 匹配视频和图片
artists, err := readArtistVideoInfo(excelPath, unzipPath) artists, err := readArtistVideoInfo(excelPath, unzipPath)
@ -89,12 +91,12 @@ func ImportPublish(c *gin.Context) {
// 5.发布视频 // 5.发布视频
var failedRecords []FailedRecord var failedRecords []FailedRecord
var artistResp []ArtistVideoDetail var artistResp []ArtistVideoDetail
fmt.Println("artists num: ", len(artists))
for _, artist := range artists { for _, artist := range artists {
var infoResp *accountFiee.UserInfoResponse var infoResp *accountFiee.UserInfoResponse
var err error
list, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{ list, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
Name: artist.Name, Name: artist.Name,
SubNum: artist.SubNum,
}) })
if err != nil { if err != nil {
failedRecords = append(failedRecords, FailedRecord{ failedRecords = append(failedRecords, FailedRecord{
@ -104,14 +106,6 @@ func ImportPublish(c *gin.Context) {
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error())) log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue continue
} }
if len(list.UserList) == 0 {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("未找到用户信息: %s", artist.Name),
})
log.Printf(fmt.Sprintf("未找到用户信息: %s", artist.Name))
continue
}
if list != nil && len(list.UserList) > 0 { if list != nil && len(list.UserList) > 0 {
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{ infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
ID: list.UserList[0].Id, ID: list.UserList[0].Id,
@ -137,226 +131,7 @@ func ImportPublish(c *gin.Context) {
} }
//自媒体账号 //自媒体账号
accountList, err := service.CastProvider.MediaUserList(c, &apiCast.MediaUserListReq{ accountList, err := service.CastProvider.MediaUserList(c, &apiCast.MediaUserListReq{
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10), //ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
ArtistVal: artist.Name,
Page: 1,
PageSize: 10,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)),
})
log.Printf(fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)))
continue
}
if accountList == nil || len(accountList.Data) == 0 {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: "自媒体账号数量为0",
})
log.Printf(fmt.Sprintf("自媒体账号,账号数量:%d", len(accountList.Data)))
continue
}
mediaAccountUuids := []string{}
mediaAccountNames := []string{}
platformIDs := []apiCast.PlatformIDENUM{}
for _, info := range accountList.Data {
if info.PlatformID == 2 && ((artist.Id == "31" && info.ArtistName == "荣小松") ||
(artist.Id == "72" && info.ArtistName == "韩风霞")) {
continue // 跳过
}
mediaAccountUuids = append(mediaAccountUuids, info.MediaAccountUuid)
mediaAccountNames = append(mediaAccountNames, info.PlatformUserName)
platformIDs = append(platformIDs, apiCast.PlatformIDENUM(info.PlatformID))
}
newCtx := cast.NewCtxWithUserInfo(c)
resp, err := service.CastProvider.UpdateWorkVideo(newCtx, &apiCast.UpdateWorkVideoReq{
Title: artist.Title,
Content: artist.Title,
VideoUrl: artist.Video,
CoverUrl: artist.Img,
AutoPublish: apiCast.AutoPublishENUM_AutoPublish_FALSE,
MediaAccountUuids: mediaAccountUuids,
MediaAccountNames: mediaAccountNames,
PlatformIDs: platformIDs,
PublishConfig1: &apiCast.PublishConfig{
CanComment: 1,
CanJoin: 1,
CanQuote: 1,
ForbidComment: 2,
IsAI: 1,
PublicType: 1,
},
PublishConfig2: &apiCast.PublishConfig{
CanComment: 1,
CanJoin: 1,
CanQuote: 1,
ForbidComment: 2,
IsAI: 1,
PublicType: 1,
},
PublishConfig3: &apiCast.PublishConfig{
CanComment: 1,
CanJoin: 1,
CanQuote: 1,
ForbidComment: 1,
IsAI: 1,
PublicType: 1,
},
Action: "submit",
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
ArtistName: infoResp.Name,
ArtistPhone: infoResp.TelNum,
ArtistPhoneAreaCode: infoResp.TelAreaCode,
Source: 2,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()))
continue
}
artistResp = append(artistResp, ArtistVideoDetail{
Id: artist.Id,
ArtistName: artist.Name,
SubNum: artist.SubNum,
Title: artist.Title,
WorkUuid: resp.WorkUuid,
Youtube: artist.Youtube,
Instagram: artist.Instagram,
TikTok: artist.TikTok,
})
}
// excelUrl, err := exportPublishRecordsToExcel(artistResp)
// if err != nil {
// service.Error(c, err)
// return
// }
// 6. 返回结果
service.Success(c, map[string]interface{}{
//"excelUrl": excelUrl,
"failedRecords": failedRecords,
})
}
func ImportPublishV2(c *gin.Context) {
// 1. 上传画家短视频详情文件
excelFile, err := c.FormFile("excel")
if err != nil {
c.JSON(400, gin.H{"error": "缺少 Excel 文件 excel"})
return
}
zipFile, err := c.FormFile("zip")
if err != nil {
c.JSON(400, gin.H{"error": "缺少 ZIP 文件"})
return
}
// 2. 保存临时文件
tempDir := "tmp"
os.MkdirAll(tempDir, 0755)
excelPath := filepath.Join(tempDir, "artists.xlsx")
zipPath := filepath.Join(tempDir, "archive.zip")
fmt.Println("before save excel...")
now := time.Now()
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
c.JSON(500, gin.H{"error": "保存 Excel 失败"})
return
}
fmt.Println("save excel success", time.Since(now))
if err = c.SaveUploadedFile(zipFile, zipPath); err != nil {
c.JSON(500, gin.H{"error": "保存 ZIP 文件失败"})
return
}
fmt.Println("save zip success", time.Since(now))
// 3. 解压 ZIP
unzipPath := filepath.Join(tempDir, "unzipped")
if _, err = os.Stat(unzipPath); err == nil {
// 路径已存在,删除
if removeErr := os.RemoveAll(unzipPath); removeErr != nil {
c.JSON(500, gin.H{"error": "清理已存在解压目录失败: " + removeErr.Error()})
return
}
}
fmt.Println("开始解压...")
os.MkdirAll(unzipPath, 0755)
if err = archiver.Unarchive(zipPath, unzipPath); err != nil {
c.JSON(500, gin.H{"error": "解压 ZIP 失败: " + err.Error()})
return
}
entries, err := os.ReadDir(unzipPath)
if err != nil || len(entries) == 0 {
c.JSON(500, gin.H{"error": "读取解压目录失败或目录为空"})
return
}
fmt.Println("jieya后...")
if len(entries) == 1 && entries[0].IsDir() {
// 说明解压后多了一层目录,把它设为新的 unzipPath
unzipPath = filepath.Join(unzipPath, entries[0].Name())
}
fmt.Println("开始读取excel...")
defer os.RemoveAll(tempDir)
// 4. 读取 Excel 画家名单, 匹配视频和图片
artists, err := readArtistVideoInfo(excelPath, unzipPath)
if err != nil {
c.JSON(500, gin.H{"error": "读取 Excel 失败"})
return
}
// 5.发布视频
var failedRecords []FailedRecord
var artistResp []ArtistVideoDetail
fmt.Println("artists num: ", len(artists))
for _, artist := range artists {
var infoResp *accountFiee.UserInfoResponse
list, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
Name: artist.Name,
SubNum: artist.SubNum,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue
}
if len(list.UserList) == 0 {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("未找到用户信息: %s", artist.Name),
})
log.Printf(fmt.Sprintf("未找到用户信息: %s", artist.Name))
continue
}
if list != nil && len(list.UserList) > 0 {
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
ID: list.UserList[0].Id,
Domain: "app",
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue
}
}
if err = cast.CheckUserBundleBalance(int32(list.UserList[0].Id), modelCast.BalanceTypeVideoValue); err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()),
})
log.Printf(fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()))
continue
}
//自媒体账号
accountList, err := service.CastProvider.MediaUserList(c, &apiCast.MediaUserListReq{
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
ArtistVal: artist.Name, ArtistVal: artist.Name,
Page: 1, Page: 1,
PageSize: 10, PageSize: 10,
@ -440,7 +215,6 @@ func ImportPublishV2(c *gin.Context) {
artistResp = append(artistResp, ArtistVideoDetail{ artistResp = append(artistResp, ArtistVideoDetail{
Id: artist.Id, Id: artist.Id,
ArtistName: artist.Name, ArtistName: artist.Name,
SubNum: artist.SubNum,
Title: artist.Title, Title: artist.Title,
WorkUuid: resp.WorkUuid, WorkUuid: resp.WorkUuid,
Youtube: artist.Youtube, Youtube: artist.Youtube,
@ -448,18 +222,19 @@ func ImportPublishV2(c *gin.Context) {
TikTok: artist.TikTok, TikTok: artist.TikTok,
}) })
} }
// excelUrl, err := exportPublishRecordsToExcel(artistResp) excelUrl, err := exportRecordsToExcel(artistResp)
// if err != nil { if err != nil {
// service.Error(c, err) service.Error(c, err)
// return return
// } }
// 6. 返回结果 // 6. 返回结果
service.Success(c, map[string]interface{}{ service.Success(c, map[string]interface{}{
//"excelUrl": excelUrl, "excelUrl": excelUrl,
"failedRecords": failedRecords, "failedRecords": failedRecords,
}) })
} }
func readArtistVideoInfo(excelPath, unzipPath string) ([]ArtistMedia, error) { func readArtistVideoInfo(excelPath, unzipPath string) ([]ArtistMedia, error) {
log.Println(unzipPath) log.Println(unzipPath)
f, err := excelize.OpenFile(excelPath) f, err := excelize.OpenFile(excelPath)
@ -478,6 +253,9 @@ func readArtistVideoInfo(excelPath, unzipPath string) ([]ArtistMedia, error) {
if i == 0 || i == 1 || len(row) < 2 { if i == 0 || i == 1 || len(row) < 2 {
continue continue
} }
if i == 165 {
break
}
id, _ := f.GetCellValue(sheetName, fmt.Sprintf("A%d", i+1)) id, _ := f.GetCellValue(sheetName, fmt.Sprintf("A%d", i+1))
if id != "" { if id != "" {
id = strings.TrimSpace(id) id = strings.TrimSpace(id)
@ -502,10 +280,6 @@ func readArtistVideoInfo(excelPath, unzipPath string) ([]ArtistMedia, error) {
if tiktok != "" { if tiktok != "" {
tiktok = strings.TrimSpace(tiktok) tiktok = strings.TrimSpace(tiktok)
} }
subNum, _ := f.GetCellValue(sheetName, fmt.Sprintf("G%d", i+1))
if subNum != "" {
subNum = strings.TrimSpace(subNum)
}
artists = append(artists, ArtistMedia{ artists = append(artists, ArtistMedia{
Id: id, Id: id,
Name: artistName, Name: artistName,
@ -513,7 +287,6 @@ func readArtistVideoInfo(excelPath, unzipPath string) ([]ArtistMedia, error) {
Youtube: youtube, Youtube: youtube,
Instagram: instagram, Instagram: instagram,
TikTok: tiktok, TikTok: tiktok,
SubNum: subNum,
}) })
} }
artists, err = matchArtistMedia(artists, unzipPath) artists, err = matchArtistMedia(artists, unzipPath)
@ -523,28 +296,13 @@ func matchArtistMedia(artists []ArtistMedia, unzipPath string) ([]ArtistMedia, e
var err error var err error
var res []ArtistMedia var res []ArtistMedia
for _, artist := range artists { for _, artist := range artists {
var oldVideoPath, oldImgPath string oldImgPath := fmt.Sprintf("%s/%s/%s.jpg", unzipPath, artist.Name, artist.Id)
for _, ext := range []string{".jpg", ".png", ".jpeg"} { oldVideoPath := fmt.Sprintf("%s/%s/%s.mp4", unzipPath, artist.Name, artist.Id)
p := fmt.Sprintf("%s/%s/%s%s", unzipPath, artist.Name, artist.Id, ext)
if _, err = os.Stat(p); err == nil {
oldImgPath = p
break
}
}
// 检查源文件是否存在 // 检查源文件是否存在
if _, err = os.Stat(oldImgPath); os.IsNotExist(err) { if _, err = os.Stat(oldImgPath); os.IsNotExist(err) {
fmt.Println("图片不存在: ", artist.Id, artist.Name, oldImgPath)
continue continue
} }
for _, ext := range []string{".mp4", ".mov"} { if _, err = os.Stat(oldVideoPath); os.IsNotExist(err) {
p := fmt.Sprintf("%s/%s/%s%s", unzipPath, artist.Name, artist.Id, ext)
if _, err = os.Stat(p); err == nil {
oldVideoPath = p
break
}
}
if oldVideoPath == "" {
fmt.Println("视频不存在: ", artist.Id, artist.Name, oldVideoPath)
continue continue
} }
baseDir := filepath.Join(unzipPath, artist.Name) baseDir := filepath.Join(unzipPath, artist.Name)
@ -576,12 +334,12 @@ func matchArtistMedia(artists []ArtistMedia, unzipPath string) ([]ArtistMedia, e
return nil, err return nil, err
} }
var httpType string var httpType string
if config.AppConfig.System.AppMode == "dev" { if config.AppMode == "prod" {
url := "114.218.158.24:9020"
httpType = fmt.Sprintf("%s%s", model.HttpType, url)
} else {
url := "saas.fiee.com" url := "saas.fiee.com"
httpType = fmt.Sprintf("%s%s", model.HttpsType, url) httpType = fmt.Sprintf("%s%s", model.HttpsType, url)
} else {
url := "114.218.158.24:9020"
httpType = fmt.Sprintf("%s%s", model.HttpType, url)
} }
baseUrl := fmt.Sprintf("%s/api/fiee/resource/raw/", httpType) baseUrl := fmt.Sprintf("%s/api/fiee/resource/raw/", httpType)
videoUrl := baseUrl + filepath.Base(videoPath) videoUrl := baseUrl + filepath.Base(videoPath)
@ -597,12 +355,10 @@ func matchArtistMedia(artists []ArtistMedia, unzipPath string) ([]ArtistMedia, e
tmp.Img = imgUrl tmp.Img = imgUrl
//tmp.Video = filepath.ToSlash(videoPath) //tmp.Video = filepath.ToSlash(videoPath)
tmp.Video = videoUrl tmp.Video = videoUrl
tmp.SubNum = artist.SubNum
res = append(res, tmp) res = append(res, tmp)
} }
return res, nil return res, nil
} }
func UploadToAnotherService(ctx context.Context, fileData []byte, path string) error { func UploadToAnotherService(ctx context.Context, fileData []byte, path string) error {
const chunkSize = 4*1024*1024 - 100 const chunkSize = 4*1024*1024 - 100
_, err := service.FilesProvider.TusCreate(ctx, &files.TusCreateReq{ _, err := service.FilesProvider.TusCreate(ctx, &files.TusCreateReq{
@ -636,348 +392,148 @@ func UploadToAnotherService(ctx context.Context, fileData []byte, path string) e
} }
return nil return nil
} }
func exportRecordsToExcel(artistInfos []ArtistVideoDetail) (string, error) {
f := excelize.NewFile()
sheet := "Sheet1"
f.NewSheet(sheet)
// func exportPublishRecordsToExcel(artistInfos []ArtistVideoDetail) (string, error) { // 写表头
// fileDir := "./runtime/import/" headers := []string{"序号", "画家名", "标题", "uuid", "youtube", "instagram", "tiktok"}
// filename := "画家视频详情记录0922.xlsx"
// filePath := filepath.Join(fileDir, filename)
// _ = os.MkdirAll(fileDir, os.ModePerm) for col, h := range headers {
_ = f.SetCellValue(sheet, string(rune('A'+col))+"1", h)
}
// var f *excelize.File // 写数据
// sheet := "Sheet1" for i, artistInfo := range artistInfos {
row := i + 2
// // 判断文件是否存在 _ = f.SetCellValue(sheet, "A"+strconv.Itoa(row), artistInfo.Id)
// if _, err := os.Stat(filePath); os.IsNotExist(err) { _ = f.SetCellValue(sheet, "B"+strconv.Itoa(row), artistInfo.ArtistName)
// // 文件不存在新建文件和Sheet _ = f.SetCellValue(sheet, "C"+strconv.Itoa(row), artistInfo.Title)
// f = excelize.NewFile() _ = f.SetCellValue(sheet, "D"+strconv.Itoa(row), artistInfo.WorkUuid)
// f.SetSheetName(f.GetSheetName(0), sheet) _ = f.SetCellValue(sheet, "E"+strconv.Itoa(row), artistInfo.Youtube)
_ = f.SetCellValue(sheet, "F"+strconv.Itoa(row), artistInfo.Instagram)
// // 写表头 _ = f.SetCellValue(sheet, "G"+strconv.Itoa(row), artistInfo.TikTok)
// headers := []string{"序号", "画家名", "标题", "uuid", "youtube", "instagram", "tiktok", "用户编号"} }
// for col, h := range headers { // 保存文件
// _ = f.SetCellValue(sheet, string('A'+col)+"1", h) filename := "画家视频详情记录.xlsx"
// } fileDir := "./runtime/import/" // 自定义目录
// } else { _ = os.MkdirAll(fileDir, os.ModePerm)
// // 文件存在,打开 filePath := filepath.Join(fileDir, filename)
// var err error if err := f.SaveAs(filePath); err != nil {
// f, err = excelize.OpenFile(filePath) return "", err
// if err != nil { }
// return "", err excelUrl, err := upload.PutBos(filePath, "excel", true)
// }
// }
// // 找到最后一行,追加数据
// rows, err := f.GetRows(sheet)
// if err != nil {
// return "", err
// }
// // 计算下一行,从表头之后开始
// startRow := len(rows) + 1
// if startRow == 1 {
// startRow = 2 // 文件新建或没有数据从第2行开始
// }
// // 写数据
// for i, artistInfo := range artistInfos {
// row := startRow + i
// _ = f.SetCellValue(sheet, "A"+strconv.Itoa(row), row-1) // 序号连续
// _ = f.SetCellValue(sheet, "B"+strconv.Itoa(row), artistInfo.ArtistName)
// _ = f.SetCellValue(sheet, "C"+strconv.Itoa(row), artistInfo.Title)
// _ = f.SetCellValue(sheet, "D"+strconv.Itoa(row), artistInfo.WorkUuid)
// _ = f.SetCellValue(sheet, "E"+strconv.Itoa(row), artistInfo.Youtube)
// _ = f.SetCellValue(sheet, "F"+strconv.Itoa(row), artistInfo.Instagram)
// _ = f.SetCellValue(sheet, "G"+strconv.Itoa(row), artistInfo.TikTok)
// _ = f.SetCellValue(sheet, "H"+strconv.Itoa(row), artistInfo.SubNum)
// }
// // 保存文件
// if err = f.SaveAs(filePath); err != nil {
// fmt.Println("saveAs err: ", err)
// return "", err
// }
// // 上传
// excelUrl, err := upload.PutBos(filePath, "excel", false)
// if err != nil {
// return "", err
// }
// return excelUrl, nil
// }
func ImportPublishV3(c *gin.Context) {
// 1. 上传画家短视频详情文件
excelFile, err := c.FormFile("excel")
if err != nil { if err != nil {
c.JSON(400, gin.H{"error": "缺少 Excel 文件 excel"}) return "", err
return
}
// 2. 保存临时文件
tempDir := "tmp"
os.MkdirAll(tempDir, 0755)
excelPath := filepath.Join(tempDir, "artists.xlsx")
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
c.JSON(500, gin.H{"error": "保存 Excel 失败"})
return
} }
fmt.Println("save excel...") return excelUrl, nil
defer os.RemoveAll(tempDir)
// 3. 读取 Excel 画家名单, 匹配视频和图片
artists, err := readArtistVideoInfoV2(c, excelPath)
if err != nil {
c.JSON(500, gin.H{"error": "读取 Excel 失败"})
return
}
// 4.发布视频
var failedRecords []FailedRecord
//var artistResp []ArtistVideoDetail
for _, artist := range artists {
var infoResp *accountFiee.UserInfoResponse
list, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
Name: artist.Name,
SubNum: artist.SubNum,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue
}
if len(list.UserList) == 0 {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("未找到用户信息: %s", artist.Name),
})
log.Printf(fmt.Sprintf("未找到用户信息: %s", artist.Name))
continue
}
if list != nil && len(list.UserList) > 0 {
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
ID: list.UserList[0].Id,
Domain: "app",
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue
}
}
if err = cast.CheckUserBundleBalance(int32(list.UserList[0].Id), modelCast.BalanceTypeVideoValue); err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()),
})
log.Printf(fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()))
continue
}
//自媒体账号
accountList, err := service.CastProvider.MediaUserList(c, &apiCast.MediaUserListReq{
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
ArtistVal: artist.Name,
Page: 1,
PageSize: 10,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)),
})
log.Printf(fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)))
continue
}
if accountList == nil || len(accountList.Data) == 0 {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: "自媒体账号数量为0",
})
log.Printf(fmt.Sprintf("自媒体账号,账号数量:%d", len(accountList.Data)))
continue
}
mediaAccountUuids := []string{}
mediaAccountNames := []string{}
platformIDs := []apiCast.PlatformIDENUM{}
for _, info := range accountList.Data {
mediaAccountUuids = append(mediaAccountUuids, info.MediaAccountUuid)
mediaAccountNames = append(mediaAccountNames, info.PlatformUserName)
platformIDs = append(platformIDs, apiCast.PlatformIDENUM(info.PlatformID))
}
newCtx := cast.NewCtxWithUserInfo(c)
_, err = service.CastProvider.UpdateWorkVideo(newCtx, &apiCast.UpdateWorkVideoReq{
Title: artist.Title,
Content: artist.Title,
VideoUrl: artist.Video,
CoverUrl: artist.Img,
MediaAccountUuids: mediaAccountUuids,
MediaAccountNames: mediaAccountNames,
PlatformIDs: platformIDs,
PublishConfig1: &apiCast.PublishConfig{
CanComment: 1,
CanJoin: 1,
CanQuote: 1,
ForbidComment: 2,
IsAI: 1,
PublicType: 1,
},
PublishConfig2: &apiCast.PublishConfig{
CanComment: 1,
CanJoin: 1,
CanQuote: 1,
ForbidComment: 2,
IsAI: 1,
PublicType: 1,
},
PublishConfig3: &apiCast.PublishConfig{
CanComment: 1,
CanJoin: 1,
CanQuote: 1,
ForbidComment: 1,
IsAI: 1,
PublicType: 1,
},
Action: "submit",
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
ArtistName: infoResp.Name,
ArtistPhone: infoResp.TelNum,
ArtistPhoneAreaCode: infoResp.TelAreaCode,
Source: 2,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()))
continue
}
// artistResp = append(artistResp, ArtistVideoDetail{
// Id: artist.Id,
// ArtistName: artist.Name,
// SubNum: artist.SubNum,
// Title: artist.Title,
// WorkUuid: resp.WorkUuid,
// Youtube: artist.Youtube,
// Instagram: artist.Instagram,
// TikTok: artist.TikTok,
// })
}
// excelUrl, err := exportPublishRecordsToExcel(artistResp)
// if err != nil {
// service.Error(c, err)
// return
// }
// 6. 返回结果
service.Success(c, map[string]interface{}{
//"excelUrl": excelUrl,
"failedRecords": failedRecords,
})
} }
func readArtistVideoInfoV2(ctx *gin.Context, excelPath string) ([]ArtistMedia, error) { func updateApproval(ctx *gin.Context, artistId uint64, workUuid string, accountInfos []*apiCast.MediaUserInfo, videoUrl, imgUrl, title string) error {
f, err := excelize.OpenFile(excelPath) var publishAccounts []PublishAccount
if err != nil { var publishPlatformIds []int32
return nil, err
for _, v := range accountInfos {
publishAccounts = append(publishAccounts, PublishAccount{
AccountName: v.PlatformUserName,
AccountID: v.MediaAccountUuid,
})
publishPlatformIds = append(publishPlatformIds, int32(v.PlatformID))
} }
defer f.Close() var req CreateRequest
sheetName := f.GetSheetName(0) var url string
rows, err := f.GetRows(sheetName) saasPublishVideo := &SaasPublishVideo{
if err != nil {
return nil, err
}
log.Println("start read excel")
var artists []ArtistMedia
for i, row := range rows {
if i == 0 || i == 1 || len(row) < 2 {
continue
}
id, _ := f.GetCellValue(sheetName, fmt.Sprintf("A%d", i+1))
if id != "" {
id = strings.TrimSpace(id)
}
artistName, _ := f.GetCellValue(sheetName, fmt.Sprintf("B%d", i+1))
if artistName != "" {
artistName = strings.TrimSpace(artistName)
}
title, _ := f.GetCellValue(sheetName, fmt.Sprintf("C%d", i+1))
if title != "" {
title = strings.TrimSpace(title)
}
subNum, _ := f.GetCellValue(sheetName, fmt.Sprintf("G%d", i+1))
if subNum != "" {
subNum = strings.TrimSpace(subNum)
}
artists = append(artists, ArtistMedia{
Id: id,
Name: artistName,
Title: title, Title: title,
SubNum: subNum, Describe: title,
}) IsYoutubeSee: 1,
} IsTiktokScreen: 1,
artists, err = matchArtistMediaV3(ctx, artists) IsTiktokComment: 1,
return artists, nil IsTiktokQuote: 1,
} IsTiktokAiGenerate: 1,
Cover: imgUrl,
func matchArtistMediaV3(ctx *gin.Context, artists []ArtistMedia) ([]ArtistMedia, error) { PlatformIds: publishPlatformIds,
var medias = make(map[string][]*files.Items) PublishAccounts: publishAccounts,
var res []ArtistMedia Videos: []Video{
for _, artist := range artists { {
mediaPath := "fiee2/" + artist.Name VideoAddress: videoUrl,
imgPath := fmt.Sprintf("%s/%s/%s.jpg", mediaPath, artist.Name, artist.Title) VideoThumbnail: imgUrl,
videoPath := fmt.Sprintf("%s/%s/%s.mp4", mediaPath, artist.Name, artist.Title)
//判断文件是否存在
if _, ok := medias[artist.Name]; !ok {
sortBy := ctx.DefaultQuery("sortBy", "name")
sortAsc, _ := strconv.ParseBool(ctx.DefaultQuery("sortAsc", "true"))
resp, err := service.FilesProvider.List(ctx, &files.FileListReq{
Path: mediaPath,
UserSpacePath: "",
Sorting: &files.Sorting{
By: sortBy,
Asc: sortAsc,
}, },
},
}
if config.AppMode == "prod" {
url = "https://erp.fonchain.com/approval/v2/create"
req = CreateRequest{
Type: "SaasPublishVideo",
DepartmentID: 3,
Domain: "7bfa3942cceb20389822af7b57c5798e",
MenuType: 2,
SaasPublishVideo: saasPublishVideo,
}
} else {
url = "http://114.218.158.24:9020/approval/v2/create"
req = CreateRequest{
Type: "SaasPublishVideo",
DepartmentID: 3,
Domain: "7bfa3942cceb20389822af7b57c5798e",
MenuType: 2,
SaasPublishVideo: saasPublishVideo,
}
}
jsonBytes, err := json.Marshal(req)
if err != nil {
return err
}
res, err := http.Post(url, "application/json", bytes.NewBuffer(jsonBytes))
if err != nil {
return err
}
defer res.Body.Close()
responseBodyBytes, err := io.ReadAll(res.Body)
if err != nil {
return err
}
var apiResp APIResponse
err = json.Unmarshal(responseBodyBytes, &apiResp)
if err != nil {
// 处理错误
return err
}
fmt.Println("拿到审批ID:", apiResp.Data.ID)
_, err = service.CastProvider.UpdateStatus(ctx, &apiCast.UpdateStatusReq{
WorkUuid: workUuid,
WorkAction: apiCast.WorkActionENUM_APPROVAL,
ApprovalID: strconv.FormatUint(apiResp.Data.ID, 10),
}) })
if err != nil { if err != nil {
return nil, err return err
} }
medias[artist.Name] = resp.Items _, err = service.CastProvider.UpdateStatus(ctx, &apiCast.UpdateStatusReq{
WorkUuid: workUuid,
WorkAction: apiCast.WorkActionENUM_APPROVAL_PASS,
ApprovalID: strconv.FormatUint(apiResp.Data.ID, 10),
})
if err != nil {
return err
} }
isExist := false _, err = service.BundleProvider.AddBundleBalance(ctx, &bundle.AddBundleBalanceReq{
for _, media := range medias[artist.Name] { UserId: int32(artistId),
if media.Name == artist.Title+".jpg" || media.Name == artist.Title+".mp4" || media.Name == artist.Title+".mov" { VideoConsumptionNumber: 1,
isExist = true })
break if err != nil {
log.Printf(fmt.Sprintf("扣除余额失败: %s", err.Error()))
return err
} }
_, err = service.CastProvider.UpdateStatus(ctx, &apiCast.UpdateStatusReq{
WorkAction: apiCast.WorkActionENUM_CONFIRM,
WorkUuid: workUuid,
ConfirmRemark: "",
ConfirmStatus: 1,
})
if err != nil {
log.Printf(fmt.Sprintf("更新状态失败: %s", err.Error()))
return err
} }
if !isExist { return nil
continue
}
var httpType string
if config.AppConfig.System.AppMode == "dev" {
url := "114.218.158.24:9020"
httpType = fmt.Sprintf("%s%s", model.HttpType, url)
} else {
url := "saas.fiee.com"
httpType = fmt.Sprintf("%s%s", model.HttpsType, url)
}
baseUrl := fmt.Sprintf("%s/api/fiee/resource/raw/", httpType)
videoUrl := baseUrl + filepath.Base(videoPath)
imgUrl := baseUrl + filepath.Base(imgPath)
tmp := artist
tmp.Id = artist.Id
tmp.Name = artist.Name
tmp.Title = artist.Title
tmp.Img = imgUrl
tmp.Video = videoUrl
tmp.SubNum = artist.SubNum
res = append(res, tmp)
}
return res, nil
} }

View File

@ -7,9 +7,6 @@
package stime package stime
import ( import (
"errors"
"fonchain-fiee/pkg/e"
"go.uber.org/zap"
"time" "time"
) )
@ -91,19 +88,3 @@ var WeekStrMap = map[string]string{
"Saturday": "六", "Saturday": "六",
"Sunday": "日", "Sunday": "日",
} }
func DatetimeToTimes(datetime string, dateFormat string) (times int32, err error) {
if datetime == "" {
times = 0
return
}
loc, _ := time.LoadLocation("Asia/Shanghai")
t, err := time.ParseInLocation(dateFormat, datetime, loc)
if err != nil {
zap.L().Error("DatetimeToTimes err:"+datetime+":", zap.Error(err))
err = errors.New(e.GetCodeMsg(e.InvalidParams))
return
}
times = int32(t.Unix())
return
}

View File

@ -7,16 +7,14 @@ import (
"errors" "errors"
"fmt" "fmt"
"fonchain-fiee/pkg/e" "fonchain-fiee/pkg/e"
"github.com/gin-gonic/gin"
"github.com/tealeg/xlsx"
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"path/filepath"
"time" "time"
"github.com/gin-gonic/gin"
"github.com/tealeg/xlsx"
) )
const ( const (
@ -130,36 +128,3 @@ func ResponseXls(c *gin.Context, content io.ReadSeeker, fileTag string) {
//c.Writer.Header().Add("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") //c.Writer.Header().Add("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
http.ServeContent(c.Writer, c.Request, fileName, time.Now(), content) http.ServeContent(c.Writer, c.Request, fileName, time.Now(), content)
} }
func CreateDirPath(path string) (err error) {
if _, err = os.Stat(path); os.IsNotExist(err) {
if err = os.MkdirAll(path, os.ModePerm); err != nil {
return
}
}
return
}
func CopyFile(src, dstDir string) (string, error) {
in, err := os.Open(src)
if err != nil {
return "", err
}
defer in.Close()
if err := os.MkdirAll(dstDir, 0755); err != nil {
return "", err
}
dst := filepath.Join(dstDir, filepath.Base(src))
out, err := os.Create(dst)
if err != nil {
return "", err
}
defer out.Close()
if _, err = io.Copy(out, in); err != nil {
return "", err
}
if err = out.Sync(); err != nil {
return "", err
}
return dst, nil
}