App游客时正常展示消息页面
This commit is contained in:
+23
-1
@@ -461,7 +461,8 @@ public class MessageManageApplicationService
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if(null == loginUser){
|
||||
throw new ServiceException("获取登录人失败");
|
||||
//未登录(游客):返回空消息中心结构,保证小程序界面正常展示而不报错
|
||||
return buildEmptyAppNoticeList();
|
||||
}
|
||||
noticeMessageLoggingDo.setUserId(loginUser.getUserid());
|
||||
//获取每种类型的最新一条
|
||||
@@ -522,6 +523,27 @@ public class MessageManageApplicationService
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 未登录(游客)时返回空的消息中心结构,避免前端页面因无登录上下文而报错
|
||||
* @return NoticeMessageLoggingAppListPo
|
||||
*/
|
||||
private NoticeMessageLoggingAppListPo buildEmptyAppNoticeList() {
|
||||
NoticeMessageLoggingAppListPo result = new NoticeMessageLoggingAppListPo();
|
||||
NoticeMessageLoggingAppListPo.CommonNotice serviceNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
|
||||
serviceNotice.setUnreadNum("0");
|
||||
NoticeMessageLoggingAppListPo.CommonNotice activityNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
|
||||
activityNotice.setUnreadNum("0");
|
||||
NoticeMessageLoggingAppListPo.CommonNotice logisticsNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
|
||||
logisticsNotice.setUnreadNum("0");
|
||||
NoticeMessageLoggingAppListPo.CommonNotice systemNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
|
||||
systemNotice.setUnreadNum("0");
|
||||
result.setServiceNotice(serviceNotice);
|
||||
result.setActivityNotice(activityNotice);
|
||||
result.setLogisticsNotice(logisticsNotice);
|
||||
result.setSystemNotice(systemNotice);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* APP根据类型获取消息通知
|
||||
* @param noticeMessageLoggingDo
|
||||
|
||||
@@ -13,17 +13,17 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.30:6848
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
# server-addr: 10.102.192.105:6848
|
||||
config:
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.30:6848
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
Reference in New Issue
Block a user