feat(msgcenter): jumpUrl 回落链——jumpApp 优先/bizType 回落/绝对 URL 直通(自指地址 Phase 2 接收侧)+ 本地补 flow.cc/flow.returned/svc_item 三键
This commit is contained in:
@@ -182,7 +182,7 @@ public class MsgCenterProxyService {
|
||||
|
||||
// ===== 出参改写 =====
|
||||
|
||||
/** MsgListVo 逐字段透传 + jumpUrl 改写(jumpType=1 且配置了 bizType 基址时)+ 应用名补全 */
|
||||
/** MsgListVo 逐字段透传 + jumpUrl 改写(jumpType=1 且查到基址时)+ 应用名补全 */
|
||||
private Map<String, Object> rewrite(JsonNode row) {
|
||||
Map<String, Object> out = new LinkedHashMap<>();
|
||||
out.put("msgId", row.has("msgId") ? row.get("msgId").asLong() : null);
|
||||
@@ -191,6 +191,7 @@ public class MsgCenterProxyService {
|
||||
out.put("msgType", row.has("msgType") && row.get("msgType").isNumber() ? row.get("msgType").asInt() : null);
|
||||
out.put("jumpType", row.has("jumpType") && row.get("jumpType").isNumber() ? row.get("jumpType").asInt() : null);
|
||||
out.put("jumpPath", text(row, "jumpPath"));
|
||||
out.put("jumpApp", text(row, "jumpApp"));
|
||||
out.put("appKey", text(row, "appKey"));
|
||||
String appKey = text(row, "appKey");
|
||||
out.put("appName", appKey == null ? null : properties.getAppNames().get(appKey));
|
||||
@@ -202,16 +203,29 @@ public class MsgCenterProxyService {
|
||||
return out;
|
||||
}
|
||||
|
||||
/** 基址 + "/#" + jumpPath;未配置基址/非应用内跳转/无路径 → null(前端不渲染跳转) */
|
||||
/**
|
||||
* 基址 + "/#" + jumpPath。基址查询优先「页面归属应用」(jumpApp,代发场景页面属业务方时由
|
||||
* 发送方声明),缺省回落 bizType(=发送方自己的消息分类);都查不到返回 null(前端不渲染跳转)。
|
||||
* jumpPath 已是绝对 URL(http/https)时直接透传——兼容存量已落库的绝对地址消息,且不再
|
||||
* 重复拼基址产出双前缀畸形链接。非应用内跳转(jumpType≠1)/无路径 → null。
|
||||
*/
|
||||
private String jumpUrl(JsonNode row) {
|
||||
Integer jumpType = row.has("jumpType") && row.get("jumpType").isNumber() ? row.get("jumpType").asInt() : null;
|
||||
String jumpPath = text(row, "jumpPath");
|
||||
String jumpApp = text(row, "jumpApp");
|
||||
String bizType = text(row, "bizType");
|
||||
if (jumpType == null || jumpType != 1 || !StringUtils.hasText(jumpPath)
|
||||
|| !StringUtils.hasText(bizType)) {
|
||||
if (jumpType == null || jumpType != 1 || !StringUtils.hasText(jumpPath)) {
|
||||
return null;
|
||||
}
|
||||
String base = properties.getJumpBases().get(bizType);
|
||||
String path = jumpPath.trim();
|
||||
if (path.startsWith("http://") || path.startsWith("https://")) {
|
||||
return path;
|
||||
}
|
||||
String base = StringUtils.hasText(jumpApp)
|
||||
? properties.getJumpBases().get(jumpApp.trim()) : null;
|
||||
if (!StringUtils.hasText(base) && StringUtils.hasText(bizType)) {
|
||||
base = properties.getJumpBases().get(bizType);
|
||||
}
|
||||
if (!StringUtils.hasText(base)) {
|
||||
return null;
|
||||
}
|
||||
@@ -219,8 +233,8 @@ public class MsgCenterProxyService {
|
||||
while (b.endsWith("/")) {
|
||||
b = b.substring(0, b.length() - 1);
|
||||
}
|
||||
String path = jumpPath.startsWith("/") ? jumpPath : "/" + jumpPath;
|
||||
return b + "/#" + path;
|
||||
String p = path.startsWith("/") ? path : "/" + path;
|
||||
return b + "/#" + p;
|
||||
}
|
||||
|
||||
private static Map<String, Object> emptyPage() {
|
||||
|
||||
Reference in New Issue
Block a user