diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineCloudConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineCloudConstants.java index eadfe84acb..537984470c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineCloudConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineCloudConstants.java @@ -1,6 +1,11 @@ package com.fr.design.mainframe.alphafine; +import com.fr.design.i18n.Toolkit; import com.fr.general.CloudCenter; +import com.fr.json.JSONArray; + +import java.util.HashMap; +import java.util.Map; /** * 需要从云端获取的常量单独放一起 @@ -38,6 +43,9 @@ public class AlphaFineCloudConstants { private static final String AF_HELP_MONTHLY_DOCUMENT = "af.help.monthly.document"; private static final String AF_RECOMMEND = "af.recommend"; + private static final String LINK_NAME = "name"; + private static final String LINK_URL = "link"; + /** * 插件搜索api */ @@ -53,14 +61,14 @@ public class AlphaFineCloudConstants { } /** - * get REUSE_URL + * 获取组件信息api */ public static String getReuseUrl() { return CloudCenter.getInstance().acquireUrlByKind(AF_REUSE_INFO); } /** - * get DOCUMENT_DOC_URL + * 获取帮助文档url */ public static String getDocumentDocUrl() { return CloudCenter.getInstance().acquireUrlByKind(AF_DOC_VIEW); @@ -88,28 +96,28 @@ public class AlphaFineCloudConstants { } /** - * get CLOUD_SERVER_URL + * 获取云端接口,用于上传alphafine搜索记录 */ public static String getCloudServerUrl() { return CloudCenter.getInstance().acquireUrlByKind(AF_RECORD); } /** - * get SEARCH_API + * 获取搜索api,输入搜索词,返回fr的相关功能 */ public static String getSearchApi() { return CloudCenter.getInstance().acquireUrlByKind(AF_CLOUD_SEARCH); } /** - * get SIMILAR_SEARCH_URL_PREFIX + * 获取模糊搜索api前缀,输入搜索词,返回alphaFine相关内容,插件,文档,功能等 */ public static String getSimilarSearchUrlPrefix() { return CloudCenter.getInstance().acquireUrlByKind(AF_SIMILAR_SEARCH); } /** - * get COMPLEMENT_ADVICE_SEARCH_URL_PREFIX + * 补全建议搜索结果 api,与AF_SIMILAR_SEARCH接口类似,但是返回的信息更全 */ public static String getComplementAdviceSearchUrlPrefix() { return CloudCenter.getInstance().acquireUrlByKind(AF_ADVICE_SEARCH); @@ -130,14 +138,14 @@ public class AlphaFineCloudConstants { } /** - * get ALPHA_GO_TO_WEB + * 推荐搜索api,输入搜索词,返回猜你想搜的内容(html格式) */ public static String getAlphaGoToWeb() { return CloudCenter.getInstance().acquireUrlByKind(AF_GO_WEB); } /** - * get ALPHA_PREVIEW + * 帆软智能客服页面url */ public static String getAlphaPreview() { return CloudCenter.getInstance().acquireUrlByKind(AF_PREVIEW); @@ -161,26 +169,23 @@ public class AlphaFineCloudConstants { * 获取默认推荐的帮助文档 */ public static String getAlphaHelpRecommend() { - String quickStartUrl = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_QUICK_START); - - String reportLearningPath = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_REPORT_LEARNING_PATH); - - String parameterLearningPath = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_PARAM_LEARNING_PATH); - - String fillLearningPath = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_FILL_LEARNING_PATH); - - String apiSummary = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_API_SUMMARY); - - String monthlyDocument = CloudCenter.getInstance().acquireUrlByKind(AF_HELP_MONTHLY_DOCUMENT); - - String defaultRecommend = "[ {\"name\":\"快速入门指南\", \"link\":\"" + quickStartUrl + "\"}," + - "{\"name\":\"报表应用学习路径\", \"link\":\"" + reportLearningPath + "\"}," + - "{\"name\":\"参数应用学习路径\", \"link\":\"" + parameterLearningPath + "\"}," + - "{\"name\":\"填报学习路径\", \"link\":\"" + fillLearningPath + "\"}," + - "{\"name\":\"API接口汇总\", \"link\":\"" + apiSummary + "\"}," + - "{\"name\":\"文档月刊\", \"link\":\"" + monthlyDocument + "\"} ]"; - - return CloudCenter.getInstance().acquireUrlByKind(AF_RECOMMEND, defaultRecommend); + String[][] links = new String[][]{ + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Quick_Start"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_QUICK_START)}, + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Report_Learning"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_REPORT_LEARNING_PATH)}, + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Parameter_Learning"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_PARAM_LEARNING_PATH)}, + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Fill_Learning"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_FILL_LEARNING_PATH)}, + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Api_Summary"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_API_SUMMARY)}, + {Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Monthly_Document"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_MONTHLY_DOCUMENT)} + }; + JSONArray jsonArray = new JSONArray(); + for (String[] link : links) { + Map map = new HashMap<>(); + map.put(LINK_NAME, link[0]); + map.put(LINK_URL, link[1]); + jsonArray.put(map); + } + + return CloudCenter.getInstance().acquireUrlByKind(AF_RECOMMEND, jsonArray.toString()); } }