|
|
|
|
@ -171,7 +171,7 @@ public class SmartReminderService {
|
|
|
|
|
*/
|
|
|
|
|
private void sendOverdueNotification(Loan loan, String bookTitle, long overdueDays) {
|
|
|
|
|
String title = "⚠️ 图书已逾期";
|
|
|
|
|
String content = "《%s》已逾期 %d 天,请尽快归还!".formatted(bookTitle, overdueDays);
|
|
|
|
|
String content = String.format("《%s》已逾期 %d 天,请尽快归还!", bookTitle, overdueDays);
|
|
|
|
|
|
|
|
|
|
sendNotification(
|
|
|
|
|
loan.getId().hashCode(),
|
|
|
|
|
@ -189,9 +189,9 @@ public class SmartReminderService {
|
|
|
|
|
String title = "📚 还书提醒";
|
|
|
|
|
String content;
|
|
|
|
|
if (daysLeft == 0) {
|
|
|
|
|
content = "《%s》今天到期,请及时归还!".formatted(bookTitle);
|
|
|
|
|
content = String.format("《%s》今天到期,请及时归还!", bookTitle);
|
|
|
|
|
} else {
|
|
|
|
|
content = "《%s》还有 %d 天到期,是否需要续借?".formatted(bookTitle, daysLeft);
|
|
|
|
|
content = String.format("《%s》还有 %d 天到期,是否需要续借?", bookTitle, daysLeft);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sendNotification(
|
|
|
|
|
@ -208,7 +208,7 @@ public class SmartReminderService {
|
|
|
|
|
*/
|
|
|
|
|
private void sendWeekReminderNotification(Loan loan, String bookTitle) {
|
|
|
|
|
String title = "📖 阅读进度提醒";
|
|
|
|
|
String content = "《%s》还有一周到期,记得安排阅读时间哦~".formatted(bookTitle);
|
|
|
|
|
String content = String.format("《%s》还有一周到期,记得安排阅读时间哦~", bookTitle);
|
|
|
|
|
|
|
|
|
|
sendNotification(
|
|
|
|
|
loan.getId().hashCode() + 2000,
|
|
|
|
|
@ -224,7 +224,7 @@ public class SmartReminderService {
|
|
|
|
|
*/
|
|
|
|
|
public void sendReservationReadyNotification(String bookTitle, String location) {
|
|
|
|
|
String title = "🎉 预约图书已到馆";
|
|
|
|
|
String content = "《%s》已到馆,位置:%s,请在3天内取书。".formatted(bookTitle, location);
|
|
|
|
|
String content = String.format("《%s》已到馆,位置:%s,请在3天内取书。", bookTitle, location);
|
|
|
|
|
|
|
|
|
|
sendNotification(
|
|
|
|
|
(int) System.currentTimeMillis(),
|
|
|
|
|
@ -240,7 +240,7 @@ public class SmartReminderService {
|
|
|
|
|
*/
|
|
|
|
|
public void sendNewBookNotification(String bookTitle, String category) {
|
|
|
|
|
String title = "📚 新书上架";
|
|
|
|
|
String content = "您关注的「%s」分类有新书:《%s》".formatted(category, bookTitle);
|
|
|
|
|
String content = String.format("您关注的「%s」分类有新书:《%s》", category, bookTitle);
|
|
|
|
|
|
|
|
|
|
sendNotification(
|
|
|
|
|
(int) System.currentTimeMillis(),
|
|
|
|
|
@ -257,7 +257,7 @@ public class SmartReminderService {
|
|
|
|
|
public void sendRenewSuccessNotification(String bookTitle, Date newDueDate) {
|
|
|
|
|
String title = "✅ 续借成功";
|
|
|
|
|
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd", java.util.Locale.getDefault());
|
|
|
|
|
String content = "《%s》续借成功,新到期日:%s".formatted(bookTitle, sdf.format(newDueDate));
|
|
|
|
|
String content = String.format("《%s》续借成功,新到期日:%s", bookTitle, sdf.format(newDueDate));
|
|
|
|
|
|
|
|
|
|
sendNotification(
|
|
|
|
|
(int) System.currentTimeMillis(),
|
|
|
|
|
@ -307,7 +307,7 @@ public class SmartReminderService {
|
|
|
|
|
reminderService.checkLoanStatus(loan, dataManager);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Log.d(TAG, "借阅检查完成,共检查 %d 条记录".formatted(allLoans.size()));
|
|
|
|
|
Log.d(TAG, String.format("借阅检查完成,共检查 %d 条记录", allLoans.size()));
|
|
|
|
|
return Result.success();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
Log.e(TAG, "借阅检查失败", e);
|
|
|
|
|
|