update
This commit is contained in:
@ -24,8 +24,8 @@ type ReviewRepository interface {
|
||||
RecordImages(ctx context.Context, recordID uint32) ([]model.BrandRunwayImage, error)
|
||||
// UpdateRecord 审核前微调字段(白名单,杜绝任意列注入)。
|
||||
UpdateRecord(ctx context.Context, id uint32, fields map[string]any) error
|
||||
// SetRecordStatus 设置状态(通过/驳回)与审核人/驳回理由;记录不存在返回 ErrNotFound。
|
||||
SetRecordStatus(ctx context.Context, id uint32, status, reviewer, reason string) error
|
||||
// SetRecordStatus 设置状态(通过/驳回)与审核人;记录不存在返回 ErrNotFound。
|
||||
SetRecordStatus(ctx context.Context, id uint32, status, reviewer string) error
|
||||
|
||||
// 街拍镜像方法(对象为 street_snaps / street_snap_images)。
|
||||
ListStreetRecords(ctx context.Context, status string, page, size int) ([]model.StreetSnap, int64, error)
|
||||
@ -33,7 +33,7 @@ type ReviewRepository interface {
|
||||
StreetRecordImages(ctx context.Context, recordID uint32) ([]model.StreetSnapImage, error)
|
||||
UpdateStreetRecord(ctx context.Context, id uint32, fields map[string]any) error
|
||||
// SetStreetRecordStatus 设置状态;记录不存在返回 ErrNotFound。
|
||||
SetStreetRecordStatus(ctx context.Context, id uint32, status, reviewer, reason string) error
|
||||
SetStreetRecordStatus(ctx context.Context, id uint32, status, reviewer string) error
|
||||
|
||||
// SoftDeleteRunwayImage 软删单张走秀图片(审核阶段剔除坏图),并按实际存活**主图**行数重算 image_count。
|
||||
SoftDeleteRunwayImage(ctx context.Context, recordID, imgID uint32) error
|
||||
@ -166,15 +166,14 @@ func (r *reviewRepository) UpdateRecord(ctx context.Context, id uint32, fields m
|
||||
// 列表页只对 pending 显示通过 / 驳回按钮,但 POST 端点本身不设防 —— 这是已知取舍
|
||||
//(幂等重放 / 管理端纠正误操作都依赖它);若日后要收紧,应改在 handler 或显式状态机里做,
|
||||
// 而不是悄悄在这个仓储方法里加限制。
|
||||
func (r *reviewRepository) SetRecordStatus(ctx context.Context, id uint32, status, reviewer, reason string) error {
|
||||
func (r *reviewRepository) SetRecordStatus(ctx context.Context, id uint32, status, reviewer string) error {
|
||||
res := r.db.WithContext(ctx).
|
||||
Model(&model.BrandRunway{}).
|
||||
Where("id = ?", id).
|
||||
Updates(map[string]any{
|
||||
"status": status,
|
||||
"reviewer": reviewer,
|
||||
"reject_reason": reason,
|
||||
"updated_at": uint32(time.Now().Unix()),
|
||||
"status": status,
|
||||
"reviewer": reviewer,
|
||||
"updated_at": uint32(time.Now().Unix()),
|
||||
})
|
||||
if res.Error != nil {
|
||||
return res.Error
|
||||
@ -272,15 +271,14 @@ func (r *reviewRepository) UpdateStreetRecord(ctx context.Context, id uint32, fi
|
||||
|
||||
// SetStreetRecordStatus 命中 0 行说明记录不存在,返回 ErrNotFound(理由同 SetRecordStatus)。
|
||||
// 同样有意不校验前置状态:允许 rejected 直接置 published,属已知取舍(见 SetRecordStatus)。
|
||||
func (r *reviewRepository) SetStreetRecordStatus(ctx context.Context, id uint32, status, reviewer, reason string) error {
|
||||
func (r *reviewRepository) SetStreetRecordStatus(ctx context.Context, id uint32, status, reviewer string) error {
|
||||
res := r.db.WithContext(ctx).
|
||||
Model(&model.StreetSnap{}).
|
||||
Where("id = ?", id).
|
||||
Updates(map[string]any{
|
||||
"status": status,
|
||||
"reviewer": reviewer,
|
||||
"reject_reason": reason,
|
||||
"updated_at": uint32(time.Now().Unix()),
|
||||
"status": status,
|
||||
"reviewer": reviewer,
|
||||
"updated_at": uint32(time.Now().Unix()),
|
||||
})
|
||||
if res.Error != nil {
|
||||
return res.Error
|
||||
|
||||
Reference in New Issue
Block a user