Merge branch 'feature-octTwo-daiyb' into dev

This commit is contained in:
戴育兵 2025-10-11 16:21:30 +08:00
commit f0ffd00a7d
7 changed files with 135 additions and 4 deletions

View File

@ -1379,6 +1379,7 @@ type WorkListReq struct {
Page int32 `protobuf:"varint,12,opt,name=page,proto3" json:"page"` Page int32 `protobuf:"varint,12,opt,name=page,proto3" json:"page"`
PageSize int32 `protobuf:"varint,13,opt,name=pageSize,proto3" json:"pageSize"` PageSize int32 `protobuf:"varint,13,opt,name=pageSize,proto3" json:"pageSize"`
MediaAccountUuids []string `protobuf:"bytes,14,rep,name=mediaAccountUuids,proto3" json:"mediaAccountUuids"` MediaAccountUuids []string `protobuf:"bytes,14,rep,name=mediaAccountUuids,proto3" json:"mediaAccountUuids"`
CostType int32 `protobuf:"varint,15,opt,name=costType,proto3" json:"costType"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -1511,6 +1512,13 @@ func (x *WorkListReq) GetMediaAccountUuids() []string {
return nil return nil
} }
func (x *WorkListReq) GetCostType() int32 {
if x != nil {
return x.CostType
}
return 0
}
type WorkListResp struct { type WorkListResp struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Data []*WorkListResp_Info `protobuf:"bytes,1,rep,name=data,proto3" json:"data"` Data []*WorkListResp_Info `protobuf:"bytes,1,rep,name=data,proto3" json:"data"`
@ -3494,7 +3502,7 @@ const file_pb_fiee_cast_proto_rawDesc = "" +
"\x10coverTimestampMs\x18\x12 \x01(\x04R\x10coverTimestampMs\x127\n" + "\x10coverTimestampMs\x18\x12 \x01(\x04R\x10coverTimestampMs\x127\n" +
"\vautoPublish\x18\x13 \x01(\x0e2\x15.Cast.AutoPublishENUMR\vautoPublish\"1\n" + "\vautoPublish\x18\x13 \x01(\x0e2\x15.Cast.AutoPublishENUMR\vautoPublish\"1\n" +
"\x13UpdateWorkVideoResp\x12\x1a\n" + "\x13UpdateWorkVideoResp\x12\x1a\n" +
"\bworkUuid\x18\x01 \x01(\tR\bworkUuid\"\x8f\x04\n" + "\bworkUuid\x18\x01 \x01(\tR\bworkUuid\"\xab\x04\n" +
"\vWorkListReq\x12\x1c\n" + "\vWorkListReq\x12\x1c\n" +
"\tartistVal\x18\x01 \x01(\tR\tartistVal\x12\x1e\n" + "\tartistVal\x18\x01 \x01(\tR\tartistVal\x12\x1e\n" +
"\n" + "\n" +
@ -3514,7 +3522,8 @@ const file_pb_fiee_cast_proto_rawDesc = "" +
"\x0emanagerUserVal\x18\v \x01(\tR\x0emanagerUserVal\x12\x12\n" + "\x0emanagerUserVal\x18\v \x01(\tR\x0emanagerUserVal\x12\x12\n" +
"\x04page\x18\f \x01(\x05R\x04page\x12\x1a\n" + "\x04page\x18\f \x01(\x05R\x04page\x12\x1a\n" +
"\bpageSize\x18\r \x01(\x05R\bpageSize\x12,\n" + "\bpageSize\x18\r \x01(\x05R\bpageSize\x12,\n" +
"\x11mediaAccountUuids\x18\x0e \x03(\tR\x11mediaAccountUuids\"\xe8\x04\n" + "\x11mediaAccountUuids\x18\x0e \x03(\tR\x11mediaAccountUuids\x12\x1a\n" +
"\bcostType\x18\x0f \x01(\x05R\bcostType\"\xe8\x04\n" +
"\fWorkListResp\x12+\n" + "\fWorkListResp\x12+\n" +
"\x04data\x18\x01 \x03(\v2\x17.Cast.WorkListResp.InfoR\x04data\x12\x14\n" + "\x04data\x18\x01 \x03(\v2\x17.Cast.WorkListResp.InfoR\x04data\x12\x14\n" +
"\x05count\x18\x02 \x01(\x03R\x05count\x1a\x94\x04\n" + "\x05count\x18\x02 \x01(\x03R\x05count\x1a\x94\x04\n" +

View File

@ -1770,6 +1770,8 @@ func (m *WorkListReq) validate(all bool) error {
// no validation rules for PageSize // no validation rules for PageSize
// no validation rules for CostType
if len(errors) > 0 { if len(errors) > 0 {
return WorkListReqMultiError(errors) return WorkListReqMultiError(errors)
} }

59
pkg/logic/cast/work.go Normal file
View File

@ -0,0 +1,59 @@
package cast
import (
"fmt"
"fonchain-fiee/api/cast"
modelCast "fonchain-fiee/pkg/model/cast"
"strings"
"github.com/360EntSecGroup-Skylar/excelize"
)
type Work struct {
}
func (w *Work) ExportExcelWorkList(data []*cast.WorkListResp_Info) (*excelize.File, error) {
f := excelize.NewFile()
sheetName := "Sheet1"
f.SetSheetName("Sheet1", sheetName)
headers := []string{
"艺人", "艺人手机号", "作品标题", "作品类型", "类型", "发布平台", "提交时间", "作品状态", "发布账号", "管理人",
}
for i, h := range headers {
cell := fmt.Sprintf("%s%d", string(rune('A'+i)), 1)
f.SetCellValue(sheetName, cell, h)
}
rowIndex := 2
for _, info := range data {
var platformNames string
for _, v := range info.PlatformIDs {
platformNames += modelCast.PlatformIDMM[int(v)] + "/"
}
platformNames = strings.Trim(platformNames, "/")
var ManagerUserNames string
for _, v := range info.ManagerUserNames {
ManagerUserNames += v + "/"
}
ManagerUserNames = strings.Trim(ManagerUserNames, "/")
var mediaAccountNames string
for _, v := range info.MediaAccountNames {
mediaAccountNames += v + "/"
}
mediaAccountNames = strings.Trim(mediaAccountNames, "/")
f.SetCellValue(sheetName, fmt.Sprintf("A%d", rowIndex), info.ArtistName)
f.SetCellValue(sheetName, fmt.Sprintf("B%d", rowIndex), info.ArtistPhone)
f.SetCellValue(sheetName, fmt.Sprintf("C%d", rowIndex), info.Title)
f.SetCellValue(sheetName, fmt.Sprintf("D%d", rowIndex), modelCast.WorkCategoryMM[int(info.WorkCategory)])
f.SetCellValue(sheetName, fmt.Sprintf("E%d", rowIndex), modelCast.WorkCostTypeMM[int(info.CostType)])
f.SetCellValue(sheetName, fmt.Sprintf("F%d", rowIndex), platformNames)
f.SetCellValue(sheetName, fmt.Sprintf("G%d", rowIndex), info.SubmitTime)
f.SetCellValue(sheetName, fmt.Sprintf("H%d", rowIndex), modelCast.WorkStatusMM[int(info.WorkStatus)])
f.SetCellValue(sheetName, fmt.Sprintf("I%d", rowIndex), mediaAccountNames)
f.SetCellValue(sheetName, fmt.Sprintf("J%d", rowIndex), ManagerUserNames)
rowIndex++
}
return f, nil
}

View File

@ -9,3 +9,31 @@ const (
WorkStatusPublishSuccess = 6 // 发布成功 WorkStatusPublishSuccess = 6 // 发布成功
WorkStatusPublishFailed = 7 // 发布失败 WorkStatusPublishFailed = 7 // 发布失败
) )
var WorkCategoryMM = map[int]string{
1: "图文",
2: "视频",
}
var WorkCostTypeMM = map[int]string{
1: "套餐",
2: "增值",
}
var PlatformIDMM = map[int]string{
1: "TIKTOK",
2: "YouTube",
3: "Ins",
4: "DM",
}
var WorkStatusMM = map[int]string{
1: "待提交",
2: "审核中",
3: "审核失败",
4: "待艺人确认",
5: "艺人驳回",
6: "发布成功",
7: "发布失败",
8: "待发布",
}

View File

@ -34,6 +34,7 @@ func MediaRouter(r *gin.RouterGroup) {
work.POST("update-work-video", serviceCast.UpdateWorkVideo) work.POST("update-work-video", serviceCast.UpdateWorkVideo)
work.POST("update-approval", serviceCast.UpdateApproval) work.POST("update-approval", serviceCast.UpdateApproval)
work.POST("list", serviceCast.WorkList) work.POST("list", serviceCast.WorkList)
work.Any("list-export", serviceCast.WorkListExport)
work.POST("detail", serviceCast.WorkDetail) work.POST("detail", serviceCast.WorkDetail)
work.POST("republish", serviceCast.RePublish) work.POST("republish", serviceCast.RePublish)
work.POST("delete", serviceCast.DelWork) work.POST("delete", serviceCast.DelWork)

View File

@ -2,16 +2,17 @@ package cast
import ( import (
"context" "context"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"fmt" "fmt"
"fonchain-fiee/cmd/config" "fonchain-fiee/cmd/config"
"fonchain-fiee/pkg/model/login" "fonchain-fiee/pkg/model/login"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
func NewCtxWithUserInfo(ctx *gin.Context) (newCtx context.Context) { func NewCtxWithUserInfo(ctx *gin.Context) (newCtx context.Context) {
var userInfo = login.Info{} var userInfo = login.Info{}
if config.AppConfig.System.AppMode != "dev" { if config.AppConfig.System.AppMode == "prod" {
userInfo = login.GetUserInfoFromC(ctx) userInfo = login.GetUserInfoFromC(ctx)
} else { } else {
userInfo = login.Info{ userInfo = login.Info{

View File

@ -9,6 +9,7 @@ import (
"fonchain-fiee/api/cast" "fonchain-fiee/api/cast"
"fonchain-fiee/cmd/config" "fonchain-fiee/cmd/config"
"fonchain-fiee/pkg/e" "fonchain-fiee/pkg/e"
logicCast "fonchain-fiee/pkg/logic/cast"
modelCast "fonchain-fiee/pkg/model/cast" modelCast "fonchain-fiee/pkg/model/cast"
"fonchain-fiee/pkg/service" "fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/utils/stime" "fonchain-fiee/pkg/utils/stime"
@ -447,3 +448,33 @@ func PublishInfo(ctx *gin.Context) {
service.Success(ctx, resp) service.Success(ctx, resp)
return return
} }
func WorkListExport(ctx *gin.Context) {
var (
req *cast.WorkListReq
resp *cast.WorkListResp
)
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
newCtx := NewCtxWithUserInfo(ctx)
resp, err = service.CastProvider.WorkList(newCtx, req)
if err != nil {
service.Error(ctx, err)
return
}
var loigcCastWork = new(logicCast.Work)
excelFile, err := loigcCastWork.ExportExcelWorkList(resp.Data)
if err != nil {
service.Error(ctx, err)
return
}
fileName := fmt.Sprintf("作品列表_%s.xlsx", time.Now().Format("20060102"))
ctx.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
ctx.Header("Content-Disposition", "attachment; filename="+fileName)
ctx.Header("File-Name", fileName)
ctx.Header("Access-Control-Expose-Headers", "File-Name")
_ = excelFile.Write(ctx.Writer)
}