feat(notify): 增加景区通知模板标题和描述字段

- 在记录用户通知授权接口中将日志级别从 info 调整为 debug
- 在获取景区通知模板及用户授权余额接口中将日志级别从 info 调整为 debug
- 根据不同模板 ID 设置对应的标题和描述信息:
  - 视频生成通知  - 视频下载通知- 视频即将过期通知
  -未知模板类型兜底处理
- 在 ScenicTemplateAuthResp 类中新增 title 和 description 字段用于返回模板信息
This commit is contained in:
2025-10-20 14:58:49 +08:00
parent 70ef4eb09c
commit 9fcb472717
2 changed files with 26 additions and 2 deletions

View File

@@ -41,7 +41,7 @@ public class UserNotificationAuthController {
@PostMapping("/record") @PostMapping("/record")
public ApiResponse<NotificationAuthRecordResp> recordAuthorization( public ApiResponse<NotificationAuthRecordResp> recordAuthorization(
@RequestBody NotificationAuthRecordReq req) { @RequestBody NotificationAuthRecordReq req) {
log.info("记录用户通知授权: templateIds={}, scenicId={}", req.getTemplateIds(), req.getScenicId()); log.debug("记录用户通知授权: templateIds={}, scenicId={}", req.getTemplateIds(), req.getScenicId());
try { try {
// 获取当前用户ID // 获取当前用户ID
@@ -98,7 +98,7 @@ public class UserNotificationAuthController {
*/ */
@GetMapping("/{scenicId}/templates") @GetMapping("/{scenicId}/templates")
public ApiResponse<ScenicTemplateAuthResp> getScenicTemplatesWithAuth(@PathVariable("scenicId") Long scenicId) { public ApiResponse<ScenicTemplateAuthResp> getScenicTemplatesWithAuth(@PathVariable("scenicId") Long scenicId) {
log.info("获取景区通知模板ID及用户授权余额: scenicId={}", scenicId); log.debug("获取景区通知模板ID及用户授权余额: scenicId={}", scenicId);
try { try {
// 获取当前用户ID // 获取当前用户ID
@@ -131,6 +131,20 @@ public class UserNotificationAuthController {
new ScenicTemplateAuthResp.TemplateAuthInfo(); new ScenicTemplateAuthResp.TemplateAuthInfo();
templateAuthInfo.setTemplateId(templateId); templateAuthInfo.setTemplateId(templateId);
if (templateId.equals(scenicRepository.getVideoGeneratedTemplateId(scenicId))) {
templateAuthInfo.setTitle("视频生成通知");
templateAuthInfo.setDescription("当视频生成完成时,我们将通过此方式提醒您");
} else if (templateId.equals(scenicRepository.getVideoDownloadTemplateId(scenicId))) {
templateAuthInfo.setTitle("视频下载通知");
templateAuthInfo.setDescription("当您的视频未购买时,我们将通过此方式提醒您");
} else if (templateId.equals(scenicRepository.getVideoPreExpireTemplateId(scenicId))) {
templateAuthInfo.setTitle("视频即将过期通知");
templateAuthInfo.setDescription("当您的视频即将过期时,我们将通过此方式提醒您,请及时下载");
} else {
templateAuthInfo.setTitle("未知模板类型");
templateAuthInfo.setDescription("未知的模板类型");
}
// 获取授权详情 // 获取授权详情
try { try {
com.ycwl.basic.model.pc.notify.entity.UserNotificationAuthorizationEntity authEntity = com.ycwl.basic.model.pc.notify.entity.UserNotificationAuthorizationEntity authEntity =

View File

@@ -33,6 +33,16 @@ public class ScenicTemplateAuthResp {
*/ */
private String templateId; private String templateId;
/**
* 模板标题
*/
private String title;
/**
* 模板描述
*/
private String description;
/** /**
* 剩余授权次数 * 剩余授权次数
*/ */