feat: 删除已停用的同步店铺 (#197)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user