导出任务Excel
This commit is contained in:
parent
1b5461d005
commit
2ba217c315
2352
api/cast/cast.pb.go
2352
api/cast/cast.pb.go
File diff suppressed because it is too large
Load Diff
@ -2749,245 +2749,6 @@ var _ interface {
|
||||
ErrorName() string
|
||||
} = WorkListRespValidationError{}
|
||||
|
||||
// Validate checks the field values on WorkList2Req with the rules defined in
|
||||
// the proto definition for this message. If any rules are violated, the first
|
||||
// error encountered is returned, or nil if there are no violations.
|
||||
func (m *WorkList2Req) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on WorkList2Req with the rules defined
|
||||
// in the proto definition for this message. If any rules are violated, the
|
||||
// result is a list of violation errors wrapped in WorkList2ReqMultiError, or
|
||||
// nil if none found.
|
||||
func (m *WorkList2Req) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *WorkList2Req) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for Page
|
||||
|
||||
// no validation rules for PageSize
|
||||
|
||||
if len(errors) > 0 {
|
||||
return WorkList2ReqMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// WorkList2ReqMultiError is an error wrapping multiple validation errors
|
||||
// returned by WorkList2Req.ValidateAll() if the designated constraints aren't met.
|
||||
type WorkList2ReqMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m WorkList2ReqMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m WorkList2ReqMultiError) AllErrors() []error { return m }
|
||||
|
||||
// WorkList2ReqValidationError is the validation error returned by
|
||||
// WorkList2Req.Validate if the designated constraints aren't met.
|
||||
type WorkList2ReqValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e WorkList2ReqValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e WorkList2ReqValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e WorkList2ReqValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e WorkList2ReqValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e WorkList2ReqValidationError) ErrorName() string { return "WorkList2ReqValidationError" }
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e WorkList2ReqValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sWorkList2Req.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = WorkList2ReqValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = WorkList2ReqValidationError{}
|
||||
|
||||
// Validate checks the field values on WorkList2Resp with the rules defined in
|
||||
// the proto definition for this message. If any rules are violated, the first
|
||||
// error encountered is returned, or nil if there are no violations.
|
||||
func (m *WorkList2Resp) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on WorkList2Resp with the rules defined
|
||||
// in the proto definition for this message. If any rules are violated, the
|
||||
// result is a list of violation errors wrapped in WorkList2RespMultiError, or
|
||||
// nil if none found.
|
||||
func (m *WorkList2Resp) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *WorkList2Resp) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
for idx, item := range m.GetData() {
|
||||
_, _ = idx, item
|
||||
|
||||
if all {
|
||||
switch v := interface{}(item).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, WorkList2RespValidationError{
|
||||
field: fmt.Sprintf("Data[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, WorkList2RespValidationError{
|
||||
field: fmt.Sprintf("Data[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return WorkList2RespValidationError{
|
||||
field: fmt.Sprintf("Data[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// no validation rules for Count
|
||||
|
||||
if len(errors) > 0 {
|
||||
return WorkList2RespMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// WorkList2RespMultiError is an error wrapping multiple validation errors
|
||||
// returned by WorkList2Resp.ValidateAll() if the designated constraints
|
||||
// aren't met.
|
||||
type WorkList2RespMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m WorkList2RespMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m WorkList2RespMultiError) AllErrors() []error { return m }
|
||||
|
||||
// WorkList2RespValidationError is the validation error returned by
|
||||
// WorkList2Resp.Validate if the designated constraints aren't met.
|
||||
type WorkList2RespValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e WorkList2RespValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e WorkList2RespValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e WorkList2RespValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e WorkList2RespValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e WorkList2RespValidationError) ErrorName() string { return "WorkList2RespValidationError" }
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e WorkList2RespValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sWorkList2Resp.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = WorkList2RespValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = WorkList2RespValidationError{}
|
||||
|
||||
// Validate checks the field values on WorkDetailReq with the rules defined in
|
||||
// the proto definition for this message. If any rules are violated, the first
|
||||
// error encountered is returned, or nil if there are no violations.
|
||||
@ -4859,6 +4620,8 @@ func (m *WorkInfoResp) validate(all bool) error {
|
||||
|
||||
}
|
||||
|
||||
// no validation rules for Title
|
||||
|
||||
if len(errors) > 0 {
|
||||
return WorkInfoRespMultiError(errors)
|
||||
}
|
||||
@ -5708,7 +5471,7 @@ func (m *PlatformInfo) validate(all bool) error {
|
||||
|
||||
// no validation rules for PublishMediaId
|
||||
|
||||
// no validation rules for PublishStatus
|
||||
// no validation rules for PublishMediaStatus
|
||||
|
||||
// no validation rules for Remark
|
||||
|
||||
@ -19990,6 +19753,8 @@ func (m *TaskListInfo) validate(all bool) error {
|
||||
|
||||
// no validation rules for UpdatedAt
|
||||
|
||||
// no validation rules for ExtraData
|
||||
|
||||
if len(errors) > 0 {
|
||||
return TaskListInfoMultiError(errors)
|
||||
}
|
||||
@ -24614,124 +24379,6 @@ var _ interface {
|
||||
ErrorName() string
|
||||
} = WorkListResp_InfoValidationError{}
|
||||
|
||||
// Validate checks the field values on WorkList2Resp_Info with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *WorkList2Resp_Info) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on WorkList2Resp_Info with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// WorkList2Resp_InfoMultiError, or nil if none found.
|
||||
func (m *WorkList2Resp_Info) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *WorkList2Resp_Info) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for WorkUuid
|
||||
|
||||
// no validation rules for ArtistName
|
||||
|
||||
// no validation rules for ArtistPhone
|
||||
|
||||
// no validation rules for Title
|
||||
|
||||
// no validation rules for WorkCategory
|
||||
|
||||
// no validation rules for WorkStatus
|
||||
|
||||
// no validation rules for SubmitTime
|
||||
|
||||
// no validation rules for StatusUpdateTime
|
||||
|
||||
if len(errors) > 0 {
|
||||
return WorkList2Resp_InfoMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// WorkList2Resp_InfoMultiError is an error wrapping multiple validation errors
|
||||
// returned by WorkList2Resp_Info.ValidateAll() if the designated constraints
|
||||
// aren't met.
|
||||
type WorkList2Resp_InfoMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m WorkList2Resp_InfoMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m WorkList2Resp_InfoMultiError) AllErrors() []error { return m }
|
||||
|
||||
// WorkList2Resp_InfoValidationError is the validation error returned by
|
||||
// WorkList2Resp_Info.Validate if the designated constraints aren't met.
|
||||
type WorkList2Resp_InfoValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e WorkList2Resp_InfoValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e WorkList2Resp_InfoValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e WorkList2Resp_InfoValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e WorkList2Resp_InfoValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e WorkList2Resp_InfoValidationError) ErrorName() string {
|
||||
return "WorkList2Resp_InfoValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e WorkList2Resp_InfoValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sWorkList2Resp_Info.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = WorkList2Resp_InfoValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = WorkList2Resp_InfoValidationError{}
|
||||
|
||||
// Validate checks the field values on MediaAccountsResp_Info with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
|
||||
@ -39,7 +39,6 @@ type CastClient interface {
|
||||
MediaInfoByPlatform(ctx context.Context, in *MediaInfoByPlatformReq, opts ...grpc_go.CallOption) (*MediaInfoByPlatformResp, common.ErrorWithAttachment)
|
||||
WorkList(ctx context.Context, in *WorkListReq, opts ...grpc_go.CallOption) (*WorkListResp, common.ErrorWithAttachment)
|
||||
WorkListPublished(ctx context.Context, in *WorkListPublishedReq, opts ...grpc_go.CallOption) (*WorkListPublishedResp, common.ErrorWithAttachment)
|
||||
WorkList2(ctx context.Context, in *WorkList2Req, opts ...grpc_go.CallOption) (*WorkList2Resp, common.ErrorWithAttachment)
|
||||
WorkDetail(ctx context.Context, in *WorkDetailReq, opts ...grpc_go.CallOption) (*WorkDetailResp, common.ErrorWithAttachment)
|
||||
UpdateStatus(ctx context.Context, in *UpdateStatusReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
MediaAccounts(ctx context.Context, in *MediaAccountsReq, opts ...grpc_go.CallOption) (*MediaAccountsResp, common.ErrorWithAttachment)
|
||||
@ -148,7 +147,6 @@ type CastClientImpl struct {
|
||||
MediaInfoByPlatform func(ctx context.Context, in *MediaInfoByPlatformReq) (*MediaInfoByPlatformResp, error)
|
||||
WorkList func(ctx context.Context, in *WorkListReq) (*WorkListResp, error)
|
||||
WorkListPublished func(ctx context.Context, in *WorkListPublishedReq) (*WorkListPublishedResp, error)
|
||||
WorkList2 func(ctx context.Context, in *WorkList2Req) (*WorkList2Resp, error)
|
||||
WorkDetail func(ctx context.Context, in *WorkDetailReq) (*WorkDetailResp, error)
|
||||
UpdateStatus func(ctx context.Context, in *UpdateStatusReq) (*emptypb.Empty, error)
|
||||
MediaAccounts func(ctx context.Context, in *MediaAccountsReq) (*MediaAccountsResp, error)
|
||||
@ -299,12 +297,6 @@ func (c *castClient) WorkListPublished(ctx context.Context, in *WorkListPublishe
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/WorkListPublished", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) WorkList2(ctx context.Context, in *WorkList2Req, opts ...grpc_go.CallOption) (*WorkList2Resp, common.ErrorWithAttachment) {
|
||||
out := new(WorkList2Resp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/WorkList2", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) WorkDetail(ctx context.Context, in *WorkDetailReq, opts ...grpc_go.CallOption) (*WorkDetailResp, common.ErrorWithAttachment) {
|
||||
out := new(WorkDetailResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -775,7 +767,6 @@ type CastServer interface {
|
||||
MediaInfoByPlatform(context.Context, *MediaInfoByPlatformReq) (*MediaInfoByPlatformResp, error)
|
||||
WorkList(context.Context, *WorkListReq) (*WorkListResp, error)
|
||||
WorkListPublished(context.Context, *WorkListPublishedReq) (*WorkListPublishedResp, error)
|
||||
WorkList2(context.Context, *WorkList2Req) (*WorkList2Resp, error)
|
||||
WorkDetail(context.Context, *WorkDetailReq) (*WorkDetailResp, error)
|
||||
UpdateStatus(context.Context, *UpdateStatusReq) (*emptypb.Empty, error)
|
||||
MediaAccounts(context.Context, *MediaAccountsReq) (*MediaAccountsResp, error)
|
||||
@ -905,9 +896,6 @@ func (UnimplementedCastServer) WorkList(context.Context, *WorkListReq) (*WorkLis
|
||||
func (UnimplementedCastServer) WorkListPublished(context.Context, *WorkListPublishedReq) (*WorkListPublishedResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method WorkListPublished not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) WorkList2(context.Context, *WorkList2Req) (*WorkList2Resp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method WorkList2 not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) WorkDetail(context.Context, *WorkDetailReq) (*WorkDetailResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method WorkDetail not implemented")
|
||||
}
|
||||
@ -1454,35 +1442,6 @@ func _Cast_WorkListPublished_Handler(srv interface{}, ctx context.Context, dec f
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Cast_WorkList2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(WorkList2Req)
|
||||
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("WorkList2", 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_WorkDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(WorkDetailReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -3734,10 +3693,6 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "WorkListPublished",
|
||||
Handler: _Cast_WorkListPublished_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "WorkList2",
|
||||
Handler: _Cast_WorkList2_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "WorkDetail",
|
||||
Handler: _Cast_WorkDetail_Handler,
|
||||
|
||||
7
pkg/model/cast/task.go
Normal file
7
pkg/model/cast/task.go
Normal file
@ -0,0 +1,7 @@
|
||||
package cast
|
||||
|
||||
type PublishTaskDto struct {
|
||||
WorkUuids []string
|
||||
MediaAccountUuids []string
|
||||
PlatformIds []string
|
||||
}
|
||||
@ -63,6 +63,7 @@ func MediaRouter(r *gin.RouterGroup) {
|
||||
{
|
||||
task.POST("list", serviceCast.TaskList)
|
||||
task.POST("delete", serviceCast.DeleteTasK)
|
||||
task.POST("download", serviceCast.DownloadTaskFile)
|
||||
}
|
||||
|
||||
layout := auth.Group("layout")
|
||||
|
||||
@ -2,12 +2,20 @@ package cast
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"fonchain-fiee/cmd/config"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"fonchain-fiee/api/cast"
|
||||
modelCast "fonchain-fiee/pkg/model/cast"
|
||||
"fonchain-fiee/pkg/model/login"
|
||||
"fonchain-fiee/pkg/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/xuri/excelize/v2"
|
||||
)
|
||||
|
||||
func TaskList(ctx *gin.Context) {
|
||||
@ -42,5 +50,137 @@ func DeleteTasK(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
service.Success(ctx, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func DownloadTaskFile(ctx *gin.Context) {
|
||||
var req *cast.GetTaskListReq
|
||||
var err error
|
||||
if err = ctx.ShouldBind(&req); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
resp, err := service.CastProvider.GetTaskList(context.Background(), req)
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
if resp == nil || resp.Data == nil {
|
||||
service.Error(ctx, errors.New("没有此任务"))
|
||||
return
|
||||
}
|
||||
|
||||
var taskInfo modelCast.PublishTaskDto
|
||||
if resp.Data.ExtraData != "" {
|
||||
_ = json.Unmarshal([]byte(resp.Data.ExtraData), &taskInfo)
|
||||
}
|
||||
// 创建Excel文件
|
||||
f := excelize.NewFile()
|
||||
sheetName := "Sheet1"
|
||||
f.SetSheetName("Sheet1", sheetName)
|
||||
// 设置表头
|
||||
headers := []interface{}{
|
||||
"艺人编号", "艺人姓名", "内容类型", "内容标题",
|
||||
"执行结果", "TIKTOK", "YOUTUBE", "INS", "DM", "BULESKY",
|
||||
}
|
||||
sw, err := f.NewStreamWriter(sheetName)
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
if err := sw.SetRow("A1", headers); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
// 遍历所有作品,收集数据
|
||||
rowIndex := 2
|
||||
for _, workUuid := range taskInfo.WorkUuids {
|
||||
var workResp *cast.WorkDetailResp
|
||||
workResp, err = service.CastProvider.WorkDetail(context.Background(), &cast.WorkDetailReq{WorkUuid: workUuid})
|
||||
if err != nil {
|
||||
continue // 如果某个作品获取失败,跳过继续处理其他作品
|
||||
}
|
||||
// 内容类型
|
||||
contentType := ""
|
||||
if workResp.WorkCategory == 1 {
|
||||
contentType = "图文"
|
||||
} else if workResp.WorkCategory == 2 {
|
||||
contentType = "视频"
|
||||
}
|
||||
// 执行结果
|
||||
executionResult := modelCast.WorkStatusMM[int(workResp.WorkStatus)]
|
||||
tiktokStatus := ""
|
||||
youtubeStatus := ""
|
||||
insStatus := ""
|
||||
dmStatus := ""
|
||||
blueskyStatus := ""
|
||||
|
||||
// 获取平台信息和艺人姓名
|
||||
artistName := ""
|
||||
var infoResp *cast.WorkInfoResp
|
||||
infoResp, err = service.CastProvider.WorkInfo(context.Background(), &cast.WorkInfoReq{WorkUuid: workUuid})
|
||||
if err == nil && infoResp != nil {
|
||||
artistName = infoResp.ArtistName
|
||||
if infoResp.PlatformInfoData != nil {
|
||||
for _, platform := range infoResp.PlatformInfoData {
|
||||
statusText := modelCast.PlatformPublishStatusMM[platform.PublishMediaStatus]
|
||||
switch cast.PlatformIDENUM(platform.PlatformID) {
|
||||
case cast.PlatformIDENUM_TIKTOK:
|
||||
tiktokStatus = statusText
|
||||
case cast.PlatformIDENUM_YOUTUBE:
|
||||
youtubeStatus = statusText
|
||||
case cast.PlatformIDENUM_INS:
|
||||
insStatus = statusText
|
||||
case cast.PlatformIDENUM_DM:
|
||||
dmStatus = statusText
|
||||
case cast.PlatformIDENUM_BULESKY:
|
||||
blueskyStatus = statusText
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
row := []interface{}{
|
||||
workResp.ArtistSubNum,
|
||||
artistName,
|
||||
contentType,
|
||||
workResp.Title,
|
||||
executionResult,
|
||||
tiktokStatus,
|
||||
youtubeStatus,
|
||||
insStatus,
|
||||
dmStatus,
|
||||
blueskyStatus,
|
||||
}
|
||||
cell, _ := excelize.CoordinatesToCellName(1, rowIndex)
|
||||
if err = sw.SetRow(cell, row); err != nil {
|
||||
continue
|
||||
}
|
||||
rowIndex++
|
||||
}
|
||||
if err := sw.Flush(); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
tempDir := "./runtime/task"
|
||||
if _, err = os.Stat(tempDir); os.IsNotExist(err) {
|
||||
if err = os.MkdirAll(tempDir, 0755); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
filename := fmt.Sprintf("任务_%s.xlsx", strings.ReplaceAll(resp.Data.CreatedAt, ":", "-"))
|
||||
filePath := tempDir + "/" + filename
|
||||
var exportUrl string = fmt.Sprintf("%s/api/fiee/static/%s", config.AppConfig.System.FieeHost, strings.Replace(filePath, "./runtime/", "", 1))
|
||||
if err = f.SaveAs(filePath); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
//// 上传到阿里云
|
||||
//excelUrl, err := upload.PutBos(filePath, "excel", true)
|
||||
//if err != nil {
|
||||
// service.Error(ctx, err)
|
||||
// return
|
||||
//}
|
||||
service.Success(ctx, gin.H{
|
||||
"url": exportUrl,
|
||||
})
|
||||
}
|
||||
|
||||
@ -16,6 +16,17 @@ import (
|
||||
|
||||
func Test(ctx *gin.Context) {
|
||||
action := ctx.PostForm("action")
|
||||
if action == "" {
|
||||
workUuid := ctx.PostForm("workUuid")
|
||||
resp, err := service.CastProvider.WorkInfo(context.Background(), &cast.WorkInfoReq{WorkUuid: workUuid})
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
service.Success(ctx, resp)
|
||||
return
|
||||
}
|
||||
|
||||
if action == "getPost" {
|
||||
id := ctx.PostForm("id")
|
||||
profileKey := ctx.PostForm("profileKey")
|
||||
@ -70,19 +81,6 @@ func Test(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if action == "" {
|
||||
profileKey := ctx.PostForm("profileKey")
|
||||
resp, err := service.AyrshareProvider.GetUser(context.Background(), &aryshare.GetUserRequest{
|
||||
ProfileKey: profileKey,
|
||||
InstagramDetails: true,
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
service.Success(ctx, resp)
|
||||
return
|
||||
}
|
||||
if action == "getProfile" {
|
||||
//profileKey := ctx.PostForm("profileKey")
|
||||
resp, err := service.AyrshareProvider.GetProfiles(context.Background(), &aryshare.GetProfilesRequest{
|
||||
|
||||
@ -680,14 +680,14 @@ func PostAS(workUuid string) error {
|
||||
}
|
||||
infoReq := &cast.UpdateWorkPlatformInfoReq{PlatformInfoData: make([]*cast.PlatformInfo, 0)}
|
||||
infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
||||
WorkUuid: workDetail.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: uint32(platformID),
|
||||
PublishType: 2,
|
||||
PublishResp: _err.Error(),
|
||||
PublishMediaId: "",
|
||||
PublishStatus: cast.PublishStatusENUM_PublishMediaStatus_EXCEPTION,
|
||||
Remark: "",
|
||||
WorkUuid: workDetail.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: uint32(platformID),
|
||||
PublishType: 2,
|
||||
PublishResp: _err.Error(),
|
||||
PublishMediaId: "",
|
||||
PublishMediaStatus: cast.PublishStatusENUM_PublishMediaStatus_EXCEPTION,
|
||||
Remark: "",
|
||||
})
|
||||
zap.L().Info("UpdateWorkPlatformInfo", zap.Any("infoReq", infoReq))
|
||||
_, errS = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
||||
@ -741,14 +741,14 @@ func PostAS(workUuid string) error {
|
||||
}
|
||||
postBytes, _ = json.Marshal(postInfo)
|
||||
infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
||||
WorkUuid: workDetail.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: pid,
|
||||
PublishType: 2,
|
||||
PublishResp: string(postBytes),
|
||||
PublishMediaId: postResp.Posts[0].Id,
|
||||
PublishStatus: publishStatus,
|
||||
Remark: string(postData),
|
||||
WorkUuid: workDetail.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: pid,
|
||||
PublishType: 2,
|
||||
PublishResp: string(postBytes),
|
||||
PublishMediaId: postResp.Posts[0].Id,
|
||||
PublishMediaStatus: publishStatus,
|
||||
Remark: string(postData),
|
||||
})
|
||||
}
|
||||
zap.L().Info("post 10", zap.Any("workUuid", workUuid), zap.Any("platformID", platformID))
|
||||
@ -1606,8 +1606,8 @@ func RefreshPublish() error {
|
||||
PlatformInfoData: make([]*cast.PlatformInfo, 0),
|
||||
}
|
||||
infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
PublishStatus: cast.PublishStatusENUM_PublishMediaStatus_NO,
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
PublishMediaStatus: cast.PublishStatusENUM_PublishMediaStatus_NO,
|
||||
})
|
||||
_, _ = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
||||
continue
|
||||
@ -1622,15 +1622,15 @@ func RefreshPublish() error {
|
||||
map[string]string{"Authorization": "Bearer " + platformInfo.Token}, config.AppConfig.System.ProxyUrl)
|
||||
if err != nil {
|
||||
infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: uint32(platformInfo.PlatformID),
|
||||
PublishType: 2,
|
||||
PublishResp: err.Error(),
|
||||
PublishMediaId: platformInfo.PublishMediaID,
|
||||
PublishStatus: cast.PublishStatusENUM_PublishMediaStatus_EXCEPTION,
|
||||
Remark: "",
|
||||
PlatformUuid: platformInfo.PlatformUuid,
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: uint32(platformInfo.PlatformID),
|
||||
PublishType: 2,
|
||||
PublishResp: err.Error(),
|
||||
PublishMediaId: platformInfo.PublishMediaID,
|
||||
PublishMediaStatus: cast.PublishStatusENUM_PublishMediaStatus_EXCEPTION,
|
||||
Remark: "",
|
||||
PlatformUuid: platformInfo.PlatformUuid,
|
||||
})
|
||||
_, _ = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
||||
continue
|
||||
@ -1639,15 +1639,15 @@ func RefreshPublish() error {
|
||||
_ = json.Unmarshal(dmData, &dmPost)
|
||||
if dmPost.Published {
|
||||
infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: uint32(platformInfo.PlatformID),
|
||||
PublishType: 2,
|
||||
PublishResp: string(dmData),
|
||||
PublishMediaId: platformInfo.PublishMediaID,
|
||||
PublishStatus: cast.PublishStatusENUM_PublishMediaStatus_DONE,
|
||||
Remark: "",
|
||||
PlatformUuid: platformInfo.PlatformUuid,
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: uint32(platformInfo.PlatformID),
|
||||
PublishType: 2,
|
||||
PublishResp: string(dmData),
|
||||
PublishMediaId: platformInfo.PublishMediaID,
|
||||
PublishMediaStatus: cast.PublishStatusENUM_PublishMediaStatus_DONE,
|
||||
Remark: "",
|
||||
PlatformUuid: platformInfo.PlatformUuid,
|
||||
})
|
||||
_, _ = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
||||
} else {
|
||||
@ -1692,15 +1692,15 @@ func RefreshPublish() error {
|
||||
})
|
||||
}(workInfo)
|
||||
infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: uint32(platformInfo.PlatformID),
|
||||
PublishType: 2,
|
||||
PublishResp: _err.Error(),
|
||||
PublishMediaId: platformInfo.PublishMediaID,
|
||||
PublishStatus: cast.PublishStatusENUM_PublishMediaStatus_EXCEPTION,
|
||||
Remark: "",
|
||||
PlatformUuid: platformInfo.PlatformUuid,
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: uint32(platformInfo.PlatformID),
|
||||
PublishType: 2,
|
||||
PublishResp: _err.Error(),
|
||||
PublishMediaId: platformInfo.PublishMediaID,
|
||||
PublishMediaStatus: cast.PublishStatusENUM_PublishMediaStatus_EXCEPTION,
|
||||
Remark: "",
|
||||
PlatformUuid: platformInfo.PlatformUuid,
|
||||
})
|
||||
_, _ = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
||||
continue
|
||||
@ -1712,15 +1712,15 @@ func RefreshPublish() error {
|
||||
postBytes, _ = json.Marshal(postResp)
|
||||
if len(postResp.PostIds) == 0 || len(postResp.Errors) > 0 {
|
||||
infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: uint32(platformInfo.PlatformID),
|
||||
PublishType: 2,
|
||||
PublishResp: string(postBytes),
|
||||
PublishMediaId: platformInfo.PublishMediaID,
|
||||
PublishStatus: cast.PublishStatusENUM_PublishMediaStatus_FAIL,
|
||||
Remark: "",
|
||||
PlatformUuid: platformInfo.PlatformUuid,
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: uint32(platformInfo.PlatformID),
|
||||
PublishType: 2,
|
||||
PublishResp: string(postBytes),
|
||||
PublishMediaId: platformInfo.PublishMediaID,
|
||||
PublishMediaStatus: cast.PublishStatusENUM_PublishMediaStatus_FAIL,
|
||||
Remark: "",
|
||||
PlatformUuid: platformInfo.PlatformUuid,
|
||||
})
|
||||
_, _ = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
||||
}
|
||||
@ -1742,15 +1742,15 @@ func RefreshPublish() error {
|
||||
}
|
||||
platformID := modelCast.NamePlatformIDKv[vv.Platform]
|
||||
infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: platformID,
|
||||
PublishType: 2,
|
||||
PublishResp: string(postBytes),
|
||||
PublishMediaId: platformInfo.PublishMediaID,
|
||||
PublishStatus: publishStatus,
|
||||
Remark: "",
|
||||
PlatformUuid: platformInfo.PlatformUuid,
|
||||
WorkUuid: workInfo.WorkUuid,
|
||||
MediaAccountUuid: "",
|
||||
PlatformID: platformID,
|
||||
PublishType: 2,
|
||||
PublishResp: string(postBytes),
|
||||
PublishMediaId: platformInfo.PublishMediaID,
|
||||
PublishMediaStatus: publishStatus,
|
||||
Remark: "",
|
||||
PlatformUuid: platformInfo.PlatformUuid,
|
||||
})
|
||||
}
|
||||
_, _ = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user