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
+14
View File
@@ -90,6 +90,20 @@ func SetSybAllowedShopEnabled(q Execer, shopID string, enabled bool, updatedAt s
return affected == 1, nil
}
// DeleteDisabledSybAllowedShop 只删除提交瞬间仍处于停用状态的配置项。
// enabled 条件是最终并发保护,不能只依赖管理页隐藏启用项的删除按钮。
func DeleteDisabledSybAllowedShop(q Execer, shopID string) (bool, error) {
result, err := q.Exec(`DELETE FROM syb_allowed_shops WHERE shop_id=? AND enabled=0`, shopID)
if err != nil {
return false, fmt.Errorf("删除已停用的顺运宝店铺失败: %w", err)
}
affected, err := result.RowsAffected()
if err != nil {
return false, fmt.Errorf("确认顺运宝店铺删除结果失败: %w", err)
}
return affected == 1, nil
}
// ---------- 会话缓存 ----------
// SaveSybSession 写入或更新顺运宝登录会话缓存(按用户名 upsert)。