feat: 删除已停用的同步店铺 (#197)

This commit is contained in:
chengma
2026-08-13 08:48:02 +08:00
parent 7cdfc6de99
commit 761058efc1
9 changed files with 120 additions and 3 deletions
+19
View File
@@ -78,3 +78,22 @@ func SetSybAllowedShopEnabled(db *sql.DB, actor *model.User, shopID string, enab
}
return nil
}
// DeleteDisabledSybAllowedShop 永久删除一条已停用配置,不影响历史货运单和同步记录。
func DeleteDisabledSybAllowedShop(db *sql.DB, actor *model.User, shopID string) error {
if actor == nil || !actor.IsAdmin() {
return ErrAdminRequired
}
shopID = strings.TrimSpace(shopID)
if shopID == "" {
return &validationError{field: "shop_id", message: "店铺编号不能为空"}
}
deleted, err := repository.DeleteDisabledSybAllowedShop(db, shopID)
if err != nil {
return err
}
if !deleted {
return &validationError{field: "shop_id", message: "店铺不存在或仍在启用,请刷新页面并先停用后再删除"}
}
return nil
}