Compare commits
21 Commits
d7b56b8ea3
...
6d3056d990
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d3056d990 | ||
|
|
65ce2132e7 | ||
|
|
2d93ad6df1 | ||
|
|
979e050108 | ||
|
|
111eeeb56f | ||
|
|
b56763ed03 | ||
|
|
b922b4bd88 | ||
|
|
77248eb885 | ||
|
|
1791397782 | ||
|
|
37771a9b5a | ||
|
|
8dbe5744e5 | ||
|
|
d526db4c31 | ||
|
|
1608207281 | ||
|
|
762c9640de | ||
|
|
addd492875 | ||
|
|
73b183a1e4 | ||
|
|
64e52b5ec4 | ||
|
|
ed40212dec | ||
|
|
25c89523cc | ||
|
|
f6a7e0ad8c | ||
|
|
37246ed813 |
14449
api/cast/cast.pb.go
14449
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.
|
// 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.8
|
||||||
// - protoc v3.21.1
|
// - protoc v6.32.0--rc2
|
||||||
// source: pb/fiee/cast.proto
|
// source: pb/fiee/cast.proto
|
||||||
|
|
||||||
package cast
|
package cast
|
||||||
@ -136,6 +136,8 @@ type CastClient interface {
|
|||||||
DeleteCompetitiveReport(ctx context.Context, in *DeleteCompetitiveReportReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
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)
|
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)
|
CountCompetitiveReportByWorkUuids(ctx context.Context, in *CountCompetitiveReportByWorkUuidsReq, opts ...grpc_go.CallOption) (*CountCompetitiveReportByWorkUuidsResp, common.ErrorWithAttachment)
|
||||||
|
// 发布记录相关接口
|
||||||
|
ListPublishLog(ctx context.Context, in *ListPublishLogReq, opts ...grpc_go.CallOption) (*ListPublishLogResp, common.ErrorWithAttachment)
|
||||||
}
|
}
|
||||||
|
|
||||||
type castClient struct {
|
type castClient struct {
|
||||||
@ -235,6 +237,7 @@ type CastClientImpl struct {
|
|||||||
DeleteCompetitiveReport func(ctx context.Context, in *DeleteCompetitiveReportReq) (*emptypb.Empty, error)
|
DeleteCompetitiveReport func(ctx context.Context, in *DeleteCompetitiveReportReq) (*emptypb.Empty, error)
|
||||||
UpdateCompetitiveReportApprovalID func(ctx context.Context, in *UpdateCompetitiveReportApprovalIDReq) (*emptypb.Empty, error)
|
UpdateCompetitiveReportApprovalID func(ctx context.Context, in *UpdateCompetitiveReportApprovalIDReq) (*emptypb.Empty, error)
|
||||||
CountCompetitiveReportByWorkUuids func(ctx context.Context, in *CountCompetitiveReportByWorkUuidsReq) (*CountCompetitiveReportByWorkUuidsResp, error)
|
CountCompetitiveReportByWorkUuids func(ctx context.Context, in *CountCompetitiveReportByWorkUuidsReq) (*CountCompetitiveReportByWorkUuidsResp, error)
|
||||||
|
ListPublishLog func(ctx context.Context, in *ListPublishLogReq) (*ListPublishLogResp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CastClientImpl) GetDubboStub(cc *triple.TripleConn) CastClient {
|
func (c *CastClientImpl) GetDubboStub(cc *triple.TripleConn) CastClient {
|
||||||
@ -801,6 +804,12 @@ func (c *castClient) CountCompetitiveReportByWorkUuids(ctx context.Context, in *
|
|||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CountCompetitiveReportByWorkUuids", in, out)
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CountCompetitiveReportByWorkUuids", 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)
|
||||||
|
}
|
||||||
|
|
||||||
// CastServer is the server API for Cast service.
|
// CastServer is the server API for Cast service.
|
||||||
// All implementations must embed UnimplementedCastServer
|
// All implementations must embed UnimplementedCastServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
@ -912,6 +921,8 @@ type CastServer interface {
|
|||||||
DeleteCompetitiveReport(context.Context, *DeleteCompetitiveReportReq) (*emptypb.Empty, error)
|
DeleteCompetitiveReport(context.Context, *DeleteCompetitiveReportReq) (*emptypb.Empty, error)
|
||||||
UpdateCompetitiveReportApprovalID(context.Context, *UpdateCompetitiveReportApprovalIDReq) (*emptypb.Empty, error)
|
UpdateCompetitiveReportApprovalID(context.Context, *UpdateCompetitiveReportApprovalIDReq) (*emptypb.Empty, error)
|
||||||
CountCompetitiveReportByWorkUuids(context.Context, *CountCompetitiveReportByWorkUuidsReq) (*CountCompetitiveReportByWorkUuidsResp, error)
|
CountCompetitiveReportByWorkUuids(context.Context, *CountCompetitiveReportByWorkUuidsReq) (*CountCompetitiveReportByWorkUuidsResp, error)
|
||||||
|
// 发布记录相关接口
|
||||||
|
ListPublishLog(context.Context, *ListPublishLogReq) (*ListPublishLogResp, error)
|
||||||
mustEmbedUnimplementedCastServer()
|
mustEmbedUnimplementedCastServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1196,6 +1207,9 @@ func (UnimplementedCastServer) UpdateCompetitiveReportApprovalID(context.Context
|
|||||||
func (UnimplementedCastServer) CountCompetitiveReportByWorkUuids(context.Context, *CountCompetitiveReportByWorkUuidsReq) (*CountCompetitiveReportByWorkUuidsResp, error) {
|
func (UnimplementedCastServer) CountCompetitiveReportByWorkUuids(context.Context, *CountCompetitiveReportByWorkUuidsReq) (*CountCompetitiveReportByWorkUuidsResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CountCompetitiveReportByWorkUuids not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method CountCompetitiveReportByWorkUuids not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedCastServer) ListPublishLog(context.Context, *ListPublishLogReq) (*ListPublishLogResp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method ListPublishLog not implemented")
|
||||||
|
}
|
||||||
func (s *UnimplementedCastServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
func (s *UnimplementedCastServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||||
s.proxyImpl = impl
|
s.proxyImpl = impl
|
||||||
}
|
}
|
||||||
@ -3892,6 +3906,35 @@ func _Cast_CountCompetitiveReportByWorkUuids_Handler(srv interface{}, ctx contex
|
|||||||
return interceptor(ctx, in, info, handler)
|
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 {
|
||||||
|
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("ListPublishLog", 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.
|
// Cast_ServiceDesc is the grpc_go.ServiceDesc for Cast 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)
|
||||||
@ -4267,6 +4310,10 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
MethodName: "CountCompetitiveReportByWorkUuids",
|
MethodName: "CountCompetitiveReportByWorkUuids",
|
||||||
Handler: _Cast_CountCompetitiveReportByWorkUuids_Handler,
|
Handler: _Cast_CountCompetitiveReportByWorkUuids_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ListPublishLog",
|
||||||
|
Handler: _Cast_ListPublishLog_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc_go.StreamDesc{},
|
Streams: []grpc_go.StreamDesc{},
|
||||||
Metadata: "pb/fiee/cast.proto",
|
Metadata: "pb/fiee/cast.proto",
|
||||||
|
|||||||
@ -38,4 +38,11 @@ TelNum = "18021272627"
|
|||||||
Password = "Gy.123456"
|
Password = "Gy.123456"
|
||||||
|
|
||||||
[service]
|
[service]
|
||||||
IsHTTPS = false
|
IsHTTPS = false
|
||||||
|
|
||||||
|
[zapLog]
|
||||||
|
level = "info"
|
||||||
|
filename = "logs/fiee_zap.log"
|
||||||
|
maxsize = 5
|
||||||
|
maxage = 30
|
||||||
|
maxbackups = 30
|
||||||
|
|||||||
@ -43,6 +43,6 @@ Webhookkey = "whsec_uOQpG6IZTqtfLuePIDtfLCGJPqedSCCN"
|
|||||||
[zapLog]
|
[zapLog]
|
||||||
level = "info"
|
level = "info"
|
||||||
filename = "logs/fiee_zap.log"
|
filename = "logs/fiee_zap.log"
|
||||||
max_size = 5
|
maxsize = 5
|
||||||
max_age = 30
|
maxage = 30
|
||||||
max_backups = 30
|
maxbackups = 30
|
||||||
|
|||||||
@ -43,6 +43,6 @@ Webhookkey = "whsec_Mol32WD1KcKHUdYsSwap0LR03q2g9qNY"
|
|||||||
[zapLog]
|
[zapLog]
|
||||||
level = "info"
|
level = "info"
|
||||||
filename = "logs/fiee_zap.log"
|
filename = "logs/fiee_zap.log"
|
||||||
max_size = 5
|
maxsize = 5
|
||||||
max_age = 30
|
maxage = 30
|
||||||
max_backups = 30
|
maxbackups = 30
|
||||||
|
|||||||
@ -44,6 +44,6 @@ Webhookkey = "whsec_uOQpG6IZTqtfLuePIDtfLCGJPqedSCCN"
|
|||||||
[zapLog]
|
[zapLog]
|
||||||
level = "info"
|
level = "info"
|
||||||
filename = "logs/fiee_zap.log"
|
filename = "logs/fiee_zap.log"
|
||||||
max_size = 5
|
maxsize = 5
|
||||||
max_age = 30
|
maxage = 30
|
||||||
max_backups = 30
|
maxbackups = 30
|
||||||
|
|||||||
@ -31,7 +31,7 @@ func InitTasks() error {
|
|||||||
err := cm.AddTask("refreshWorkApprovalStatus", "0 */5 * * * *", RefreshApprovalStatusTask)
|
err := cm.AddTask("refreshWorkApprovalStatus", "0 */5 * * * *", RefreshApprovalStatusTask)
|
||||||
err = cm.AddTask("artistAutoConfirm", "0 */1 * * * *", ArtistAutoConfirmTask)
|
err = cm.AddTask("artistAutoConfirm", "0 */1 * * * *", ArtistAutoConfirmTask)
|
||||||
err = cm.AddTask("refreshPublishStatus", "0 */5 * * * *", PublishTask)
|
err = cm.AddTask("refreshPublishStatus", "0 */5 * * * *", PublishTask)
|
||||||
err = cm.AddTask("scheduledPublish", "0 */30 * * * *", ScheduledPublishTask)
|
err = cm.AddTask("scheduledPublish", "0 */1 * * * *", ScheduledPublishTask) //FIXME
|
||||||
|
|
||||||
err = cm.AddTask("artistAutoConfirmAnalysis", "0 */1 * * * *", ArtistAutoConfirmAnalysisTask)
|
err = cm.AddTask("artistAutoConfirmAnalysis", "0 */1 * * * *", ArtistAutoConfirmAnalysisTask)
|
||||||
err = cm.AddTask("refreshWorkAnalysisApprovalStatus", "0 */5 * * * *", RefreshWorkAnalysisApprovalStatusTask)
|
err = cm.AddTask("refreshWorkAnalysisApprovalStatus", "0 */5 * * * *", RefreshWorkAnalysisApprovalStatusTask)
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package cast
|
package cast
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"fonchain-fiee/api/cast"
|
"fonchain-fiee/api/cast"
|
||||||
modelCast "fonchain-fiee/pkg/model/cast"
|
modelCast "fonchain-fiee/pkg/model/cast"
|
||||||
"strings"
|
"strings"
|
||||||
@ -102,3 +103,44 @@ func (w *Work) ExportExcelWorkList(data []*cast.WorkListResp_Info) (*excelize.Fi
|
|||||||
|
|
||||||
return f, nil
|
return f, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *Work) ExportPublishLogList(data []*cast.PublishLogInfo, savePath string) error {
|
||||||
|
f := excelize.NewFile()
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
sheetName := "Sheet1"
|
||||||
|
f.SetSheetName("Sheet1", sheetName)
|
||||||
|
|
||||||
|
headers := []string{
|
||||||
|
"状态", "失败原因", "提交发布时间", "发布平台", "发布方式", "作品类型", "作品标题", "艺人", "用户编号",
|
||||||
|
}
|
||||||
|
for col, h := range headers {
|
||||||
|
cell, _ := excelize.CoordinatesToCellName(col+1, 1)
|
||||||
|
f.SetCellValue(sheetName, cell, h)
|
||||||
|
}
|
||||||
|
|
||||||
|
for rowIndex, info := range data {
|
||||||
|
row := rowIndex + 2
|
||||||
|
platformName := modelCast.PlatformNameKv[info.PlatformID]
|
||||||
|
if platformName == "" {
|
||||||
|
platformName = fmt.Sprintf("%d", info.PlatformID)
|
||||||
|
}
|
||||||
|
values := []interface{}{
|
||||||
|
modelCast.PublishStatusMM[int(info.PublishMediaStatus)],
|
||||||
|
info.Detail,
|
||||||
|
info.CreatedAt,
|
||||||
|
modelCast.PlatformNameKv[info.PlatformID],
|
||||||
|
modelCast.PublishSourceMM[int(info.PublishSource)],
|
||||||
|
modelCast.WorkCategoryMM[int(info.WorkCategory)],
|
||||||
|
info.Title,
|
||||||
|
info.ArtistName,
|
||||||
|
info.ArtistSubNum,
|
||||||
|
}
|
||||||
|
for col, v := range values {
|
||||||
|
cell, _ := excelize.CoordinatesToCellName(col+1, row)
|
||||||
|
f.SetCellValue(sheetName, cell, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return f.SaveAs(savePath)
|
||||||
|
}
|
||||||
|
|||||||
@ -32,6 +32,18 @@ var WorkCategoryMM = map[int]string{
|
|||||||
1: "图文",
|
1: "图文",
|
||||||
2: "视频",
|
2: "视频",
|
||||||
}
|
}
|
||||||
|
var PublishSourceMM = map[int]string{
|
||||||
|
1: "手动发布",
|
||||||
|
2: "定时任务",
|
||||||
|
3: "手动发布",
|
||||||
|
}
|
||||||
|
|
||||||
|
var PublishStatusMM = map[int]string{
|
||||||
|
1: "进行中",
|
||||||
|
2: "发布成功",
|
||||||
|
3: "发布失败",
|
||||||
|
4: "发布异常",
|
||||||
|
}
|
||||||
|
|
||||||
var WorkCostTypeMM = map[int]string{
|
var WorkCostTypeMM = map[int]string{
|
||||||
1: "套餐",
|
1: "套餐",
|
||||||
|
|||||||
@ -50,11 +50,12 @@ func MediaRouter(r *gin.RouterGroup) {
|
|||||||
work.POST("import-batch", serviceCast.ImportWorkBatch)
|
work.POST("import-batch", serviceCast.ImportWorkBatch)
|
||||||
work.POST("list-published", serviceCast.WorkListPublished)
|
work.POST("list-published", serviceCast.WorkListPublished)
|
||||||
work.POST("update-work-script", serviceCast.UpdateWorkScript)
|
work.POST("update-work-script", serviceCast.UpdateWorkScript)
|
||||||
|
work.POST("publish-log-list", serviceCast.PublishLogList)
|
||||||
|
work.Any("publish-log-list-export", serviceCast.PublishLogListExport)
|
||||||
}
|
}
|
||||||
|
|
||||||
workNoAuth := noAuth.Group("work")
|
workNoAuth := noAuth.Group("work")
|
||||||
{
|
{
|
||||||
|
|
||||||
workNoAuth.POST("cron-republish", serviceCast.CronRePublish)
|
workNoAuth.POST("cron-republish", serviceCast.CronRePublish)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
119
pkg/service/cast/publish_log.go
Normal file
119
pkg/service/cast/publish_log.go
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
package cast
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"fonchain-fiee/api/cast"
|
||||||
|
"fonchain-fiee/pkg/cache"
|
||||||
|
logicCast "fonchain-fiee/pkg/logic/cast"
|
||||||
|
"fonchain-fiee/pkg/model/login"
|
||||||
|
"fonchain-fiee/pkg/service"
|
||||||
|
"fonchain-fiee/pkg/utils"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PublishLogList 查询发布记录列表
|
||||||
|
func PublishLogList(ctx *gin.Context) {
|
||||||
|
var req cast.ListPublishLogReq
|
||||||
|
if err := ctx.ShouldBind(&req); err != nil {
|
||||||
|
service.Error(ctx, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := service.CastProvider.ListPublishLog(context.Background(), &req)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(ctx, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
service.Success(ctx, resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PublishLogListExport 导出发布记录列表 Excel
|
||||||
|
func PublishLogListExport(ctx *gin.Context) {
|
||||||
|
var req cast.ListPublishLogReq
|
||||||
|
if err := ctx.ShouldBind(&req); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
loginInfo := login.GetUserInfoFromC(ctx)
|
||||||
|
newCtx := NewCtxWithUserInfo(ctx)
|
||||||
|
|
||||||
|
lockKey := "PublishLogListExport" + fmt.Sprint(loginInfo.ID)
|
||||||
|
replay := cache.RedisClient.SetNX(lockKey, time.Now().Unix(), time.Minute*30)
|
||||||
|
if !replay.Val() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer cache.RedisClient.Del(lockKey)
|
||||||
|
|
||||||
|
const batchSize = 5000
|
||||||
|
var allData []*cast.PublishLogInfo
|
||||||
|
|
||||||
|
page := int32(1)
|
||||||
|
if req.Page > 0 {
|
||||||
|
page = req.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
originalPageSize := req.PageSize
|
||||||
|
req.PageSize = batchSize
|
||||||
|
|
||||||
|
zap.L().Info("开始分批导出发布记录列表", zap.Int32("batchSize", batchSize))
|
||||||
|
|
||||||
|
for {
|
||||||
|
req.Page = page
|
||||||
|
zap.L().Info("获取第 N 页数据", zap.Int32("page", page), zap.Int32("pageSize", req.PageSize))
|
||||||
|
|
||||||
|
resp, err := service.CastProvider.ListPublishLog(newCtx, &req)
|
||||||
|
if err != nil {
|
||||||
|
zap.L().Error("获取发布记录失败", zap.Error(err), zap.Int32("page", page))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if resp == nil || len(resp.Data) == 0 {
|
||||||
|
zap.L().Info("没有更多数据", zap.Int32("page", page))
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
allData = append(allData, resp.Data...)
|
||||||
|
zap.L().Info("获取数据成功",
|
||||||
|
zap.Int32("page", page),
|
||||||
|
zap.Int("本批次数量", len(resp.Data)),
|
||||||
|
zap.Int("累计总数", len(allData)))
|
||||||
|
|
||||||
|
if len(resp.Data) < batchSize {
|
||||||
|
zap.L().Info("已到最后一页", zap.Int32("page", page))
|
||||||
|
break
|
||||||
|
}
|
||||||
|
page++
|
||||||
|
}
|
||||||
|
|
||||||
|
req.PageSize = originalPageSize
|
||||||
|
zap.L().Info("数据获取完成,开始生成Excel", zap.Int("总数据量", len(allData)))
|
||||||
|
|
||||||
|
if len(allData) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fileName := fmt.Sprintf("发布记录_%s.xlsx", time.Now().Format("20060102150405"))
|
||||||
|
filePath := fmt.Sprintf("./runtime/%d/%s", loginInfo.ID, fileName)
|
||||||
|
utils.CheckDirPath("./runtime/"+fmt.Sprint(loginInfo.ID), true)
|
||||||
|
|
||||||
|
var logicWork = new(logicCast.Work)
|
||||||
|
if err := logicWork.ExportPublishLogList(allData, filePath); err != nil {
|
||||||
|
zap.L().Error("生成Excel失败", zap.Error(err))
|
||||||
|
service.Error(ctx, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
scheme := "http"
|
||||||
|
if ctx.GetHeader("X-Forwarded-Proto") == "https" {
|
||||||
|
scheme = "https"
|
||||||
|
}
|
||||||
|
exportUrl := fmt.Sprintf("%s://%s/api/fiee/static/%s", scheme, ctx.Request.Host, strings.Replace(filePath, "./runtime/", "", 1))
|
||||||
|
|
||||||
|
zap.L().Info("Excel导出成功", zap.String("文件名", fileName), zap.Int("记录数", len(allData)))
|
||||||
|
service.Success(ctx, gin.H{"url": exportUrl})
|
||||||
|
}
|
||||||
@ -189,6 +189,14 @@ func Test(ctx *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if action == "addDecodoProxies" {
|
||||||
|
service.CastProvider.Tools(context.Background(), &cast.ToolsReq{Action: action, CfgLinks: []string{
|
||||||
|
"http://spd7b09ho0:sqx_1MlQ1rN5gfm2Dx@isp.decodo.com:10001",
|
||||||
|
"http://spd7b09ho0:sqx_1MlQ1rN5gfm2Dx@isp.decodo.com:10002",
|
||||||
|
"http://spd7b09ho0:sqx_1MlQ1rN5gfm2Dx@isp.decodo.com:10003",
|
||||||
|
}})
|
||||||
|
}
|
||||||
|
|
||||||
service.Success(ctx, "unknow")
|
service.Success(ctx, "unknow")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -735,7 +735,7 @@ func PostAS(ctx context.Context, workUuid string, publishSource cast.PublishSour
|
|||||||
return nil
|
return nil
|
||||||
//return errors.New("作品无发布平台")
|
//return errors.New("作品无发布平台")
|
||||||
}
|
}
|
||||||
zap.L().Info("post 2", zap.Any("workUuid", workUuid))
|
zap.L().Info("post 2", zap.Any("workUuid", workUuid), zap.Any("needPlatformIDs", needPlatformIDs))
|
||||||
var mediaUrls []string
|
var mediaUrls []string
|
||||||
var isVideo bool
|
var isVideo bool
|
||||||
//var urlResp *UploadMediaResponse
|
//var urlResp *UploadMediaResponse
|
||||||
@ -893,11 +893,12 @@ func PostAS(ctx context.Context, workUuid string, publishSource cast.PublishSour
|
|||||||
}
|
}
|
||||||
if _err != nil {
|
if _err != nil {
|
||||||
_, errS := service.CastProvider.UpdateWorkPublishLog(context.Background(), &cast.UpdateWorkPublishLogReq{
|
_, errS := service.CastProvider.UpdateWorkPublishLog(context.Background(), &cast.UpdateWorkPublishLogReq{
|
||||||
WorkUuid: workUuid,
|
WorkUuid: workUuid,
|
||||||
PlatformID: cast.PlatformIDENUM(platformID),
|
PlatformID: cast.PlatformIDENUM(platformID),
|
||||||
Action: "post",
|
Action: "post",
|
||||||
Detail: _err.Error(),
|
Detail: _err.Error(),
|
||||||
PublishSource: publishSource,
|
PublishSource: publishSource,
|
||||||
|
PublishMediaStatus: cast.PublishStatusENUM_PublishMediaStatus_EXCEPTION,
|
||||||
})
|
})
|
||||||
if errS != nil {
|
if errS != nil {
|
||||||
zap.L().Error("PostAs UpdateWorkPublishLog err", zap.Error(errS), zap.Any("WorkUuid", workDetail.WorkUuid))
|
zap.L().Error("PostAs UpdateWorkPublishLog err", zap.Error(errS), zap.Any("WorkUuid", workDetail.WorkUuid))
|
||||||
@ -978,12 +979,22 @@ func PostAS(ctx context.Context, workUuid string, publishSource cast.PublishSour
|
|||||||
Remark: string(postData),
|
Remark: string(postData),
|
||||||
PublishSource: publishSource,
|
PublishSource: publishSource,
|
||||||
})
|
})
|
||||||
|
_, _ = service.CastProvider.UpdateWorkPublishLog(context.Background(), &cast.UpdateWorkPublishLogReq{
|
||||||
|
PlatformID: cast.PlatformIDENUM(platformID),
|
||||||
|
WorkUuid: workUuid,
|
||||||
|
Action: "post",
|
||||||
|
Detail: string(postData),
|
||||||
|
PublishSource: publishSource,
|
||||||
|
PublishMediaStatus: publishStatus,
|
||||||
|
PublishMediaID: postResp.Posts[0].Id,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
zap.L().Info("post 10", zap.Any("workUuid", workUuid), zap.Any("platformID", platformID))
|
zap.L().Info("post 10", zap.Any("workUuid", workUuid), zap.Any("platformID", platformID))
|
||||||
_, err = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
_, err = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
zap.L().Error("Publish UpdateWorkPlatformInfo failed", zap.String("workUuid", workUuid), zap.Error(err))
|
zap.L().Error("Publish UpdateWorkPlatformInfo failed", zap.String("workUuid", workUuid), zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
zap.L().Info("Publish Ayrshare PostResp", zap.Any("postResp", postResp))
|
zap.L().Info("Publish Ayrshare PostResp", zap.Any("postResp", postResp))
|
||||||
}
|
}
|
||||||
zap.L().Info("post 5.1", zap.Any("workUuid", workUuid))
|
zap.L().Info("post 5.1", zap.Any("workUuid", workUuid))
|
||||||
@ -1014,6 +1025,7 @@ func RePublish(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func republishCore(gCtx *gin.Context, newCtx context.Context, req *cast.RePublishReq) error {
|
func republishCore(gCtx *gin.Context, newCtx context.Context, req *cast.RePublishReq) error {
|
||||||
|
zap.L().Info("republishCore", zap.Any("req", req))
|
||||||
var resp *cast.RePublishResp
|
var resp *cast.RePublishResp
|
||||||
var err error
|
var err error
|
||||||
if len(req.PlatformIDs) == 0 && len(req.MediaAccountUuids) == 0 {
|
if len(req.PlatformIDs) == 0 && len(req.MediaAccountUuids) == 0 {
|
||||||
@ -1973,6 +1985,15 @@ func RefreshPublish() error {
|
|||||||
PlatformUuid: platformInfo.PlatformUuid,
|
PlatformUuid: platformInfo.PlatformUuid,
|
||||||
})
|
})
|
||||||
_, _ = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
_, _ = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
||||||
|
go func(work *cast.RefreshWorkListResp_Info, platform *cast.RefreshWorkListResp_Info_PlatformInfo, postResult string) {
|
||||||
|
_, _ = service.CastProvider.UpdateWorkPublishLog(context.Background(), &cast.UpdateWorkPublishLogReq{
|
||||||
|
PlatformID: platform.PlatformID,
|
||||||
|
WorkUuid: work.WorkUuid,
|
||||||
|
Action: "getPost",
|
||||||
|
Detail: postResult,
|
||||||
|
PublishMediaID: platform.PublishMediaID,
|
||||||
|
})
|
||||||
|
}(workInfo, platformInfo, string(dmData))
|
||||||
} else {
|
} else {
|
||||||
// 未发布的先不管,不能标记失败
|
// 未发布的先不管,不能标记失败
|
||||||
/*infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
/*infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
||||||
@ -1995,15 +2016,16 @@ func RefreshPublish() error {
|
|||||||
ProfileKey: workInfo.ProfileKey,
|
ProfileKey: workInfo.ProfileKey,
|
||||||
})
|
})
|
||||||
|
|
||||||
go func() {
|
go func(work *cast.RefreshWorkListResp_Info, platform *cast.RefreshWorkListResp_Info_PlatformInfo, post *aryshare.GetPostResponse) {
|
||||||
postBytes, _ := json.Marshal(postResp)
|
postBytes, _ := json.Marshal(post)
|
||||||
_, _ = service.CastProvider.UpdateWorkPublishLog(context.Background(), &cast.UpdateWorkPublishLogReq{
|
_, _ = service.CastProvider.UpdateWorkPublishLog(context.Background(), &cast.UpdateWorkPublishLogReq{
|
||||||
PlatformID: platformInfo.PlatformID,
|
PlatformID: platform.PlatformID,
|
||||||
WorkUuid: workInfo.WorkUuid,
|
WorkUuid: work.WorkUuid,
|
||||||
Action: "getPost",
|
Action: "getPost",
|
||||||
Detail: string(postBytes),
|
Detail: string(postBytes),
|
||||||
|
PublishMediaID: platform.PublishMediaID,
|
||||||
})
|
})
|
||||||
}()
|
}(workInfo, platformInfo, postResp)
|
||||||
|
|
||||||
if _err != nil {
|
if _err != nil {
|
||||||
zap.L().Error("GetPost err", zap.Error(_err))
|
zap.L().Error("GetPost err", zap.Error(_err))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user