fix: 移资存在bug,已解决
This commit is contained in:
parent
2773d0e9f8
commit
cad6542d8e
@ -137,7 +137,12 @@ void MainWindow::on_newCardButton_clicked()
|
|||||||
"where id = :userId");
|
"where id = :userId");
|
||||||
query.bindValue(":userId", cardUserId);
|
query.bindValue(":userId", cardUserId);
|
||||||
bool success = query.exec();
|
bool success = query.exec();
|
||||||
if (!success || !query.next())
|
if (!success)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, "提示", QString("数据库异常。\n重开卡失败,请重试。"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!query.next())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, "提示", QString("数据库异常。\n重开卡失败,请重试。"));
|
QMessageBox::warning(this, "提示", QString("数据库异常。\n重开卡失败,请重试。"));
|
||||||
return;
|
return;
|
||||||
@ -516,10 +521,15 @@ bool MainWindow::transferCard(int userId, QString newCardId, QString oldCardId,
|
|||||||
// 查询旧卡余额
|
// 查询旧卡余额
|
||||||
query.finish();
|
query.finish();
|
||||||
query.prepare("select balance from card "
|
query.prepare("select balance from card "
|
||||||
"where userId = :userId;");
|
"where id = :cardId;");
|
||||||
query.bindValue(":userId", oldCardId);
|
query.bindValue(":cardId", oldCardId);
|
||||||
isExecuted = query.exec();
|
isExecuted = query.exec();
|
||||||
if (!isExecuted || query.next())
|
if (!isExecuted)
|
||||||
|
{
|
||||||
|
info = QString("数据库异常。");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!query.next())
|
||||||
{
|
{
|
||||||
info = QString("数据库异常。");
|
info = QString("数据库异常。");
|
||||||
return false;
|
return false;
|
||||||
|
@ -114,6 +114,11 @@ void MainWindow::on_userRecordQueryButton_clicked()
|
|||||||
{
|
{
|
||||||
ui->queryCardStatusLabel->setText(QString("已被挂失"));
|
ui->queryCardStatusLabel->setText(QString("已被挂失"));
|
||||||
}
|
}
|
||||||
|
if (cardStatus == 1)
|
||||||
|
{
|
||||||
|
ui->queryCardStatusLabel->setText(QString("启用中"));
|
||||||
|
}
|
||||||
|
|
||||||
userId = query.value("userId").toInt();
|
userId = query.value("userId").toInt();
|
||||||
balance = query.value("balance").toDouble();
|
balance = query.value("balance").toDouble();
|
||||||
ui->queryBalanceShowEdit->setText(QString::number(balance, 'f', 2));
|
ui->queryBalanceShowEdit->setText(QString::number(balance, 'f', 2));
|
||||||
@ -337,6 +342,10 @@ void MainWindow::on_cardRecordQueryButton_clicked()
|
|||||||
{
|
{
|
||||||
ui->queryCardStatusLabel->setText(QString("已被挂失"));
|
ui->queryCardStatusLabel->setText(QString("已被挂失"));
|
||||||
}
|
}
|
||||||
|
if (cardStatus == 1)
|
||||||
|
{
|
||||||
|
ui->queryCardStatusLabel->setText(QString("启用中"));
|
||||||
|
}
|
||||||
balance = query.value("balance").toDouble();
|
balance = query.value("balance").toDouble();
|
||||||
ui->queryBalanceShowEdit->setText(QString::number(balance, 'f', 2));
|
ui->queryBalanceShowEdit->setText(QString::number(balance, 'f', 2));
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,14 @@ void MainWindow::on_reportLossButton_clicked()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString info, prompt = QString("如需挂失该学/工号绑定的卡,请输入密码。");
|
||||||
|
success = verifyUser(userId, prompt, info);
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, "提示", info + QString("\n验证用户失败。挂失失败,请重试。"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 将该学/工号的卡设置为挂失状态
|
// 将该学/工号的卡设置为挂失状态
|
||||||
query.prepare(QString("update card "
|
query.prepare(QString("update card "
|
||||||
"set `status` = -1 "
|
"set `status` = -1 "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user