修复添加化妆品无法更改过期时间的bug

This commit is contained in:
2025-09-29 10:47:25 +08:00
parent 1068d32886
commit a2f2a82a9c
5 changed files with 22 additions and 3 deletions

View File

@@ -58,11 +58,12 @@ Cosmetic* CosmeticManager::findCosmetic(const std::string& name) {
return nullptr;
}
bool CosmeticManager::modifyCosmetic(const std::string& name, double newPrice, bool newType) {
bool CosmeticManager::modifyCosmetic(const std::string &name, double newPrice, bool newType, std::string expirationDate) {
Cosmetic* cosmetic = findCosmetic(name);
if (cosmetic) {
cosmetic->setPrice(newPrice);
cosmetic->setType(newType);
cosmetic->setExpirationDate(expirationDate);
saveToFile();
return true;
}