Merge branch 'feat-cjy-addData'
This commit is contained in:
commit
5a0d5eba3d
12746
api/cast/cast.pb.go
12746
api/cast/cast.pb.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v6.32.0--rc2
|
||||
// - protoc v3.21.1
|
||||
// source: pb/fiee/cast.proto
|
||||
|
||||
package cast
|
||||
@ -85,6 +85,7 @@ type CastClient interface {
|
||||
GetArtist(ctx context.Context, in *GetArtistReq, opts ...grpc_go.CallOption) (*GetArtistResp, common.ErrorWithAttachment)
|
||||
// 作品分析相关接口
|
||||
CreateWorkAnalysis(ctx context.Context, in *CreateWorkAnalysisReq, opts ...grpc_go.CallOption) (*CreateWorkAnalysisResp, common.ErrorWithAttachment)
|
||||
ImportWorkAnalysis(ctx context.Context, in *ImportWorkAnalysisReq, opts ...grpc_go.CallOption) (*ImportWorkAnalysisResp, common.ErrorWithAttachment)
|
||||
UpdateWorkAnalysis(ctx context.Context, in *UpdateWorkAnalysisReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
UpdateWorkAnalysisStatus(ctx context.Context, in *UpdateWorkAnalysisStatusReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
GetWorkAnalysis(ctx context.Context, in *GetWorkAnalysisDetailReq, opts ...grpc_go.CallOption) (*GetWorkAnalysisDetailResp, common.ErrorWithAttachment)
|
||||
@ -92,6 +93,7 @@ type CastClient interface {
|
||||
ListWorkAnalysis(ctx context.Context, in *ListWorkAnalysisReq, opts ...grpc_go.CallOption) (*ListWorkAnalysisResp, common.ErrorWithAttachment)
|
||||
DeleteWorkAnalysis(ctx context.Context, in *DeleteWorkAnalysisReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
UpdateWorkAnalysisApprovalID(ctx context.Context, in *UpdateWorkAnalysisApprovalIDReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
UpdateWorkAnalysisPdfUrl(ctx context.Context, in *UpdateWorkAnalysisReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
// 数据列表相关接口
|
||||
ArtistDataList(ctx context.Context, in *ArtistDataListReq, opts ...grpc_go.CallOption) (*ArtistDataListResp, common.ErrorWithAttachment)
|
||||
MediaDataList(ctx context.Context, in *MediaDataListReq, opts ...grpc_go.CallOption) (*MediaDataListResp, common.ErrorWithAttachment)
|
||||
@ -136,8 +138,11 @@ type CastClient interface {
|
||||
DeleteCompetitiveReport(ctx context.Context, in *DeleteCompetitiveReportReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
UpdateCompetitiveReportApprovalID(ctx context.Context, in *UpdateCompetitiveReportApprovalIDReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
CountCompetitiveReportByWorkUuids(ctx context.Context, in *CountCompetitiveReportByWorkUuidsReq, opts ...grpc_go.CallOption) (*CountCompetitiveReportByWorkUuidsResp, common.ErrorWithAttachment)
|
||||
ImportCompetitiveReportHistory(ctx context.Context, in *ImportCompetitiveReportHistoryReq, opts ...grpc_go.CallOption) (*ImportCompetitiveReportHistoryResp, common.ErrorWithAttachment)
|
||||
// 发布记录相关接口
|
||||
ListPublishLog(ctx context.Context, in *ListPublishLogReq, opts ...grpc_go.CallOption) (*ListPublishLogResp, common.ErrorWithAttachment)
|
||||
// 艺人作品统计快照接口
|
||||
GetArtistWorkStats(ctx context.Context, in *GetArtistWorkStatsReq, opts ...grpc_go.CallOption) (*GetArtistWorkStatsResp, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type castClient struct {
|
||||
@ -197,6 +202,7 @@ type CastClientImpl struct {
|
||||
UpdateArtist func(ctx context.Context, in *UpdateArtistReq) (*UpdateArtistResp, error)
|
||||
GetArtist func(ctx context.Context, in *GetArtistReq) (*GetArtistResp, error)
|
||||
CreateWorkAnalysis func(ctx context.Context, in *CreateWorkAnalysisReq) (*CreateWorkAnalysisResp, error)
|
||||
ImportWorkAnalysis func(ctx context.Context, in *ImportWorkAnalysisReq) (*ImportWorkAnalysisResp, error)
|
||||
UpdateWorkAnalysis func(ctx context.Context, in *UpdateWorkAnalysisReq) (*emptypb.Empty, error)
|
||||
UpdateWorkAnalysisStatus func(ctx context.Context, in *UpdateWorkAnalysisStatusReq) (*emptypb.Empty, error)
|
||||
GetWorkAnalysis func(ctx context.Context, in *GetWorkAnalysisDetailReq) (*GetWorkAnalysisDetailResp, error)
|
||||
@ -204,6 +210,7 @@ type CastClientImpl struct {
|
||||
ListWorkAnalysis func(ctx context.Context, in *ListWorkAnalysisReq) (*ListWorkAnalysisResp, error)
|
||||
DeleteWorkAnalysis func(ctx context.Context, in *DeleteWorkAnalysisReq) (*emptypb.Empty, error)
|
||||
UpdateWorkAnalysisApprovalID func(ctx context.Context, in *UpdateWorkAnalysisApprovalIDReq) (*emptypb.Empty, error)
|
||||
UpdateWorkAnalysisPdfUrl func(ctx context.Context, in *UpdateWorkAnalysisReq) (*emptypb.Empty, error)
|
||||
ArtistDataList func(ctx context.Context, in *ArtistDataListReq) (*ArtistDataListResp, error)
|
||||
MediaDataList func(ctx context.Context, in *MediaDataListReq) (*MediaDataListResp, error)
|
||||
DataOverview func(ctx context.Context, in *DataOverviewReq) (*DataOverviewResp, error)
|
||||
@ -237,7 +244,9 @@ type CastClientImpl struct {
|
||||
DeleteCompetitiveReport func(ctx context.Context, in *DeleteCompetitiveReportReq) (*emptypb.Empty, error)
|
||||
UpdateCompetitiveReportApprovalID func(ctx context.Context, in *UpdateCompetitiveReportApprovalIDReq) (*emptypb.Empty, error)
|
||||
CountCompetitiveReportByWorkUuids func(ctx context.Context, in *CountCompetitiveReportByWorkUuidsReq) (*CountCompetitiveReportByWorkUuidsResp, error)
|
||||
ImportCompetitiveReportHistory func(ctx context.Context, in *ImportCompetitiveReportHistoryReq) (*ImportCompetitiveReportHistoryResp, error)
|
||||
ListPublishLog func(ctx context.Context, in *ListPublishLogReq) (*ListPublishLogResp, error)
|
||||
GetArtistWorkStats func(ctx context.Context, in *GetArtistWorkStatsReq) (*GetArtistWorkStatsResp, error)
|
||||
}
|
||||
|
||||
func (c *CastClientImpl) GetDubboStub(cc *triple.TripleConn) CastClient {
|
||||
@ -564,6 +573,12 @@ func (c *castClient) CreateWorkAnalysis(ctx context.Context, in *CreateWorkAnaly
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateWorkAnalysis", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) ImportWorkAnalysis(ctx context.Context, in *ImportWorkAnalysisReq, opts ...grpc_go.CallOption) (*ImportWorkAnalysisResp, common.ErrorWithAttachment) {
|
||||
out := new(ImportWorkAnalysisResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ImportWorkAnalysis", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) UpdateWorkAnalysis(ctx context.Context, in *UpdateWorkAnalysisReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment) {
|
||||
out := new(emptypb.Empty)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -606,6 +621,12 @@ func (c *castClient) UpdateWorkAnalysisApprovalID(ctx context.Context, in *Updat
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateWorkAnalysisApprovalID", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) UpdateWorkAnalysisPdfUrl(ctx context.Context, in *UpdateWorkAnalysisReq, 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+"/UpdateWorkAnalysisPdfUrl", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) ArtistDataList(ctx context.Context, in *ArtistDataListReq, opts ...grpc_go.CallOption) (*ArtistDataListResp, common.ErrorWithAttachment) {
|
||||
out := new(ArtistDataListResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -804,12 +825,24 @@ func (c *castClient) CountCompetitiveReportByWorkUuids(ctx context.Context, in *
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CountCompetitiveReportByWorkUuids", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) ImportCompetitiveReportHistory(ctx context.Context, in *ImportCompetitiveReportHistoryReq, opts ...grpc_go.CallOption) (*ImportCompetitiveReportHistoryResp, common.ErrorWithAttachment) {
|
||||
out := new(ImportCompetitiveReportHistoryResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ImportCompetitiveReportHistory", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) ListPublishLog(ctx context.Context, in *ListPublishLogReq, opts ...grpc_go.CallOption) (*ListPublishLogResp, common.ErrorWithAttachment) {
|
||||
out := new(ListPublishLogResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ListPublishLog", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) GetArtistWorkStats(ctx context.Context, in *GetArtistWorkStatsReq, opts ...grpc_go.CallOption) (*GetArtistWorkStatsResp, common.ErrorWithAttachment) {
|
||||
out := new(GetArtistWorkStatsResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetArtistWorkStats", in, out)
|
||||
}
|
||||
|
||||
// CastServer is the server API for Cast service.
|
||||
// All implementations must embed UnimplementedCastServer
|
||||
// for forward compatibility
|
||||
@ -870,6 +903,7 @@ type CastServer interface {
|
||||
GetArtist(context.Context, *GetArtistReq) (*GetArtistResp, error)
|
||||
// 作品分析相关接口
|
||||
CreateWorkAnalysis(context.Context, *CreateWorkAnalysisReq) (*CreateWorkAnalysisResp, error)
|
||||
ImportWorkAnalysis(context.Context, *ImportWorkAnalysisReq) (*ImportWorkAnalysisResp, error)
|
||||
UpdateWorkAnalysis(context.Context, *UpdateWorkAnalysisReq) (*emptypb.Empty, error)
|
||||
UpdateWorkAnalysisStatus(context.Context, *UpdateWorkAnalysisStatusReq) (*emptypb.Empty, error)
|
||||
GetWorkAnalysis(context.Context, *GetWorkAnalysisDetailReq) (*GetWorkAnalysisDetailResp, error)
|
||||
@ -877,6 +911,7 @@ type CastServer interface {
|
||||
ListWorkAnalysis(context.Context, *ListWorkAnalysisReq) (*ListWorkAnalysisResp, error)
|
||||
DeleteWorkAnalysis(context.Context, *DeleteWorkAnalysisReq) (*emptypb.Empty, error)
|
||||
UpdateWorkAnalysisApprovalID(context.Context, *UpdateWorkAnalysisApprovalIDReq) (*emptypb.Empty, error)
|
||||
UpdateWorkAnalysisPdfUrl(context.Context, *UpdateWorkAnalysisReq) (*emptypb.Empty, error)
|
||||
// 数据列表相关接口
|
||||
ArtistDataList(context.Context, *ArtistDataListReq) (*ArtistDataListResp, error)
|
||||
MediaDataList(context.Context, *MediaDataListReq) (*MediaDataListResp, error)
|
||||
@ -921,8 +956,11 @@ type CastServer interface {
|
||||
DeleteCompetitiveReport(context.Context, *DeleteCompetitiveReportReq) (*emptypb.Empty, error)
|
||||
UpdateCompetitiveReportApprovalID(context.Context, *UpdateCompetitiveReportApprovalIDReq) (*emptypb.Empty, error)
|
||||
CountCompetitiveReportByWorkUuids(context.Context, *CountCompetitiveReportByWorkUuidsReq) (*CountCompetitiveReportByWorkUuidsResp, error)
|
||||
ImportCompetitiveReportHistory(context.Context, *ImportCompetitiveReportHistoryReq) (*ImportCompetitiveReportHistoryResp, error)
|
||||
// 发布记录相关接口
|
||||
ListPublishLog(context.Context, *ListPublishLogReq) (*ListPublishLogResp, error)
|
||||
// 艺人作品统计快照接口
|
||||
GetArtistWorkStats(context.Context, *GetArtistWorkStatsReq) (*GetArtistWorkStatsResp, error)
|
||||
mustEmbedUnimplementedCastServer()
|
||||
}
|
||||
|
||||
@ -1087,6 +1125,9 @@ func (UnimplementedCastServer) GetArtist(context.Context, *GetArtistReq) (*GetAr
|
||||
func (UnimplementedCastServer) CreateWorkAnalysis(context.Context, *CreateWorkAnalysisReq) (*CreateWorkAnalysisResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateWorkAnalysis not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) ImportWorkAnalysis(context.Context, *ImportWorkAnalysisReq) (*ImportWorkAnalysisResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ImportWorkAnalysis not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) UpdateWorkAnalysis(context.Context, *UpdateWorkAnalysisReq) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkAnalysis not implemented")
|
||||
}
|
||||
@ -1108,6 +1149,9 @@ func (UnimplementedCastServer) DeleteWorkAnalysis(context.Context, *DeleteWorkAn
|
||||
func (UnimplementedCastServer) UpdateWorkAnalysisApprovalID(context.Context, *UpdateWorkAnalysisApprovalIDReq) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkAnalysisApprovalID not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) UpdateWorkAnalysisPdfUrl(context.Context, *UpdateWorkAnalysisReq) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkAnalysisPdfUrl not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) ArtistDataList(context.Context, *ArtistDataListReq) (*ArtistDataListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ArtistDataList not implemented")
|
||||
}
|
||||
@ -1207,9 +1251,15 @@ func (UnimplementedCastServer) UpdateCompetitiveReportApprovalID(context.Context
|
||||
func (UnimplementedCastServer) CountCompetitiveReportByWorkUuids(context.Context, *CountCompetitiveReportByWorkUuidsReq) (*CountCompetitiveReportByWorkUuidsResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CountCompetitiveReportByWorkUuids not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) ImportCompetitiveReportHistory(context.Context, *ImportCompetitiveReportHistoryReq) (*ImportCompetitiveReportHistoryResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ImportCompetitiveReportHistory not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) ListPublishLog(context.Context, *ListPublishLogReq) (*ListPublishLogResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListPublishLog not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) GetArtistWorkStats(context.Context, *GetArtistWorkStatsReq) (*GetArtistWorkStatsResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetArtistWorkStats not implemented")
|
||||
}
|
||||
func (s *UnimplementedCastServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
@ -2746,6 +2796,35 @@ func _Cast_CreateWorkAnalysis_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Cast_ImportWorkAnalysis_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ImportWorkAnalysisReq)
|
||||
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("ImportWorkAnalysis", 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_UpdateWorkAnalysis_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateWorkAnalysisReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -2949,6 +3028,35 @@ func _Cast_UpdateWorkAnalysisApprovalID_Handler(srv interface{}, ctx context.Con
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Cast_UpdateWorkAnalysisPdfUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateWorkAnalysisReq)
|
||||
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("UpdateWorkAnalysisPdfUrl", 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_ArtistDataList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ArtistDataListReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -3906,6 +4014,35 @@ func _Cast_CountCompetitiveReportByWorkUuids_Handler(srv interface{}, ctx contex
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Cast_ImportCompetitiveReportHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ImportCompetitiveReportHistoryReq)
|
||||
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("ImportCompetitiveReportHistory", 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_ListPublishLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListPublishLogReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -3935,6 +4072,35 @@ func _Cast_ListPublishLog_Handler(srv interface{}, ctx context.Context, dec func
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Cast_GetArtistWorkStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetArtistWorkStatsReq)
|
||||
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("GetArtistWorkStats", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Cast_ServiceDesc is the grpc_go.ServiceDesc for Cast service.
|
||||
// It's only intended for direct use with grpc_go.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -4150,6 +4316,10 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "CreateWorkAnalysis",
|
||||
Handler: _Cast_CreateWorkAnalysis_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ImportWorkAnalysis",
|
||||
Handler: _Cast_ImportWorkAnalysis_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateWorkAnalysis",
|
||||
Handler: _Cast_UpdateWorkAnalysis_Handler,
|
||||
@ -4178,6 +4348,10 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "UpdateWorkAnalysisApprovalID",
|
||||
Handler: _Cast_UpdateWorkAnalysisApprovalID_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateWorkAnalysisPdfUrl",
|
||||
Handler: _Cast_UpdateWorkAnalysisPdfUrl_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ArtistDataList",
|
||||
Handler: _Cast_ArtistDataList_Handler,
|
||||
@ -4310,10 +4484,18 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "CountCompetitiveReportByWorkUuids",
|
||||
Handler: _Cast_CountCompetitiveReportByWorkUuids_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ImportCompetitiveReportHistory",
|
||||
Handler: _Cast_ImportCompetitiveReportHistory_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListPublishLog",
|
||||
Handler: _Cast_ListPublishLog_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetArtistWorkStats",
|
||||
Handler: _Cast_GetArtistWorkStats_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "pb/fiee/cast.proto",
|
||||
|
||||
@ -31,6 +31,10 @@ func AnalysisRouter(r *gin.RouterGroup) {
|
||||
analysis.POST("artist-metrics-single", serviceCast.ArtistMetricsDailyWindow) // 艺人指标日窗口
|
||||
analysis.POST("tobe-confirmed-list", serviceCast.TobeConfirmedList) // 待确认数据列表
|
||||
analysis.POST("update-approval-id", serviceCast.UpdateWorkAnalysisApprovalID) // 更新作品分析审批ID
|
||||
analysis.POST("update-pdf-url", serviceCast.UpdateWorkAnalysisPdfUrl) // 更新作品分析PDF链接
|
||||
|
||||
// 刷数据专用的导入接口
|
||||
analysis.POST("import-batch", serviceCast.ImportWorkAnalysisBatch) // Excel 批量导入数据分析
|
||||
|
||||
analysis.POST("trigger-ayrshare-metrics", serviceCast.TriggerAyrshareMetricsCollector) // 手动触发 Ayrshare 指标采集任务
|
||||
}
|
||||
@ -50,6 +54,9 @@ func AnalysisRouter(r *gin.RouterGroup) {
|
||||
competitiveReport.POST("export-list", serviceCast.ListCompetitiveReportExport) // 竞品报告列表导出
|
||||
competitiveReport.POST("export-single-list", serviceCast.ListCompetitiveReportSingleExport) // 竞品报告单个列表导出
|
||||
competitiveReport.POST("import-pdf-batch", serviceCast.ImportPdfBatch) // 批量导入PDF(下载、重命名、上传)
|
||||
|
||||
// 刷竞品报告专用的导入接口
|
||||
competitiveReport.POST("import-history-batch", serviceCast.ImportCompetitiveReportHistoryBatch) // Excel 批量刷写竞品报告历史数据
|
||||
}
|
||||
|
||||
// 员工任务相关路由(需要App登录验证
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cast
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@ -19,14 +20,18 @@ import (
|
||||
"fonchain-fiee/pkg/service/bundle/common"
|
||||
"fonchain-fiee/pkg/utils"
|
||||
"fonchain-fiee/pkg/utils/stime"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"math/rand"
|
||||
|
||||
"dubbo.apache.org/dubbo-go/v3/common/constant"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
"github.com/xuri/excelize/v2"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@ -92,6 +97,305 @@ func CreateWorkAnalysisCore(ctx *gin.Context, req *cast.CreateWorkAnalysisReq) (
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ImportWorkAnalysisBatch 通过 Excel 批量导入数据分析
|
||||
// Excel 列顺序:SubNum | ArtistName | SubmitTime | PeriodTypeFans | PeriodTypeViews | PeriodTypeLikes | PeriodTypeComments | PeriodTypeShares | IsRefreshData(1=false,2=true)
|
||||
func ImportWorkAnalysisBatch(ctx *gin.Context) {
|
||||
excelFile, err := ctx.FormFile("file")
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
loginInfo := login.GetUserInfoFromC(ctx)
|
||||
lockKey := fmt.Sprintf("import_work_analysis_batch:%d", loginInfo.ID)
|
||||
replay := cache.RedisClient.SetNX(lockKey, time.Now().Format("20060102150405"), 5*time.Minute)
|
||||
if !replay.Val() {
|
||||
service.Error(ctx, errors.New("有导入任务正在进行,请稍后再试"))
|
||||
return
|
||||
}
|
||||
defer cache.RedisClient.Del(lockKey)
|
||||
|
||||
tempDir := "./runtime/report_pdf"
|
||||
_, err = utils.CheckDirPath(tempDir, true)
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
fileName := fmt.Sprintf("%d_work_analysis.xlsx", time.Now().UnixMicro())
|
||||
excelPath := filepath.Join(tempDir, fileName)
|
||||
if err = ctx.SaveUploadedFile(excelFile, excelPath); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
excelData, err := excelize.OpenFile(excelPath)
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
defer excelData.Close()
|
||||
|
||||
rows, err := excelData.GetRows("Sheet1")
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
newCtx := NewCtxWithUserInfo(ctx)
|
||||
|
||||
// 写入表头
|
||||
_ = excelData.SetCellValue("Sheet1", "J1", "DateInt")
|
||||
_ = excelData.SetCellValue("Sheet1", "K1", "ConfirmType")
|
||||
_ = excelData.SetCellValue("Sheet1", "L1", "结果")
|
||||
|
||||
successCount := 0
|
||||
|
||||
for line, row := range rows {
|
||||
if line == 0 {
|
||||
continue // 跳过表头
|
||||
}
|
||||
if len(row) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// Excel 行号(1-based),line=1 → 行号 2
|
||||
cellL := fmt.Sprintf("L%d", line+1)
|
||||
|
||||
// 第一列:SubNum
|
||||
subNum := ""
|
||||
if len(row) > 0 {
|
||||
subNum = utils.CleanString(row[0])
|
||||
}
|
||||
if subNum == "" {
|
||||
_ = excelData.SetCellValue("Sheet1", cellL, "SubNum 不能为空")
|
||||
continue
|
||||
}
|
||||
|
||||
// 第二列:ArtistName
|
||||
artistName := ""
|
||||
if len(row) > 1 {
|
||||
artistName = utils.CleanString(row[1])
|
||||
}
|
||||
|
||||
// 第三列:SubmitTime
|
||||
submitTime := ""
|
||||
if len(row) > 2 {
|
||||
submitTime = row[2]
|
||||
}
|
||||
|
||||
// 第四列:PeriodTypeFans
|
||||
var periodTypeFans uint32
|
||||
if len(row) > 3 && utils.CleanString(row[3]) != "" {
|
||||
v, _ := strconv.ParseUint(utils.CleanString(row[3]), 10, 32)
|
||||
periodTypeFans = uint32(v)
|
||||
}
|
||||
|
||||
// 第五列:PeriodTypeViews
|
||||
var periodTypeViews uint32
|
||||
if len(row) > 4 && utils.CleanString(row[4]) != "" {
|
||||
v, _ := strconv.ParseUint(utils.CleanString(row[4]), 10, 32)
|
||||
periodTypeViews = uint32(v)
|
||||
}
|
||||
|
||||
// 第六列:PeriodTypeLikes
|
||||
var periodTypeLikes uint32
|
||||
if len(row) > 5 && utils.CleanString(row[5]) != "" {
|
||||
v, _ := strconv.ParseUint(utils.CleanString(row[5]), 10, 32)
|
||||
periodTypeLikes = uint32(v)
|
||||
}
|
||||
|
||||
// 第七列:PeriodTypeComments
|
||||
var periodTypeComments uint32
|
||||
if len(row) > 6 && utils.CleanString(row[6]) != "" {
|
||||
v, _ := strconv.ParseUint(utils.CleanString(row[6]), 10, 32)
|
||||
periodTypeComments = uint32(v)
|
||||
}
|
||||
|
||||
// 第八列:PeriodTypeShares
|
||||
var periodTypeShares uint32
|
||||
if len(row) > 7 && utils.CleanString(row[7]) != "" {
|
||||
v, _ := strconv.ParseUint(utils.CleanString(row[7]), 10, 32)
|
||||
periodTypeShares = uint32(v)
|
||||
}
|
||||
|
||||
// 第九列:IsRefreshData(1 → false, 2 → true)
|
||||
isRefreshData := false
|
||||
if len(row) > 8 && utils.CleanString(row[8]) == "2" {
|
||||
isRefreshData = true
|
||||
}
|
||||
|
||||
// 第十列:DateInt(YYYYMMDD 格式,直接从 Excel 读取)
|
||||
var dateInt int32
|
||||
if len(row) > 9 && utils.CleanString(row[9]) != "" {
|
||||
v, _ := strconv.ParseInt(utils.CleanString(row[9]), 10, 32)
|
||||
dateInt = int32(v)
|
||||
}
|
||||
|
||||
// 第十一列:ConfirmType(1 艺人确认,2 系统自动确认)
|
||||
var confirmType int32
|
||||
if len(row) > 10 && utils.CleanString(row[10]) != "" {
|
||||
v, _ := strconv.ParseInt(utils.CleanString(row[10]), 10, 32)
|
||||
confirmType = int32(v)
|
||||
}
|
||||
|
||||
// 根据 subNum 查询艺人信息
|
||||
subInfoResp, err := service.AccountFieeProvider.SubNumGetInfo(context.Background(), &accountFiee.SubNumGetInfoRequest{
|
||||
SubNum: subNum,
|
||||
Domain: "app",
|
||||
})
|
||||
if err != nil {
|
||||
zap.L().Error("ImportWorkAnalysisBatch SubNumGetInfo", zap.Error(err), zap.String("subNum", subNum))
|
||||
_ = excelData.SetCellValue("Sheet1", cellL, fmt.Sprintf("自媒体用户查询失败:%s", err.Error()))
|
||||
continue
|
||||
}
|
||||
if subInfoResp == nil || subInfoResp.Id == 0 {
|
||||
_ = excelData.SetCellValue("Sheet1", cellL, "自媒体用户不存在")
|
||||
continue
|
||||
}
|
||||
|
||||
artistID := uint64(subInfoResp.Id)
|
||||
|
||||
// 查询艺人套餐订单
|
||||
balanceResp, err := service.BundleProvider.GetBundleBalanceByUserId(context.Background(), &bundle.GetBundleBalanceByUserIdReq{
|
||||
UserId: int32(artistID),
|
||||
})
|
||||
if err != nil {
|
||||
zap.L().Error("ImportWorkAnalysisBatch GetBundleBalanceByUserId", zap.Error(err), zap.Uint64("artistID", artistID))
|
||||
_ = excelData.SetCellValue("Sheet1", cellL, fmt.Sprintf("获取套餐订单失败:%s", err.Error()))
|
||||
continue
|
||||
}
|
||||
if balanceResp.OrderUUID == "" {
|
||||
_ = excelData.SetCellValue("Sheet1", cellL, "订单不存在")
|
||||
continue
|
||||
}
|
||||
|
||||
// 若 artistName 为空则使用账号服务中的姓名
|
||||
if artistName == "" {
|
||||
artistName = subInfoResp.Name
|
||||
}
|
||||
|
||||
// 将 submitTime(YYYY-MM-DD 00:00:00)加随机 9~15 小时、0~59 分钟、0~59 秒,使提交时间更真实
|
||||
if submitTime != "" {
|
||||
if parsedTime, parseErr := time.Parse("2006-01-02 15:04:05", submitTime); parseErr == nil {
|
||||
randomDuration := time.Duration(rand.Intn(7)+9)*time.Hour +
|
||||
time.Duration(rand.Intn(60))*time.Minute +
|
||||
time.Duration(rand.Intn(60))*time.Second
|
||||
submitTime = parsedTime.Add(randomDuration).Format("2006-01-02 15:04:05")
|
||||
}
|
||||
}
|
||||
|
||||
// 提升到外部作用域,供 importReq 使用
|
||||
var aiAnalysis string
|
||||
var mediaAccountCount int32
|
||||
var workVideoCount, workImageCount int32
|
||||
|
||||
// 调用 ArtistMetricsSeries 获取艺人指标数据并写入 Analysis
|
||||
metricsReq := &cast.ArtistMetricsSeriesReq{
|
||||
ArtistUUID: fmt.Sprint(subInfoResp.Id),
|
||||
Date: dateInt,
|
||||
PeriodTypeFans: periodTypeFans,
|
||||
PeriodTypeViews: periodTypeViews,
|
||||
PeriodTypeLikes: periodTypeLikes,
|
||||
PeriodTypeComments: periodTypeComments,
|
||||
PeriodTypeShares: periodTypeShares,
|
||||
}
|
||||
|
||||
// 并行调用 ArtistMetricsSeries 和 GetArtistWorkStats
|
||||
var metricsResp *cast.ArtistMetricsSeriesResp
|
||||
var workStatsResp *cast.GetArtistWorkStatsResp
|
||||
var metricsErr, workStatsErr error
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(2)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
metricsResp, metricsErr = service.CastProvider.ArtistMetricsSeries(context.Background(), metricsReq)
|
||||
}()
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
workStatsResp, workStatsErr = service.CastProvider.GetArtistWorkStats(newCtx, &cast.GetArtistWorkStatsReq{
|
||||
ArtistUuid: fmt.Sprint(subInfoResp.Id),
|
||||
StatusUpdateTime: submitTime,
|
||||
})
|
||||
}()
|
||||
wg.Wait()
|
||||
|
||||
if workStatsErr == nil && workStatsResp != nil {
|
||||
mediaAccountCount = int32(workStatsResp.AccountCount)
|
||||
workVideoCount = int32(workStatsResp.VideoCount)
|
||||
workImageCount = int32(workStatsResp.ImageCount)
|
||||
} else if workStatsErr != nil {
|
||||
zap.L().Warn("ImportWorkAnalysisBatch GetArtistWorkStats failed", zap.Error(workStatsErr), zap.String("subNum", subNum))
|
||||
}
|
||||
|
||||
if metricsErr != nil {
|
||||
zap.L().Warn("ImportWorkAnalysisBatch ArtistMetricsSeries failed", zap.Error(metricsErr), zap.String("subNum", subNum))
|
||||
} else if metricsResp != nil {
|
||||
// 构建与 ArtistMetricsSeries HTTP 接口相同的 respMap
|
||||
raw, _ := json.Marshal(metricsResp)
|
||||
respMap := make(map[string]interface{})
|
||||
_ = json.Unmarshal(raw, &respMap)
|
||||
respMap["accountConsumptionNumber"] = mediaAccountCount
|
||||
respMap["videoCount"] = workVideoCount
|
||||
respMap["imageCount"] = workImageCount
|
||||
|
||||
// 调用 AI 生成分析文本
|
||||
aiAnalysis, _ = generateArtistMetricsAnalysis(metricsResp)
|
||||
if aiAnalysis == "" {
|
||||
zap.L().Warn("ImportWorkAnalysisBatch generateArtistMetricsAnalysis returned empty", zap.String("subNum", subNum))
|
||||
}
|
||||
respMap["analysis"] = aiAnalysis
|
||||
}
|
||||
|
||||
importReq := &cast.ImportWorkAnalysisReq{
|
||||
SubNum: subNum,
|
||||
ArtistID: fmt.Sprint(subInfoResp.Id),
|
||||
ArtistName: artistName,
|
||||
ArtistPhone: subInfoResp.TelNum,
|
||||
BundleOrderUuid: balanceResp.OrderUUID,
|
||||
SubmitTime: submitTime,
|
||||
PeriodTypeFans: periodTypeFans,
|
||||
PeriodTypeViews: periodTypeViews,
|
||||
PeriodTypeLikes: periodTypeLikes,
|
||||
PeriodTypeComments: periodTypeComments,
|
||||
PeriodTypeShares: periodTypeShares,
|
||||
IsRefreshData: isRefreshData,
|
||||
Analysis: aiAnalysis,
|
||||
MediaAccountCount: mediaAccountCount,
|
||||
WorkVideoCount: workVideoCount,
|
||||
WorkImageCount: workImageCount,
|
||||
Views: 1,
|
||||
Likes: 1,
|
||||
Comments: 1,
|
||||
Shares: 1,
|
||||
FansCount: 1,
|
||||
MostActiveDay: 1,
|
||||
BestPostTime: 1,
|
||||
Date: dateInt,
|
||||
ConfirmType: confirmType,
|
||||
}
|
||||
|
||||
importResp, err := service.CastProvider.ImportWorkAnalysis(newCtx, importReq)
|
||||
if err != nil {
|
||||
zap.L().Error("ImportWorkAnalysisBatch ImportWorkAnalysis", zap.Error(err), zap.String("subNum", subNum))
|
||||
_ = excelData.SetCellValue("Sheet1", cellL, fmt.Sprintf("导入失败:%s", err.Error()))
|
||||
continue
|
||||
}
|
||||
|
||||
// 导入成功,将返回的 UUID 写入 L 列
|
||||
_ = excelData.SetCellValue("Sheet1", cellL, importResp.Uuid)
|
||||
successCount++
|
||||
}
|
||||
|
||||
// 将修改后的 Excel 写入 buffer 并返回给客户端下载
|
||||
buf, err := excelData.WriteToBuffer()
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
utils.ResponseXls(ctx, bytes.NewReader(buf.Bytes()), fmt.Sprintf("数据分析导入结果_%d成功", successCount))
|
||||
}
|
||||
|
||||
// UpdateWorkAnalysis 更新作品分析
|
||||
func UpdateWorkAnalysis(ctx *gin.Context) {
|
||||
var req *cast.UpdateWorkAnalysisReq
|
||||
@ -565,14 +869,14 @@ func ArtistMetricsSeries(ctx *gin.Context) {
|
||||
|
||||
var subInfoResp *accountFiee.UserInfoResponse
|
||||
var subInfoErr error
|
||||
var dataListResp *cast.ArtistDataListResp
|
||||
var workStatsResp *cast.GetArtistWorkStatsResp
|
||||
var metricsResp *cast.ArtistMetricsSeriesResp
|
||||
var dataListErr, metricsErr error
|
||||
var workStatsErr, metricsErr error
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(3)
|
||||
wg.Add(2)
|
||||
|
||||
// 并行调用 SubNumGetInfo、ArtistDataList、ArtistMetricsSeries
|
||||
// 并行调用 SubNumGetInfo、ArtistMetricsSeries
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
subInfoResp, subInfoErr = service.AccountFieeProvider.SubNumGetInfo(context.Background(), &accountFiee.SubNumGetInfoRequest{
|
||||
@ -581,15 +885,6 @@ func ArtistMetricsSeries(ctx *gin.Context) {
|
||||
})
|
||||
}()
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
dataListResp, dataListErr = service.CastProvider.ArtistDataList(context.Background(), &cast.ArtistDataListReq{
|
||||
SubNum: subNum,
|
||||
Page: 1,
|
||||
PageSize: 1,
|
||||
})
|
||||
}()
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
metricsResp, metricsErr = service.CastProvider.ArtistMetricsSeries(context.Background(), req)
|
||||
@ -607,13 +902,30 @@ func ArtistMetricsSeries(ctx *gin.Context) {
|
||||
}
|
||||
req.ArtistUUID = fmt.Sprint(subInfoResp.Id)
|
||||
|
||||
// 将 ArtistMetricsSeriesReq 中 int 类型日期(YYYYMMDD)格式化为时间字符串,作为快照截止时间
|
||||
statusUpdateTime := ""
|
||||
if req.Date > 0 {
|
||||
parsedDate, parseErr := time.Parse("20060102", strconv.Itoa(int(req.Date)))
|
||||
if parseErr == nil {
|
||||
statusUpdateTime = parsedDate.Add(17 * time.Hour).Format("2006-01-02 15:04:05")
|
||||
}
|
||||
}
|
||||
|
||||
newCtx := NewCtxWithUserInfo(ctx)
|
||||
workStatsResp, workStatsErr = service.CastProvider.GetArtistWorkStats(newCtx, &cast.GetArtistWorkStatsReq{
|
||||
ArtistUuid: req.ArtistUUID,
|
||||
StatusUpdateTime: statusUpdateTime,
|
||||
})
|
||||
|
||||
var accountConsumptionNumber int32
|
||||
var videoCount int64
|
||||
var imageCount int64
|
||||
if dataListErr == nil && dataListResp != nil && len(dataListResp.Data) > 0 && dataListResp.Data[0] != nil {
|
||||
accountConsumptionNumber = dataListResp.Data[0].AccountConsumptionNumber
|
||||
videoCount = dataListResp.Data[0].VideoCount
|
||||
imageCount = dataListResp.Data[0].ImageCount
|
||||
if workStatsErr == nil && workStatsResp != nil {
|
||||
accountConsumptionNumber = int32(workStatsResp.AccountCount)
|
||||
videoCount = workStatsResp.VideoCount
|
||||
imageCount = workStatsResp.ImageCount
|
||||
} else if workStatsErr != nil {
|
||||
zap.L().Warn("GetArtistWorkStats failed", zap.Error(workStatsErr), zap.String("artistUUID", req.ArtistUUID), zap.String("statusUpdateTime", statusUpdateTime))
|
||||
}
|
||||
|
||||
if metricsErr != nil {
|
||||
@ -813,6 +1125,24 @@ func UpdateWorkAnalysisApprovalID(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateWorkAnalysisPdfUrl 更新作品分析PDF链接
|
||||
func UpdateWorkAnalysisPdfUrl(ctx *gin.Context) {
|
||||
var req *cast.UpdateWorkAnalysisReq
|
||||
var err error
|
||||
if err = ctx.ShouldBind(&req); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
newCtx := NewCtxWithUserInfo(ctx)
|
||||
_, err = service.CastProvider.UpdateWorkAnalysisPdfUrl(newCtx, req)
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
service.Success(ctx, nil)
|
||||
return
|
||||
}
|
||||
|
||||
type CheckBundleBalanceReq struct {
|
||||
ArtistID string `protobuf:"bytes,4,opt,name=artistID,proto3" json:"artistID"` // 艺人ID
|
||||
BalanceType modelCast.BalanceTypeEnum `json:"balanceType"` // 套餐类型
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cast
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
@ -17,6 +18,7 @@ import (
|
||||
"fonchain-fiee/pkg/service/upload"
|
||||
"fonchain-fiee/pkg/utils"
|
||||
"fonchain-fiee/pkg/utils/stime"
|
||||
"math/rand"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -1489,6 +1491,141 @@ func ImportPdfBatch(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// ImportCompetitiveReportHistoryBatch 通过 Excel 批量刷写竞品报告历史数据
|
||||
// Excel 列顺序:ReportUuid | Title(可为空)| SubmitTime | ConfirmType | 结果(空,由接口写入)
|
||||
func ImportCompetitiveReportHistoryBatch(ctx *gin.Context) {
|
||||
excelFile, err := ctx.FormFile("file")
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
loginInfo := login.GetUserInfoFromC(ctx)
|
||||
lockKey := fmt.Sprintf("import_competitive_report_history_batch:%d", loginInfo.ID)
|
||||
replay := cache.RedisClient.SetNX(lockKey, time.Now().Format("20060102150405"), 5*time.Minute)
|
||||
if !replay.Val() {
|
||||
service.Error(ctx, errors.New("有导入任务正在进行,请稍后再试"))
|
||||
return
|
||||
}
|
||||
defer cache.RedisClient.Del(lockKey)
|
||||
|
||||
tempDir := "./runtime/report_pdf"
|
||||
_, err = utils.CheckDirPath(tempDir, true)
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
fileName := fmt.Sprintf("%d_competitive_report_history.xlsx", time.Now().UnixMicro())
|
||||
excelPath := filepath.Join(tempDir, fileName)
|
||||
if err = ctx.SaveUploadedFile(excelFile, excelPath); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
excelData, err := excelize.OpenFile(excelPath)
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
defer excelData.Close()
|
||||
|
||||
rows, err := excelData.GetRows("Sheet1")
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
newCtx := NewCtxWithUserInfo(ctx)
|
||||
|
||||
// 写入表头(第 4 列 ConfirmType,第 5 列 结果)
|
||||
_ = excelData.SetCellValue("Sheet1", "D1", "ConfirmType")
|
||||
_ = excelData.SetCellValue("Sheet1", "E1", "结果")
|
||||
|
||||
successCount := 0
|
||||
|
||||
for line, row := range rows {
|
||||
if line == 0 {
|
||||
continue // 跳过表头
|
||||
}
|
||||
if len(row) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// Excel 行号(1-based),line=1 → 行号 2
|
||||
cellE := fmt.Sprintf("E%d", line+1)
|
||||
|
||||
// 第一列:ReportUuid
|
||||
reportUuid := ""
|
||||
if len(row) > 0 {
|
||||
reportUuid = utils.CleanString(row[0])
|
||||
}
|
||||
if reportUuid == "" {
|
||||
_ = excelData.SetCellValue("Sheet1", cellE, "ReportUuid 不能为空")
|
||||
continue
|
||||
}
|
||||
|
||||
// 第二列:Title(可为空)
|
||||
title := ""
|
||||
if len(row) > 1 {
|
||||
title = utils.CleanString(row[1])
|
||||
}
|
||||
|
||||
// 第三列:SubmitTime
|
||||
submitTime := ""
|
||||
if len(row) > 2 {
|
||||
submitTime = row[2]
|
||||
}
|
||||
|
||||
// 第四列:ConfirmType(1 艺人确认,2 系统自动确认)
|
||||
var confirmType int32
|
||||
if len(row) > 3 && utils.CleanString(row[3]) != "" {
|
||||
v, _ := strconv.ParseInt(utils.CleanString(row[3]), 10, 32)
|
||||
confirmType = int32(v)
|
||||
}
|
||||
|
||||
// 将 submitTime(YYYY-MM-DD 00:00:00)加随机 9~15 小时、0~59 分钟、0~59 秒,使提交时间更真实
|
||||
if submitTime != "" {
|
||||
if parsedTime, parseErr := time.Parse("2006-01-02 15:04:05", submitTime); parseErr == nil {
|
||||
randomDuration := time.Duration(rand.Intn(7)+9)*time.Hour +
|
||||
time.Duration(rand.Intn(60))*time.Minute +
|
||||
time.Duration(rand.Intn(60))*time.Second
|
||||
submitTime = parsedTime.Add(randomDuration).Format("2006-01-02 15:04:05")
|
||||
}
|
||||
}
|
||||
|
||||
// 构造请求
|
||||
importReq := &cast.ImportCompetitiveReportHistoryReq{
|
||||
ReportUuid: reportUuid,
|
||||
SubmitTime: submitTime,
|
||||
ConfirmType: confirmType,
|
||||
}
|
||||
if title != "" {
|
||||
importReq.Title = title
|
||||
}
|
||||
|
||||
importResp, err := service.CastProvider.ImportCompetitiveReportHistory(newCtx, importReq)
|
||||
if err != nil {
|
||||
zap.L().Error("ImportCompetitiveReportHistoryBatch ImportCompetitiveReportHistory",
|
||||
zap.Error(err), zap.String("reportUuid", reportUuid))
|
||||
_ = excelData.SetCellValue("Sheet1", cellE, fmt.Sprintf("导入失败:%s", err.Error()))
|
||||
continue
|
||||
}
|
||||
|
||||
// 导入成功,将返回的 report_uuid 写入第 5 列
|
||||
_ = excelData.SetCellValue("Sheet1", cellE, importResp.ReportUuid)
|
||||
successCount++
|
||||
}
|
||||
|
||||
// 将修改后的 Excel 写入 buffer 并返回给客户端下载
|
||||
buf, err := excelData.WriteToBuffer()
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
utils.ResponseXls(ctx, bytes.NewReader(buf.Bytes()), fmt.Sprintf("竞品报告历史导入结果_%d成功", successCount))
|
||||
}
|
||||
|
||||
// truncateCompetitorReportData 截断竞品报告数据中超长的字段
|
||||
// 字段长度要求参考 AI 生成竞品报告的限制
|
||||
func truncateCompetitorReportData(data utils.CompetitorReportData) utils.CompetitorReportData {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user