更新categoryinfo.json配置,取消对catid的限制
This commit is contained in:
@@ -24,7 +24,7 @@ import java.util.*;
|
|||||||
public class BrightCloud {
|
public class BrightCloud {
|
||||||
private static final Log logger = Log.get();
|
private static final Log logger = Log.get();
|
||||||
|
|
||||||
private final HashMap<Integer, List<String>> catId2Info = new HashMap<>();
|
private static HashMap<Integer, List<String>> catId2Info = new HashMap<>();
|
||||||
private HttpURLConnection con;
|
private HttpURLConnection con;
|
||||||
|
|
||||||
private static BrightCloudConfig bcConfig = (BrightCloudConfig) SpringContextUtil.getBean("brightCloudConfig");
|
private static BrightCloudConfig bcConfig = (BrightCloudConfig) SpringContextUtil.getBean("brightCloudConfig");
|
||||||
@@ -172,7 +172,7 @@ public class BrightCloud {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取类别id对应信息
|
// 获取类别id对应信息
|
||||||
public void geneCatInfo() {
|
public static void geneCatInfo() {
|
||||||
if (catId2Info.size() == 0) {
|
if (catId2Info.size() == 0) {
|
||||||
JSONObject jsonObject;
|
JSONObject jsonObject;
|
||||||
String s = FileUtils.readJsonFile(bcConfig.getCateinfoFilepath());
|
String s = FileUtils.readJsonFile(bcConfig.getCateinfoFilepath());
|
||||||
@@ -194,20 +194,15 @@ public class BrightCloud {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getCatInfo(Integer catId) {
|
public List<String> getCatInfo(Integer catId) {
|
||||||
List<String> info = Arrays.asList("", "");
|
if (catId2Info.size() == 0) {
|
||||||
|
geneCatInfo();
|
||||||
if (0 < catId && catId <= 83) {
|
|
||||||
if (catId2Info.size() == 0) {
|
|
||||||
geneCatInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
info = catId2Info.get(catId);
|
|
||||||
|
|
||||||
if (info == null) {
|
|
||||||
logger.error("Failed at geneCatInfo function");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
List<String> info = catId2Info.get(catId);
|
||||||
|
|
||||||
|
if (info == null || info.size()==0) {
|
||||||
|
info = Arrays.asList("", "");
|
||||||
|
logger.error("Failed at geneCatInfo function");
|
||||||
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -422,6 +422,26 @@
|
|||||||
"catid": 83,
|
"catid": 83,
|
||||||
"catname": "Food and Dining",
|
"catname": "Food and Dining",
|
||||||
"catgroup": "Unmaintained"
|
"catgroup": "Unmaintained"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"catid": 85,
|
||||||
|
"catname": "Self Harm",
|
||||||
|
"catgroup": "Sensitive"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"catid": 86,
|
||||||
|
"catname": "Low-THC Cannabis Products",
|
||||||
|
"catgroup": "Security"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"catid": 87,
|
||||||
|
"catname": "Self Harm",
|
||||||
|
"catgroup": "Sensitive"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"catid": 88,
|
||||||
|
"catname": "Generative AI",
|
||||||
|
"catgroup": "Productivity"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user