yidun送检新增账户下拉和导出优化

This commit is contained in:
2026-05-15 14:01:15 +08:00
parent 307b01c0e3
commit 3dbcf7a8e3
7 changed files with 388 additions and 30 deletions

View File

@@ -436,6 +436,103 @@ func (c *MaterialVerifyController) BatchVerifyVideo(ctx context.Context, req *Ba
}, nil
}
// =============================================================================
// 账户列表接口
// =============================================================================
// ListAccountsReq 账户列表请求
type ListAccountsReq struct{}
// AccountItem 账户列表项
type AccountItem struct {
AccountID int64 `json:"accountId"`
CorporationName string `json:"corporationName"`
}
// ListAccountsRes 账户列表响应
type ListAccountsRes struct {
List []AccountItem `json:"list"`
}
// ListAccounts 获取所有启用的广告账户列表(用于前端下拉筛选)
func (c *MaterialVerifyController) ListAccounts(ctx context.Context, req *ListAccountsReq) (res *ListAccountsRes, err error) {
accounts, err := dao.TencentAccountRelation.GetAll(ctx)
if err != nil {
return nil, err
}
var items []AccountItem
for _, acc := range accounts {
items = append(items, AccountItem{
AccountID: acc.AccountID,
CorporationName: acc.CorporationName,
})
}
return &ListAccountsRes{
List: items,
}, nil
}
// =============================================================================
// 导出接口 - 不通过数据
// =============================================================================
// ExportRejectedReq 导出不通过数据请求
type ExportRejectedReq struct {
MaterialType string `json:"materialType"` // IMAGE/VIDEO为空则导出全部
}
// ExportRejectedItem 导出的不通过数据项
type ExportRejectedItem struct {
ID int64 `json:"id"`
MaterialID string `json:"materialId"`
AccountID int64 `json:"accountId"`
CorporationName string `json:"corporationName"`
PreviewURL string `json:"previewUrl"`
Description string `json:"description"`
ErrorMsg string `json:"errorMsg"`
MaterialType string `json:"materialType"`
ImageUsage string `json:"imageUsage,omitempty"`
CreatedAt string `json:"createdAt"`
}
// ExportRejectedRes 导出不通过数据响应
type ExportRejectedRes struct {
Items []ExportRejectedItem `json:"items"`
Total int `json:"total"`
}
// ExportRejected 导出不通过的图片/视频数据(含失败原因)
func (c *MaterialVerifyController) ExportRejected(ctx context.Context, req *ExportRejectedReq) (res *ExportRejectedRes, err error) {
items, err := serviceDataengine.MaterialVerify.ExportRejectedData(ctx, req.MaterialType)
if err != nil {
return nil, err
}
// 转换为响应结构
var respItems []ExportRejectedItem
for _, item := range items {
respItems = append(respItems, ExportRejectedItem{
ID: item.ID,
MaterialID: item.MaterialID,
AccountID: item.AccountID,
CorporationName: item.CorporationName,
PreviewURL: item.PreviewURL,
Description: item.Description,
ErrorMsg: item.ErrorMsg,
MaterialType: item.MaterialType,
ImageUsage: item.ImageUsage,
CreatedAt: item.CreatedAt,
})
}
return &ExportRejectedRes{
Items: respItems,
Total: len(respItems),
}, nil
}
// =============================================================================
// 回调处理接口
// =============================================================================