我想知道些什么,但我不知道是否有可能:
在RestController中,我有:
$sqlCheckLogin = $pdo->prepare("SELECT user_login FROM ".DB_PREFIX."users WHERE user_login=:login");
$sqlCheckLogin->execute(['login' => $login]);
if ($sqlCheckLogin->fetchColumn()) {
$message = 'User with this login is already registered! Enter another login.';
}
else
{
$sqlCheckEmail = $pdo->prepare("SELECT user_email FROM ".DB_PREFIX."users WHERE user_email=:email");
$sqlCheckEmail->execute(['email' => $email]);
if ($sqlCheckEmail->fetchColumn()) {
$message = 'User with this e-mail is already registered!';
}
else
{
$sqlCheckIp = $pdo->prepare("SELECT user_ip FROM ".DB_PREFIX."users WHERE user_ip=:ip");
$sqlCheckIp->execute(['ip' => $ip]);
if ($sqlCheckIp->fetchColumn()) {
$message = 'You have already registered on the site, re-registration is prohibited and punishable by the rules of the site!';
}
该值是在运行时通过spring框架设置的,该框架从外部rest api调用中填充该值。
让我们说“登录”的值在此外部参照上发生了变化。 我的目标是能够实现一个ConfigurationListener,它可以定期查询此远程引用并更新运行时的登录值。
这是可以实现的吗?
关于, 纪尧姆
答案 0 :(得分:0)
您可以使用Spring Cloud Config具有动态配置属性。
有关此主题的文章:Centralized Configuration
寻找@RefreshScope
端点和public void Login()
{
LoginWindow l = new LoginWindow();
if (l.tbxEmail.Text != "" && l.tbxPassword.Text != "")
{
string query = "SELECT * FROM UsersTBL";
l.con.Open();
l.com = l.con.CreateCommand();
l.com.CommandText = query;
SqlDataReader dr = l.com.ExecuteReader();
if (dr.Read())
{
if (dr["Email"].Equals(l.tbxEmail.Text.ToString()) && dr["UserPassword"].Equals(l.tbxPassword.Text.ToString()))
{
AppWindow a = new AppWindow();
a.Show();
}
else
l.lblMissingParameter.Content = "Incorrect Password or Email entered";
}
}
}
注释。