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