update backend

This commit is contained in:
toom1996
2026-09-20 01:06:13 +08:00
parent f7ae917603
commit b99dc3dca1
115 changed files with 24732 additions and 10842 deletions

View File

@ -30,7 +30,7 @@ type StreetSnapRepository interface {
UpdateSnap(ctx context.Context, id uint32, fields map[string]any) error
// DeleteSnapImage 软删单张街拍图片。
DeleteSnapImage(ctx context.Context, imageID uint32) error
// GetSnapImageKey 取单张街拍图片的七牛 key(删除前清理用);不存在返回空串。
// GetSnapImageKey 取单张街拍图片的S4 key(删除前清理用);不存在返回空串。
GetSnapImageKey(ctx context.Context, imageID uint32) (string, error)
// SoftDeleteSnapImages 软删某街拍的全部图片(级联下架用),返回被删图片的 key 列表。
SoftDeleteSnapImages(ctx context.Context, snapID uint32) ([]string, error)
@ -67,11 +67,11 @@ func snapFilterScope(q dto.StreetSnapQuery) func(*gorm.DB) *gorm.DB {
func snapOrderBy(sort string) string {
switch sort {
case "year_asc":
return "street_snap.year ASC, street_snap.id ASC"
return "street_snaps.year ASC, street_snaps.id ASC"
case "year_desc":
return "street_snap.year DESC, street_snap.id DESC"
return "street_snaps.year DESC, street_snaps.id DESC"
default: // image_count
return "street_snap.image_count DESC, street_snap.id DESC"
return "street_snaps.image_count DESC, street_snaps.id DESC"
}
}
@ -222,7 +222,7 @@ func (r *streetSnapRepository) GetSnapImageKey(ctx context.Context, imageID uint
}
// SoftDeleteSnapImages 软删某街拍的全部图片(级联下架用)。
// 先取非删除图片的 key 列表返回给调用方(用于后续七牛孤儿清理),再统一置 is_deleted=1。
// 先取非删除图片的 key 列表返回给调用方(用于后续S4孤儿清理),再统一置 is_deleted=1。
func (r *streetSnapRepository) SoftDeleteSnapImages(ctx context.Context, snapID uint32) ([]string, error) {
var imgs []model.StreetSnapImage
if err := r.db.WithContext(ctx).