- 深度优化商品审核工作台:指标概览卡片、风险边条队列、标价管道联动、核心资产高密度展示、底部决策浮动 Dock、全套键盘快捷键 - 重构截图大图查看体验:移除旧版底部溢出的全局画廊,封装全屏居中弹窗 AdminListingReviewPreviewDialog,支持「按住速览(松手即关闭)」与「常驻弹窗(缩放/翻页/打码/原图)」双模交互 - 新增在线截图编辑器 ImageEditorDialog:支持平滑马赛克打码、自由裁剪与旋转保存 - 弹窗组件解耦:抽离审核拒绝、调价、全量核验、快捷键速查等子组件,严格控制单文件行数 - 后端支持:新增商品审核调整价格接口与配套单元测试
95 lines
2.7 KiB
Go
95 lines
2.7 KiB
Go
package listing
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
func (s *Service) ListPendingReview(ctx context.Context) ([]ListingDTO, error) {
|
|
if s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
return s.repo.ListPendingReview(ctx)
|
|
}
|
|
|
|
func (s *Service) ListAdmin(ctx context.Context, query AdminListQuery) (*AdminListResult, error) {
|
|
if s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
return s.repo.ListAdmin(ctx, query)
|
|
}
|
|
|
|
func (s *Service) FindAdmin(ctx context.Context, id uint64) (*ListingDTO, error) {
|
|
if s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
return s.repo.FindAdmin(ctx, id)
|
|
}
|
|
|
|
func (s *Service) AdminOffline(ctx context.Context, adminID uint64, id uint64, req AdminActionRequest, meta AuditMeta) (*ListingDTO, error) {
|
|
if s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
if req.Reason == "" {
|
|
return nil, ErrInvalidInput
|
|
}
|
|
return s.repo.AdminOffline(ctx, adminID, id, req, meta)
|
|
}
|
|
|
|
func (s *Service) AdminMarkAbnormal(ctx context.Context, adminID uint64, id uint64, req AdminActionRequest, meta AuditMeta) (*ListingDTO, error) {
|
|
if s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
if req.Reason == "" {
|
|
return nil, ErrInvalidInput
|
|
}
|
|
return s.repo.AdminMarkAbnormal(ctx, adminID, id, req, meta)
|
|
}
|
|
|
|
func (s *Service) Approve(ctx context.Context, id uint64) (*ListingDTO, error) {
|
|
if s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
return s.repo.Approve(ctx, id)
|
|
}
|
|
|
|
func (s *Service) AdjustReviewPrice(ctx context.Context, adminID uint64, id uint64, req AdminPriceAdjustRequest, meta AuditMeta) (*ListingDTO, error) {
|
|
if s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
if req.BuyerRatio <= 0 && req.BuyerTotalPriceCent <= 0 {
|
|
return nil, ErrInvalidPrice
|
|
}
|
|
return s.repo.AdjustReviewPrice(ctx, adminID, id, req, meta)
|
|
}
|
|
|
|
func (s *Service) TransferOwner(ctx context.Context, adminID uint64, id uint64, req TransferOwnerRequest, meta AuditMeta) (*ListingDTO, error) {
|
|
if s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
if req.TargetUserID == 0 || req.Reason == "" {
|
|
return nil, ErrInvalidInput
|
|
}
|
|
return s.repo.TransferOwner(ctx, adminID, id, req, meta)
|
|
}
|
|
|
|
func (s *Service) Reject(ctx context.Context, id uint64, req ReviewRequest) (*ListingDTO, error) {
|
|
if s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
if req.Reason == "" {
|
|
return nil, ErrInvalidInput
|
|
}
|
|
return s.repo.Reject(ctx, id, req)
|
|
}
|
|
|
|
func (s *Service) UpdateScreenshots(ctx context.Context, adminID uint64, id uint64, req AdminUpdateScreenshotsRequest, meta AuditMeta) (*ListingDTO, error) {
|
|
if s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
if len(req.ScreenshotURLs) == 0 {
|
|
return nil, ErrInvalidInput
|
|
}
|
|
return s.repo.UpdateScreenshots(ctx, adminID, id, req, meta)
|
|
}
|
|
|